diff options
author | Franck Bui <fbui@suse.com> | 2021-09-14 22:36:14 +0200 |
---|---|---|
committer | Franck Bui <fbui@suse.com> | 2021-09-15 12:14:34 +0200 |
commit | d74965e6fe583562ebaf0767da6325a72d11643a (patch) | |
tree | 472f5c5908e5ed86819195b02046b23c11d6ea8d /src | |
parent | watchdog: minor simplification of watchdog_runtime_wait() (diff) | |
download | systemd-d74965e6fe583562ebaf0767da6325a72d11643a.tar.xz systemd-d74965e6fe583562ebaf0767da6325a72d11643a.zip |
watchdog: rename watchdog_set_timeout() into watchdog_setup()
"watchdog_set_timeout()" was misleading as the function is not just a setter -
it must be called for activating the watchdog device.
Diffstat (limited to 'src')
-rw-r--r-- | src/core/main.c | 2 | ||||
-rw-r--r-- | src/core/manager.c | 4 | ||||
-rw-r--r-- | src/shared/watchdog.c | 4 | ||||
-rw-r--r-- | src/shared/watchdog.h | 2 | ||||
-rw-r--r-- | src/shutdown/shutdown.c | 2 | ||||
-rw-r--r-- | src/test/test-watchdog.c | 2 |
6 files changed, 8 insertions, 8 deletions
diff --git a/src/core/main.c b/src/core/main.c index d049591645..8be00d129e 100644 --- a/src/core/main.c +++ b/src/core/main.c @@ -1539,7 +1539,7 @@ static int become_shutdown( /* If we reboot or kexec let's set the shutdown watchdog and * tell the shutdown binary to repeatedly ping it */ - r = watchdog_set_timeout(watchdog_timer); + r = watchdog_setup(watchdog_timer); watchdog_close(r < 0); /* Tell the binary how often to ping, ignore failure */ diff --git a/src/core/manager.c b/src/core/manager.c index b82628be51..cb07d3c6d5 100644 --- a/src/core/manager.c +++ b/src/core/manager.c @@ -3205,7 +3205,7 @@ void manager_set_watchdog(Manager *m, WatchdogType t, usec_t timeout) { if (t == WATCHDOG_RUNTIME) if (!timestamp_is_set(m->watchdog_overridden[WATCHDOG_RUNTIME])) { if (timestamp_is_set(timeout)) - (void) watchdog_set_timeout(timeout); + (void) watchdog_setup(timeout); else watchdog_close(true); } @@ -3227,7 +3227,7 @@ int manager_override_watchdog(Manager *m, WatchdogType t, usec_t timeout) { usec_t usec = timestamp_is_set(timeout) ? timeout : m->watchdog[t]; if (timestamp_is_set(usec)) - (void) watchdog_set_timeout(usec); + (void) watchdog_setup(usec); else watchdog_close(true); } diff --git a/src/shared/watchdog.c b/src/shared/watchdog.c index b0b377325c..b42d241528 100644 --- a/src/shared/watchdog.c +++ b/src/shared/watchdog.c @@ -101,7 +101,7 @@ int watchdog_set_device(char *path) { return r; } -int watchdog_set_timeout(usec_t timeout) { +int watchdog_setup(usec_t timeout) { /* Initialize the watchdog timeout with the caller value. This value is * going to be updated by update_timeout() with the closest value @@ -191,6 +191,6 @@ void watchdog_close(bool disarm) { watchdog_fd = safe_close(watchdog_fd); /* Once closed, pinging the device becomes a NOP and we request a new - * call to watchdog_set_timeout() to open the device again. */ + * call to watchdog_setup() to open the device again. */ watchdog_timeout = USEC_INFINITY; } diff --git a/src/shared/watchdog.h b/src/shared/watchdog.h index 08be44fd18..794176d310 100644 --- a/src/shared/watchdog.h +++ b/src/shared/watchdog.h @@ -7,7 +7,7 @@ #include "util.h" int watchdog_set_device(char *path); -int watchdog_set_timeout(usec_t timeout); +int watchdog_setup(usec_t timeout); int watchdog_ping(void); void watchdog_close(bool disarm); usec_t watchdog_runtime_wait(void); diff --git a/src/shutdown/shutdown.c b/src/shutdown/shutdown.c index 2387e27985..903977bcb1 100644 --- a/src/shutdown/shutdown.c +++ b/src/shutdown/shutdown.c @@ -387,7 +387,7 @@ int main(int argc, char *argv[]) { log_warning_errno(r, "Failed to parse watchdog timeout '%s', ignoring: %m", watchdog_usec); else - (void) watchdog_set_timeout(usec); + (void) watchdog_setup(usec); } /* Lock us into memory */ diff --git a/src/test/test-watchdog.c b/src/test/test-watchdog.c index d94ac91d2c..074ed1e451 100644 --- a/src/test/test-watchdog.c +++ b/src/test/test-watchdog.c @@ -20,7 +20,7 @@ int main(int argc, char *argv[]) { t = slow ? 10 * USEC_PER_SEC : 1 * USEC_PER_SEC; count = slow ? 5 : 3; - r = watchdog_set_timeout(t); + r = watchdog_setup(t); if (r < 0) log_warning_errno(r, "Failed to open watchdog: %m"); if (r == -EPERM) |