util: make virNetDev(Get|Set)IFFlags() static

e562a61a07 added these two new helper functions and only used them
within virnetdev.c, but declared them in the .h file. If some
currently unsupported interface flags need to be accessed in the
future, it will make more sense to write the appropriate higher level
function rather than require us to artificially define IFF_* on some
mythical platform that doesn't have SIOC[SG]IFFLAGS (and therefore
doesn't have IFF_*) just so we can call virNetDevSetIFFFlags() to
return an error.

To help someone in not going down the wrong road, this patch makes the
two helper functions static, hopefully making it less likely that
someone will want to use them outside of virnetdev.c.
This commit is contained in:
Laine Stump 2015-01-30 11:56:15 -05:00
parent 1d2e4d8ca2
commit df2cc650c0
2 changed files with 14 additions and 18 deletions

View File

@ -1,5 +1,5 @@
/*
* Copyright (C) 2007-2014 Red Hat, Inc.
* Copyright (C) 2007-2015 Red Hat, Inc.
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
@ -610,7 +610,8 @@ int virNetDevSetName(const char* ifname, const char *newifname)
#if defined(SIOCSIFFLAGS) && defined(HAVE_STRUCT_IFREQ)
int virNetDevSetIFFlag(const char *ifname, int flag, bool val)
static int
virNetDevSetIFFlag(const char *ifname, int flag, bool val)
{
int fd = -1;
int ret = -1;
@ -649,9 +650,10 @@ int virNetDevSetIFFlag(const char *ifname, int flag, bool val)
return ret;
}
#else
int virNetDevSetIFFlag(const char *ifname,
int flag ATTRIBUTE_UNUSED,
bool val ATTRIBUTE_UNUSED)
static int
virNetDevSetIFFlag(const char *ifname,
int flag ATTRIBUTE_UNUSED,
bool val ATTRIBUTE_UNUSED)
{
virReportSystemError(ENOSYS,
_("Cannot set interface flags on '%s'"),
@ -731,7 +733,8 @@ int virNetDevSetRcvAllMulti(const char *ifname,
#if defined(SIOCGIFFLAGS) && defined(HAVE_STRUCT_IFREQ)
int virNetDevGetIFFlag(const char *ifname, int flag, bool *val)
static int
virNetDevGetIFFlag(const char *ifname, int flag, bool *val)
{
int fd = -1;
int ret = -1;
@ -755,9 +758,10 @@ int virNetDevGetIFFlag(const char *ifname, int flag, bool *val)
return ret;
}
#else
int virNetDevGetIFFlag(const char *ifname,
int flag ATTRIBUTE_UNUSED,
bool *val ATTRIBUTE_UNUSED)
static int
virNetDevGetIFFlag(const char *ifname,
int flag ATTRIBUTE_UNUSED,
bool *val ATTRIBUTE_UNUSED)
{
virReportSystemError(ENOSYS,
_("Cannot get interface flags on '%s'"),

View File

@ -1,5 +1,5 @@
/*
* Copyright (C) 2007-2014 Red Hat, Inc.
* Copyright (C) 2007-2015 Red Hat, Inc.
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
@ -200,14 +200,6 @@ int virNetDevDelMulti(const char *ifname,
virMacAddrPtr macaddr)
ATTRIBUTE_NONNULL(1) ATTRIBUTE_NONNULL(2) ATTRIBUTE_RETURN_CHECK;
int virNetDevSetIFFlag(const char *ifname, int flag, bool val)
ATTRIBUTE_NONNULL(1) ATTRIBUTE_NONNULL(2) ATTRIBUTE_NONNULL(3)
ATTRIBUTE_RETURN_CHECK;
int virNetDevGetIFFlag(const char *ifname, int flag, bool *val)
ATTRIBUTE_NONNULL(1) ATTRIBUTE_NONNULL(2) ATTRIBUTE_NONNULL(3)
ATTRIBUTE_RETURN_CHECK;
int virNetDevSetPromiscuous(const char *ifname, bool promiscuous)
ATTRIBUTE_NONNULL(1) ATTRIBUTE_NONNULL(2) ATTRIBUTE_RETURN_CHECK;
int virNetDevGetPromiscuous(const char *ifname, bool *promiscuous)