aboutsummaryrefslogtreecommitdiffstats
path: root/fs/partitions/check.c
diff options
context:
space:
mode:
Diffstat (limited to 'fs/partitions/check.c')
-rw-r--r--fs/partitions/check.c15
1 files changed, 12 insertions, 3 deletions
diff --git a/fs/partitions/check.c b/fs/partitions/check.c
index 3d73d94d93a7..ac32a2e8540c 100644
--- a/fs/partitions/check.c
+++ b/fs/partitions/check.c
@@ -365,7 +365,7 @@ void delete_partition(struct gendisk *disk, int part)
365 kobject_put(&p->kobj); 365 kobject_put(&p->kobj);
366} 366}
367 367
368void add_partition(struct gendisk *disk, int part, sector_t start, sector_t len) 368void add_partition(struct gendisk *disk, int part, sector_t start, sector_t len, int flags)
369{ 369{
370 struct hd_struct *p; 370 struct hd_struct *p;
371 371
@@ -390,6 +390,15 @@ void add_partition(struct gendisk *disk, int part, sector_t start, sector_t len)
390 if (!disk->part_uevent_suppress) 390 if (!disk->part_uevent_suppress)
391 kobject_uevent(&p->kobj, KOBJ_ADD); 391 kobject_uevent(&p->kobj, KOBJ_ADD);
392 sysfs_create_link(&p->kobj, &block_subsys.kset.kobj, "subsystem"); 392 sysfs_create_link(&p->kobj, &block_subsys.kset.kobj, "subsystem");
393 if (flags & ADDPART_FLAG_WHOLEDISK) {
394 static struct attribute addpartattr = {
395 .name = "whole_disk",
396 .mode = S_IRUSR | S_IRGRP | S_IROTH,
397 .owner = THIS_MODULE,
398 };
399
400 sysfs_create_file(&p->kobj, &addpartattr);
401 }
393 partition_sysfs_add_subdir(p); 402 partition_sysfs_add_subdir(p);
394 disk->part[part-1] = p; 403 disk->part[part-1] = p;
395} 404}
@@ -543,9 +552,9 @@ int rescan_partitions(struct gendisk *disk, struct block_device *bdev)
543 printk(" %s: p%d exceeds device capacity\n", 552 printk(" %s: p%d exceeds device capacity\n",
544 disk->disk_name, p); 553 disk->disk_name, p);
545 } 554 }
546 add_partition(disk, p, from, size); 555 add_partition(disk, p, from, size, state->parts[p].flags);
547#ifdef CONFIG_BLK_DEV_MD 556#ifdef CONFIG_BLK_DEV_MD
548 if (state->parts[p].flags) 557 if (state->parts[p].flags & ADDPART_FLAG_RAID)
549 md_autodetect_dev(bdev->bd_dev+p); 558 md_autodetect_dev(bdev->bd_dev+p);
550#endif 559#endif
551 } 560 }