Lines Matching +full:part +full:- +full:number

1 // SPDX-License-Identifier: GPL-2.0-only
15 * match_dev_by_uuid - callback for finding a partition using its uuid
26 if (!bdev->bd_meta_info || in match_dev_by_uuid()
27 strncasecmp(cmp->uuid, bdev->bd_meta_info->uuid, cmp->len)) in match_dev_by_uuid()
33 * devt_from_partuuid - looks up the dev_t of a partition by its UUID
41 * If @uuid_str is followed by a "/PARTNROFF=%d", then the number will be
56 /* Check for optional partition number offset attributes. */ in devt_from_partuuid()
63 cmp.len = slash - uuid_str; in devt_from_partuuid()
73 return -ENODEV; in devt_from_partuuid()
78 * to the partition number found by UUID. in devt_from_partuuid()
81 dev_to_bdev(dev)->bd_partno + offset); in devt_from_partuuid()
83 *devt = dev->devt; in devt_from_partuuid()
91 "Expected PARTUUID=<valid-uuid-id>[/PARTNROFF=%%d]\n"); in devt_from_partuuid()
92 return -EINVAL; in devt_from_partuuid()
96 * match_dev_by_label - callback for finding a partition using its label
107 if (!bdev->bd_meta_info || strcmp(label, bdev->bd_meta_info->volname)) in match_dev_by_label()
118 return -ENODEV; in devt_from_partlabel()
119 *devt = dev->devt; in devt_from_partlabel()
137 if (partno < disk->minors) { in blk_lookup_devt()
141 devt = MKDEV(MAJOR(dev->devt), in blk_lookup_devt()
142 MINOR(dev->devt) + partno); in blk_lookup_devt()
155 int part; in devt_from_devname() local
160 return -EINVAL; in devt_from_devname()
172 * Try non-existent, but valid partition, which may only exist after in devt_from_devname()
175 while (p > s && isdigit(p[-1])) in devt_from_devname()
176 p--; in devt_from_devname()
178 return -ENODEV; in devt_from_devname()
180 /* try disk name without <part number> */ in devt_from_devname()
181 part = simple_strtoul(p, NULL, 10); in devt_from_devname()
183 *devt = blk_lookup_devt(s, part); in devt_from_devname()
187 /* try disk name without p<part number> */ in devt_from_devname()
188 if (p < s + 2 || !isdigit(p[-2]) || p[-1] != 'p') in devt_from_devname()
189 return -ENODEV; in devt_from_devname()
190 p[-1] = '\0'; in devt_from_devname()
191 *devt = blk_lookup_devt(s, part); in devt_from_devname()
194 return -ENODEV; in devt_from_devname()
206 return -EINVAL; in devt_from_devnum()
210 return -EINVAL; in devt_from_devnum()
217 * Convert a name into device number. We accept the following variants:
219 * 1) <hex_major><hex_minor> device number in hexadecimal represents itself
221 * 3) /dev/<disk_name> represents the device number of disk
222 * 4) /dev/<disk_name><decimal> represents the device number
223 * of partition - device number of disk plus the partition number
224 * 5) /dev/<disk_name>p<decimal> - same as the above, that form is
226 * 6) PARTUUID=00112233-4455-6677-8899-AABBCCDDEEFF representing the
229 * partition using the format SSSSSSSS-PP, where SSSSSSSS is a zero-
230 * filled hex representation of the 32-bit "NT disk signature", and PP
231 * is a zero-filled hex representation of the 1-based partition number.
234 * 8) <major>:<minor> major and minor number of the device separated by
260 snprintf(buf, BDEVT_SIZE, "%-9s", tbuf); in bdevt_str()
268 * print a full list of all partitions - intended for places where the root
280 struct block_device *part; in printk_all_partitions() local
288 if (get_capacity(disk) == 0 || (disk->flags & GENHD_FL_HIDDEN)) in printk_all_partitions()
293 * hex - the same format as the root= option takes. in printk_all_partitions()
296 xa_for_each(&disk->part_tbl, idx, part) { in printk_all_partitions()
297 if (!bdev_nr_sectors(part)) in printk_all_partitions()
300 bdev_is_partition(part) ? " " : "", in printk_all_partitions()
301 bdevt_str(part->bd_dev, devt_buf), in printk_all_partitions()
302 bdev_nr_sectors(part) >> 1, part, in printk_all_partitions()
303 part->bd_meta_info ? in printk_all_partitions()
304 part->bd_meta_info->uuid : ""); in printk_all_partitions()
305 if (bdev_is_partition(part)) in printk_all_partitions()
307 else if (dev->parent && dev->parent->driver) in printk_all_partitions()
309 dev->parent->driver->name); in printk_all_partitions()