diff options
author | Kay Sievers <kay.sievers@vrfy.org> | 2011-12-23 04:50:33 +0100 |
---|---|---|
committer | Kay Sievers <kay.sievers@vrfy.org> | 2011-12-23 04:50:33 +0100 |
commit | 06316d9f1a91b4d3efdb7402e72498cb3deb1806 (patch) | |
tree | 48feeccd57cd656b7d81764570d090f917aefa83 | |
parent | e5d8ce91bedf4af89111ac9499d6bdc91b475f0d (diff) |
builtin: kmod - switch modprobe to builtin
-rw-r--r-- | INSTALL | 3 | ||||
-rwxr-xr-x | autogen.sh | 1 | ||||
-rw-r--r-- | configure.ac | 1 | ||||
-rw-r--r-- | extras/mtd_probe/75-probe_mtd.rules.in | 2 | ||||
-rw-r--r-- | rules/rules.d/80-drivers.rules.in | 12 | ||||
-rw-r--r-- | udev/udev-builtin-kmod.c | 28 |
6 files changed, 29 insertions, 18 deletions
@@ -3,7 +3,6 @@ The options used used usually look like: --prefix=/usr \ --sysconfdir=/etc \ --bindir=/usr/bin \ - --sbindir=/usr/sbin \ --libdir=/usr/lib64 \ --libexecdir=/usr/lib/udev \ --with-systemdsystemunitdir=/usr/lib/systemd/system \ @@ -14,7 +13,6 @@ The options used in a RPM spec file look like: --prefix=%{_prefix} \ --sysconfdir=%{_sysconfdir} \ --bindir=%{_bindir} \ - --sbindir=%{_sbindir} \ --libdir=%{_libdir} \ --libexecdir=%{_prefix}/lib/udev \ --with-systemdsystemunitdir=%{_prefix}/lib/systemd/system \ @@ -23,7 +21,6 @@ The options used in a RPM spec file look like: The options to install udev in the rootfs instead of /usr, and udevadm in /sbin: --bindir=/sbin - --sbindir=/sbin --libexecdir=/lib/udev --with-systemdsystemunitdir=/lib/systemd/system --with-rootlibdir=/lib64 diff --git a/autogen.sh b/autogen.sh index ceb7e65018..e7bd9c2a1c 100755 --- a/autogen.sh +++ b/autogen.sh @@ -25,7 +25,6 @@ libdir() { args="--prefix=/usr \ --sysconfdir=/etc \ --bindir=/sbin \ ---sbindir=/sbin \ --libdir=$(libdir /usr/lib) \ --with-rootlibdir=$(libdir /lib) \ --libexecdir=/lib/udev \ diff --git a/configure.ac b/configure.ac index f0d5d04076..abfcb361dd 100644 --- a/configure.ac +++ b/configure.ac @@ -218,7 +218,6 @@ AC_MSG_RESULT([ prefix: ${prefix} sysconfdir: ${sysconfdir} bindir: ${bindir} - sbindir: ${sbindir} libdir: ${libdir} rootlibdir: ${rootlib_execdir} libexecdir: ${libexecdir} diff --git a/extras/mtd_probe/75-probe_mtd.rules.in b/extras/mtd_probe/75-probe_mtd.rules.in index 2e28d37fa3..6b0c1c27e6 100644 --- a/extras/mtd_probe/75-probe_mtd.rules.in +++ b/extras/mtd_probe/75-probe_mtd.rules.in @@ -3,6 +3,6 @@ ACTION!="add", GOTO="mtd_probe_end" KERNEL=="mtd*ro", IMPORT{program}="mtd_probe $tempnode" -KERNEL=="mtd*ro", ENV{MTD_FTL}=="smartmedia", RUN+="@sbindir@/modprobe -bv sm_ftl" +KERNEL=="mtd*ro", ENV{MTD_FTL}=="smartmedia", IMPORT{builtin}="kmod load sm_ftl" LABEL="mtd_probe_end" diff --git a/rules/rules.d/80-drivers.rules.in b/rules/rules.d/80-drivers.rules.in index 04e30f5b04..38ebfeb0e6 100644 --- a/rules/rules.d/80-drivers.rules.in +++ b/rules/rules.d/80-drivers.rules.in @@ -2,11 +2,11 @@ ACTION=="remove", GOTO="drivers_end" -DRIVER!="?*", ENV{MODALIAS}=="?*", RUN+="@sbindir@/modprobe -bv $env{MODALIAS}" -SUBSYSTEM=="tifm", ENV{TIFM_CARD_TYPE}=="SD", RUN+="@sbindir@/modprobe -bv tifm_sd" -SUBSYSTEM=="tifm", ENV{TIFM_CARD_TYPE}=="MS", RUN+="@sbindir@/modprobe -bv tifm_ms" -SUBSYSTEM=="memstick", RUN+="@sbindir@/modprobe -bv --all ms_block mspro_block" -SUBSYSTEM=="i2o", RUN+="@sbindir@/modprobe -bv i2o_block" -SUBSYSTEM=="module", KERNEL=="parport_pc", RUN+="@sbindir@/modprobe -bv ppdev" +DRIVER!="?*", ENV{MODALIAS}=="?*", IMPORT{builtin}="kmod load $env{MODALIAS}" +SUBSYSTEM=="tifm", ENV{TIFM_CARD_TYPE}=="SD", IMPORT{builtin}="kmod load tifm_sd" +SUBSYSTEM=="tifm", ENV{TIFM_CARD_TYPE}=="MS", IMPORT{builtin}="kmod load tifm_ms" +SUBSYSTEM=="memstick", IMPORT{builtin}="kmod load ms_block mspro_block" +SUBSYSTEM=="i2o", IMPORT{builtin}="kmod load i2o_block" +SUBSYSTEM=="module", KERNEL=="parport_pc", IMPORT{builtin}="kmod load ppdev" LABEL="drivers_end" diff --git a/udev/udev-builtin-kmod.c b/udev/udev-builtin-kmod.c index 4e8ec653fe..a84f08cf93 100644 --- a/udev/udev-builtin-kmod.c +++ b/udev/udev-builtin-kmod.c @@ -25,36 +25,52 @@ #include <errno.h> #include <fcntl.h> #include <sys/stat.h> +#include <sys/wait.h> #include "udev.h" -static char *kmod; - static int builtin_kmod(struct udev_device *dev, int argc, char *argv[], bool test) { struct udev *udev = udev_device_get_udev(dev); + pid_t pid; + char *m[5]; if (argc < 3) { err(udev, "missing command + argument\n"); return EXIT_FAILURE; } - printf("soon we '%s' the module '%s' (%i) here\n", argv[1], argv[2], argc); - printf("test: %s\n", kmod); + err(udev, "'%s' the module '%s' (%i)\n", argv[1], argv[2], argc); + + m[0] = "/sbin/modprobe"; + m[1] = "-bv"; + m[1] = argv[2]; + m[2] = argv[3]; + m[3] = NULL; + + pid = fork(); + switch(pid) { + case 0: + execv(m[0], m); + _exit(1); + case -1: + return EXIT_FAILURE; + default: + waitpid(pid, NULL, 0); + } + return EXIT_SUCCESS; } static int builtin_kmod_load(struct udev *udev) { info(udev, "load module index\n"); - asprintf(&kmod, "pid: %u", getpid()); return 0; } static int builtin_kmod_unload(struct udev *udev) { info(udev, "unload module index\n"); - free(kmod); return 0; } |