* Copyright (C) 2011 ProFUSION embedded systems
*
* This program is free software: you can redistribute it and/or modify
* Copyright (C) 2011 ProFUSION embedded systems
*
* This program is free software: you can redistribute it and/or modify
kmod_list_foreach(l, list) {
struct kmod_module *mod = kmod_module_get_module(l);
err = kmod_module_probe_insert_module(mod, KMOD_PROBE_APPLY_BLACKLIST, NULL, NULL, NULL, NULL);
if (err == KMOD_PROBE_APPLY_BLACKLIST)
kmod_list_foreach(l, list) {
struct kmod_module *mod = kmod_module_get_module(l);
err = kmod_module_probe_insert_module(mod, KMOD_PROBE_APPLY_BLACKLIST, NULL, NULL, NULL, NULL);
if (err == KMOD_PROBE_APPLY_BLACKLIST)
udev_main_log(data, priority, file, line, fn, format, args);
}
udev_main_log(data, priority, file, line, fn, format, args);
}
static int builtin_kmod(struct udev_device *dev, int argc, char *argv[], bool test)
{
struct udev *udev = udev_device_get_udev(dev);
int i;
static int builtin_kmod(struct udev_device *dev, int argc, char *argv[], bool test)
{
struct udev *udev = udev_device_get_udev(dev);
int i;
- if (!ctx) {
- ctx = kmod_new(NULL, NULL);
- if (!ctx)
- return -ENOMEM;
-
- info(udev, "load module index\n");
- kmod_set_log_fn(ctx, udev_kmod_log, udev);
- kmod_load_resources(ctx);
- }
- if (argc < 3 || strcmp(argv[1], "load")) {
- err(udev, "expect: %s load <module>\n", argv[0]);
+ if (argc < 3 || !streq(argv[1], "load")) {
+ log_error("expect: %s load <module>\n", argv[0]);
- info(udev, "execute '%s' '%s'\n", argv[1], argv[i]);
+ log_debug("execute '%s' '%s'\n", argv[1], argv[i]);
kmod_set_log_fn(ctx, udev_kmod_log, udev);
kmod_load_resources(ctx);
return 0;
kmod_set_log_fn(ctx, udev_kmod_log, udev);
kmod_load_resources(ctx);
return 0;
ctx = kmod_unref(ctx);
}
/* called every couple of seconds during event activity; 'true' if config has changed */
static bool builtin_kmod_validate(struct udev *udev)
{
ctx = kmod_unref(ctx);
}
/* called every couple of seconds during event activity; 'true' if config has changed */
static bool builtin_kmod_validate(struct udev *udev)
{
- info(udev, "validate module index\n");
- if (kmod_validate_resources(ctx) != KMOD_RESOURCES_OK)
- return true;
- return false;
+ log_debug("validate module index\n");
+ if (!ctx)
+ return false;
+ return (kmod_validate_resources(ctx) != KMOD_RESOURCES_OK);