aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--block/ioctl.c2
-rw-r--r--fs/partitions/check.c15
-rw-r--r--fs/partitions/msdos.c2
-rw-r--r--fs/partitions/sgi.c2
-rw-r--r--fs/partitions/sun.c5
-rw-r--r--include/linux/genhd.h8
6 files changed, 26 insertions, 8 deletions
diff --git a/block/ioctl.c b/block/ioctl.c
index f6962b64660e..e3f5eb9882cf 100644
--- a/block/ioctl.c
+++ b/block/ioctl.c
@@ -61,7 +61,7 @@ static int blkpg_ioctl(struct block_device *bdev, struct blkpg_ioctl_arg __user
61 } 61 }
62 } 62 }
63 /* all seems OK */ 63 /* all seems OK */
64 add_partition(disk, part, start, length); 64 add_partition(disk, part, start, length, ADDPART_FLAG_NONE);
65 mutex_unlock(&bdev->bd_mutex); 65 mutex_unlock(&bdev->bd_mutex);
66 return 0; 66 return 0;
67 case BLKPG_DEL_PARTITION: 67 case BLKPG_DEL_PARTITION:
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 }
diff --git a/fs/partitions/msdos.c b/fs/partitions/msdos.c
index 8c7af1777819..d964d1f90dec 100644
--- a/fs/partitions/msdos.c
+++ b/fs/partitions/msdos.c
@@ -155,7 +155,7 @@ parse_extended(struct parsed_partitions *state, struct block_device *bdev,
155 155
156 put_partition(state, state->next, next, size); 156 put_partition(state, state->next, next, size);
157 if (SYS_IND(p) == LINUX_RAID_PARTITION) 157 if (SYS_IND(p) == LINUX_RAID_PARTITION)
158 state->parts[state->next].flags = 1; 158 state->parts[state->next].flags = ADDPART_FLAG_RAID;
159 loopct = 0; 159 loopct = 0;
160 if (++state->next == state->limit) 160 if (++state->next == state->limit)
161 goto done; 161 goto done;
diff --git a/fs/partitions/sgi.c b/fs/partitions/sgi.c
index 6fa4ff895104..ed5ac83fe83a 100644
--- a/fs/partitions/sgi.c
+++ b/fs/partitions/sgi.c
@@ -72,7 +72,7 @@ int sgi_partition(struct parsed_partitions *state, struct block_device *bdev)
72 if (blocks) { 72 if (blocks) {
73 put_partition(state, slot, start, blocks); 73 put_partition(state, slot, start, blocks);
74 if (be32_to_cpu(p->type) == LINUX_RAID_PARTITION) 74 if (be32_to_cpu(p->type) == LINUX_RAID_PARTITION)
75 state->parts[slot].flags = 1; 75 state->parts[slot].flags = ADDPART_FLAG_RAID;
76 } 76 }
77 slot++; 77 slot++;
78 } 78 }
diff --git a/fs/partitions/sun.c b/fs/partitions/sun.c
index 0a5927c806ca..123f8b46c8ba 100644
--- a/fs/partitions/sun.c
+++ b/fs/partitions/sun.c
@@ -80,8 +80,11 @@ int sun_partition(struct parsed_partitions *state, struct block_device *bdev)
80 num_sectors = be32_to_cpu(p->num_sectors); 80 num_sectors = be32_to_cpu(p->num_sectors);
81 if (num_sectors) { 81 if (num_sectors) {
82 put_partition(state, slot, st_sector, num_sectors); 82 put_partition(state, slot, st_sector, num_sectors);
83 state->parts[slot].flags = 0;
83 if (label->infos[i].id == LINUX_RAID_PARTITION) 84 if (label->infos[i].id == LINUX_RAID_PARTITION)
84 state->parts[slot].flags = 1; 85 state->parts[slot].flags |= ADDPART_FLAG_RAID;
86 if (label->infos[i].id == SUN_WHOLE_DISK)
87 state->parts[slot].flags |= ADDPART_FLAG_WHOLEDISK;
85 } 88 }
86 slot++; 89 slot++;
87 } 90 }
diff --git a/include/linux/genhd.h b/include/linux/genhd.h
index 0a022b2f63fc..247734f7881f 100644
--- a/include/linux/genhd.h
+++ b/include/linux/genhd.h
@@ -20,6 +20,8 @@ enum {
20 LINUX_EXTENDED_PARTITION = 0x85, 20 LINUX_EXTENDED_PARTITION = 0x85,
21 WIN98_EXTENDED_PARTITION = 0x0f, 21 WIN98_EXTENDED_PARTITION = 0x0f,
22 22
23 SUN_WHOLE_DISK = DOS_EXTENDED_PARTITION,
24
23 LINUX_SWAP_PARTITION = 0x82, 25 LINUX_SWAP_PARTITION = 0x82,
24 LINUX_RAID_PARTITION = 0xfd, /* autodetect RAID partition */ 26 LINUX_RAID_PARTITION = 0xfd, /* autodetect RAID partition */
25 27
@@ -400,10 +402,14 @@ struct unixware_disklabel {
400 402
401#ifdef __KERNEL__ 403#ifdef __KERNEL__
402 404
405#define ADDPART_FLAG_NONE 0
406#define ADDPART_FLAG_RAID 1
407#define ADDPART_FLAG_WHOLEDISK 2
408
403char *disk_name (struct gendisk *hd, int part, char *buf); 409char *disk_name (struct gendisk *hd, int part, char *buf);
404 410
405extern int rescan_partitions(struct gendisk *disk, struct block_device *bdev); 411extern int rescan_partitions(struct gendisk *disk, struct block_device *bdev);
406extern void add_partition(struct gendisk *, int, sector_t, sector_t); 412extern void add_partition(struct gendisk *, int, sector_t, sector_t, int);
407extern void delete_partition(struct gendisk *, int); 413extern void delete_partition(struct gendisk *, int);
408 414
409extern struct gendisk *alloc_disk_node(int minors, int node_id); 415extern struct gendisk *alloc_disk_node(int minors, int node_id);