diff options
-rw-r--r-- | block/genhd.c | 54 | ||||
-rw-r--r-- | block/ioctl.c | 15 | ||||
-rw-r--r-- | fs/block_dev.c | 8 | ||||
-rw-r--r-- | fs/partitions/check.c | 33 | ||||
-rw-r--r-- | include/linux/genhd.h | 12 |
5 files changed, 60 insertions, 62 deletions
diff --git a/block/genhd.c b/block/genhd.c index 11038fbc75ed..dc9ad4c171e2 100644 --- a/block/genhd.c +++ b/block/genhd.c | |||
@@ -43,14 +43,14 @@ static inline int major_to_index(int major) | |||
43 | } | 43 | } |
44 | 44 | ||
45 | #ifdef CONFIG_PROC_FS | 45 | #ifdef CONFIG_PROC_FS |
46 | void blkdev_show(struct seq_file *f, off_t offset) | 46 | void blkdev_show(struct seq_file *seqf, off_t offset) |
47 | { | 47 | { |
48 | struct blk_major_name *dp; | 48 | struct blk_major_name *dp; |
49 | 49 | ||
50 | if (offset < BLKDEV_MAJOR_HASH_SIZE) { | 50 | if (offset < BLKDEV_MAJOR_HASH_SIZE) { |
51 | mutex_lock(&block_class_lock); | 51 | mutex_lock(&block_class_lock); |
52 | for (dp = major_names[offset]; dp; dp = dp->next) | 52 | for (dp = major_names[offset]; dp; dp = dp->next) |
53 | seq_printf(f, "%3d %s\n", dp->major, dp->name); | 53 | seq_printf(seqf, "%3d %s\n", dp->major, dp->name); |
54 | mutex_unlock(&block_class_lock); | 54 | mutex_unlock(&block_class_lock); |
55 | } | 55 | } |
56 | } | 56 | } |
@@ -157,7 +157,7 @@ void blk_unregister_region(dev_t devt, unsigned long range) | |||
157 | 157 | ||
158 | EXPORT_SYMBOL(blk_unregister_region); | 158 | EXPORT_SYMBOL(blk_unregister_region); |
159 | 159 | ||
160 | static struct kobject *exact_match(dev_t devt, int *part, void *data) | 160 | static struct kobject *exact_match(dev_t devt, int *partno, void *data) |
161 | { | 161 | { |
162 | struct gendisk *p = data; | 162 | struct gendisk *p = data; |
163 | 163 | ||
@@ -217,9 +217,9 @@ void unlink_gendisk(struct gendisk *disk) | |||
217 | * This function gets the structure containing partitioning | 217 | * This function gets the structure containing partitioning |
218 | * information for the given device @devt. | 218 | * information for the given device @devt. |
219 | */ | 219 | */ |
220 | struct gendisk *get_gendisk(dev_t devt, int *part) | 220 | struct gendisk *get_gendisk(dev_t devt, int *partno) |
221 | { | 221 | { |
222 | struct kobject *kobj = kobj_lookup(bdev_map, devt, part); | 222 | struct kobject *kobj = kobj_lookup(bdev_map, devt, partno); |
223 | struct device *dev = kobj_to_dev(kobj); | 223 | struct device *dev = kobj_to_dev(kobj); |
224 | 224 | ||
225 | return kobj ? dev_to_disk(dev) : NULL; | 225 | return kobj ? dev_to_disk(dev) : NULL; |
@@ -336,23 +336,12 @@ static void *show_partition_start(struct seq_file *seqf, loff_t *pos) | |||
336 | return p; | 336 | return p; |
337 | } | 337 | } |
338 | 338 | ||
339 | static int show_partition(struct seq_file *part, void *v) | 339 | static int show_partition(struct seq_file *seqf, void *v) |
340 | { | 340 | { |
341 | struct gendisk *sgp = v; | 341 | struct gendisk *sgp = v; |
342 | int n; | 342 | int n; |
343 | char buf[BDEVNAME_SIZE]; | 343 | char buf[BDEVNAME_SIZE]; |
344 | 344 | ||
345 | /* | ||
346 | * Print header if start told us to do. This is to preserve | ||
347 | * the original behavior of not printing header if no | ||
348 | * partition exists. This hackery will be removed later with | ||
349 | * class iteration clean up. | ||
350 | */ | ||
351 | if (part->private) { | ||
352 | seq_puts(part, "major minor #blocks name\n\n"); | ||
353 | part->private = NULL; | ||
354 | } | ||
355 | |||
356 | /* Don't show non-partitionable removeable devices or empty devices */ | 345 | /* Don't show non-partitionable removeable devices or empty devices */ |
357 | if (!get_capacity(sgp) || | 346 | if (!get_capacity(sgp) || |
358 | (sgp->minors == 1 && (sgp->flags & GENHD_FL_REMOVABLE))) | 347 | (sgp->minors == 1 && (sgp->flags & GENHD_FL_REMOVABLE))) |
@@ -361,7 +350,7 @@ static int show_partition(struct seq_file *part, void *v) | |||
361 | return 0; | 350 | return 0; |
362 | 351 | ||
363 | /* show the full disk and all non-0 size partitions of it */ | 352 | /* show the full disk and all non-0 size partitions of it */ |
364 | seq_printf(part, "%4d %4d %10llu %s\n", | 353 | seq_printf(seqf, "%4d %4d %10llu %s\n", |
365 | sgp->major, sgp->first_minor, | 354 | sgp->major, sgp->first_minor, |
366 | (unsigned long long)get_capacity(sgp) >> 1, | 355 | (unsigned long long)get_capacity(sgp) >> 1, |
367 | disk_name(sgp, 0, buf)); | 356 | disk_name(sgp, 0, buf)); |
@@ -370,7 +359,7 @@ static int show_partition(struct seq_file *part, void *v) | |||
370 | continue; | 359 | continue; |
371 | if (sgp->part[n]->nr_sects == 0) | 360 | if (sgp->part[n]->nr_sects == 0) |
372 | continue; | 361 | continue; |
373 | seq_printf(part, "%4d %4d %10llu %s\n", | 362 | seq_printf(seqf, "%4d %4d %10llu %s\n", |
374 | sgp->major, n + 1 + sgp->first_minor, | 363 | sgp->major, n + 1 + sgp->first_minor, |
375 | (unsigned long long)sgp->part[n]->nr_sects >> 1 , | 364 | (unsigned long long)sgp->part[n]->nr_sects >> 1 , |
376 | disk_name(sgp, n + 1, buf)); | 365 | disk_name(sgp, n + 1, buf)); |
@@ -388,7 +377,7 @@ const struct seq_operations partitions_op = { | |||
388 | #endif | 377 | #endif |
389 | 378 | ||
390 | 379 | ||
391 | static struct kobject *base_probe(dev_t devt, int *part, void *data) | 380 | static struct kobject *base_probe(dev_t devt, int *partno, void *data) |
392 | { | 381 | { |
393 | if (request_module("block-major-%d-%d", MAJOR(devt), MINOR(devt)) > 0) | 382 | if (request_module("block-major-%d-%d", MAJOR(devt), MINOR(devt)) > 0) |
394 | /* Make old-style 2.4 aliases work */ | 383 | /* Make old-style 2.4 aliases work */ |
@@ -564,7 +553,14 @@ static struct device_type disk_type = { | |||
564 | }; | 553 | }; |
565 | 554 | ||
566 | #ifdef CONFIG_PROC_FS | 555 | #ifdef CONFIG_PROC_FS |
567 | static int diskstats_show(struct seq_file *s, void *v) | 556 | /* |
557 | * aggregate disk stat collector. Uses the same stats that the sysfs | ||
558 | * entries do, above, but makes them available through one seq_file. | ||
559 | * | ||
560 | * The output looks suspiciously like /proc/partitions with a bunch of | ||
561 | * extra fields. | ||
562 | */ | ||
563 | static int diskstats_show(struct seq_file *seqf, void *v) | ||
568 | { | 564 | { |
569 | struct gendisk *gp = v; | 565 | struct gendisk *gp = v; |
570 | char buf[BDEVNAME_SIZE]; | 566 | char buf[BDEVNAME_SIZE]; |
@@ -572,7 +568,7 @@ static int diskstats_show(struct seq_file *s, void *v) | |||
572 | 568 | ||
573 | /* | 569 | /* |
574 | if (&gp->dev.kobj.entry == block_class.devices.next) | 570 | if (&gp->dev.kobj.entry == block_class.devices.next) |
575 | seq_puts(s, "major minor name" | 571 | seq_puts(seqf, "major minor name" |
576 | " rio rmerge rsect ruse wio wmerge " | 572 | " rio rmerge rsect ruse wio wmerge " |
577 | "wsect wuse running use aveq" | 573 | "wsect wuse running use aveq" |
578 | "\n\n"); | 574 | "\n\n"); |
@@ -581,7 +577,7 @@ static int diskstats_show(struct seq_file *s, void *v) | |||
581 | preempt_disable(); | 577 | preempt_disable(); |
582 | disk_round_stats(gp); | 578 | disk_round_stats(gp); |
583 | preempt_enable(); | 579 | preempt_enable(); |
584 | seq_printf(s, "%4d %4d %s %lu %lu %llu %u %lu %lu %llu %u %u %u %u\n", | 580 | seq_printf(seqf, "%4d %4d %s %lu %lu %llu %u %lu %lu %llu %u %u %u %u\n", |
585 | gp->major, gp->first_minor, disk_name(gp, 0, buf), | 581 | gp->major, gp->first_minor, disk_name(gp, 0, buf), |
586 | disk_stat_read(gp, ios[0]), disk_stat_read(gp, merges[0]), | 582 | disk_stat_read(gp, ios[0]), disk_stat_read(gp, merges[0]), |
587 | (unsigned long long)disk_stat_read(gp, sectors[0]), | 583 | (unsigned long long)disk_stat_read(gp, sectors[0]), |
@@ -603,7 +599,7 @@ static int diskstats_show(struct seq_file *s, void *v) | |||
603 | preempt_disable(); | 599 | preempt_disable(); |
604 | part_round_stats(hd); | 600 | part_round_stats(hd); |
605 | preempt_enable(); | 601 | preempt_enable(); |
606 | seq_printf(s, "%4d %4d %s %lu %lu %llu " | 602 | seq_printf(seqf, "%4d %4d %s %lu %lu %llu " |
607 | "%u %lu %lu %llu %u %u %u %u\n", | 603 | "%u %lu %lu %llu %u %u %u %u\n", |
608 | gp->major, n + gp->first_minor + 1, | 604 | gp->major, n + gp->first_minor + 1, |
609 | disk_name(gp, n + 1, buf), | 605 | disk_name(gp, n + 1, buf), |
@@ -655,7 +651,7 @@ void genhd_media_change_notify(struct gendisk *disk) | |||
655 | EXPORT_SYMBOL_GPL(genhd_media_change_notify); | 651 | EXPORT_SYMBOL_GPL(genhd_media_change_notify); |
656 | #endif /* 0 */ | 652 | #endif /* 0 */ |
657 | 653 | ||
658 | dev_t blk_lookup_devt(const char *name, int part) | 654 | dev_t blk_lookup_devt(const char *name, int partno) |
659 | { | 655 | { |
660 | dev_t devt = MKDEV(0, 0); | 656 | dev_t devt = MKDEV(0, 0); |
661 | struct class_dev_iter iter; | 657 | struct class_dev_iter iter; |
@@ -665,9 +661,9 @@ dev_t blk_lookup_devt(const char *name, int part) | |||
665 | while ((dev = class_dev_iter_next(&iter))) { | 661 | while ((dev = class_dev_iter_next(&iter))) { |
666 | struct gendisk *disk = dev_to_disk(dev); | 662 | struct gendisk *disk = dev_to_disk(dev); |
667 | 663 | ||
668 | if (!strcmp(dev->bus_id, name) && part < disk->minors) { | 664 | if (!strcmp(dev->bus_id, name) && partno < disk->minors) { |
669 | devt = MKDEV(MAJOR(dev->devt), | 665 | devt = MKDEV(MAJOR(dev->devt), |
670 | MINOR(dev->devt) + part); | 666 | MINOR(dev->devt) + partno); |
671 | break; | 667 | break; |
672 | } | 668 | } |
673 | } | 669 | } |
@@ -777,10 +773,10 @@ int bdev_read_only(struct block_device *bdev) | |||
777 | 773 | ||
778 | EXPORT_SYMBOL(bdev_read_only); | 774 | EXPORT_SYMBOL(bdev_read_only); |
779 | 775 | ||
780 | int invalidate_partition(struct gendisk *disk, int index) | 776 | int invalidate_partition(struct gendisk *disk, int partno) |
781 | { | 777 | { |
782 | int res = 0; | 778 | int res = 0; |
783 | struct block_device *bdev = bdget_disk(disk, index); | 779 | struct block_device *bdev = bdget_disk(disk, partno); |
784 | if (bdev) { | 780 | if (bdev) { |
785 | fsync_bdev(bdev); | 781 | fsync_bdev(bdev); |
786 | res = __invalidate_device(bdev); | 782 | res = __invalidate_device(bdev); |
diff --git a/block/ioctl.c b/block/ioctl.c index eb046aeede8a..d77f5e280a6e 100644 --- a/block/ioctl.c +++ b/block/ioctl.c | |||
@@ -15,7 +15,7 @@ static int blkpg_ioctl(struct block_device *bdev, struct blkpg_ioctl_arg __user | |||
15 | struct blkpg_ioctl_arg a; | 15 | struct blkpg_ioctl_arg a; |
16 | struct blkpg_partition p; | 16 | struct blkpg_partition p; |
17 | long long start, length; | 17 | long long start, length; |
18 | int part; | 18 | int partno; |
19 | int i; | 19 | int i; |
20 | int err; | 20 | int err; |
21 | 21 | ||
@@ -28,8 +28,8 @@ static int blkpg_ioctl(struct block_device *bdev, struct blkpg_ioctl_arg __user | |||
28 | disk = bdev->bd_disk; | 28 | disk = bdev->bd_disk; |
29 | if (bdev != bdev->bd_contains) | 29 | if (bdev != bdev->bd_contains) |
30 | return -EINVAL; | 30 | return -EINVAL; |
31 | part = p.pno; | 31 | partno = p.pno; |
32 | if (part <= 0 || part >= disk->minors) | 32 | if (partno <= 0 || partno >= disk->minors) |
33 | return -EINVAL; | 33 | return -EINVAL; |
34 | switch (a.op) { | 34 | switch (a.op) { |
35 | case BLKPG_ADD_PARTITION: | 35 | case BLKPG_ADD_PARTITION: |
@@ -59,13 +59,14 @@ static int blkpg_ioctl(struct block_device *bdev, struct blkpg_ioctl_arg __user | |||
59 | } | 59 | } |
60 | } | 60 | } |
61 | /* all seems OK */ | 61 | /* all seems OK */ |
62 | err = add_partition(disk, part, start, length, ADDPART_FLAG_NONE); | 62 | err = add_partition(disk, partno, start, length, |
63 | ADDPART_FLAG_NONE); | ||
63 | mutex_unlock(&bdev->bd_mutex); | 64 | mutex_unlock(&bdev->bd_mutex); |
64 | return err; | 65 | return err; |
65 | case BLKPG_DEL_PARTITION: | 66 | case BLKPG_DEL_PARTITION: |
66 | if (!disk->part[part-1]) | 67 | if (!disk->part[partno - 1]) |
67 | return -ENXIO; | 68 | return -ENXIO; |
68 | bdevp = bdget_disk(disk, part); | 69 | bdevp = bdget_disk(disk, partno); |
69 | if (!bdevp) | 70 | if (!bdevp) |
70 | return -ENOMEM; | 71 | return -ENOMEM; |
71 | mutex_lock(&bdevp->bd_mutex); | 72 | mutex_lock(&bdevp->bd_mutex); |
@@ -79,7 +80,7 @@ static int blkpg_ioctl(struct block_device *bdev, struct blkpg_ioctl_arg __user | |||
79 | invalidate_bdev(bdevp); | 80 | invalidate_bdev(bdevp); |
80 | 81 | ||
81 | mutex_lock_nested(&bdev->bd_mutex, 1); | 82 | mutex_lock_nested(&bdev->bd_mutex, 1); |
82 | delete_partition(disk, part); | 83 | delete_partition(disk, partno); |
83 | mutex_unlock(&bdev->bd_mutex); | 84 | mutex_unlock(&bdev->bd_mutex); |
84 | mutex_unlock(&bdevp->bd_mutex); | 85 | mutex_unlock(&bdevp->bd_mutex); |
85 | bdput(bdevp); | 86 | bdput(bdevp); |
diff --git a/fs/block_dev.c b/fs/block_dev.c index aff54219e049..de0776cd7215 100644 --- a/fs/block_dev.c +++ b/fs/block_dev.c | |||
@@ -930,7 +930,7 @@ static int do_open(struct block_device *bdev, struct file *file, int for_part) | |||
930 | struct module *owner = NULL; | 930 | struct module *owner = NULL; |
931 | struct gendisk *disk; | 931 | struct gendisk *disk; |
932 | int ret; | 932 | int ret; |
933 | int part; | 933 | int partno; |
934 | int perm = 0; | 934 | int perm = 0; |
935 | 935 | ||
936 | if (file->f_mode & FMODE_READ) | 936 | if (file->f_mode & FMODE_READ) |
@@ -949,7 +949,7 @@ static int do_open(struct block_device *bdev, struct file *file, int for_part) | |||
949 | ret = -ENXIO; | 949 | ret = -ENXIO; |
950 | file->f_mapping = bdev->bd_inode->i_mapping; | 950 | file->f_mapping = bdev->bd_inode->i_mapping; |
951 | lock_kernel(); | 951 | lock_kernel(); |
952 | disk = get_gendisk(bdev->bd_dev, &part); | 952 | disk = get_gendisk(bdev->bd_dev, &partno); |
953 | if (!disk) { | 953 | if (!disk) { |
954 | unlock_kernel(); | 954 | unlock_kernel(); |
955 | bdput(bdev); | 955 | bdput(bdev); |
@@ -961,7 +961,7 @@ static int do_open(struct block_device *bdev, struct file *file, int for_part) | |||
961 | if (!bdev->bd_openers) { | 961 | if (!bdev->bd_openers) { |
962 | bdev->bd_disk = disk; | 962 | bdev->bd_disk = disk; |
963 | bdev->bd_contains = bdev; | 963 | bdev->bd_contains = bdev; |
964 | if (!part) { | 964 | if (!partno) { |
965 | struct backing_dev_info *bdi; | 965 | struct backing_dev_info *bdi; |
966 | if (disk->fops->open) { | 966 | if (disk->fops->open) { |
967 | ret = disk->fops->open(bdev->bd_inode, file); | 967 | ret = disk->fops->open(bdev->bd_inode, file); |
@@ -989,7 +989,7 @@ static int do_open(struct block_device *bdev, struct file *file, int for_part) | |||
989 | if (ret) | 989 | if (ret) |
990 | goto out_first; | 990 | goto out_first; |
991 | bdev->bd_contains = whole; | 991 | bdev->bd_contains = whole; |
992 | p = disk->part[part - 1]; | 992 | p = disk->part[partno - 1]; |
993 | bdev->bd_inode->i_data.backing_dev_info = | 993 | bdev->bd_inode->i_data.backing_dev_info = |
994 | whole->bd_inode->i_data.backing_dev_info; | 994 | whole->bd_inode->i_data.backing_dev_info; |
995 | if (!(disk->flags & GENHD_FL_UP) || !p || !p->nr_sects) { | 995 | if (!(disk->flags & GENHD_FL_UP) || !p || !p->nr_sects) { |
diff --git a/fs/partitions/check.c b/fs/partitions/check.c index 16f98d824608..b86aab1b0df6 100644 --- a/fs/partitions/check.c +++ b/fs/partitions/check.c | |||
@@ -120,22 +120,22 @@ static int (*check_part[])(struct parsed_partitions *, struct block_device *) = | |||
120 | * a pointer to that same buffer (for convenience). | 120 | * a pointer to that same buffer (for convenience). |
121 | */ | 121 | */ |
122 | 122 | ||
123 | char *disk_name(struct gendisk *hd, int part, char *buf) | 123 | char *disk_name(struct gendisk *hd, int partno, char *buf) |
124 | { | 124 | { |
125 | if (!part) | 125 | if (!partno) |
126 | snprintf(buf, BDEVNAME_SIZE, "%s", hd->disk_name); | 126 | snprintf(buf, BDEVNAME_SIZE, "%s", hd->disk_name); |
127 | else if (isdigit(hd->disk_name[strlen(hd->disk_name)-1])) | 127 | else if (isdigit(hd->disk_name[strlen(hd->disk_name)-1])) |
128 | snprintf(buf, BDEVNAME_SIZE, "%sp%d", hd->disk_name, part); | 128 | snprintf(buf, BDEVNAME_SIZE, "%sp%d", hd->disk_name, partno); |
129 | else | 129 | else |
130 | snprintf(buf, BDEVNAME_SIZE, "%s%d", hd->disk_name, part); | 130 | snprintf(buf, BDEVNAME_SIZE, "%s%d", hd->disk_name, partno); |
131 | 131 | ||
132 | return buf; | 132 | return buf; |
133 | } | 133 | } |
134 | 134 | ||
135 | const char *bdevname(struct block_device *bdev, char *buf) | 135 | const char *bdevname(struct block_device *bdev, char *buf) |
136 | { | 136 | { |
137 | int part = MINOR(bdev->bd_dev) - bdev->bd_disk->first_minor; | 137 | int partno = MINOR(bdev->bd_dev) - bdev->bd_disk->first_minor; |
138 | return disk_name(bdev->bd_disk, part, buf); | 138 | return disk_name(bdev->bd_disk, partno, buf); |
139 | } | 139 | } |
140 | 140 | ||
141 | EXPORT_SYMBOL(bdevname); | 141 | EXPORT_SYMBOL(bdevname); |
@@ -310,13 +310,13 @@ static inline void disk_sysfs_add_subdirs(struct gendisk *disk) | |||
310 | kobject_put(k); | 310 | kobject_put(k); |
311 | } | 311 | } |
312 | 312 | ||
313 | void delete_partition(struct gendisk *disk, int part) | 313 | void delete_partition(struct gendisk *disk, int partno) |
314 | { | 314 | { |
315 | struct hd_struct *p = disk->part[part-1]; | 315 | struct hd_struct *p = disk->part[partno - 1]; |
316 | 316 | ||
317 | if (!p) | 317 | if (!p) |
318 | return; | 318 | return; |
319 | disk->part[part-1] = NULL; | 319 | disk->part[partno - 1] = NULL; |
320 | p->start_sect = 0; | 320 | p->start_sect = 0; |
321 | p->nr_sects = 0; | 321 | p->nr_sects = 0; |
322 | part_stat_set_all(p, 0); | 322 | part_stat_set_all(p, 0); |
@@ -333,12 +333,13 @@ static ssize_t whole_disk_show(struct device *dev, | |||
333 | static DEVICE_ATTR(whole_disk, S_IRUSR | S_IRGRP | S_IROTH, | 333 | static DEVICE_ATTR(whole_disk, S_IRUSR | S_IRGRP | S_IROTH, |
334 | whole_disk_show, NULL); | 334 | whole_disk_show, NULL); |
335 | 335 | ||
336 | int add_partition(struct gendisk *disk, int part, sector_t start, sector_t len, int flags) | 336 | int add_partition(struct gendisk *disk, int partno, |
337 | sector_t start, sector_t len, int flags) | ||
337 | { | 338 | { |
338 | struct hd_struct *p; | 339 | struct hd_struct *p; |
339 | int err; | 340 | int err; |
340 | 341 | ||
341 | if (disk->part[part - 1]) | 342 | if (disk->part[partno - 1]) |
342 | return -EBUSY; | 343 | return -EBUSY; |
343 | 344 | ||
344 | p = kzalloc(sizeof(*p), GFP_KERNEL); | 345 | p = kzalloc(sizeof(*p), GFP_KERNEL); |
@@ -351,18 +352,18 @@ int add_partition(struct gendisk *disk, int part, sector_t start, sector_t len, | |||
351 | } | 352 | } |
352 | p->start_sect = start; | 353 | p->start_sect = start; |
353 | p->nr_sects = len; | 354 | p->nr_sects = len; |
354 | p->partno = part; | 355 | p->partno = partno; |
355 | p->policy = disk->policy; | 356 | p->policy = disk->policy; |
356 | 357 | ||
357 | if (isdigit(disk->dev.bus_id[strlen(disk->dev.bus_id)-1])) | 358 | if (isdigit(disk->dev.bus_id[strlen(disk->dev.bus_id)-1])) |
358 | snprintf(p->dev.bus_id, BUS_ID_SIZE, | 359 | snprintf(p->dev.bus_id, BUS_ID_SIZE, |
359 | "%sp%d", disk->dev.bus_id, part); | 360 | "%sp%d", disk->dev.bus_id, partno); |
360 | else | 361 | else |
361 | snprintf(p->dev.bus_id, BUS_ID_SIZE, | 362 | snprintf(p->dev.bus_id, BUS_ID_SIZE, |
362 | "%s%d", disk->dev.bus_id, part); | 363 | "%s%d", disk->dev.bus_id, partno); |
363 | 364 | ||
364 | device_initialize(&p->dev); | 365 | device_initialize(&p->dev); |
365 | p->dev.devt = MKDEV(disk->major, disk->first_minor + part); | 366 | p->dev.devt = MKDEV(disk->major, disk->first_minor + partno); |
366 | p->dev.class = &block_class; | 367 | p->dev.class = &block_class; |
367 | p->dev.type = &part_type; | 368 | p->dev.type = &part_type; |
368 | p->dev.parent = &disk->dev; | 369 | p->dev.parent = &disk->dev; |
@@ -386,7 +387,7 @@ int add_partition(struct gendisk *disk, int part, sector_t start, sector_t len, | |||
386 | } | 387 | } |
387 | 388 | ||
388 | /* everything is up and running, commence */ | 389 | /* everything is up and running, commence */ |
389 | disk->part[part - 1] = p; | 390 | disk->part[partno - 1] = p; |
390 | 391 | ||
391 | /* suppress uevent if the disk supresses it */ | 392 | /* suppress uevent if the disk supresses it */ |
392 | if (!disk->dev.uevent_suppress) | 393 | if (!disk->dev.uevent_suppress) |
diff --git a/include/linux/genhd.h b/include/linux/genhd.h index c64e659c9843..d1723c0a8600 100644 --- a/include/linux/genhd.h +++ b/include/linux/genhd.h | |||
@@ -365,7 +365,7 @@ extern int get_blkdev_list(char *, int); | |||
365 | extern void add_disk(struct gendisk *disk); | 365 | extern void add_disk(struct gendisk *disk); |
366 | extern void del_gendisk(struct gendisk *gp); | 366 | extern void del_gendisk(struct gendisk *gp); |
367 | extern void unlink_gendisk(struct gendisk *gp); | 367 | extern void unlink_gendisk(struct gendisk *gp); |
368 | extern struct gendisk *get_gendisk(dev_t dev, int *part); | 368 | extern struct gendisk *get_gendisk(dev_t dev, int *partno); |
369 | 369 | ||
370 | extern void set_device_ro(struct block_device *bdev, int flag); | 370 | extern void set_device_ro(struct block_device *bdev, int flag); |
371 | extern void set_disk_ro(struct gendisk *disk, int flag); | 371 | extern void set_disk_ro(struct gendisk *disk, int flag); |
@@ -534,8 +534,8 @@ struct unixware_disklabel { | |||
534 | #define ADDPART_FLAG_RAID 1 | 534 | #define ADDPART_FLAG_RAID 1 |
535 | #define ADDPART_FLAG_WHOLEDISK 2 | 535 | #define ADDPART_FLAG_WHOLEDISK 2 |
536 | 536 | ||
537 | extern dev_t blk_lookup_devt(const char *name, int part); | 537 | extern dev_t blk_lookup_devt(const char *name, int partno); |
538 | extern char *disk_name (struct gendisk *hd, int part, char *buf); | 538 | extern char *disk_name (struct gendisk *hd, int partno, char *buf); |
539 | 539 | ||
540 | extern int rescan_partitions(struct gendisk *disk, struct block_device *bdev); | 540 | extern int rescan_partitions(struct gendisk *disk, struct block_device *bdev); |
541 | extern int __must_check add_partition(struct gendisk *, int, sector_t, sector_t, int); | 541 | extern int __must_check add_partition(struct gendisk *, int, sector_t, sector_t, int); |
@@ -553,16 +553,16 @@ extern void blk_register_region(dev_t devt, unsigned long range, | |||
553 | void *data); | 553 | void *data); |
554 | extern void blk_unregister_region(dev_t devt, unsigned long range); | 554 | extern void blk_unregister_region(dev_t devt, unsigned long range); |
555 | 555 | ||
556 | static inline struct block_device *bdget_disk(struct gendisk *disk, int index) | 556 | static inline struct block_device *bdget_disk(struct gendisk *disk, int partno) |
557 | { | 557 | { |
558 | return bdget(MKDEV(disk->major, disk->first_minor) + index); | 558 | return bdget(MKDEV(disk->major, disk->first_minor) + partno); |
559 | } | 559 | } |
560 | 560 | ||
561 | #else /* CONFIG_BLOCK */ | 561 | #else /* CONFIG_BLOCK */ |
562 | 562 | ||
563 | static inline void printk_all_partitions(void) { } | 563 | static inline void printk_all_partitions(void) { } |
564 | 564 | ||
565 | static inline dev_t blk_lookup_devt(const char *name, int part) | 565 | static inline dev_t blk_lookup_devt(const char *name, int partno) |
566 | { | 566 | { |
567 | dev_t devt = MKDEV(0, 0); | 567 | dev_t devt = MKDEV(0, 0); |
568 | return devt; | 568 | return devt; |