summaryrefslogtreecommitdiff
path: root/udev/udev-builtin-kmod.c
diff options
context:
space:
mode:
authorKay Sievers <kay.sievers@vrfy.org>2011-12-21 23:10:56 +0100
committerKay Sievers <kay.sievers@vrfy.org>2011-12-21 23:10:56 +0100
commitaa29418a13dc1e1eedca702663e733cc8d9f9859 (patch)
tree9e72f070d6176c329c285fcd50b1661e7d8b337f /udev/udev-builtin-kmod.c
parent81dadce58f80edae4dc45ba55a2c41cb0f26570b (diff)
add builtin load/unload initializers
Diffstat (limited to 'udev/udev-builtin-kmod.c')
-rw-r--r--udev/udev-builtin-kmod.c21
1 files changed, 20 insertions, 1 deletions
diff --git a/udev/udev-builtin-kmod.c b/udev/udev-builtin-kmod.c
index df057735d7..90f9c564ed 100644
--- a/udev/udev-builtin-kmod.c
+++ b/udev/udev-builtin-kmod.c
@@ -1,5 +1,5 @@
/*
- * probe disks for filesystems and partitions
+ * load kernel modules
*
* Copyright (C) 2011 Kay Sievers <kay.sievers@vrfy.org>
*
@@ -28,15 +28,34 @@
#include "udev.h"
+static char *kmod;
+
static int builtin_kmod(struct udev_device *dev, const char *command, bool test)
{
printf("soon we load a module here: '%s'\n", command);
+ printf("test: %s\n", kmod);
return EXIT_SUCCESS;
}
+static int builtin_kmod_load(struct udev *udev)
+{
+ printf("load module index\n");
+ asprintf(&kmod, "pid: %u\n", getpid());
+ return 0;
+}
+
+static int builtin_kmod_unload(struct udev *udev)
+{
+ printf("unload module index\n");
+ free(kmod);
+ return 0;
+}
+
const struct udev_builtin udev_builtin_kmod = {
.name = "kmod",
.cmd = builtin_kmod,
+ .load = builtin_kmod_load,
+ .unload = builtin_kmod_unload,
.help = "kernel module loader",
.run_once = false,
};