The file, port.c, contains utility functions for setting timers.
We will want to call one of this functions from clock.c so
this patch moves the utility function where they belong.

Signed-off-by: Anders Selhammer <anders.selham...@est.tech>
---
 port.c | 10 ----------
 port.h | 13 -------------
 util.c | 11 +++++++++++
 util.h | 13 +++++++++++++
 4 files changed, 24 insertions(+), 23 deletions(-)

diff --git a/port.c b/port.c
index 6ae37b1..f46c1ae 100644
--- a/port.c
+++ b/port.c
@@ -212,16 +212,6 @@ int set_tmo_log(int fd, unsigned int scale, int 
log_seconds)
        return timerfd_settime(fd, 0, &tmo, NULL);
 }
 
-int set_tmo_lin(int fd, int seconds)
-{
-       struct itimerspec tmo = {
-               {0, 0}, {0, 0}
-       };
-
-       tmo.it_value.tv_sec = seconds;
-       return timerfd_settime(fd, 0, &tmo, NULL);
-}
-
 int set_tmo_random(int fd, int min, int span, int log_seconds)
 {
        uint64_t value_ns, min_ns, span_ns;
diff --git a/port.h b/port.h
index 028701e..6af0ecf 100644
--- a/port.h
+++ b/port.h
@@ -278,19 +278,6 @@ int set_tmo_log(int fd, unsigned int scale, int 
log_seconds);
 int set_tmo_random(int fd, int min, int span, int log_seconds);
 
 /**
- * Utility function for setting or resetting a file descriptor timer.
- *
- * This function sets the timer 'fd' to the value of the 'seconds' parameter.
- *
- * Passing 'seconds' as zero disables the timer.
- *
- * @param fd A file descriptor previously opened with timerfd_create(2).
- * @param seconds The timeout value for the timer.
- * @return Zero on success, non-zero otherwise.
- */
-int set_tmo_lin(int fd, int seconds);
-
-/**
  * Sets port's fault file descriptor timer.
  * Passing both 'scale' and 'log_seconds' as zero disables the timer.
  *
diff --git a/util.c b/util.c
index 2eacafc..6d2ce0f 100644
--- a/util.c
+++ b/util.c
@@ -25,6 +25,7 @@
 #include <string.h>
 
 #include "address.h"
+#include "missing.h"
 #include "print.h"
 #include "sk.h"
 #include "util.h"
@@ -585,3 +586,13 @@ int rate_limited(int interval, time_t *last)
 
        return 0;
 }
+
+int set_tmo_lin(int fd, int seconds)
+{
+       struct itimerspec tmo = {
+               {0, 0}, {0, 0}
+       };
+
+       tmo.it_value.tv_sec = seconds;
+       return timerfd_settime(fd, 0, &tmo, NULL);
+}
diff --git a/util.h b/util.h
index 41fbdb2..1d6c511 100644
--- a/util.h
+++ b/util.h
@@ -380,4 +380,17 @@ void parray_extend(void ***a, ...);
  */
 int rate_limited(int interval, time_t *last);
 
+/**
+ * Utility function for setting or resetting a file descriptor timer.
+ *
+ * This function sets the timer 'fd' to the value of the 'seconds' parameter.
+ *
+ * Passing 'seconds' as zero disables the timer.
+ *
+ * @param fd A file descriptor previously opened with timerfd_create(2).
+ * @param seconds The timeout value for the timer.
+ * @return Zero on success, non-zero otherwise.
+ */
+int set_tmo_lin(int fd, int seconds);
+
 #endif
-- 
1.8.3.1


------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
_______________________________________________
Linuxptp-devel mailing list
Linuxptp-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/linuxptp-devel

Reply via email to