]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
watchdog: rename watchdog_set_timeout() into watchdog_setup()
authorFranck Bui <fbui@suse.com>
Tue, 14 Sep 2021 20:36:14 +0000 (22:36 +0200)
committerFranck Bui <fbui@suse.com>
Wed, 15 Sep 2021 10:14:34 +0000 (12:14 +0200)
"watchdog_set_timeout()" was misleading as the function is not just a setter -
it must be called for activating the watchdog device.

src/core/main.c
src/core/manager.c
src/shared/watchdog.c
src/shared/watchdog.h
src/shutdown/shutdown.c
src/test/test-watchdog.c

index d0495916459208d38e2759ec912af09437445ad8..8be00d129e301b661da456f7c0a135247c62e260 100644 (file)
@@ -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 */
index b82628be512dd8da9ef2ce7af6b198477d6c9380..cb07d3c6d52b82a05a7747669aff9f5a48d6b5f8 100644 (file)
@@ -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);
         }
index b0b377325ce8daeba0accd4b0b041f78e37b9201..b42d241528ea7539d6461658f19011e446bab41c 100644 (file)
@@ -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;
 }
index 08be44fd1859141a45acf3be2e06c0f2e22a691d..794176d3109fca54ac33a517c73fbea3f608f261 100644 (file)
@@ -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);
index 2387e2798502310be892469069a8b77c323c4f22..903977bcb14c597d2eb6219e3030b0750c1098cd 100644 (file)
@@ -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 */
index d94ac91d2cbd65509bacb35dc6f4038102954ea4..074ed1e451ba29924cfafa253b2dfe459f11abe7 100644 (file)
@@ -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)