Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

wrapper for access to ->bd_partno

On the next step it's going to get folded into a field where flags will go.

Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>

Al Viro b8c873ed 3f9b8fb4

+14 -9
+1 -1
block/early-lookup.c
··· 78 78 * to the partition number found by UUID. 79 79 */ 80 80 *devt = part_devt(dev_to_disk(dev), 81 - dev_to_bdev(dev)->bd_partno + offset); 81 + bdev_partno(dev_to_bdev(dev)) + offset); 82 82 } else { 83 83 *devt = dev->devt; 84 84 }
+6 -6
block/partitions/core.c
··· 173 173 static ssize_t part_partition_show(struct device *dev, 174 174 struct device_attribute *attr, char *buf) 175 175 { 176 - return sprintf(buf, "%d\n", dev_to_bdev(dev)->bd_partno); 176 + return sprintf(buf, "%d\n", bdev_partno(dev_to_bdev(dev))); 177 177 } 178 178 179 179 static ssize_t part_start_show(struct device *dev, ··· 250 250 { 251 251 const struct block_device *part = dev_to_bdev(dev); 252 252 253 - add_uevent_var(env, "PARTN=%u", part->bd_partno); 253 + add_uevent_var(env, "PARTN=%u", bdev_partno(part)); 254 254 if (part->bd_meta_info && part->bd_meta_info->volname[0]) 255 255 add_uevent_var(env, "PARTNAME=%s", part->bd_meta_info->volname); 256 256 return 0; ··· 267 267 { 268 268 lockdep_assert_held(&part->bd_disk->open_mutex); 269 269 270 - xa_erase(&part->bd_disk->part_tbl, part->bd_partno); 270 + xa_erase(&part->bd_disk->part_tbl, bdev_partno(part)); 271 271 kobject_put(part->bd_holder_dir); 272 272 273 273 device_del(&part->bd_device); ··· 338 338 pdev->parent = ddev; 339 339 340 340 /* in consecutive minor range? */ 341 - if (bdev->bd_partno < disk->minors) { 342 - devt = MKDEV(disk->major, disk->first_minor + bdev->bd_partno); 341 + if (bdev_partno(bdev) < disk->minors) { 342 + devt = MKDEV(disk->major, disk->first_minor + bdev_partno(bdev)); 343 343 } else { 344 344 err = blk_alloc_ext_minor(); 345 345 if (err < 0) ··· 404 404 405 405 rcu_read_lock(); 406 406 xa_for_each_start(&disk->part_tbl, idx, part, 1) { 407 - if (part->bd_partno != skip_partno && 407 + if (bdev_partno(part) != skip_partno && 408 408 start < part->bd_start_sect + bdev_nr_sectors(part) && 409 409 start + length > part->bd_start_sect) { 410 410 overlap = true;
+6 -1
include/linux/blkdev.h
··· 720 720 void set_disk_ro(struct gendisk *disk, bool read_only); 721 721 void disk_uevent(struct gendisk *disk, enum kobject_action action); 722 722 723 + static inline u8 bdev_partno(const struct block_device *bdev) 724 + { 725 + return bdev->bd_partno; 726 + } 727 + 723 728 static inline int get_disk_ro(struct gendisk *disk) 724 729 { 725 730 return disk->part0->bd_read_only || ··· 1100 1095 1101 1096 static inline bool bdev_is_partition(struct block_device *bdev) 1102 1097 { 1103 - return bdev->bd_partno; 1098 + return bdev_partno(bdev) != 0; 1104 1099 } 1105 1100 1106 1101 enum blk_default_limits {
+1 -1
lib/vsprintf.c
··· 972 972 *buf = 'p'; 973 973 buf++; 974 974 } 975 - buf = number(buf, end, bdev->bd_partno, spec); 975 + buf = number(buf, end, bdev_partno(bdev), spec); 976 976 } 977 977 return buf; 978 978 }