diff options
author | Kay Sievers <kay.sievers@vrfy.org> | 2011-12-25 16:37:15 +0100 |
---|---|---|
committer | Kay Sievers <kay.sievers@vrfy.org> | 2011-12-25 16:37:15 +0100 |
commit | 7c85d636e646a5c2021d1daaab10282f340e0134 (patch) | |
tree | 592115c42a6a3a1a670099ae92547ab33c84e0d7 /udev/udev-builtin-kmod.c | |
parent | 779f4de1b93b77f84527d9916a1af462fc2579a1 (diff) |
invalidate rules and kmod index with 'udevadm control --reload'
- rename --reload-rules to --reload
- invalidate rules and databases only, delay parsing to the next event
- enable debug output for test-builtin
Diffstat (limited to 'udev/udev-builtin-kmod.c')
-rw-r--r-- | udev/udev-builtin-kmod.c | 19 |
1 files changed, 14 insertions, 5 deletions
diff --git a/udev/udev-builtin-kmod.c b/udev/udev-builtin-kmod.c index 8e7a50a020..6f3e2589c2 100644 --- a/udev/udev-builtin-kmod.c +++ b/udev/udev-builtin-kmod.c @@ -321,11 +321,17 @@ static int builtin_kmod(struct udev_device *dev, int argc, char *argv[], bool te struct udev *udev = udev_device_get_udev(dev); int i; - if (!ctx) - return EXIT_FAILURE; + if (!ctx) { + ctx = kmod_new(NULL, NULL); + if (!ctx) + return -ENOMEM; - if (argc < 3) { - err(udev, "missing command + argument\n"); + info(udev, "load module index\n"); + kmod_load_resources(ctx); + } + + if (argc < 3 || strcmp(argv[1], "load")) { + err(udev, "expect: %s load <module>\n", argv[0]); return EXIT_FAILURE; } @@ -339,12 +345,15 @@ static int builtin_kmod(struct udev_device *dev, int argc, char *argv[], bool te static int builtin_kmod_init(struct udev *udev) { - kmod_unref(ctx); + if (ctx) + return 0; + ctx = kmod_new(NULL, NULL); if (!ctx) return -ENOMEM; info(udev, "load module index\n"); + kmod_load_resources(ctx); return 0; } |