Make virNetDevSetupControl() public.

This method is useful not only in virnetdev.c.
This commit is contained in:
Roman Bogorodskiy 2013-06-13 10:26:20 +04:00 committed by Michal Privoznik
parent 0f81bdb2f7
commit 9614d70b0c
3 changed files with 28 additions and 4 deletions

View File

@ -1532,6 +1532,7 @@ virNetDevSetMTUFromDevice;
virNetDevSetName; virNetDevSetName;
virNetDevSetNamespace; virNetDevSetNamespace;
virNetDevSetOnline; virNetDevSetOnline;
virNetDevSetupControl;
virNetDevValidateConfig; virNetDevValidateConfig;

View File

@ -88,12 +88,23 @@ static int virNetDevSetupControlFull(const char *ifname,
} }
static int virNetDevSetupControl(const char *ifname, int
virNetDevSetupControl(const char *ifname,
struct ifreq *ifr) struct ifreq *ifr)
{ {
return virNetDevSetupControlFull(ifname, ifr, VIR_NETDEV_FAMILY, SOCK_DGRAM); return virNetDevSetupControlFull(ifname, ifr, VIR_NETDEV_FAMILY, SOCK_DGRAM);
} }
#endif #else /* !HAVE_STRUCT_IFREQ */
int
virNetDevSetupControl(const char *ifname ATTRIBUTE_UNUSED,
void *ifr ATTRIBUTE_UNUSED)
{
virReportSystemError(ENOSYS, "%s",
_("Network device configuration is not supported "
"on this platform"));
return -1;
}
#endif /* HAVE_STRUCT_IFREQ */
#if defined(SIOCGIFFLAGS) && defined(HAVE_STRUCT_IFREQ) #if defined(SIOCGIFFLAGS) && defined(HAVE_STRUCT_IFREQ)

View File

@ -1,5 +1,5 @@
/* /*
* Copyright (C) 2007-2012 Red Hat, Inc. * Copyright (C) 2007-2013 Red Hat, Inc.
* *
* This library is free software; you can redistribute it and/or * This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public * modify it under the terms of the GNU Lesser General Public
@ -23,11 +23,23 @@
#ifndef __VIR_NETDEV_H__ #ifndef __VIR_NETDEV_H__
# define __VIR_NETDEV_H__ # define __VIR_NETDEV_H__
# include <net/if.h>
# include "virsocketaddr.h" # include "virsocketaddr.h"
# include "virnetlink.h" # include "virnetlink.h"
# include "virmacaddr.h" # include "virmacaddr.h"
# include "virpci.h" # include "virpci.h"
# ifdef HAVE_STRUCT_IFREQ
typedef struct ifreq virIfreq;
# else
typedef void virIfreq;
# endif
int virNetDevSetupControl(const char *ifname,
virIfreq *ifr)
ATTRIBUTE_RETURN_CHECK ATTRIBUTE_NONNULL(1) ATTRIBUTE_NONNULL(2);
int virNetDevExists(const char *brname) int virNetDevExists(const char *brname)
ATTRIBUTE_NONNULL(1) ATTRIBUTE_RETURN_CHECK; ATTRIBUTE_NONNULL(1) ATTRIBUTE_RETURN_CHECK;