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.c37
1 files changed, 32 insertions, 5 deletions
diff --git a/fs/partitions/check.c b/fs/partitions/check.c
index 8dc1822a7022..f924f459bdb8 100644
--- a/fs/partitions/check.c
+++ b/fs/partitions/check.c
@@ -35,6 +35,7 @@
35#include "ibm.h" 35#include "ibm.h"
36#include "ultrix.h" 36#include "ultrix.h"
37#include "efi.h" 37#include "efi.h"
38#include "karma.h"
38 39
39#ifdef CONFIG_BLK_DEV_MD 40#ifdef CONFIG_BLK_DEV_MD
40extern void md_autodetect_dev(dev_t dev); 41extern void md_autodetect_dev(dev_t dev);
@@ -103,6 +104,9 @@ static int (*check_part[])(struct parsed_partitions *, struct block_device *) =
103#ifdef CONFIG_IBM_PARTITION 104#ifdef CONFIG_IBM_PARTITION
104 ibm_partition, 105 ibm_partition,
105#endif 106#endif
107#ifdef CONFIG_KARMA_PARTITION
108 karma_partition,
109#endif
106 NULL 110 NULL
107}; 111};
108 112
@@ -226,7 +230,7 @@ static struct sysfs_ops part_sysfs_ops = {
226static ssize_t part_uevent_store(struct hd_struct * p, 230static ssize_t part_uevent_store(struct hd_struct * p,
227 const char *page, size_t count) 231 const char *page, size_t count)
228{ 232{
229 kobject_hotplug(&p->kobj, KOBJ_ADD); 233 kobject_uevent(&p->kobj, KOBJ_ADD);
230 return count; 234 return count;
231} 235}
232static ssize_t part_dev_read(struct hd_struct * p, char *page) 236static ssize_t part_dev_read(struct hd_struct * p, char *page)
@@ -336,12 +340,31 @@ void add_partition(struct gendisk *disk, int part, sector_t start, sector_t len)
336 disk->part[part-1] = p; 340 disk->part[part-1] = p;
337} 341}
338 342
343static char *make_block_name(struct gendisk *disk)
344{
345 char *name;
346 static char *block_str = "block:";
347 int size;
348
349 size = strlen(block_str) + strlen(disk->disk_name) + 1;
350 name = kmalloc(size, GFP_KERNEL);
351 if (!name)
352 return NULL;
353 strcpy(name, block_str);
354 strcat(name, disk->disk_name);
355 return name;
356}
357
339static void disk_sysfs_symlinks(struct gendisk *disk) 358static void disk_sysfs_symlinks(struct gendisk *disk)
340{ 359{
341 struct device *target = get_device(disk->driverfs_dev); 360 struct device *target = get_device(disk->driverfs_dev);
342 if (target) { 361 if (target) {
362 char *disk_name = make_block_name(disk);
343 sysfs_create_link(&disk->kobj,&target->kobj,"device"); 363 sysfs_create_link(&disk->kobj,&target->kobj,"device");
344 sysfs_create_link(&target->kobj,&disk->kobj,"block"); 364 if (disk_name) {
365 sysfs_create_link(&target->kobj,&disk->kobj,disk_name);
366 kfree(disk_name);
367 }
345 } 368 }
346} 369}
347 370
@@ -360,7 +383,7 @@ void register_disk(struct gendisk *disk)
360 if ((err = kobject_add(&disk->kobj))) 383 if ((err = kobject_add(&disk->kobj)))
361 return; 384 return;
362 disk_sysfs_symlinks(disk); 385 disk_sysfs_symlinks(disk);
363 kobject_hotplug(&disk->kobj, KOBJ_ADD); 386 kobject_uevent(&disk->kobj, KOBJ_ADD);
364 387
365 /* No minors to use for partitions */ 388 /* No minors to use for partitions */
366 if (disk->minors == 1) { 389 if (disk->minors == 1) {
@@ -461,10 +484,14 @@ void del_gendisk(struct gendisk *disk)
461 devfs_remove_disk(disk); 484 devfs_remove_disk(disk);
462 485
463 if (disk->driverfs_dev) { 486 if (disk->driverfs_dev) {
487 char *disk_name = make_block_name(disk);
464 sysfs_remove_link(&disk->kobj, "device"); 488 sysfs_remove_link(&disk->kobj, "device");
465 sysfs_remove_link(&disk->driverfs_dev->kobj, "block"); 489 if (disk_name) {
490 sysfs_remove_link(&disk->driverfs_dev->kobj, disk_name);
491 kfree(disk_name);
492 }
466 put_device(disk->driverfs_dev); 493 put_device(disk->driverfs_dev);
467 } 494 }
468 kobject_hotplug(&disk->kobj, KOBJ_REMOVE); 495 kobject_uevent(&disk->kobj, KOBJ_REMOVE);
469 kobject_del(&disk->kobj); 496 kobject_del(&disk->kobj);
470} 497}