diff options
author | Linus Torvalds <torvalds@g5.osdl.org> | 2006-01-04 21:44:12 -0500 |
---|---|---|
committer | Linus Torvalds <torvalds@g5.osdl.org> | 2006-01-04 21:44:12 -0500 |
commit | db9edfd7e339ca4113153d887e782dd05be5a9eb (patch) | |
tree | 0a4ba12447a0cabc800adc7e9667d284777b0181 /fs | |
parent | 631b034724364b413e8a52e7c2e03a9d77e4c2b4 (diff) | |
parent | fd586bacf439f36dea9b9bf6e6133ac87df2730c (diff) |
Merge git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/driver-2.6
Trivial manual merge fixup for usb_find_interface clashes.
Diffstat (limited to 'fs')
-rw-r--r-- | fs/partitions/check.c | 33 | ||||
-rw-r--r-- | fs/super.c | 15 | ||||
-rw-r--r-- | fs/sysfs/dir.c | 6 |
3 files changed, 34 insertions, 20 deletions
diff --git a/fs/partitions/check.c b/fs/partitions/check.c index 8dc1822a7022..7881ce05daef 100644 --- a/fs/partitions/check.c +++ b/fs/partitions/check.c | |||
@@ -226,7 +226,7 @@ static struct sysfs_ops part_sysfs_ops = { | |||
226 | static ssize_t part_uevent_store(struct hd_struct * p, | 226 | static ssize_t part_uevent_store(struct hd_struct * p, |
227 | const char *page, size_t count) | 227 | const char *page, size_t count) |
228 | { | 228 | { |
229 | kobject_hotplug(&p->kobj, KOBJ_ADD); | 229 | kobject_uevent(&p->kobj, KOBJ_ADD); |
230 | return count; | 230 | return count; |
231 | } | 231 | } |
232 | static ssize_t part_dev_read(struct hd_struct * p, char *page) | 232 | static ssize_t part_dev_read(struct hd_struct * p, char *page) |
@@ -336,12 +336,31 @@ void add_partition(struct gendisk *disk, int part, sector_t start, sector_t len) | |||
336 | disk->part[part-1] = p; | 336 | disk->part[part-1] = p; |
337 | } | 337 | } |
338 | 338 | ||
339 | static char *make_block_name(struct gendisk *disk) | ||
340 | { | ||
341 | char *name; | ||
342 | static char *block_str = "block:"; | ||
343 | int size; | ||
344 | |||
345 | size = strlen(block_str) + strlen(disk->disk_name) + 1; | ||
346 | name = kmalloc(size, GFP_KERNEL); | ||
347 | if (!name) | ||
348 | return NULL; | ||
349 | strcpy(name, block_str); | ||
350 | strcat(name, disk->disk_name); | ||
351 | return name; | ||
352 | } | ||
353 | |||
339 | static void disk_sysfs_symlinks(struct gendisk *disk) | 354 | static void disk_sysfs_symlinks(struct gendisk *disk) |
340 | { | 355 | { |
341 | struct device *target = get_device(disk->driverfs_dev); | 356 | struct device *target = get_device(disk->driverfs_dev); |
342 | if (target) { | 357 | if (target) { |
358 | char *disk_name = make_block_name(disk); | ||
343 | sysfs_create_link(&disk->kobj,&target->kobj,"device"); | 359 | sysfs_create_link(&disk->kobj,&target->kobj,"device"); |
344 | sysfs_create_link(&target->kobj,&disk->kobj,"block"); | 360 | if (disk_name) { |
361 | sysfs_create_link(&target->kobj,&disk->kobj,disk_name); | ||
362 | kfree(disk_name); | ||
363 | } | ||
345 | } | 364 | } |
346 | } | 365 | } |
347 | 366 | ||
@@ -360,7 +379,7 @@ void register_disk(struct gendisk *disk) | |||
360 | if ((err = kobject_add(&disk->kobj))) | 379 | if ((err = kobject_add(&disk->kobj))) |
361 | return; | 380 | return; |
362 | disk_sysfs_symlinks(disk); | 381 | disk_sysfs_symlinks(disk); |
363 | kobject_hotplug(&disk->kobj, KOBJ_ADD); | 382 | kobject_uevent(&disk->kobj, KOBJ_ADD); |
364 | 383 | ||
365 | /* No minors to use for partitions */ | 384 | /* No minors to use for partitions */ |
366 | if (disk->minors == 1) { | 385 | if (disk->minors == 1) { |
@@ -461,10 +480,14 @@ void del_gendisk(struct gendisk *disk) | |||
461 | devfs_remove_disk(disk); | 480 | devfs_remove_disk(disk); |
462 | 481 | ||
463 | if (disk->driverfs_dev) { | 482 | if (disk->driverfs_dev) { |
483 | char *disk_name = make_block_name(disk); | ||
464 | sysfs_remove_link(&disk->kobj, "device"); | 484 | sysfs_remove_link(&disk->kobj, "device"); |
465 | sysfs_remove_link(&disk->driverfs_dev->kobj, "block"); | 485 | if (disk_name) { |
486 | sysfs_remove_link(&disk->driverfs_dev->kobj, disk_name); | ||
487 | kfree(disk_name); | ||
488 | } | ||
466 | put_device(disk->driverfs_dev); | 489 | put_device(disk->driverfs_dev); |
467 | } | 490 | } |
468 | kobject_hotplug(&disk->kobj, KOBJ_REMOVE); | 491 | kobject_uevent(&disk->kobj, KOBJ_REMOVE); |
469 | kobject_del(&disk->kobj); | 492 | kobject_del(&disk->kobj); |
470 | } | 493 | } |
diff --git a/fs/super.c b/fs/super.c index 6689dded3c84..5a347a4f673a 100644 --- a/fs/super.c +++ b/fs/super.c | |||
@@ -665,16 +665,6 @@ static int test_bdev_super(struct super_block *s, void *data) | |||
665 | return (void *)s->s_bdev == data; | 665 | return (void *)s->s_bdev == data; |
666 | } | 666 | } |
667 | 667 | ||
668 | static void bdev_uevent(struct block_device *bdev, enum kobject_action action) | ||
669 | { | ||
670 | if (bdev->bd_disk) { | ||
671 | if (bdev->bd_part) | ||
672 | kobject_uevent(&bdev->bd_part->kobj, action, NULL); | ||
673 | else | ||
674 | kobject_uevent(&bdev->bd_disk->kobj, action, NULL); | ||
675 | } | ||
676 | } | ||
677 | |||
678 | struct super_block *get_sb_bdev(struct file_system_type *fs_type, | 668 | struct super_block *get_sb_bdev(struct file_system_type *fs_type, |
679 | int flags, const char *dev_name, void *data, | 669 | int flags, const char *dev_name, void *data, |
680 | int (*fill_super)(struct super_block *, void *, int)) | 670 | int (*fill_super)(struct super_block *, void *, int)) |
@@ -717,10 +707,8 @@ struct super_block *get_sb_bdev(struct file_system_type *fs_type, | |||
717 | up_write(&s->s_umount); | 707 | up_write(&s->s_umount); |
718 | deactivate_super(s); | 708 | deactivate_super(s); |
719 | s = ERR_PTR(error); | 709 | s = ERR_PTR(error); |
720 | } else { | 710 | } else |
721 | s->s_flags |= MS_ACTIVE; | 711 | s->s_flags |= MS_ACTIVE; |
722 | bdev_uevent(bdev, KOBJ_MOUNT); | ||
723 | } | ||
724 | } | 712 | } |
725 | 713 | ||
726 | return s; | 714 | return s; |
@@ -736,7 +724,6 @@ void kill_block_super(struct super_block *sb) | |||
736 | { | 724 | { |
737 | struct block_device *bdev = sb->s_bdev; | 725 | struct block_device *bdev = sb->s_bdev; |
738 | 726 | ||
739 | bdev_uevent(bdev, KOBJ_UMOUNT); | ||
740 | generic_shutdown_super(sb); | 727 | generic_shutdown_super(sb); |
741 | sync_blockdev(bdev); | 728 | sync_blockdev(bdev); |
742 | close_bdev_excl(bdev); | 729 | close_bdev_excl(bdev); |
diff --git a/fs/sysfs/dir.c b/fs/sysfs/dir.c index 59734ba1ee60..d36780382176 100644 --- a/fs/sysfs/dir.c +++ b/fs/sysfs/dir.c | |||
@@ -112,7 +112,11 @@ static int create_dir(struct kobject * k, struct dentry * p, | |||
112 | } | 112 | } |
113 | } | 113 | } |
114 | if (error && (error != -EEXIST)) { | 114 | if (error && (error != -EEXIST)) { |
115 | sysfs_put((*d)->d_fsdata); | 115 | struct sysfs_dirent *sd = (*d)->d_fsdata; |
116 | if (sd) { | ||
117 | list_del_init(&sd->s_sibling); | ||
118 | sysfs_put(sd); | ||
119 | } | ||
116 | d_drop(*d); | 120 | d_drop(*d); |
117 | } | 121 | } |
118 | dput(*d); | 122 | dput(*d); |