diff options
authorSamuel Mendoza-Jonas <>2016-04-08 16:31:36 +1000
committerSamuel Mendoza-Jonas <>2016-04-13 16:21:14 +1000
commit03eba1d68dbf7ffc9690d73f957c33b8f492e627 (patch)
parent8569abdf356aa617ebdcb426aa708a0fd8129a1a (diff)
discover/udev: Don't call udev_set_log_fn()
As of libudev 218 udev_set_log_fn() is deprecated, causing a -Wdeprecated-declarations warning when building, and is otherwise a noop. Add a configure check for libudev, and only call udev_set_log_fn() if using a version older than 218. Signed-off-by: Samuel Mendoza-Jonas <>
2 files changed, 9 insertions, 0 deletions
diff --git a/ b/
index 1b9b980..00a6113 100644
--- a/
+++ b/
@@ -57,6 +57,11 @@ AC_CHECK_LIB([udev], [udev_new],
[AC_MSG_FAILURE([The libudev development library is required by petitboot. Try installing the package libudev-dev or libudev-devel.])]
+PKG_CHECK_EXISTS(libudev >= 218, [old_udev=no], [old_udev=yes])
+if test "$old_udev" = "yes" ; then
+ AC_DEFINE(UDEV_LOGGING, 1, [Support old udev logging interface])],
AC_CHECK_LIB([devmapper], [dm_task_create],
[AC_MSG_FAILURE([The libdevmapper development library is required by petitboot. Try installing the package libdevmapper-dev or libdevmapper-devel.])]
diff --git a/discover/udev.c b/discover/udev.c
index 23057bf..f4cefab 100644
--- a/discover/udev.c
+++ b/discover/udev.c
@@ -448,6 +448,7 @@ static int udev_process(void *arg)
return 0;
static void udev_log_fn(struct udev __attribute__((unused)) *udev,
int __attribute__((unused)) priority, const char *file, int line,
const char *fn, const char *format, va_list args)
@@ -455,6 +456,7 @@ static void udev_log_fn(struct udev __attribute__((unused)) *udev,
pb_log("libudev: %s %s:%d: ", fn, file, line);
vfprintf(pb_log_get_stream(), format, args);
struct pb_udev *udev_init(struct device_handler *handler,
struct waitset *waitset)
@@ -475,7 +477,9 @@ struct pb_udev *udev_init(struct device_handler *handler,
udev_set_userdata(udev->udev, udev);
udev_set_log_fn(udev->udev, udev_log_fn);
result = udev_setup_monitor(udev->udev, &udev->monitor);
if (result)
OpenPOWER on IntegriCloud