[PATCH 18/46] util: netdev: use #pragma once in headers

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Signed-off-by: Jonathon Jongsma <jjongsma@xxxxxxxxxx>
---
 src/util/virnetdev.h             | 33 +++++++++++++++-----------------
 src/util/virnetdevbandwidth.h    |  8 +++-----
 src/util/virnetdevbridge.h       |  8 +++-----
 src/util/virnetdevip.h           |  9 +++------
 src/util/virnetdevmacvlan.h      | 22 ++++++++++-----------
 src/util/virnetdevmidonet.h      |  9 +++------
 src/util/virnetdevopenvswitch.h  | 13 +++++--------
 src/util/virnetdevtap.h          | 19 ++++++++----------
 src/util/virnetdevveth.h         |  7 ++-----
 src/util/virnetdevvlan.h         | 11 ++++-------
 src/util/virnetdevvportprofile.h | 18 +++++++----------
 11 files changed, 63 insertions(+), 94 deletions(-)

diff --git a/src/util/virnetdev.h b/src/util/virnetdev.h
index 7ca22de9a5..563b218227 100644
--- a/src/util/virnetdev.h
+++ b/src/util/virnetdev.h
@@ -16,29 +16,28 @@
  * <http://www.gnu.org/licenses/>.
  */
 
-#ifndef LIBVIRT_VIRNETDEV_H
-# define LIBVIRT_VIRNETDEV_H
+#pragma once
 
-# include <net/if.h>
+#include <net/if.h>
 
-# include "virbitmap.h"
-# include "virsocketaddr.h"
-# include "virmacaddr.h"
-# include "virpci.h"
-# include "virnetdevvlan.h"
-# include "virautoclean.h"
-# include "virenum.h"
+#include "virbitmap.h"
+#include "virsocketaddr.h"
+#include "virmacaddr.h"
+#include "virpci.h"
+#include "virnetdevvlan.h"
+#include "virautoclean.h"
+#include "virenum.h"
 
-# ifdef HAVE_STRUCT_IFREQ
+#ifdef HAVE_STRUCT_IFREQ
 typedef struct ifreq virIfreq;
-# else
+#else
 typedef void virIfreq;
-# endif
+#endif
 
 /* Used for prefix of ifname of any tap device name generated
  * 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 {
    VIR_NETDEV_RX_FILTER_MODE_NONE = 0,
@@ -301,8 +300,8 @@ int virNetDevSetRcvAllMulti(const char *ifname, bool receive)
 int virNetDevGetRcvAllMulti(const char *ifname, bool *receive)
     ATTRIBUTE_NONNULL(1) ATTRIBUTE_NONNULL(2) ATTRIBUTE_RETURN_CHECK;
 
-# define SYSFS_NET_DIR "/sys/class/net/"
-# define SYSFS_INFINIBAND_DIR "/sys/class/infiniband/"
+#define SYSFS_NET_DIR "/sys/class/net/"
+#define SYSFS_INFINIBAND_DIR "/sys/class/infiniband/"
 int virNetDevSysfsFile(char **pf_sysfs_device_link,
                        const char *ifname,
                        const char *file)
@@ -313,5 +312,3 @@ int virNetDevRunEthernetScript(const char *ifname, const char *script)
     ATTRIBUTE_NOINLINE;
 
 VIR_DEFINE_AUTOPTR_FUNC(virNetDevRxFilter, virNetDevRxFilterFree);
-
-#endif /* LIBVIRT_VIRNETDEV_H */
diff --git a/src/util/virnetdevbandwidth.h b/src/util/virnetdevbandwidth.h
index d243d7262a..75da1f7ba6 100644
--- a/src/util/virnetdevbandwidth.h
+++ b/src/util/virnetdevbandwidth.h
@@ -16,11 +16,10 @@
  * <http://www.gnu.org/licenses/>.
  */
 
-#ifndef LIBVIRT_VIRNETDEVBANDWIDTH_H
-# define LIBVIRT_VIRNETDEVBANDWIDTH_H
+#pragma once
 
-# include "internal.h"
-# include "virmacaddr.h"
+#include "internal.h"
+#include "virmacaddr.h"
 
 typedef struct _virNetDevBandwidthRate virNetDevBandwidthRate;
 typedef virNetDevBandwidthRate *virNetDevBandwidthRatePtr;
@@ -74,4 +73,3 @@ int virNetDevBandwidthUpdateFilter(const char *ifname,
                                    unsigned int id)
     ATTRIBUTE_NONNULL(1) ATTRIBUTE_NONNULL(2)
     ATTRIBUTE_RETURN_CHECK;
-#endif /* LIBVIRT_VIRNETDEVBANDWIDTH_H */
diff --git a/src/util/virnetdevbridge.h b/src/util/virnetdevbridge.h
index f8cc70e7f0..8df5e51c2e 100644
--- a/src/util/virnetdevbridge.h
+++ b/src/util/virnetdevbridge.h
@@ -16,11 +16,10 @@
  * <http://www.gnu.org/licenses/>.
  */
 
-#ifndef LIBVIRT_VIRNETDEVBRIDGE_H
-# define LIBVIRT_VIRNETDEVBRIDGE_H
+#pragma once
 
-# include "internal.h"
-# include "virmacaddr.h"
+#include "internal.h"
+#include "virmacaddr.h"
 
 int virNetDevBridgeCreate(const char *brname)
     ATTRIBUTE_NONNULL(1) ATTRIBUTE_RETURN_CHECK;
@@ -89,4 +88,3 @@ int virNetDevBridgeFDBAdd(const virMacAddr *mac, const char *ifname,
 int virNetDevBridgeFDBDel(const virMacAddr *mac, const char *ifname,
                           unsigned int flags)
     ATTRIBUTE_NONNULL(1) ATTRIBUTE_NONNULL(2) ATTRIBUTE_RETURN_CHECK;
-#endif /* LIBVIRT_VIRNETDEVBRIDGE_H */
diff --git a/src/util/virnetdevip.h b/src/util/virnetdevip.h
index d885d09a00..9fa5f446b0 100644
--- a/src/util/virnetdevip.h
+++ b/src/util/virnetdevip.h
@@ -16,11 +16,10 @@
  * <http://www.gnu.org/licenses/>.
  */
 
-#ifndef LIBVIRT_VIRNETDEVIP_H
-# define LIBVIRT_VIRNETDEVIP_H
+#pragma once
 
-# include "virsocketaddr.h"
-# include "virautoclean.h"
+#include "virsocketaddr.h"
+#include "virautoclean.h"
 
 typedef struct _virNetDevIPAddr virNetDevIPAddr;
 typedef virNetDevIPAddr *virNetDevIPAddrPtr;
@@ -97,5 +96,3 @@ int virNetDevIPInfoAddToDev(const char *ifname,
 
 VIR_DEFINE_AUTOPTR_FUNC(virNetDevIPAddr, virNetDevIPAddrFree);
 VIR_DEFINE_AUTOPTR_FUNC(virNetDevIPRoute, virNetDevIPRouteFree);
-
-#endif /* LIBVIRT_VIRNETDEVIP_H */
diff --git a/src/util/virnetdevmacvlan.h b/src/util/virnetdevmacvlan.h
index a33ea8f29e..d1b479ed9f 100644
--- a/src/util/virnetdevmacvlan.h
+++ b/src/util/virnetdevmacvlan.h
@@ -17,16 +17,15 @@
  * <http://www.gnu.org/licenses/>.
  */
 
-#ifndef LIBVIRT_VIRNETDEVMACVLAN_H
-# define LIBVIRT_VIRNETDEVMACVLAN_H
+#pragma once
 
-# include "internal.h"
-# include "virmacaddr.h"
-# include "virsocketaddr.h"
-# include "virnetdevbandwidth.h"
-# include "virnetdevvportprofile.h"
-# include "virnetdevvlan.h"
-# include "virenum.h"
+#include "internal.h"
+#include "virmacaddr.h"
+#include "virsocketaddr.h"
+#include "virnetdevbandwidth.h"
+#include "virnetdevvportprofile.h"
+#include "virnetdevvlan.h"
+#include "virenum.h"
 
 /* the mode type for macvtap devices */
 typedef enum {
@@ -52,8 +51,8 @@ typedef enum {
 /* libvirt will start macvtap/macvlan interface names with one of
  * these prefixes when it auto-generates the name
  */
-# define VIR_NET_GENERATED_MACVTAP_PREFIX "macvtap"
-# define VIR_NET_GENERATED_MACVLAN_PREFIX "macvlan"
+#define VIR_NET_GENERATED_MACVTAP_PREFIX "macvtap"
+#define VIR_NET_GENERATED_MACVLAN_PREFIX "macvlan"
 
 int virNetDevMacVLanReserveName(const char *name, bool quietfail);
 int virNetDevMacVLanReleaseName(const char *name);
@@ -112,4 +111,3 @@ int virNetDevMacVLanVPortProfileRegisterCallback(const char *ifname,
                                                  virNetDevVPortProfileOp vmOp)
 ATTRIBUTE_NONNULL(1) ATTRIBUTE_NONNULL(2) ATTRIBUTE_NONNULL(3)
 ATTRIBUTE_NONNULL(4) ATTRIBUTE_RETURN_CHECK;
-#endif /* LIBVIRT_VIRNETDEVMACVLAN_H */
diff --git a/src/util/virnetdevmidonet.h b/src/util/virnetdevmidonet.h
index dde72c0653..aa7fe49103 100644
--- a/src/util/virnetdevmidonet.h
+++ b/src/util/virnetdevmidonet.h
@@ -16,11 +16,10 @@
  * <http://www.gnu.org/licenses/>.
  */
 
-#ifndef LIBVIRT_VIRNETDEVMIDONET_H
-# define LIBVIRT_VIRNETDEVMIDONET_H
+#pragma once
 
-# include "internal.h"
-# include "virnetdevvportprofile.h"
+#include "internal.h"
+#include "virnetdevvportprofile.h"
 
 
 int virNetDevMidonetBindPort(const char *ifname,
@@ -29,5 +28,3 @@ int virNetDevMidonetBindPort(const char *ifname,
 
 int virNetDevMidonetUnbindPort(virNetDevVPortProfilePtr virtualport)
     ATTRIBUTE_NONNULL(1) ATTRIBUTE_RETURN_CHECK;
-
-#endif /* LIBVIRT_VIRNETDEVMIDONET_H */
diff --git a/src/util/virnetdevopenvswitch.h b/src/util/virnetdevopenvswitch.h
index c9428f9e3e..07496fb07d 100644
--- a/src/util/virnetdevopenvswitch.h
+++ b/src/util/virnetdevopenvswitch.h
@@ -18,14 +18,13 @@
  * <http://www.gnu.org/licenses/>.
  */
 
-#ifndef LIBVIRT_VIRNETDEVOPENVSWITCH_H
-# define LIBVIRT_VIRNETDEVOPENVSWITCH_H
+#pragma once
 
-# include "internal.h"
-# include "virnetdevvportprofile.h"
-# include "virnetdevvlan.h"
+#include "internal.h"
+#include "virnetdevvportprofile.h"
+#include "virnetdevvlan.h"
 
-# define VIR_NETDEV_OVS_DEFAULT_TIMEOUT 5
+#define VIR_NETDEV_OVS_DEFAULT_TIMEOUT 5
 
 void virNetDevOpenvswitchSetTimeout(unsigned int timeout);
 
@@ -64,5 +63,3 @@ int virNetDevOpenvswitchGetVhostuserIfname(const char *path,
 int virNetDevOpenvswitchUpdateVlan(const char *ifname,
                                    virNetDevVlanPtr virtVlan)
     ATTRIBUTE_NONNULL(1) ATTRIBUTE_RETURN_CHECK;
-
-#endif /* LIBVIRT_VIRNETDEVOPENVSWITCH_H */
diff --git a/src/util/virnetdevtap.h b/src/util/virnetdevtap.h
index 2b3893cd37..ec5789959a 100644
--- a/src/util/virnetdevtap.h
+++ b/src/util/virnetdevtap.h
@@ -16,19 +16,18 @@
  * <http://www.gnu.org/licenses/>.
  */
 
-#ifndef LIBVIRT_VIRNETDEVTAP_H
-# define LIBVIRT_VIRNETDEVTAP_H
+#pragma once
 
-# include "internal.h"
-# include "virnetdev.h"
-# include "virnetdevvportprofile.h"
-# include "virnetdevvlan.h"
+#include "internal.h"
+#include "virnetdev.h"
+#include "virnetdevvportprofile.h"
+#include "virnetdevvlan.h"
 
-# ifdef __FreeBSD__
+#ifdef __FreeBSD__
 /* This should be defined on OSes that don't automatically
  * cleanup released devices */
-#  define VIR_NETDEV_TAP_REQUIRE_MANUAL_CLEANUP 1
-# endif
+# define VIR_NETDEV_TAP_REQUIRE_MANUAL_CLEANUP 1
+#endif
 
 int virNetDevTapCreate(char **ifname,
                        const char *tunpath,
@@ -103,5 +102,3 @@ int virNetDevTapInterfaceStats(const char *ifname,
                                virDomainInterfaceStatsPtr stats,
                                bool swapped)
     ATTRIBUTE_RETURN_CHECK;
-
-#endif /* LIBVIRT_VIRNETDEVTAP_H */
diff --git a/src/util/virnetdevveth.h b/src/util/virnetdevveth.h
index b00eb2b3a2..4380b7cfe1 100644
--- a/src/util/virnetdevveth.h
+++ b/src/util/virnetdevveth.h
@@ -17,15 +17,12 @@
  * <http://www.gnu.org/licenses/>.
  */
 
-#ifndef LIBVIRT_VIRNETDEVVETH_H
-# define LIBVIRT_VIRNETDEVVETH_H
+#pragma once
 
-# include "internal.h"
+#include "internal.h"
 
 /* Function declarations */
 int virNetDevVethCreate(char **veth1, char **veth2)
     ATTRIBUTE_NONNULL(1) ATTRIBUTE_NONNULL(2) ATTRIBUTE_RETURN_CHECK;
 int virNetDevVethDelete(const char *veth)
     ATTRIBUTE_NONNULL(1) ATTRIBUTE_RETURN_CHECK;
-
-#endif /* LIBVIRT_VIRNETDEVVETH_H */
diff --git a/src/util/virnetdevvlan.h b/src/util/virnetdevvlan.h
index d986300d2a..87d361a1cf 100644
--- a/src/util/virnetdevvlan.h
+++ b/src/util/virnetdevvlan.h
@@ -16,13 +16,12 @@
  * <http://www.gnu.org/licenses/>.
  */
 
-#ifndef LIBVIRT_VIRNETDEVVLAN_H
-# define LIBVIRT_VIRNETDEVVLAN_H
+#pragma once
 
-# include <virutil.h>
+#include <virutil.h>
 
-# include "virautoclean.h"
-# include "virenum.h"
+#include "virautoclean.h"
+#include "virenum.h"
 
 typedef enum {
     VIR_NATIVE_VLAN_MODE_DEFAULT = 0,
@@ -50,5 +49,3 @@ int virNetDevVlanEqual(const virNetDevVlan *a, const virNetDevVlan *b);
 int virNetDevVlanCopy(virNetDevVlanPtr dst, const virNetDevVlan *src);
 
 VIR_DEFINE_AUTOPTR_FUNC(virNetDevVlan, virNetDevVlanFree);
-
-#endif /* LIBVIRT_VIRNETDEVVLAN_H */
diff --git a/src/util/virnetdevvportprofile.h b/src/util/virnetdevvportprofile.h
index afa982f2e3..d1db8bac6a 100644
--- a/src/util/virnetdevvportprofile.h
+++ b/src/util/virnetdevvportprofile.h
@@ -16,16 +16,15 @@
  * <http://www.gnu.org/licenses/>.
  */
 
-#ifndef LIBVIRT_VIRNETDEVVPORTPROFILE_H
-# define LIBVIRT_VIRNETDEVVPORTPROFILE_H
+#pragma once
 
-# include "internal.h"
-# include "viruuid.h"
-# include "virutil.h"
-# include "virmacaddr.h"
-# include "virenum.h"
+#include "internal.h"
+#include "viruuid.h"
+#include "virutil.h"
+#include "virmacaddr.h"
+#include "virenum.h"
 
-# define LIBVIRT_IFLA_VF_PORT_PROFILE_MAX 40
+#define LIBVIRT_IFLA_VF_PORT_PROFILE_MAX 40
 
 typedef enum virNetDevVPortProfile {
     VIR_NETDEV_VPORT_PROFILE_NONE,
@@ -109,6 +108,3 @@ int virNetDevVPortProfileDisassociate(const char *ifname,
                                       int vf,
                                       virNetDevVPortProfileOp vmOp)
     ATTRIBUTE_NONNULL(4) ATTRIBUTE_RETURN_CHECK;
-
-
-#endif /* LIBVIRT_VIRNETDEVVPORTPROFILE_H */
-- 
2.20.1

--
libvir-list mailing list
libvir-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/libvir-list



[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]

  Powered by Linux