util: netdev: 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:
Jonathon Jongsma 2019-06-18 11:12:48 -05:00 committed by Ján Tomko
parent 0b8b8da7d9
commit 7987eeaf9c
11 changed files with 63 additions and 94 deletions

View File

@ -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 */

View File

@ -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 */

View File

@ -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 */

View File

@ -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 */

View File

@ -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 */

View File

@ -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 */

View File

@ -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 */

View File

@ -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 */

View File

@ -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 */

View File

@ -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 */

View File

@ -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 */