提交 a93a3b97 编写于 作者: D Daniel P. Berrange

avoid using deprecated udev logging functions

In systemd >= 218, the udev_set_log_fn method has been marked
deprecated and turned into a no-op. Nothing in the udev client
library will print to stderr by default anymore, so we can
just stop installing a logging hook for new enough udev.
上级 34f03984
...@@ -24,6 +24,13 @@ AC_DEFUN([LIBVIRT_CHECK_UDEV],[ ...@@ -24,6 +24,13 @@ AC_DEFUN([LIBVIRT_CHECK_UDEV],[
if test "$with_udev" = "yes" && test "$with_pciaccess" != "yes" ; then if test "$with_udev" = "yes" && test "$with_pciaccess" != "yes" ; then
AC_MSG_ERROR([You must install the pciaccess module to build with udev]) AC_MSG_ERROR([You must install the pciaccess module to build with udev])
fi fi
if test "$with_udev" = "yes" ; then
PKG_CHECK_EXISTS([libudev >= 218], [with_udev_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
]) ])
AC_DEFUN([LIBVIRT_RESULT_UDEV],[ AC_DEFUN([LIBVIRT_RESULT_UDEV],[
......
...@@ -340,7 +340,7 @@ static int udevGenerateDeviceName(struct udev_device *device, ...@@ -340,7 +340,7 @@ static int udevGenerateDeviceName(struct udev_device *device,
return ret; return ret;
} }
#if HAVE_UDEV_LOGGING
typedef void (*udevLogFunctionPtr)(struct udev *udev, typedef void (*udevLogFunctionPtr)(struct udev *udev,
int priority, int priority,
const char *file, const char *file,
...@@ -373,6 +373,7 @@ udevLogFunction(struct udev *udev ATTRIBUTE_UNUSED, ...@@ -373,6 +373,7 @@ udevLogFunction(struct udev *udev ATTRIBUTE_UNUSED,
VIR_FREE(format); VIR_FREE(format);
} }
#endif
static int udevTranslatePCIIds(unsigned int vendor, static int udevTranslatePCIIds(unsigned int vendor,
...@@ -1759,8 +1760,10 @@ static int nodeStateInitialize(bool privileged, ...@@ -1759,8 +1760,10 @@ static int nodeStateInitialize(bool privileged,
* its return value. * its return value.
*/ */
udev = udev_new(); udev = udev_new();
#if HAVE_UDEV_LOGGING
/* cast to get rid of missing-format-attribute warning */ /* cast to get rid of missing-format-attribute warning */
udev_set_log_fn(udev, (udevLogFunctionPtr) udevLogFunction); udev_set_log_fn(udev, (udevLogFunctionPtr) udevLogFunction);
#endif
priv->udev_monitor = udev_monitor_new_from_netlink(udev, "udev"); priv->udev_monitor = udev_monitor_new_from_netlink(udev, "udev");
if (priv->udev_monitor == NULL) { if (priv->udev_monitor == NULL) {
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册