kmod: few code cleanups to split out umh code
Subsystems (2)
Luis R. Rodriguez
maintainercover kmod: few code cleanups to split out umh code
Andrew,
Here are a few cleanup items I'd like queued up for v4.14-rc1.
The usermode helper has a provenance from the old usb code which first required a usermode helper. Eventually this was shoved into kmod.c and the kernel's modprobe calls was converted over eventually to share the same code. Over time the list of usermode helpers in the kernel has grown -- so kmod is just but one user of the API.
This series is a simple logical cleanup which acknowledges the code evolution of the usermode helper and shoves the UMH API into its own dedicated file. This way users of the API can later just include umh.h instead of kmod.h.
Note despite the diff state the first patch really is just a code shove, no functional changes are done there. I did use git format-patch -M to generate the patch, but in the end the split was not enough for git to consider it a rename hence the large diffstat.
These changes, along with the rest of kmod delta in line, are available on my linux-next git tree [0] on the branch 20170810-kmod-for-v4.14. This is based on linux-next tag next-20170810.
I've put this through 0-day and it gives me their machine compilation blessings with all tests as OK.
If there are any issues or questions please let me know.
[0] https://git.kernel.org/pub/scm/linux/kernel/git/mcgrof/linux-next.git/log/?h=20170810-kmod-for-v4.14
Luis R. Rodriguez (4):
kmod: split out umh code into its own file
MAINTAINERS: clarify kmod is just a kernel module loader
kmod: split off umh headers into its own file
kmod: move #ifdef CONFIG_MODULES wrapper to Makefile
MAINTAINERS | 9 +- include/linux/kmod.h | 60 +----- include/linux/umh.h | 69 +++++++ kernel/Makefile | 3 +- kernel/kmod.c | 563 +------------------------------------------------- kernel/umh.c | 568 +++++++++++++++++++++++++++++++++++++++++++++++++++ 6 files changed, 650 insertions(+), 622 deletions(-) create mode 100644 include/linux/umh.h create mode 100644 kernel/umh.c
Signature · 1 line
2.14.0
Luis R. Rodriguez
maintainerPATCH 1/4 kmod: split out umh code into its own file
There's a slew of usermode helper users and kmod is just one of them. Split out the usermode helper code into its own file to keep the logic and focus split up.
This change provides no functional changes.
--- MAINTAINERS | 6 + kernel/Makefile | 2 +- kernel/kmod.c | 560 +------------------------------------------------------ kernel/umh.c | 568 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 4 files changed, 577 insertions(+), 559 deletions(-) create mode 100644 kernel/umh.c
MAINTAINERS +6 -0
@@ -7423,6 +7423,12 @@ S: Maintained F: tools/testing/selftests/ F: Documentation/dev-tools/kselftest* +KERNEL USERMODE HELPER +M: "Luis R. Rodriguez" <[email protected]> +L: [email protected] +S: Maintained +F: kernel/umh.c + KERNEL VIRTUAL MACHINE (KVM) M: Paolo Bonzini <[email protected]> M: Radim Krčmář <[email protected]>
kernel/Makefile +1 -1
@@ -5,7 +5,7 @@ obj-y = fork.o exec_domain.o panic.o \ cpu.o exit.o softirq.o resource.o \ sysctl.o sysctl_binary.o capability.o ptrace.o user.o \ - signal.o sys.o kmod.o workqueue.o pid.o task_work.o \ + signal.o sys.o umh.o kmod.o workqueue.o pid.o task_work.o \ extable.o params.o \ kthread.o sys_ni.o nsproxy.o \ notifier.o ksysfs.o cred.o reboot.o \
kernel/kmod.c +2 -558
573 lines not on this page · raw message
kernel/umh.c new file +568 -0
568 lines not on this page · raw message
Signature · 1 line
2.14.0
Luis R. Rodriguez
maintainerPATCH 2/4 MAINTAINERS: clarify kmod is just a kernel module loader
In reply to Luis R. RodriguezThis should make it clearer what the kmod code is now that the umh code is split out separately.
--- MAINTAINERS | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
MAINTAINERS +1 -1
@@ -7589,7 +7589,7 @@ F: include/linux/kmemleak.h F: mm/kmemleak.c F: mm/kmemleak-test.c -KMOD MODULE USERMODE HELPER +KMOD KERNEL MODULE LOADER - USERMODE HELPER M: "Luis R. Rodriguez" <[email protected]> L: [email protected] S: Maintained
Signature · 1 line
2.14.0
Luis R. Rodriguez
maintainerPATCH 3/4 kmod: split off umh headers into its own file
In reply to Luis R. RodriguezIn the future usermode helper users do not need to carry in all the of kmod headers declarations.
Since kmod.h still includes umh.h this change has no functional changes, each umh user can be cleaned up separately later and with time.
--- MAINTAINERS | 1 + include/linux/kmod.h | 60 +-------------------------------------------- include/linux/umh.h | 69 ++++++++++++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 71 insertions(+), 59 deletions(-) create mode 100644 include/linux/umh.h
MAINTAINERS +1 -0
@@ -7428,6 +7428,7 @@ M: "Luis R. Rodriguez" <[email protected]> L: [email protected] S: Maintained F: kernel/umh.c +F: include/linux/umh.h KERNEL VIRTUAL MACHINE (KVM) M: Paolo Bonzini <[email protected]>
include/linux/kmod.h +1 -59
70 lines not on this page · raw message
include/linux/umh.h new file +69 -0
69 lines not on this page · raw message
Signature · 1 line
2.14.0
Luis R. Rodriguez
maintainerPATCH 4/4 kmod: move #ifdef CONFIG_MODULES wrapper to Makefile
In reply to Luis R. RodriguezThe entire file is now conditionally compiled only when CONFIG_MODULES is enabled, and this this is a bool. Just move this conditional to the Makefile as its easier to read this way.
--- kernel/Makefile | 3 ++- kernel/kmod.c | 3 --- 2 files changed, 2 insertions(+), 4 deletions(-)
kernel/Makefile +2 -1
@@ -5,12 +5,13 @@ obj-y = fork.o exec_domain.o panic.o \ cpu.o exit.o softirq.o resource.o \ sysctl.o sysctl_binary.o capability.o ptrace.o user.o \ - signal.o sys.o umh.o kmod.o workqueue.o pid.o task_work.o \ + signal.o sys.o umh.o workqueue.o pid.o task_work.o \ extable.o params.o \ kthread.o sys_ni.o nsproxy.o \ notifier.o ksysfs.o cred.o reboot.o \ async.o range.o smpboot.o ucount.o +obj-$(CONFIG_MODULES) += kmod.o obj-$(CONFIG_MULTIUSER) += groups.o ifdef CONFIG_FUNCTION_TRACER
kernel/kmod.c +0 -3
@@ -28,7 +28,6 @@#include <trace/events/module.h> -#ifdef CONFIG_MODULES /* * Assuming: *
@@ -177,5 +176,3 @@ int __request_module(bool wait, const char *fmt, ...)return ret; }EXPORT_SYMBOL (__request_module); - -#endif /* CONFIG_MODULES */
Signature · 1 line
2.14.0