Skip to contentSkip to conversation

infiniband-diags: rdma-ndd: remove udev logging when not supported

PATCH New [email protected] 1 participant 1 message Sep 19, 2015 InfiniBand

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 infiniband-diags: rdma-ndd: remove udev logging when not supported

From: Ira Weiny <[email protected]>

udev_set_log_* functions are deprecated on newer versions of libudev Conditionally compile out the use of these functions.

---
 configure.ac   | 8 ++++++++
 src/rdma-ndd.c | 4 ++++
 2 files changed, 12 insertions(+)
configure.ac +8 -0
index 090b6ecf7683..4c9b08fcd3ad 100644
@@ -215,6 +215,14 @@ AS_IF([test x$rdmandd = xyes], [
     AC_CONFIG_FILES([doc/man/rdma-ndd.8 etc/rdma-ndd.init])
     AC_SUBST([UDEV_CFLAGS])
     AC_SUBST([UDEV_LIBS])
+    if test "$with_udev" = "yes"; then
+	PKG_CHECK_EXISTS(libudev >= 218, [with_dev_logging=no],
+			[with_udev_logging=yes])
+	if test "$with_udev_logging" = "yes"; then
+		AC_DEFINE_UNQUOTED([HAVE_UDEV_LOGGING], 1,
+				[whether libudev logging can be used])
+	fi
+    fi
 ])
 
 dnl Generate doc/man/*.in files if possible
src/rdma-ndd.c +4 -0
index 94eb3d72a354..986082457a61 100644
@@ -232,6 +232,7 @@ static int process_opts(void *context, int ch, char *optarg)
 	return 0;
 }
 
+#if HAVE_UDEV_LOGGING
 #define MSG_MAX 2048
 static void udev_log_fn(struct udev *ud, int priority, const char *file, int line,
 		const char *fn, const char *format, va_list args)
@@ -244,6 +245,7 @@ static void udev_log_fn(struct udev *ud, int priority, const char *file, int lin
 		vsnprintf(msg+off, MSG_MAX-off, format, args);
 	syslog(LOG_ERR, "%s", msg);
 }
+#endif
 
 static void setup_udev(void)
 {
@@ -253,8 +255,10 @@ static void setup_udev(void)
 		return;
 	}
 
+#if HAVE_UDEV_LOGGING
 	udev_set_log_fn(udev, udev_log_fn);
 	udev_set_log_priority(udev, LOG_INFO);
+#endif
 }
 
 static int get_udev_fd(void)
Signature · 6 lines
1.8.2

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