mirror of
https://github.com/BobTheBlinker/android_kernel_motorola_sm6375.git
synced 2026-10-28 18:51:56 -04:00
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: [email protected] Signed-off-by: Andi Kleen <[email protected]> Cc: Kay Sievers <[email protected]> Signed-off-by: Greg Kroah-Hartman <[email protected]>
This commit is contained in:
parent
39aba963d9
commit
e52eec13cd
7 changed files with 68 additions and 30 deletions
|
|
@ -22,9 +22,7 @@
|
|||
#include "blk.h"
|
||||
|
||||
static DEFINE_MUTEX(block_class_lock);
|
||||
#ifndef CONFIG_SYSFS_DEPRECATED
|
||||
struct kobject *block_depr;
|
||||
#endif
|
||||
|
||||
/* for extended dynamic devt allocation, currently only one major is used */
|
||||
#define MAX_EXT_DEVT (1 << MINORBITS)
|
||||
|
|
@ -803,10 +801,9 @@ static int __init genhd_device_init(void)
|
|||
|
||||
register_blkdev(BLOCK_EXT_MAJOR, "blkext");
|
||||
|
||||
#ifndef CONFIG_SYSFS_DEPRECATED
|
||||
/* create top-level block dir */
|
||||
block_depr = kobject_create_and_add("block", NULL);
|
||||
#endif
|
||||
if (!sysfs_deprecated)
|
||||
block_depr = kobject_create_and_add("block", NULL);
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue