diff options
author | Yu Watanabe <watanabe.yu+github@gmail.com> | 2022-07-15 05:41:26 +0200 |
---|---|---|
committer | Yu Watanabe <watanabe.yu+github@gmail.com> | 2022-07-23 08:05:22 +0200 |
commit | 009b2c3ac16752b9c6c6501f57af7e32455db5f9 (patch) | |
tree | ccc9d8370350cea808348e8abbe6aee408aa6c15 /src/udev | |
parent | udev: reload rules and builtins only when mtime of a config changed (diff) | |
download | systemd-009b2c3ac16752b9c6c6501f57af7e32455db5f9.tar.xz systemd-009b2c3ac16752b9c6c6501f57af7e32455db5f9.zip |
udev-builtin: logs when needs reloading
Diffstat (limited to 'src/udev')
-rw-r--r-- | src/udev/udev-builtin-hwdb.c | 7 | ||||
-rw-r--r-- | src/udev/udev-builtin-kmod.c | 13 | ||||
-rw-r--r-- | src/udev/udev-builtin-net_setup_link.c | 8 |
3 files changed, 21 insertions, 7 deletions
diff --git a/src/udev/udev-builtin-hwdb.c b/src/udev/udev-builtin-hwdb.c index 1241c08f2c..1924fcc4ad 100644 --- a/src/udev/udev-builtin-hwdb.c +++ b/src/udev/udev-builtin-hwdb.c @@ -208,7 +208,12 @@ static void builtin_hwdb_exit(void) { /* called every couple of seconds during event activity; 'true' if config has changed */ static bool builtin_hwdb_validate(void) { - return hwdb_validate(hwdb); + if (hwdb_validate(hwdb)) { + log_debug("hwdb needs reloading."); + return true; + } + + return false; } const UdevBuiltin udev_builtin_hwdb = { diff --git a/src/udev/udev-builtin-kmod.c b/src/udev/udev-builtin-kmod.c index bc6a11f241..85afd3b6ec 100644 --- a/src/udev/udev-builtin-kmod.c +++ b/src/udev/udev-builtin-kmod.c @@ -43,7 +43,7 @@ static int builtin_kmod_init(void) { if (!ctx) return -ENOMEM; - log_debug("Load module index"); + log_debug("Loading kernel module index."); kmod_set_log_fn(ctx, udev_kmod_log, NULL); kmod_load_resources(ctx); return 0; @@ -51,16 +51,21 @@ static int builtin_kmod_init(void) { /* called on udev shutdown and reload request */ static void builtin_kmod_exit(void) { - log_debug("Unload module index"); + log_debug("Unload kernel module index."); ctx = kmod_unref(ctx); } /* called every couple of seconds during event activity; 'true' if config has changed */ static bool builtin_kmod_validate(void) { - log_debug("Validate module index"); if (!ctx) return false; - return (kmod_validate_resources(ctx) != KMOD_RESOURCES_OK); + + if (kmod_validate_resources(ctx) != KMOD_RESOURCES_OK) { + log_debug("Kernel module index needs reloading."); + return true; + } + + return false; } const UdevBuiltin udev_builtin_kmod = { diff --git a/src/udev/udev-builtin-net_setup_link.c b/src/udev/udev-builtin-net_setup_link.c index d4095c7684..bad4e994b9 100644 --- a/src/udev/udev-builtin-net_setup_link.c +++ b/src/udev/udev-builtin-net_setup_link.c @@ -75,11 +75,15 @@ static void builtin_net_setup_link_exit(void) { } static bool builtin_net_setup_link_validate(void) { - log_debug("Check if link configuration needs reloading."); if (!ctx) return false; - return link_config_should_reload(ctx); + if (link_config_should_reload(ctx)) { + log_debug("Link configuration context needs reloading."); + return true; + } + + return false; } const UdevBuiltin udev_builtin_net_setup_link = { |