]> xenbits.xensource.com Git - libvirt.git/commitdiff
util: make virNetDev(Get|Set)IFFlags() static
authorLaine Stump <laine@laine.org>
Fri, 30 Jan 2015 16:56:15 +0000 (11:56 -0500)
committerLaine Stump <laine@laine.org>
Mon, 2 Feb 2015 19:50:19 +0000 (14:50 -0500)
e562a61a0739 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.

src/util/virnetdev.c
src/util/virnetdev.h

index 7a0a43df1b1c64d14050f5949a002dd1d145a322..4be6265d09f0b143d5fc09a01163ad4ac219985d 100644 (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'"),
index 8d0345911f267c80e95373bed05a3dd2cc440660..6e8372f0fd03b796263d37e5219d9bec1a0c09c2 100644 (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)