diff mbox

[V1,rdma-core,1/5] utils: Add timespec compare utility

Message ID 1499699137-29037-2-git-send-email-yishaih@mellanox.com (mailing list archive)
State Accepted
Headers show

Commit Message

Yishai Hadas July 10, 2017, 3:05 p.m. UTC
From: Maor Gottlieb <maorg@mellanox.com>

Move ts_cmp from srp_daemon.h to util.h, to be used from
another place in a downstream patch.

Signed-off-by: Maor Gottlieb <maorg@mellanox.com>
Reviewed-by: Yishai Hadas <yishaih@mellanox.com>
---
 srp_daemon/srp_daemon.h | 7 +------
 util/util.h             | 6 ++++++
 2 files changed, 7 insertions(+), 6 deletions(-)
diff mbox

Patch

diff --git a/srp_daemon/srp_daemon.h b/srp_daemon/srp_daemon.h
index 026db41..5d268ed 100644
--- a/srp_daemon/srp_daemon.h
+++ b/srp_daemon/srp_daemon.h
@@ -39,6 +39,7 @@ 
 #include <stdint.h>
 #include <signal.h>
 #include <endian.h>
+#include <util/util.h>
 #include <infiniband/verbs.h>
 #include <infiniband/umad.h>
 #include <linux/types.h>	/* __be16, __be32 and __be64 */
@@ -47,12 +48,6 @@ 
 #include "config.h"
 #include "srp_ib_types.h"
 
-/* a CMP b. See also the BSD macro timercmp(). */
-#define ts_cmp(a, b, CMP)			\
-	(((a)->tv_sec == (b)->tv_sec) ?		\
-	 ((a)->tv_nsec CMP (b)->tv_nsec) :	\
-	 ((a)->tv_sec CMP (b)->tv_sec))
-
 #define SRP_CATAS_ERR SIGUSR1
 
 enum {
diff --git a/util/util.h b/util/util.h
index ed4ffe8..c3e5955 100644
--- a/util/util.h
+++ b/util/util.h
@@ -10,4 +10,10 @@ 
 		(rc < len && rc >= 0);                                         \
 	})
 
+/* a CMP b. See also the BSD macro timercmp(). */
+#define ts_cmp(a, b, CMP)			\
+	(((a)->tv_sec == (b)->tv_sec) ?		\
+	 ((a)->tv_nsec CMP (b)->tv_nsec) :	\
+	 ((a)->tv_sec CMP (b)->tv_sec))
+
 #endif