Lines Matching +full:state +full:- +full:labels

1 // SPDX-License-Identifier: GPL-2.0
29 * cyl-cyl-head-head structure
37 cyl = ptr->hh & 0xFFF0; in cchh2blk()
39 cyl |= ptr->cc; in cchh2blk()
40 head = ptr->hh & 0x000F; in cchh2blk()
41 return cyl * geo->heads * geo->sectors + in cchh2blk()
42 head * geo->sectors; in cchh2blk()
47 * cyl-cyl-head-head-block structure
55 cyl = ptr->hh & 0xFFF0; in cchhb2blk()
57 cyl |= ptr->cc; in cchhb2blk()
58 head = ptr->hh & 0x000F; in cchhb2blk()
59 return cyl * geo->heads * geo->sectors + in cchhb2blk()
60 head * geo->sectors + in cchhb2blk()
61 ptr->b; in cchhb2blk()
102 return -1; in get_label_by_type()
105 static int find_label(struct parsed_partitions *state, in find_label() argument
120 * - on an ECKD disk it's block 2 in find_label()
121 * - on an FBA disk it's block 1 in find_label()
122 * - on an CMS formatted FBA disk it is sector 1, even if the block size in find_label()
128 if ((info->cu_type == 0x6310 && info->dev_type == 0x9336) || in find_label()
129 (info->cu_type == 0x3880 && info->dev_type == 0x3370)) in find_label()
130 testsect[0] = info->label_block; in find_label()
132 testsect[0] = info->label_block * (blocksize >> 9); in find_label()
141 data = read_part_sector(state, testsect[i], &sect); in find_label()
150 memcpy(name, label->vol.volid, DASD_VOL_ID_LEN); in find_label()
156 memcpy(name, label->lnx.volid, DASD_VOL_ID_LEN); in find_label()
168 static int find_vol1_partitions(struct parsed_partitions *state, in find_vol1_partitions() argument
184 strlcat(state->pp_buf, tmp, PAGE_SIZE); in find_vol1_partitions()
187 * and format8 labels in find_vol1_partitions()
190 blk = cchhb2blk(&label->vol.vtoc, geo) + 1; in find_vol1_partitions()
192 data = read_part_sector(state, blk * secperblk, &sect); in find_vol1_partitions()
196 /* skip FMT4 / FMT5 / FMT7 labels */ in find_vol1_partitions()
202 data = read_part_sector(state, blk * secperblk, &sect); in find_vol1_partitions()
205 /* only FMT1 and 8 labels valid at this point */ in find_vol1_partitions()
211 size = cchh2blk(&f1.DS1EXT1.ulimit, geo) - in find_vol1_partitions()
212 offset + geo->sectors; in find_vol1_partitions()
215 if (counter >= state->limit) in find_vol1_partitions()
217 put_partition(state, counter + 1, offset, size); in find_vol1_partitions()
220 data = read_part_sector(state, blk * secperblk, &sect); in find_vol1_partitions()
222 strlcat(state->pp_buf, "\n", PAGE_SIZE); in find_vol1_partitions()
225 return -1; in find_vol1_partitions()
230 static int find_lnx1_partitions(struct parsed_partitions *state, in find_lnx1_partitions() argument
244 strlcat(state->pp_buf, tmp, PAGE_SIZE); in find_lnx1_partitions()
246 if (label->lnx.ldl_version == 0xf2) { in find_lnx1_partitions()
247 size = label->lnx.formatted_blocks * secperblk; in find_lnx1_partitions()
256 geo_size = geo->cylinders * geo->heads in find_lnx1_partitions()
257 * geo->sectors * secperblk; in find_lnx1_partitions()
261 strlcat(state->pp_buf, "\n", PAGE_SIZE); in find_lnx1_partitions()
264 if (!strcmp(info->type, "ECKD")) in find_lnx1_partitions()
272 put_partition(state, 1, offset, size - offset); in find_lnx1_partitions()
273 strlcat(state->pp_buf, "\n", PAGE_SIZE); in find_lnx1_partitions()
277 static int find_cms1_partitions(struct parsed_partitions *state, in find_cms1_partitions() argument
291 blocksize = label->cms.block_size; in find_cms1_partitions()
293 if (label->cms.disk_offset != 0) { in find_cms1_partitions()
295 strlcat(state->pp_buf, tmp, PAGE_SIZE); in find_cms1_partitions()
297 offset = label->cms.disk_offset * secperblk; in find_cms1_partitions()
298 size = (label->cms.block_count - 1) * secperblk; in find_cms1_partitions()
301 strlcat(state->pp_buf, tmp, PAGE_SIZE); in find_cms1_partitions()
313 size = label->cms.block_count * secperblk; in find_cms1_partitions()
316 put_partition(state, 1, offset, size-offset); in find_cms1_partitions()
317 strlcat(state->pp_buf, "\n", PAGE_SIZE); in find_cms1_partitions()
325 int ibm_partition(struct parsed_partitions *state) in ibm_partition() argument
328 struct gendisk *disk = state->disk; in ibm_partition()
329 struct block_device *bdev = disk->part0; in ibm_partition()
341 if (!disk->fops->getgeo) in ibm_partition()
360 geo->start = get_start_sect(bdev); in ibm_partition()
361 if (disk->fops->getgeo(bdev, geo)) in ibm_partition()
368 if (find_label(state, info, geo, blocksize, &labelsect, name, type, label)) { in ibm_partition()
371 res = find_vol1_partitions(state, geo, blocksize, name, in ibm_partition()
375 res = find_lnx1_partitions(state, geo, blocksize, name, in ibm_partition()
380 res = find_cms1_partitions(state, geo, blocksize, name, in ibm_partition()
393 if (info->format == DASD_FORMAT_LDL) { in ibm_partition()
394 strlcat(state->pp_buf, "(nonl)", PAGE_SIZE); in ibm_partition()
396 offset = (info->label_block + 1) * (blocksize >> 9); in ibm_partition()
397 put_partition(state, 1, offset, size-offset); in ibm_partition()
398 strlcat(state->pp_buf, "\n", PAGE_SIZE); in ibm_partition()