aboutsummaryrefslogtreecommitdiffstats
path: root/fs/partitions
diff options
context:
space:
mode:
authorFabio Massimo Di Nitto <fabbione@ubuntu.com>2007-02-11 02:50:00 -0500
committerDavid S. Miller <davem@davemloft.net>2007-02-11 02:50:00 -0500
commitd18d7682c18b617f523df6beea5ea0bd396ed0bd (patch)
tree8e005fee2e13134e9ebdd1a3b71ef72b84351b19 /fs/partitions
parent66efc5a7e3061c3597ac43a8bb1026488d57e66b (diff)
[PARTITION]: Add whole_disk attribute.
Some partitioning systems create special partitions that span the entire disk. One example are Sun partitions, and this whole-disk partition exists to tell the firmware the extent of the entire device so it can load the boot block and do other things. Such partitions should not be treated as normal partitions, because all the other partitions overlap this whole-disk one. So we'd see multiple instances of the same UUID etc. which we do not want. udev and friends can thus search for this 'whole_disk' attribute and use it to decide to ignore the partition. Signed-off-by: Fabio Massimo Di Nitto <fabbione@ubuntu.com> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'fs/partitions')
-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
4 files changed, 18 insertions, 6 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 }
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 }