diff options
author | Fabio Massimo Di Nitto <fabbione@ubuntu.com> | 2007-02-11 02:50:00 -0500 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2007-02-11 02:50:00 -0500 |
commit | d18d7682c18b617f523df6beea5ea0bd396ed0bd (patch) | |
tree | 8e005fee2e13134e9ebdd1a3b71ef72b84351b19 /fs/partitions/check.c | |
parent | 66efc5a7e3061c3597ac43a8bb1026488d57e66b (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/check.c')
-rw-r--r-- | fs/partitions/check.c | 15 |
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 | ||
368 | void add_partition(struct gendisk *disk, int part, sector_t start, sector_t len) | 368 | void 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 | } |