builtin: kmod - switch modprobe to builtin
This commit is contained in:
@@ -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
|
||||
|
||||
@@ -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 \
|
||||
|
||||
@@ -218,7 +218,6 @@ AC_MSG_RESULT([
|
||||
prefix: ${prefix}
|
||||
sysconfdir: ${sysconfdir}
|
||||
bindir: ${bindir}
|
||||
sbindir: ${sbindir}
|
||||
libdir: ${libdir}
|
||||
rootlibdir: ${rootlib_execdir}
|
||||
libexecdir: ${libexecdir}
|
||||
|
||||
@@ -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"
|
||||
|
||||
@@ -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"
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user