Signed-off-by: Jonathon Jongsma <jjongsma@xxxxxxxxxx> --- src/util/virnetlink.h | 37 +++++++++++++++++-------------------- 1 file changed, 17 insertions(+), 20 deletions(-) diff --git a/src/util/virnetlink.h b/src/util/virnetlink.h index 1bc075a86f..6419a775e1 100644 --- a/src/util/virnetlink.h +++ b/src/util/virnetlink.h @@ -17,45 +17,44 @@ * <http://www.gnu.org/licenses/>. */ -#ifndef LIBVIRT_VIRNETLINK_H -# define LIBVIRT_VIRNETLINK_H +#pragma once -# include "internal.h" -# include "virmacaddr.h" -# include "virautoclean.h" +#include "internal.h" +#include "virmacaddr.h" +#include "virautoclean.h" -# if defined(__linux__) && defined(HAVE_LIBNL) +#if defined(__linux__) && defined(HAVE_LIBNL) /* Work around a bug where older libnl-1 headers expected older gcc * semantics of 'extern inline' that conflict with C99 semantics. */ -# ifdef HAVE_LIBNL1 -# define inline -# endif -# include <netlink/msg.h> -# ifdef HAVE_LIBNL1 -# undef inline -# endif +# ifdef HAVE_LIBNL1 +# define inline +# endif +# include <netlink/msg.h> +# ifdef HAVE_LIBNL1 +# undef inline +# endif typedef struct nl_msg virNetlinkMsg; VIR_DEFINE_AUTOPTR_FUNC(virNetlinkMsg, nlmsg_free); -# else +#else struct nl_msg; struct sockaddr_nl; struct nlattr; struct nlmsghdr; -# endif /* __linux__ */ +#endif /* __linux__ */ -# define NETLINK_MSG_NEST_START(msg, container, attrtype) \ +#define NETLINK_MSG_NEST_START(msg, container, attrtype) \ do { \ container = nla_nest_start(msg, attrtype); \ if (!container) \ goto buffer_too_small; \ } while(0) -# define NETLINK_MSG_NEST_END(msg, container) \ +#define NETLINK_MSG_NEST_END(msg, container) \ do { nla_nest_end(msg, container); } while(0) /* @@ -63,7 +62,7 @@ do { nla_nest_end(msg, container); } while(0) * complain about @data not being a pointer type: * error: the address of 'foo' will always evaluate as 'true' [-Werror=address] */ -# define NETLINK_MSG_PUT(msg, attrtype, datalen, data) \ +#define NETLINK_MSG_PUT(msg, attrtype, datalen, data) \ do { \ const void *dataptr = data; \ if (dataptr && nla_put(msg, attrtype, datalen, dataptr) < 0) \ @@ -162,5 +161,3 @@ int virNetlinkEventAddClient(virNetlinkEventHandleCallback handleCB, */ int virNetlinkEventRemoveClient(int watch, const virMacAddr *macaddr, unsigned int protocol); - -#endif /* LIBVIRT_VIRNETLINK_H */ -- 2.20.1 -- libvir-list mailing list libvir-list@xxxxxxxxxx https://www.redhat.com/mailman/listinfo/libvir-list