diff options
author | Yu Watanabe <watanabe.yu+github@gmail.com> | 2022-08-17 07:44:27 +0200 |
---|---|---|
committer | Yu Watanabe <watanabe.yu+github@gmail.com> | 2022-08-17 14:56:46 +0200 |
commit | f9b3b990171078f846fbcdecf19a4dbcfe3986dc (patch) | |
tree | fb6390a438d8b0f8115ddfccea1fe145204716f8 /src | |
parent | Merge pull request #24333 from yuwata/sysctl (diff) | |
download | systemd-f9b3b990171078f846fbcdecf19a4dbcfe3986dc.tar.xz systemd-f9b3b990171078f846fbcdecf19a4dbcfe3986dc.zip |
udev: rename various validate() -> should_reload() for builtin commands
Previously, true by validate() means several configs are outdated and we
need to reload configs. That's not intuitive for me. Let's rename the
functions.
Diffstat (limited to 'src')
-rw-r--r-- | src/shared/hwdb-util.c | 2 | ||||
-rw-r--r-- | src/shared/hwdb-util.h | 2 | ||||
-rw-r--r-- | src/udev/udev-builtin-hwdb.c | 6 | ||||
-rw-r--r-- | src/udev/udev-builtin-kmod.c | 4 | ||||
-rw-r--r-- | src/udev/udev-builtin-net_setup_link.c | 4 | ||||
-rw-r--r-- | src/udev/udev-builtin.c | 4 | ||||
-rw-r--r-- | src/udev/udev-builtin.h | 4 | ||||
-rw-r--r-- | src/udev/udevd.c | 2 |
8 files changed, 14 insertions, 14 deletions
diff --git a/src/shared/hwdb-util.c b/src/shared/hwdb-util.c index 1ec861f76f..6a680fb3be 100644 --- a/src/shared/hwdb-util.c +++ b/src/shared/hwdb-util.c @@ -680,7 +680,7 @@ int hwdb_query(const char *modalias, const char *root) { return 0; } -bool hwdb_validate(sd_hwdb *hwdb) { +bool hwdb_should_reload(sd_hwdb *hwdb) { bool found = false; const char* p; struct stat st; diff --git a/src/shared/hwdb-util.h b/src/shared/hwdb-util.h index bfecddea42..cb93690ee8 100644 --- a/src/shared/hwdb-util.h +++ b/src/shared/hwdb-util.h @@ -5,6 +5,6 @@ #include "sd-hwdb.h" -bool hwdb_validate(sd_hwdb *hwdb); +bool hwdb_should_reload(sd_hwdb *hwdb); int hwdb_update(const char *root, const char *hwdb_bin_dir, bool strict, bool compat); int hwdb_query(const char *modalias, const char *root); diff --git a/src/udev/udev-builtin-hwdb.c b/src/udev/udev-builtin-hwdb.c index 1924fcc4ad..8d652e46fe 100644 --- a/src/udev/udev-builtin-hwdb.c +++ b/src/udev/udev-builtin-hwdb.c @@ -207,8 +207,8 @@ 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) { - if (hwdb_validate(hwdb)) { +static bool builtin_hwdb_should_reload(void) { + if (hwdb_should_reload(hwdb)) { log_debug("hwdb needs reloading."); return true; } @@ -221,6 +221,6 @@ const UdevBuiltin udev_builtin_hwdb = { .cmd = builtin_hwdb, .init = builtin_hwdb_init, .exit = builtin_hwdb_exit, - .validate = builtin_hwdb_validate, + .should_reload = builtin_hwdb_should_reload, .help = "Hardware database", }; diff --git a/src/udev/udev-builtin-kmod.c b/src/udev/udev-builtin-kmod.c index 85afd3b6ec..0ba2d2bd13 100644 --- a/src/udev/udev-builtin-kmod.c +++ b/src/udev/udev-builtin-kmod.c @@ -56,7 +56,7 @@ static void builtin_kmod_exit(void) { } /* called every couple of seconds during event activity; 'true' if config has changed */ -static bool builtin_kmod_validate(void) { +static bool builtin_kmod_should_reload(void) { if (!ctx) return false; @@ -73,7 +73,7 @@ const UdevBuiltin udev_builtin_kmod = { .cmd = builtin_kmod, .init = builtin_kmod_init, .exit = builtin_kmod_exit, - .validate = builtin_kmod_validate, + .should_reload = builtin_kmod_should_reload, .help = "Kernel module loader", .run_once = false, }; diff --git a/src/udev/udev-builtin-net_setup_link.c b/src/udev/udev-builtin-net_setup_link.c index bad4e994b9..ea7b1c5f60 100644 --- a/src/udev/udev-builtin-net_setup_link.c +++ b/src/udev/udev-builtin-net_setup_link.c @@ -74,7 +74,7 @@ static void builtin_net_setup_link_exit(void) { log_debug("Unloaded link configuration context."); } -static bool builtin_net_setup_link_validate(void) { +static bool builtin_net_setup_link_should_reload(void) { if (!ctx) return false; @@ -91,7 +91,7 @@ const UdevBuiltin udev_builtin_net_setup_link = { .cmd = builtin_net_setup_link, .init = builtin_net_setup_link_init, .exit = builtin_net_setup_link_exit, - .validate = builtin_net_setup_link_validate, + .should_reload = builtin_net_setup_link_should_reload, .help = "Configure network link", .run_once = false, }; diff --git a/src/udev/udev-builtin.c b/src/udev/udev-builtin.c index bf82709771..c98c6fa714 100644 --- a/src/udev/udev-builtin.c +++ b/src/udev/udev-builtin.c @@ -53,9 +53,9 @@ void udev_builtin_exit(void) { initialized = false; } -bool udev_builtin_validate(void) { +bool udev_builtin_should_reload(void) { for (UdevBuiltinCommand i = 0; i < _UDEV_BUILTIN_MAX; i++) - if (builtins[i] && builtins[i]->validate && builtins[i]->validate()) + if (builtins[i] && builtins[i]->should_reload && builtins[i]->should_reload()) return true; return false; } diff --git a/src/udev/udev-builtin.h b/src/udev/udev-builtin.h index b0f2f919a9..bcfec03aae 100644 --- a/src/udev/udev-builtin.h +++ b/src/udev/udev-builtin.h @@ -34,7 +34,7 @@ typedef struct UdevBuiltin { const char *help; int (*init)(void); void (*exit)(void); - bool (*validate)(void); + bool (*should_reload)(void); bool run_once; } UdevBuiltin; @@ -76,7 +76,7 @@ const char *udev_builtin_name(UdevBuiltinCommand cmd); bool udev_builtin_run_once(UdevBuiltinCommand cmd); int udev_builtin_run(sd_device *dev, sd_netlink **rtnl, UdevBuiltinCommand cmd, const char *command, bool test); void udev_builtin_list(void); -bool udev_builtin_validate(void); +bool udev_builtin_should_reload(void); int udev_builtin_add_property(sd_device *dev, bool test, const char *key, const char *val); int udev_builtin_hwdb_lookup(sd_device *dev, const char *prefix, const char *modalias, const char *filter, bool test); diff --git a/src/udev/udevd.c b/src/udev/udevd.c index 70a5394b16..a6926bbfb7 100644 --- a/src/udev/udevd.c +++ b/src/udev/udevd.c @@ -368,7 +368,7 @@ static void manager_reload(Manager *manager, bool force) { mac_selinux_maybe_reload(); /* Nothing changed. It is not necessary to reload. */ - if (!udev_rules_should_reload(manager->rules) && !udev_builtin_validate()) + if (!udev_rules_should_reload(manager->rules) && !udev_builtin_should_reload()) return; sd_notify(false, |