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

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



From: Maor Gottlieb <maorg@xxxxxxxxxxxx>

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@xxxxxxxxxxxx>
Reviewed-by: Yishai Hadas <yishaih@xxxxxxxxxxxx>
---
 srp_daemon/srp_daemon.h | 7 +------
 util/util.h             | 6 ++++++
 2 files changed, 7 insertions(+), 6 deletions(-)

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
-- 
1.8.3.1

--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html



[Index of Archives]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Photo]     [Yosemite News]     [Yosemite Photos]     [Linux Kernel]     [Linux SCSI]     [XFree86]
  Powered by Linux