]> err.no Git - systemd/commitdiff
builtin: kmod - switch modprobe to builtin
authorKay Sievers <kay.sievers@vrfy.org>
Fri, 23 Dec 2011 03:50:33 +0000 (04:50 +0100)
committerKay Sievers <kay.sievers@vrfy.org>
Fri, 23 Dec 2011 03:50:33 +0000 (04:50 +0100)
INSTALL
autogen.sh
configure.ac
extras/mtd_probe/75-probe_mtd.rules.in
rules/rules.d/80-drivers.rules.in
udev/udev-builtin-kmod.c

diff --git a/INSTALL b/INSTALL
index 8ad69a43ad48951262dbd273548a19b5b759efe4..29620005b2a3734ba87f743d1605668c163087a9 100644 (file)
--- a/INSTALL
+++ b/INSTALL
@@ -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
index ceb7e65018648818e4d26a0d5546da679bea0446..e7bd9c2a1c0c5d23dd6c42b890ad98d1f529d810 100755 (executable)
@@ -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 \
index f0d5d0407644745f5b77c2ce2e47261044b81f28..abfcb361dd18ae865b99e7ddf2600900720a62ea 100644 (file)
@@ -218,7 +218,6 @@ AC_MSG_RESULT([
        prefix:                 ${prefix}
        sysconfdir:             ${sysconfdir}
        bindir:                 ${bindir}
-       sbindir:                ${sbindir}
        libdir:                 ${libdir}
        rootlibdir:             ${rootlib_execdir}
        libexecdir:             ${libexecdir}
index 2e28d37fa3f523bea50c1378348de4f159c4a21c..6b0c1c27e6ccb775f2320b2a02cd74c9e93dd172 100644 (file)
@@ -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"
index 04e30f5b0446773c0a32974eccdfd4ae21b75287..38ebfeb0e6145754cf90a9efc4da4b5277339263 100644 (file)
@@ -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"
index 4e8ec653fe90abd99779cb44a66bd5764e5d42e0..a84f08cf93c122854cf938a9689d9146a313895b 100644 (file)
 #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;
 }