RFC: ksmbd: Create module_kobject if builtin
Adding a call to lookup_or_create_module_kobject() to ksmbd
makes /sys/modules/ksmbd appear even when ksmbd is compiled
into the kernel.
This is nice when you boot a custom kernel on OpenWrt because
the startup script does things such as:
[ ! -e /sys/module/ksmbd ] && modprobe ksmbd 2> /dev/null
if [ ! -e /sys/module/ksmbd ]; then
logger -p daemon.error -t 'ksmbd' "modprobe of ksmbd "
"module failed, can\'t start ksmbd!"
exit 1
fi
which makes the script not work with a compiled-in ksmbd.
Since I actually turn off modules and compile all my modules
into the kernel, I can't change the script to just check
cat /lib/modules/$(uname -r)/modules.builtin | grep ksmbd
either: no /lib/modules directory.
An option would be to change the script to proceed and
just assume the module is compiled in but it feels wrong.
If this approach is acceptable I am happy to generalize this
to something that any module that wants a /sys/modules/foo
file can use to get just that.
I can think of other ways to just create a dummy dir in
/sys/modules but it is probably unwise if someone would later
actually add a parameter or version string to the module and
get unpredictable bugs. It's probably better like this if
we do this thing.
Cc: Rosen Penev <rosenp@gmail.com>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
1 file changed