提交 52e596ca 编写于 作者: J Jonathon Jongsma 提交者: Ján Tomko

util: socketaddr: use #pragma once in headers

Signed-off-by: NJonathon Jongsma <jjongsma@redhat.com>
Reviewed-by: NJán Tomko <jtomko@redhat.com>
Signed-off-by: NJán Tomko <jtomko@redhat.com>
上级 a6d386eb
......@@ -16,17 +16,16 @@
* <http://www.gnu.org/licenses/>.
*/
#ifndef LIBVIRT_VIRSOCKETADDR_H
# define LIBVIRT_VIRSOCKETADDR_H
#pragma once
# include <netinet/in.h>
# include <sys/socket.h>
# ifdef HAVE_SYS_UN_H
# include <sys/un.h>
# endif
#include <netinet/in.h>
#include <sys/socket.h>
#ifdef HAVE_SYS_UN_H
# include <sys/un.h>
#endif
# include "internal.h"
# include "virautoclean.h"
#include "internal.h"
#include "virautoclean.h"
/* On architectures which lack these limits, define them (ie. Cygwin).
* Note that the libvirt code should be robust enough to handle the
......@@ -34,11 +33,11 @@
* length correctly in second argument to gethostname and by always
* using strncpy instead of strcpy).
*/
# ifndef INET_ADDRSTRLEN
# define INET_ADDRSTRLEN 16
# endif
#ifndef INET_ADDRSTRLEN
# define INET_ADDRSTRLEN 16
#endif
# define VIR_LOOPBACK_IPV4_ADDR "127.0.0.1"
#define VIR_LOOPBACK_IPV4_ADDR "127.0.0.1"
typedef struct {
union {
......@@ -46,27 +45,27 @@ typedef struct {
struct sockaddr_storage stor;
struct sockaddr_in inet4;
struct sockaddr_in6 inet6;
# ifdef HAVE_SYS_UN_H
#ifdef HAVE_SYS_UN_H
struct sockaddr_un un;
# endif
#endif
} data;
socklen_t len;
} virSocketAddr;
# define VIR_SOCKET_ADDR_VALID(s) \
#define VIR_SOCKET_ADDR_VALID(s) \
((s)->data.sa.sa_family != AF_UNSPEC)
# define VIR_SOCKET_ADDR_IS_FAMILY(s, f) \
#define VIR_SOCKET_ADDR_IS_FAMILY(s, f) \
((s)->data.sa.sa_family == f)
# define VIR_SOCKET_ADDR_FAMILY(s) \
#define VIR_SOCKET_ADDR_FAMILY(s) \
((s)->data.sa.sa_family)
# define VIR_SOCKET_ADDR_IPV4_ALL "0.0.0.0"
# define VIR_SOCKET_ADDR_IPV6_ALL "::"
#define VIR_SOCKET_ADDR_IPV4_ALL "0.0.0.0"
#define VIR_SOCKET_ADDR_IPV6_ALL "::"
# define VIR_SOCKET_ADDR_IPV4_ARPA "in-addr.arpa"
# define VIR_SOCKET_ADDR_IPV6_ARPA "ip6.arpa"
#define VIR_SOCKET_ADDR_IPV4_ARPA "in-addr.arpa"
#define VIR_SOCKET_ADDR_IPV6_ARPA "ip6.arpa"
typedef virSocketAddr *virSocketAddrPtr;
......@@ -161,5 +160,3 @@ int virSocketAddrPTRDomain(const virSocketAddr *addr,
void virSocketAddrFree(virSocketAddrPtr addr);
VIR_DEFINE_AUTOPTR_FUNC(virSocketAddr, virSocketAddrFree);
#endif /* LIBVIRT_VIRSOCKETADDR_H */
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册