diff options
author | Andi Kleen <ak@linux.intel.com> | 2010-09-08 10:54:17 -0400 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@suse.de> | 2010-10-22 13:16:43 -0400 |
commit | e52eec13cd6b7f30ab19081b387813e03e592ae5 (patch) | |
tree | 7b327e0b9283c578fb10922edcf6e10b3b8fd943 /fs/partitions/check.c | |
parent | 39aba963d937edb20db7d9d93e6dda5d2adfdcdd (diff) |
SYSFS: Allow boot time switching between deprecated and modern sysfs layout
I have some systems which need legacy sysfs due to old tools that are
making assumptions that a directory can never be a symlink to another
directory, and it's a big hazzle to compile separate kernels for them.
This patch turns CONFIG_SYSFS_DEPRECATED into a run time option
that can be switched on/off the kernel command line. This way
the same binary can be used in both cases with just a option
on the command line.
The old CONFIG_SYSFS_DEPRECATED_V2 option is still there to set
the default. I kept the weird name to not break existing
config files.
Also the compat code can be still completely disabled by undefining
CONFIG_SYSFS_DEPRECATED_SWITCH -- just the optimizer takes
care of this now instead of lots of ifdefs. This makes the code
look nicer.
v2: This is an updated version on top of Kay's patch to only
handle the block devices. I tested it on my old systems
and that seems to work.
Cc: axboe@kernel.dk
Signed-off-by: Andi Kleen <ak@linux.intel.com>
Cc: Kay Sievers <kay.sievers@vrfy.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Diffstat (limited to 'fs/partitions/check.c')
-rw-r--r-- | fs/partitions/check.c | 19 |
1 files changed, 9 insertions, 10 deletions
diff --git a/fs/partitions/check.c b/fs/partitions/check.c index 79fbf3f390f..137bf978785 100644 --- a/fs/partitions/check.c +++ b/fs/partitions/check.c | |||
@@ -513,14 +513,14 @@ void register_disk(struct gendisk *disk) | |||
513 | 513 | ||
514 | if (device_add(ddev)) | 514 | if (device_add(ddev)) |
515 | return; | 515 | return; |
516 | #ifndef CONFIG_SYSFS_DEPRECATED | 516 | if (!sysfs_deprecated) { |
517 | err = sysfs_create_link(block_depr, &ddev->kobj, | 517 | err = sysfs_create_link(block_depr, &ddev->kobj, |
518 | kobject_name(&ddev->kobj)); | 518 | kobject_name(&ddev->kobj)); |
519 | if (err) { | 519 | if (err) { |
520 | device_del(ddev); | 520 | device_del(ddev); |
521 | return; | 521 | return; |
522 | } | ||
522 | } | 523 | } |
523 | #endif | ||
524 | disk->part0.holder_dir = kobject_create_and_add("holders", &ddev->kobj); | 524 | disk->part0.holder_dir = kobject_create_and_add("holders", &ddev->kobj); |
525 | disk->slave_dir = kobject_create_and_add("slaves", &ddev->kobj); | 525 | disk->slave_dir = kobject_create_and_add("slaves", &ddev->kobj); |
526 | 526 | ||
@@ -737,8 +737,7 @@ void del_gendisk(struct gendisk *disk) | |||
737 | kobject_put(disk->part0.holder_dir); | 737 | kobject_put(disk->part0.holder_dir); |
738 | kobject_put(disk->slave_dir); | 738 | kobject_put(disk->slave_dir); |
739 | disk->driverfs_dev = NULL; | 739 | disk->driverfs_dev = NULL; |
740 | #ifndef CONFIG_SYSFS_DEPRECATED | 740 | if (!sysfs_deprecated) |
741 | sysfs_remove_link(block_depr, dev_name(disk_to_dev(disk))); | 741 | sysfs_remove_link(block_depr, dev_name(disk_to_dev(disk))); |
742 | #endif | ||
743 | device_del(disk_to_dev(disk)); | 742 | device_del(disk_to_dev(disk)); |
744 | } | 743 | } |