mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2025-01-21 20:15:17 +00:00
util: netlink: use #pragma once in headers
Signed-off-by: Jonathon Jongsma <jjongsma@redhat.com> Reviewed-by: Ján Tomko <jtomko@redhat.com> Signed-off-by: Ján Tomko <jtomko@redhat.com>
This commit is contained in:
parent
55c0ec283b
commit
507b5707bc
@ -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 */
|
||||
|
Loading…
x
Reference in New Issue
Block a user