提交 7987eeaf 编写于 作者: J Jonathon Jongsma 提交者: Ján Tomko

util: netdev: 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>
上级 0b8b8da7
...@@ -16,29 +16,28 @@ ...@@ -16,29 +16,28 @@
* <http://www.gnu.org/licenses/>. * <http://www.gnu.org/licenses/>.
*/ */
#ifndef LIBVIRT_VIRNETDEV_H #pragma once
# define LIBVIRT_VIRNETDEV_H
# include <net/if.h> #include <net/if.h>
# include "virbitmap.h" #include "virbitmap.h"
# include "virsocketaddr.h" #include "virsocketaddr.h"
# include "virmacaddr.h" #include "virmacaddr.h"
# include "virpci.h" #include "virpci.h"
# include "virnetdevvlan.h" #include "virnetdevvlan.h"
# include "virautoclean.h" #include "virautoclean.h"
# include "virenum.h" #include "virenum.h"
# ifdef HAVE_STRUCT_IFREQ #ifdef HAVE_STRUCT_IFREQ
typedef struct ifreq virIfreq; typedef struct ifreq virIfreq;
# else #else
typedef void virIfreq; typedef void virIfreq;
# endif #endif
/* Used for prefix of ifname of any tap device name generated /* Used for prefix of ifname of any tap device name generated
* dynamically by libvirt, cannot be used for a persistent network name. * dynamically by libvirt, cannot be used for a persistent network name.
*/ */
# define VIR_NET_GENERATED_TAP_PREFIX "vnet" #define VIR_NET_GENERATED_TAP_PREFIX "vnet"
typedef enum { typedef enum {
VIR_NETDEV_RX_FILTER_MODE_NONE = 0, VIR_NETDEV_RX_FILTER_MODE_NONE = 0,
...@@ -301,8 +300,8 @@ int virNetDevSetRcvAllMulti(const char *ifname, bool receive) ...@@ -301,8 +300,8 @@ int virNetDevSetRcvAllMulti(const char *ifname, bool receive)
int virNetDevGetRcvAllMulti(const char *ifname, bool *receive) int virNetDevGetRcvAllMulti(const char *ifname, bool *receive)
ATTRIBUTE_NONNULL(1) ATTRIBUTE_NONNULL(2) ATTRIBUTE_RETURN_CHECK; ATTRIBUTE_NONNULL(1) ATTRIBUTE_NONNULL(2) ATTRIBUTE_RETURN_CHECK;
# define SYSFS_NET_DIR "/sys/class/net/" #define SYSFS_NET_DIR "/sys/class/net/"
# define SYSFS_INFINIBAND_DIR "/sys/class/infiniband/" #define SYSFS_INFINIBAND_DIR "/sys/class/infiniband/"
int virNetDevSysfsFile(char **pf_sysfs_device_link, int virNetDevSysfsFile(char **pf_sysfs_device_link,
const char *ifname, const char *ifname,
const char *file) const char *file)
...@@ -313,5 +312,3 @@ int virNetDevRunEthernetScript(const char *ifname, const char *script) ...@@ -313,5 +312,3 @@ int virNetDevRunEthernetScript(const char *ifname, const char *script)
ATTRIBUTE_NOINLINE; ATTRIBUTE_NOINLINE;
VIR_DEFINE_AUTOPTR_FUNC(virNetDevRxFilter, virNetDevRxFilterFree); VIR_DEFINE_AUTOPTR_FUNC(virNetDevRxFilter, virNetDevRxFilterFree);
#endif /* LIBVIRT_VIRNETDEV_H */
...@@ -16,11 +16,10 @@ ...@@ -16,11 +16,10 @@
* <http://www.gnu.org/licenses/>. * <http://www.gnu.org/licenses/>.
*/ */
#ifndef LIBVIRT_VIRNETDEVBANDWIDTH_H #pragma once
# define LIBVIRT_VIRNETDEVBANDWIDTH_H
# include "internal.h" #include "internal.h"
# include "virmacaddr.h" #include "virmacaddr.h"
typedef struct _virNetDevBandwidthRate virNetDevBandwidthRate; typedef struct _virNetDevBandwidthRate virNetDevBandwidthRate;
typedef virNetDevBandwidthRate *virNetDevBandwidthRatePtr; typedef virNetDevBandwidthRate *virNetDevBandwidthRatePtr;
...@@ -74,4 +73,3 @@ int virNetDevBandwidthUpdateFilter(const char *ifname, ...@@ -74,4 +73,3 @@ int virNetDevBandwidthUpdateFilter(const char *ifname,
unsigned int id) unsigned int id)
ATTRIBUTE_NONNULL(1) ATTRIBUTE_NONNULL(2) ATTRIBUTE_NONNULL(1) ATTRIBUTE_NONNULL(2)
ATTRIBUTE_RETURN_CHECK; ATTRIBUTE_RETURN_CHECK;
#endif /* LIBVIRT_VIRNETDEVBANDWIDTH_H */
...@@ -16,11 +16,10 @@ ...@@ -16,11 +16,10 @@
* <http://www.gnu.org/licenses/>. * <http://www.gnu.org/licenses/>.
*/ */
#ifndef LIBVIRT_VIRNETDEVBRIDGE_H #pragma once
# define LIBVIRT_VIRNETDEVBRIDGE_H
# include "internal.h" #include "internal.h"
# include "virmacaddr.h" #include "virmacaddr.h"
int virNetDevBridgeCreate(const char *brname) int virNetDevBridgeCreate(const char *brname)
ATTRIBUTE_NONNULL(1) ATTRIBUTE_RETURN_CHECK; ATTRIBUTE_NONNULL(1) ATTRIBUTE_RETURN_CHECK;
...@@ -89,4 +88,3 @@ int virNetDevBridgeFDBAdd(const virMacAddr *mac, const char *ifname, ...@@ -89,4 +88,3 @@ int virNetDevBridgeFDBAdd(const virMacAddr *mac, const char *ifname,
int virNetDevBridgeFDBDel(const virMacAddr *mac, const char *ifname, int virNetDevBridgeFDBDel(const virMacAddr *mac, const char *ifname,
unsigned int flags) unsigned int flags)
ATTRIBUTE_NONNULL(1) ATTRIBUTE_NONNULL(2) ATTRIBUTE_RETURN_CHECK; ATTRIBUTE_NONNULL(1) ATTRIBUTE_NONNULL(2) ATTRIBUTE_RETURN_CHECK;
#endif /* LIBVIRT_VIRNETDEVBRIDGE_H */
...@@ -16,11 +16,10 @@ ...@@ -16,11 +16,10 @@
* <http://www.gnu.org/licenses/>. * <http://www.gnu.org/licenses/>.
*/ */
#ifndef LIBVIRT_VIRNETDEVIP_H #pragma once
# define LIBVIRT_VIRNETDEVIP_H
# include "virsocketaddr.h" #include "virsocketaddr.h"
# include "virautoclean.h" #include "virautoclean.h"
typedef struct _virNetDevIPAddr virNetDevIPAddr; typedef struct _virNetDevIPAddr virNetDevIPAddr;
typedef virNetDevIPAddr *virNetDevIPAddrPtr; typedef virNetDevIPAddr *virNetDevIPAddrPtr;
...@@ -97,5 +96,3 @@ int virNetDevIPInfoAddToDev(const char *ifname, ...@@ -97,5 +96,3 @@ int virNetDevIPInfoAddToDev(const char *ifname,
VIR_DEFINE_AUTOPTR_FUNC(virNetDevIPAddr, virNetDevIPAddrFree); VIR_DEFINE_AUTOPTR_FUNC(virNetDevIPAddr, virNetDevIPAddrFree);
VIR_DEFINE_AUTOPTR_FUNC(virNetDevIPRoute, virNetDevIPRouteFree); VIR_DEFINE_AUTOPTR_FUNC(virNetDevIPRoute, virNetDevIPRouteFree);
#endif /* LIBVIRT_VIRNETDEVIP_H */
...@@ -17,16 +17,15 @@ ...@@ -17,16 +17,15 @@
* <http://www.gnu.org/licenses/>. * <http://www.gnu.org/licenses/>.
*/ */
#ifndef LIBVIRT_VIRNETDEVMACVLAN_H #pragma once
# define LIBVIRT_VIRNETDEVMACVLAN_H
# include "internal.h" #include "internal.h"
# include "virmacaddr.h" #include "virmacaddr.h"
# include "virsocketaddr.h" #include "virsocketaddr.h"
# include "virnetdevbandwidth.h" #include "virnetdevbandwidth.h"
# include "virnetdevvportprofile.h" #include "virnetdevvportprofile.h"
# include "virnetdevvlan.h" #include "virnetdevvlan.h"
# include "virenum.h" #include "virenum.h"
/* the mode type for macvtap devices */ /* the mode type for macvtap devices */
typedef enum { typedef enum {
...@@ -52,8 +51,8 @@ typedef enum { ...@@ -52,8 +51,8 @@ typedef enum {
/* libvirt will start macvtap/macvlan interface names with one of /* libvirt will start macvtap/macvlan interface names with one of
* these prefixes when it auto-generates the name * these prefixes when it auto-generates the name
*/ */
# define VIR_NET_GENERATED_MACVTAP_PREFIX "macvtap" #define VIR_NET_GENERATED_MACVTAP_PREFIX "macvtap"
# define VIR_NET_GENERATED_MACVLAN_PREFIX "macvlan" #define VIR_NET_GENERATED_MACVLAN_PREFIX "macvlan"
int virNetDevMacVLanReserveName(const char *name, bool quietfail); int virNetDevMacVLanReserveName(const char *name, bool quietfail);
int virNetDevMacVLanReleaseName(const char *name); int virNetDevMacVLanReleaseName(const char *name);
...@@ -112,4 +111,3 @@ int virNetDevMacVLanVPortProfileRegisterCallback(const char *ifname, ...@@ -112,4 +111,3 @@ int virNetDevMacVLanVPortProfileRegisterCallback(const char *ifname,
virNetDevVPortProfileOp vmOp) virNetDevVPortProfileOp vmOp)
ATTRIBUTE_NONNULL(1) ATTRIBUTE_NONNULL(2) ATTRIBUTE_NONNULL(3) ATTRIBUTE_NONNULL(1) ATTRIBUTE_NONNULL(2) ATTRIBUTE_NONNULL(3)
ATTRIBUTE_NONNULL(4) ATTRIBUTE_RETURN_CHECK; ATTRIBUTE_NONNULL(4) ATTRIBUTE_RETURN_CHECK;
#endif /* LIBVIRT_VIRNETDEVMACVLAN_H */
...@@ -16,11 +16,10 @@ ...@@ -16,11 +16,10 @@
* <http://www.gnu.org/licenses/>. * <http://www.gnu.org/licenses/>.
*/ */
#ifndef LIBVIRT_VIRNETDEVMIDONET_H #pragma once
# define LIBVIRT_VIRNETDEVMIDONET_H
# include "internal.h" #include "internal.h"
# include "virnetdevvportprofile.h" #include "virnetdevvportprofile.h"
int virNetDevMidonetBindPort(const char *ifname, int virNetDevMidonetBindPort(const char *ifname,
...@@ -29,5 +28,3 @@ int virNetDevMidonetBindPort(const char *ifname, ...@@ -29,5 +28,3 @@ int virNetDevMidonetBindPort(const char *ifname,
int virNetDevMidonetUnbindPort(virNetDevVPortProfilePtr virtualport) int virNetDevMidonetUnbindPort(virNetDevVPortProfilePtr virtualport)
ATTRIBUTE_NONNULL(1) ATTRIBUTE_RETURN_CHECK; ATTRIBUTE_NONNULL(1) ATTRIBUTE_RETURN_CHECK;
#endif /* LIBVIRT_VIRNETDEVMIDONET_H */
...@@ -18,14 +18,13 @@ ...@@ -18,14 +18,13 @@
* <http://www.gnu.org/licenses/>. * <http://www.gnu.org/licenses/>.
*/ */
#ifndef LIBVIRT_VIRNETDEVOPENVSWITCH_H #pragma once
# define LIBVIRT_VIRNETDEVOPENVSWITCH_H
# include "internal.h" #include "internal.h"
# include "virnetdevvportprofile.h" #include "virnetdevvportprofile.h"
# include "virnetdevvlan.h" #include "virnetdevvlan.h"
# define VIR_NETDEV_OVS_DEFAULT_TIMEOUT 5 #define VIR_NETDEV_OVS_DEFAULT_TIMEOUT 5
void virNetDevOpenvswitchSetTimeout(unsigned int timeout); void virNetDevOpenvswitchSetTimeout(unsigned int timeout);
...@@ -64,5 +63,3 @@ int virNetDevOpenvswitchGetVhostuserIfname(const char *path, ...@@ -64,5 +63,3 @@ int virNetDevOpenvswitchGetVhostuserIfname(const char *path,
int virNetDevOpenvswitchUpdateVlan(const char *ifname, int virNetDevOpenvswitchUpdateVlan(const char *ifname,
virNetDevVlanPtr virtVlan) virNetDevVlanPtr virtVlan)
ATTRIBUTE_NONNULL(1) ATTRIBUTE_RETURN_CHECK; ATTRIBUTE_NONNULL(1) ATTRIBUTE_RETURN_CHECK;
#endif /* LIBVIRT_VIRNETDEVOPENVSWITCH_H */
...@@ -16,19 +16,18 @@ ...@@ -16,19 +16,18 @@
* <http://www.gnu.org/licenses/>. * <http://www.gnu.org/licenses/>.
*/ */
#ifndef LIBVIRT_VIRNETDEVTAP_H #pragma once
# define LIBVIRT_VIRNETDEVTAP_H
# include "internal.h" #include "internal.h"
# include "virnetdev.h" #include "virnetdev.h"
# include "virnetdevvportprofile.h" #include "virnetdevvportprofile.h"
# include "virnetdevvlan.h" #include "virnetdevvlan.h"
# ifdef __FreeBSD__ #ifdef __FreeBSD__
/* This should be defined on OSes that don't automatically /* This should be defined on OSes that don't automatically
* cleanup released devices */ * cleanup released devices */
# define VIR_NETDEV_TAP_REQUIRE_MANUAL_CLEANUP 1 # define VIR_NETDEV_TAP_REQUIRE_MANUAL_CLEANUP 1
# endif #endif
int virNetDevTapCreate(char **ifname, int virNetDevTapCreate(char **ifname,
const char *tunpath, const char *tunpath,
...@@ -103,5 +102,3 @@ int virNetDevTapInterfaceStats(const char *ifname, ...@@ -103,5 +102,3 @@ int virNetDevTapInterfaceStats(const char *ifname,
virDomainInterfaceStatsPtr stats, virDomainInterfaceStatsPtr stats,
bool swapped) bool swapped)
ATTRIBUTE_RETURN_CHECK; ATTRIBUTE_RETURN_CHECK;
#endif /* LIBVIRT_VIRNETDEVTAP_H */
...@@ -17,15 +17,12 @@ ...@@ -17,15 +17,12 @@
* <http://www.gnu.org/licenses/>. * <http://www.gnu.org/licenses/>.
*/ */
#ifndef LIBVIRT_VIRNETDEVVETH_H #pragma once
# define LIBVIRT_VIRNETDEVVETH_H
# include "internal.h" #include "internal.h"
/* Function declarations */ /* Function declarations */
int virNetDevVethCreate(char **veth1, char **veth2) int virNetDevVethCreate(char **veth1, char **veth2)
ATTRIBUTE_NONNULL(1) ATTRIBUTE_NONNULL(2) ATTRIBUTE_RETURN_CHECK; ATTRIBUTE_NONNULL(1) ATTRIBUTE_NONNULL(2) ATTRIBUTE_RETURN_CHECK;
int virNetDevVethDelete(const char *veth) int virNetDevVethDelete(const char *veth)
ATTRIBUTE_NONNULL(1) ATTRIBUTE_RETURN_CHECK; ATTRIBUTE_NONNULL(1) ATTRIBUTE_RETURN_CHECK;
#endif /* LIBVIRT_VIRNETDEVVETH_H */
...@@ -16,13 +16,12 @@ ...@@ -16,13 +16,12 @@
* <http://www.gnu.org/licenses/>. * <http://www.gnu.org/licenses/>.
*/ */
#ifndef LIBVIRT_VIRNETDEVVLAN_H #pragma once
# define LIBVIRT_VIRNETDEVVLAN_H
# include <virutil.h> #include <virutil.h>
# include "virautoclean.h" #include "virautoclean.h"
# include "virenum.h" #include "virenum.h"
typedef enum { typedef enum {
VIR_NATIVE_VLAN_MODE_DEFAULT = 0, VIR_NATIVE_VLAN_MODE_DEFAULT = 0,
...@@ -50,5 +49,3 @@ int virNetDevVlanEqual(const virNetDevVlan *a, const virNetDevVlan *b); ...@@ -50,5 +49,3 @@ int virNetDevVlanEqual(const virNetDevVlan *a, const virNetDevVlan *b);
int virNetDevVlanCopy(virNetDevVlanPtr dst, const virNetDevVlan *src); int virNetDevVlanCopy(virNetDevVlanPtr dst, const virNetDevVlan *src);
VIR_DEFINE_AUTOPTR_FUNC(virNetDevVlan, virNetDevVlanFree); VIR_DEFINE_AUTOPTR_FUNC(virNetDevVlan, virNetDevVlanFree);
#endif /* LIBVIRT_VIRNETDEVVLAN_H */
...@@ -16,16 +16,15 @@ ...@@ -16,16 +16,15 @@
* <http://www.gnu.org/licenses/>. * <http://www.gnu.org/licenses/>.
*/ */
#ifndef LIBVIRT_VIRNETDEVVPORTPROFILE_H #pragma once
# define LIBVIRT_VIRNETDEVVPORTPROFILE_H
# include "internal.h" #include "internal.h"
# include "viruuid.h" #include "viruuid.h"
# include "virutil.h" #include "virutil.h"
# include "virmacaddr.h" #include "virmacaddr.h"
# include "virenum.h" #include "virenum.h"
# define LIBVIRT_IFLA_VF_PORT_PROFILE_MAX 40 #define LIBVIRT_IFLA_VF_PORT_PROFILE_MAX 40
typedef enum virNetDevVPortProfile { typedef enum virNetDevVPortProfile {
VIR_NETDEV_VPORT_PROFILE_NONE, VIR_NETDEV_VPORT_PROFILE_NONE,
...@@ -109,6 +108,3 @@ int virNetDevVPortProfileDisassociate(const char *ifname, ...@@ -109,6 +108,3 @@ int virNetDevVPortProfileDisassociate(const char *ifname,
int vf, int vf,
virNetDevVPortProfileOp vmOp) virNetDevVPortProfileOp vmOp)
ATTRIBUTE_NONNULL(4) ATTRIBUTE_RETURN_CHECK; ATTRIBUTE_NONNULL(4) ATTRIBUTE_RETURN_CHECK;
#endif /* LIBVIRT_VIRNETDEVVPORTPROFILE_H */
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册