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 /block/genhd.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 'block/genhd.c')
-rw-r--r-- | block/genhd.c | 7 |
1 files changed, 2 insertions, 5 deletions
diff --git a/block/genhd.c b/block/genhd.c index 59a2db6fecef..4e28a840bde0 100644 --- a/block/genhd.c +++ b/block/genhd.c | |||
@@ -22,9 +22,7 @@ | |||
22 | #include "blk.h" | 22 | #include "blk.h" |
23 | 23 | ||
24 | static DEFINE_MUTEX(block_class_lock); | 24 | static DEFINE_MUTEX(block_class_lock); |
25 | #ifndef CONFIG_SYSFS_DEPRECATED | ||
26 | struct kobject *block_depr; | 25 | struct kobject *block_depr; |
27 | #endif | ||
28 | 26 | ||
29 | /* for extended dynamic devt allocation, currently only one major is used */ | 27 | /* for extended dynamic devt allocation, currently only one major is used */ |
30 | #define MAX_EXT_DEVT (1 << MINORBITS) | 28 | #define MAX_EXT_DEVT (1 << MINORBITS) |
@@ -803,10 +801,9 @@ static int __init genhd_device_init(void) | |||
803 | 801 | ||
804 | register_blkdev(BLOCK_EXT_MAJOR, "blkext"); | 802 | register_blkdev(BLOCK_EXT_MAJOR, "blkext"); |
805 | 803 | ||
806 | #ifndef CONFIG_SYSFS_DEPRECATED | ||
807 | /* create top-level block dir */ | 804 | /* create top-level block dir */ |
808 | block_depr = kobject_create_and_add("block", NULL); | 805 | if (!sysfs_deprecated) |
809 | #endif | 806 | block_depr = kobject_create_and_add("block", NULL); |
810 | return 0; | 807 | return 0; |
811 | } | 808 | } |
812 | 809 | ||