Re: [PATCH 03/33] Rename all brXXXX APIs to follow new convention

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

 



On 11/03/2011 01:29 PM, Daniel P. Berrange wrote:
From: "Daniel P. Berrange"<berrange@xxxxxxxxxx>

The existing brXXX APIs in src/util/bridge.h are renamed to
follow one of three different conventions

  - virNetDevXXX       - operations for any type of interface
  - virNetDevBridgeXXX - operations for bridge interfaces
  - virNetDevTapXXX    - operations for tap interfaces

* src/util/bridge.h, src/util/bridge.c: Rename all APIs
* src/lxc/lxc_driver.c, src/network/bridge_driver.c,
   src/qemu/qemu_command.c, src/uml/uml_conf.c,
   src/uml/uml_driver.c: Update for API renaming
---
  src/lxc/lxc_driver.c        |    2 +-
  src/network/bridge_driver.c |   32 ++++----
  src/qemu/qemu_command.c     |    4 +-
  src/uml/uml_conf.c          |    4 +-
  src/uml/uml_driver.c        |    2 +-
  src/util/bridge.c           |  196 +++++++++++++++++++-----------------------
  src/util/bridge.h           |   74 ++++++++--------
  7 files changed, 148 insertions(+), 166 deletions(-)

diff --git a/src/lxc/lxc_driver.c b/src/lxc/lxc_driver.c
index 8ee1306..c75941f 100644
--- a/src/lxc/lxc_driver.c
+++ b/src/lxc/lxc_driver.c
@@ -1269,7 +1269,7 @@ static int lxcSetupInterfaces(virConnectPtr conn,
                  goto error_exit;
          }

-        if (brAddInterface(bridge, parentVeth)<  0)
+        if (virNetDevBridgeAddPort(bridge, parentVeth)<  0)
              goto error_exit;

          if (vethInterfaceUpOrDown(parentVeth, 1)<  0)
diff --git a/src/network/bridge_driver.c b/src/network/bridge_driver.c
index d5d2472..bc9d2e1 100644
--- a/src/network/bridge_driver.c
+++ b/src/network/bridge_driver.c
@@ -211,7 +211,7 @@ networkFindActiveConfigs(struct network_driver *driver) {

          /* If bridge exists, then mark it active */
          if (obj->def->bridge&&
-            brHasBridge(obj->def->bridge) == 0) {
+            virNetDevExists(obj->def->bridge) == 0) {
              obj->active = 1;

              /* Try and read dnsmasq/radvd pids if any */
@@ -1677,8 +1677,8 @@ networkAddAddrToBridge(virNetworkObjPtr network,
          return -1;
      }

-    if (brAddInetAddress(network->def->bridge,
-&ipdef->address, prefix)<  0)
+    if (virNetDevSetIPv4Addres(network->def->bridge,
+&ipdef->address, prefix)<  0)

Addres -> Address

          return -1;

      return 0;
@@ -1699,7 +1699,7 @@ networkStartNetworkVirtual(struct network_driver *driver,
          return -1;

      /* Create and configure the bridge device */
-    if (brAddBridge(network->def->bridge)<  0)
+    if (virNetDevBridgeCreate(network->def->bridge)<  0)
          return -1;

      if (network->def->mac_specified) {
@@ -1714,20 +1714,20 @@ networkStartNetworkVirtual(struct network_driver *driver,
              virReportOOMError();
              goto err0;
          }
-        if (brAddTap(network->def->bridge,
-&macTapIfName, network->def->mac, 0, false, NULL)<  0) {
+        if (virNetDevTapCreateInBridgePort(network->def->bridge,
+&macTapIfName, network->def->mac, 0, false, NULL)<  0) {
              VIR_FREE(macTapIfName);
              goto err0;
          }
      }

      /* Set bridge options */
-    if (brSetForwardDelay(network->def->bridge,
+    if (virNetDevBridgeSetSTPDelay(network->def->bridge,
                            network->def->delay)<  0)
          goto err1;

-    if (brSetEnableSTP(network->def->bridge,
-                       network->def->stp ? 1 : 0)<  0)
+    if (virNetDevBridgeSetSTP(network->def->bridge,
+                              network->def->stp ? 1 : 0)<  0)
          goto err1;

      /* Disable IPv6 on the bridge if there are no IPv6 addresses
@@ -1755,7 +1755,7 @@ networkStartNetworkVirtual(struct network_driver *driver,
      }

      /* Bring up the bridge interface */
-    if (brSetInterfaceUp(network->def->bridge, 1)<  0)
+    if (virNetDevSetOnline(network->def->bridge, 1)<  0)
          goto err2;

      /* If forwardType != NONE, turn on global IP forwarding */
@@ -1804,7 +1804,7 @@ networkStartNetworkVirtual(struct network_driver *driver,
   err3:
      if (!save_err)
          save_err = virSaveLastError();
-    ignore_value(brSetInterfaceUp(network->def->bridge, 0));
+    ignore_value(virNetDevSetOnline(network->def->bridge, 0));

   err2:
      if (!save_err)
@@ -1815,13 +1815,13 @@ networkStartNetworkVirtual(struct network_driver *driver,
      if (!save_err)
          save_err = virSaveLastError();

-    ignore_value(brDeleteTap(macTapIfName));
+    ignore_value(virNetDevTapDelete(macTapIfName));
      VIR_FREE(macTapIfName);

   err0:
      if (!save_err)
          save_err = virSaveLastError();
-    ignore_value(brDeleteBridge(network->def->bridge));
+    ignore_value(virNetDevBridgeDelete(network->def->bridge));

      if (save_err) {
          virSetError(save_err);
@@ -1859,16 +1859,16 @@ static int networkShutdownNetworkVirtual(struct network_driver *driver,
          if (!macTapIfName) {
              virReportOOMError();
          } else {
-            ignore_value(brDeleteTap(macTapIfName));
+            ignore_value(virNetDevTapDelete(macTapIfName));
              VIR_FREE(macTapIfName);
          }
      }

-    ignore_value(brSetInterfaceUp(network->def->bridge, 0));
+    ignore_value(virNetDevSetOnline(network->def->bridge, 0));

      networkRemoveIptablesRules(driver, network);

-    ignore_value(brDeleteBridge(network->def->bridge));
+    ignore_value(virNetDevBridgeDelete(network->def->bridge));

      /* See if its still alive and really really kill it */
      if (network->dnsmasqPid>  0&&
diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c
index 6fbdc20..5680636 100644
--- a/src/qemu/qemu_command.c
+++ b/src/qemu/qemu_command.c
@@ -279,8 +279,8 @@ qemuNetworkIfaceConnect(virDomainDefPtr def,

      memcpy(tapmac, net->mac, VIR_MAC_BUFLEN);
      tapmac[0] = 0xFE; /* Discourage bridge from using TAP dev MAC */
-    err = brAddTap(brname,&net->ifname, tapmac,
-                   vnet_hdr, true,&tapfd);
+    err = virNetDevTapCreateInBridgePort(brname,&net->ifname, tapmac,
+                                         vnet_hdr, true,&tapfd);
      virDomainAuditNetDevice(def, net, "/dev/net/tun", tapfd>= 0);
      if (err<  0) {
          if (template_ifname)
diff --git a/src/uml/uml_conf.c b/src/uml/uml_conf.c
index 477a178..9b6abe7 100644
--- a/src/uml/uml_conf.c
+++ b/src/uml/uml_conf.c
@@ -136,8 +136,8 @@ umlConnectTapDevice(virConnectPtr conn,

      memcpy(tapmac, net->mac, VIR_MAC_BUFLEN);
      tapmac[0] = 0xFE; /* Discourage bridge from using TAP dev MAC */
-    if (brAddTap(bridge,&net->ifname, tapmac,
-                 0, true, NULL)<  0) {
+    if (virNetDevTapCreateInBridgePort(bridge,&net->ifname, tapmac,
+                                       0, true, NULL)<  0) {
          if (template_ifname)
              VIR_FREE(net->ifname);
          goto error;
diff --git a/src/uml/uml_driver.c b/src/uml/uml_driver.c
index 8ba06a5..4a417ab 100644
--- a/src/uml/uml_driver.c
+++ b/src/uml/uml_driver.c
@@ -962,7 +962,7 @@ static void umlCleanupTapDevices(virDomainObjPtr vm) {
              def->type != VIR_DOMAIN_NET_TYPE_NETWORK)
              continue;

-        ignore_value(brDeleteTap(def->ifname));
+        ignore_value(virNetDevTapDelete(def->ifname));
      }
  }

diff --git a/src/util/bridge.c b/src/util/bridge.c
index 351e482..a853c2a 100644
--- a/src/util/bridge.c
+++ b/src/util/bridge.c
@@ -58,10 +58,10 @@

  # define VIR_FROM_THIS VIR_FROM_NONE

-static int brSetupControlFull(const char *ifname,
-                              struct ifreq *ifr,
-                              int domain,
-                              int type)
+static int virNetDevSetupControlFull(const char *ifname,
+                                     struct ifreq *ifr,
+                                     int domain,
+                                     int type)
  {
      int fd;

@@ -93,15 +93,15 @@ static int brSetupControlFull(const char *ifname,
  }


-static int brSetupControl(const char *ifname,
-                          struct ifreq *ifr)
+static int virNetDevSetupControl(const char *ifname,
+                                 struct ifreq *ifr)
  {
-    return brSetupControlFull(ifname, ifr, AF_PACKET, SOCK_DGRAM);
+    return virNetDevSetupControlFull(ifname, ifr, AF_PACKET, SOCK_DGRAM);
  }


  /**
- * brAddBridge:
+ * virNetDevBridgeCreate:
   * @brname: the bridge name
   *
   * This function register a new bridge
@@ -109,13 +109,12 @@ static int brSetupControl(const char *ifname,
   * Returns 0 in case of success or -1 on failure
   */
  # ifdef SIOCBRADDBR
-int
-brAddBridge(const char *brname)
+int virNetDevBridgeCreate(const char *brname)
  {
      int fd = -1;
      int ret = -1;

-    if ((fd = brSetupControl(NULL, NULL))<  0)
+    if ((fd = virNetDevSetupControl(NULL, NULL))<  0)
          return -1;

      if (ioctl(fd, SIOCBRADDBR, brname)<  0) {
@@ -131,7 +130,7 @@ cleanup:
      return ret;
  }
  # else
-int brAddBridge(const char *brname)
+int virNetDevBridgeCreate(const char *brname)
  {
      virReportSystemError(ENOSYS,
                           _("Unable to create bridge %s"), brname);
@@ -141,21 +140,20 @@ int brAddBridge(const char *brname)

  # ifdef SIOCBRDELBR
  /**
- * brHasBridge:
- * @brname
+ * virNetDevExists:
+ * @ifname
   *
- * Check if the bridge @brname exists
+ * Check if the network device @ifname exists
   *
   * Returns 1 if it exists, 0 if it does not, -1 on error
   */
-int
-brHasBridge(const char *brname)
+int virNetDevExists(const char *ifname)
  {
      int fd = -1;
      int ret = -1;
      struct ifreq ifr;

-    if ((fd = brSetupControl(brname,&ifr))<  0)
+    if ((fd = virNetDevSetupControl(ifname,&ifr))<  0)
          return -1;

      if (ioctl(fd, SIOCGIFFLAGS,&ifr)) {
@@ -163,7 +161,7 @@ brHasBridge(const char *brname)
              ret = 0;
          else
              virReportSystemError(errno,
-                                 _("Unable to delete bridge %s"), brname);
+                                 _("Unable to check interface flags for %s"), ifname);
          goto cleanup;
      }

@@ -174,17 +172,16 @@ cleanup:
      return ret;
  }
  # else
-int
-brHasBridge(const char *brname)
+int virNetDevExists(const char *ifname)
  {
      virReportSystemError(errno,
-                         _("Unable to check bridge %s"), brname);
+                         _("Unable to check interface %s"), ifname);
      return -1;
  }
  # endif

  /**
- * brDeleteBridge:
+ * virNetDevBridgeDelete:
   * @brname: the bridge name
   *
   * Remove a bridge from the layer.
@@ -192,13 +189,12 @@ brHasBridge(const char *brname)
   * Returns 0 in case of success or an errno code in case of failure.
   */
  # ifdef SIOCBRDELBR
-int
-brDeleteBridge(const char *brname)
+int virNetDevBridgeDelete(const char *brname)
  {
      int fd = -1;
      int ret = -1;

-    if ((fd = brSetupControl(NULL, NULL))<  0)
+    if ((fd = virNetDevSetupControl(NULL, NULL))<  0)
          return -1;

      if (ioctl(fd, SIOCBRDELBR, brname)<  0) {
@@ -214,8 +210,7 @@ cleanup:
      return ret;
  }
  # else
-int
-brDeleteBridge(const char *brname ATTRIBUTE_UNUSED)
+int virNetDevBridgeDelete(const char *brname ATTRIBUTE_UNUSED)
  {
      virReportSystemError(errno,
                           _("Unable to delete bridge %s"), brname);
@@ -224,7 +219,7 @@ brDeleteBridge(const char *brname ATTRIBUTE_UNUSED)
  # endif

  /**
- * brAddInterface:
+ * virNetDevBridgeAddPort:
   * @brname: the bridge name
   * @ifname: the network interface name
   *
@@ -233,15 +228,14 @@ brDeleteBridge(const char *brname ATTRIBUTE_UNUSED)
   * Returns 0 in case of success or an errno code in case of failure.
   */
  # ifdef SIOCBRADDIF
-int
-brAddInterface(const char *brname,
-               const char *ifname)
+int virNetDevBridgeAddPort(const char *brname,
+                           const char *ifname)
  {
      int fd = -1;
      int ret = -1;
      struct ifreq ifr;

-    if ((fd = brSetupControl(brname,&ifr))<  0)
+    if ((fd = virNetDevSetupControl(brname,&ifr))<  0)
          return -1;

      if (!(ifr.ifr_ifindex = if_nametoindex(ifname))) {
@@ -262,9 +256,8 @@ cleanup:
      return ret;
  }
  # else
-int
-brAddInterface(const char *brname,
-               const char *ifname)
+int virNetDevBridgeAddPort(const char *brname,
+                           const char *ifname)
  {
      virReportSystemError(ENOSYS,
                           _("Unable to add bridge %s port %s"), brname, ifname);
@@ -273,7 +266,7 @@ brAddInterface(const char *brname,
  # endif

  /**
- * brDeleteInterface:
+ * virNetDevBridgeRemovePort:
   * @brname: the bridge name
   * @ifname: the network interface name
   *
@@ -282,15 +275,14 @@ brAddInterface(const char *brname,
   * Returns 0 in case of success or an errno code in case of failure.
   */
  # ifdef SIOCBRDELIF
-int
-brDeleteInterface(const char *brname,
-                  const char *ifname)
+int virNetDevBridgeRemovePort(const char *brname,
+                              const char *ifname)
  {
      int fd = -1;
      int ret = -1;
      struct ifreq ifr;

-    if ((fd = brSetupControl(brname,&ifr))<  0)
+    if ((fd = virNetDevSetupControl(brname,&ifr))<  0)
          return -1;

      if (!(ifr.ifr_ifindex = if_nametoindex(ifname))) {
@@ -312,9 +304,8 @@ cleanup:
      return ret;
  }
  # else
-int
-brDeleteInterface(const char *brname,
-                  const char *ifname)
+int virNetDevBridgeRemovePort(const char *brname,
+                              const char *ifname)
  {
      virReportSystemError(errno,
                           _("Unable to remove bridge %s port %s"), brname, ifname);
@@ -323,7 +314,7 @@ brDeleteInterface(const char *brname,
  # endif

  /**
- * brSetInterfaceMac:
+ * virNetDevSetMAC:
   * @ifname: interface name to set MTU for
   * @macaddr: MAC address (VIR_MAC_BUFLEN in size)
   *
@@ -332,15 +323,14 @@ brDeleteInterface(const char *brname,
   *
   * Returns 0 in case of success or -1 on failure
   */
-int
-brSetInterfaceMac(const char *ifname,
-                  const unsigned char *macaddr)
+int virNetDevSetMAC(const char *ifname,
+                    const unsigned char *macaddr)
  {
      int fd = -1;
      int ret = -1;
      struct ifreq ifr;

-    if ((fd = brSetupControl(ifname,&ifr))<  0)
+    if ((fd = virNetDevSetupControl(ifname,&ifr))<  0)
          return -1;

      /* To fill ifr.ifr_hdaddr.sa_family field */
@@ -368,20 +358,20 @@ cleanup:
  }

  /**
- * ifGetMtu
+ * virNetDevGetMTU:
   * @ifname: interface name get MTU for
   *
   * This function gets the @mtu value set for a given interface @ifname.
   *
   * Returns the MTU value in case of success, or -1 on failure.
   */
-static int ifGetMtu(const char *ifname)
+static int virNetDevGetMTU(const char *ifname)
  {
      int fd = -1;
      int ret = -1;
      struct ifreq ifr;

-    if ((fd = brSetupControl(ifname,&ifr))<  0)
+    if ((fd = virNetDevSetupControl(ifname,&ifr))<  0)
          return -1;

      if (ioctl(fd, SIOCGIFMTU,&ifr)<  0) {
@@ -399,7 +389,7 @@ cleanup:
  }

  /**
- * ifSetMtu:
+ * virNetDevSetMTU:
   * @ifname: interface name to set MTU for
   * @mtu: MTU value
   *
@@ -408,13 +398,13 @@ cleanup:
   *
   * Returns 0 in case of success, or -1 on failure
   */
-static int ifSetMtu(const char *ifname, int mtu)
+static int virNetDevSetMTU(const char *ifname, int mtu)
  {
      int fd = -1;
      int ret = -1;
      struct ifreq ifr;

-    if ((fd = brSetupControl(ifname,&ifr))<  0)
+    if ((fd = virNetDevSetupControl(ifname,&ifr))<  0)
          return -1;

      ifr.ifr_mtu = mtu;
@@ -442,19 +432,19 @@ cleanup:
   *
   * Returns 0 in case of success, or -1 on failure
   */
-static int brSetInterfaceMtu(const char *brname,
-                             const char *ifname)
+static int virNetDevSetMTUFromDevice(const char *brname,
+                                     const char *ifname)
  {
-    int mtu = ifGetMtu(brname);
+    int mtu = virNetDevGetMTU(brname);

      if (mtu<  0)
          return -1;

-    return ifSetMtu(ifname, mtu);
+    return virNetDevSetMTU(ifname, mtu);
  }

  /**
- * brProbeVnetHdr:
+ * virNetDevProbeVnetHdr:
   * @tapfd: a tun/tap file descriptor
   *
   * Check whether it is safe to enable the IFF_VNET_HDR flag on the
@@ -474,7 +464,7 @@ static int brSetInterfaceMtu(const char *brname,
   */
  # ifdef IFF_VNET_HDR
  static int
-brProbeVnetHdr(int tapfd)
+virNetDevProbeVnetHdr(int tapfd)
  {
  #  if defined(IFF_VNET_HDR)&&  defined(TUNGETFEATURES)&&  defined(TUNGETIFF)
      unsigned int features;
@@ -530,15 +520,14 @@ brProbeVnetHdr(int tapfd)
   *
   * Returns 0 in case of success or -1 on failure
   */
-int
-brAddTap(const char *brname,
-         char **ifname,
-         const unsigned char *macaddr,
-         int vnet_hdr,
-         bool up,
-         int *tapfd)
+int virNetDevTapCreateInBridgePort(const char *brname,
+                                   char **ifname,
+                                   const unsigned char *macaddr,
+                                   int vnet_hdr,
+                                   bool up,
+                                   int *tapfd)
  {
-    if (brCreateTap(ifname, vnet_hdr, tapfd)<  0)
+    if (virNetDevTapCreate(ifname, vnet_hdr, tapfd)<  0)
          return -1;

      /* We need to set the interface MAC before adding it
@@ -547,20 +536,20 @@ brAddTap(const char *brname,
       * seeing the kernel allocate random MAC for the TAP
       * device before we set our static MAC.
       */
-    if (brSetInterfaceMac(*ifname, macaddr)<  0)
+    if (virNetDevSetMAC(*ifname, macaddr)<  0)
          goto error;

      /* We need to set the interface MTU before adding it
       * to the bridge, because the bridge will have its
       * MTU adjusted automatically when we add the new interface.
       */
-    if (brSetInterfaceMtu(brname, *ifname)<  0)
+    if (virNetDevSetMTUFromDevice(brname, *ifname)<  0)
          goto error;

-    if (brAddInterface(brname, *ifname)<  0)
+    if (virNetDevBridgeAddPort(brname, *ifname)<  0)
          goto error;

-    if (brSetInterfaceUp(*ifname, up)<  0)
+    if (virNetDevSetOnline(*ifname, up)<  0)
          goto error;

      return 0;
@@ -571,7 +560,7 @@ error:
      return -1;
  }

-int brDeleteTap(const char *ifname)
+int virNetDevTapDelete(const char *ifname)
  {
      struct ifreq try;
      int fd;
@@ -614,7 +603,7 @@ cleanup:


  /**
- * brSetInterfaceUp:
+ * virNetDevSetOnline:
   * @ifname: the interface name
   * @up: 1 for up, 0 for down
   *
@@ -622,16 +611,15 @@ cleanup:
   *
   * Returns 0 in case of success or -1 on error.
   */
-int
-brSetInterfaceUp(const char *ifname,
-                 int up)
+int virNetDevSetOnline(const char *ifname,
+                       int up)
  {
      int fd = -1;
      int ret = -1;
      struct ifreq ifr;
      int ifflags;

-    if ((fd = brSetupControl(ifname,&ifr))<  0)
+    if ((fd = virNetDevSetupControl(ifname,&ifr))<  0)
          return -1;

      if (ioctl(fd, SIOCGIFFLAGS,&ifr)<  0) {
@@ -664,7 +652,7 @@ cleanup:
  }

  /**
- * brGetInterfaceUp:
+ * virNetDevIsOnline:
   * @ifname: the interface name
   * @up: where to store the status
   *
@@ -672,15 +660,14 @@ cleanup:
   *
   * Returns 0 in case of success or an errno code in case of failure.
   */
-int
-brGetInterfaceUp(const char *ifname,
-                 int *up)
+int virNetDevIsOnline(const char *ifname,
+                      int *up)
  {
      int fd = -1;
      int ret = -1;
      struct ifreq ifr;

-    if ((fd = brSetupControl(ifname,&ifr))<  0)
+    if ((fd = virNetDevSetupControl(ifname,&ifr))<  0)
          return -1;

      if (ioctl(fd, SIOCGIFFLAGS,&ifr)<  0) {
@@ -699,7 +686,7 @@ cleanup:
  }

  /**
- * brAddInetAddress:
+ * virNetDevSetIPv4Addres:
   * @ifname: the interface name
   * @addr: the IP address (IPv4 or IPv6)
   * @prefix: number of 1 bits in the netmask
@@ -711,10 +698,9 @@ cleanup:
   * Returns 0 in case of success or -1 in case of error.
   */

-int
-brAddInetAddress(const char *ifname,
-                 virSocketAddr *addr,
-                 unsigned int prefix)
+int virNetDevSetIPv4Addres(const char *ifname,
+                           virSocketAddr *addr,
+                           unsigned int prefix)
  {
      virCommandPtr cmd = NULL;
      char *addrstr = NULL, *bcaststr = NULL;
@@ -748,7 +734,7 @@ cleanup:
  }

  /**
- * brDelInetAddress:
+ * virNetDevClearIPv4Address:
   * @ifname: the interface name
   * @addr: the IP address (IPv4 or IPv6)
   * @prefix: number of 1 bits in the netmask
@@ -758,10 +744,9 @@ cleanup:
   * Returns 0 in case of success or -1 in case of error.
   */

-int
-brDelInetAddress(const char *ifname,
-                 virSocketAddr *addr,
-                 unsigned int prefix)
+int virNetDevClearIPv4Address(const char *ifname,
+                              virSocketAddr *addr,
+                              unsigned int prefix)
  {
      virCommandPtr cmd = NULL;
      char *addrstr;
@@ -785,7 +770,7 @@ cleanup:
  }

  /**
- * brSetForwardDelay:
+ * virNetDevBridgeSetSTPDelay:
   * @brname: the bridge name
   * @delay: delay in seconds
   *
@@ -794,9 +779,8 @@ cleanup:
   * Returns 0 in case of success or -1 on failure
   */

-int
-brSetForwardDelay(const char *brname,
-                  int delay)
+int virNetDevBridgeSetSTPDelay(const char *brname,
+                               int delay)
  {
      virCommandPtr cmd;
      int ret = -1;
@@ -815,7 +799,7 @@ cleanup:
  }

  /**
- * brSetEnableSTP:
+ * virNetDevBridgeSetSTP:
   * @brname: the bridge name
   * @enable: 1 to enable, 0 to disable
   *
@@ -824,9 +808,8 @@ cleanup:
   *
   * Returns 0 in case of success or -1 on failure
   */
-int
-brSetEnableSTP(const char *brname,
-               int enable)
+int virNetDevBridgeSetSTP(const char *brname,
+                          int enable)
  {
      virCommandPtr cmd;
      int ret = -1;
@@ -860,10 +843,9 @@ cleanup:
   * Returns 0 in case of success or an errno code in case of failure.
   */

-int
-brCreateTap(char **ifname,
-            int vnet_hdr ATTRIBUTE_UNUSED,
-            int *tapfd)
+int virNetDevTapCreate(char **ifname,
+                       int vnet_hdr ATTRIBUTE_UNUSED,
+                       int *tapfd)
  {
      int fd;
      struct ifreq ifr;
@@ -880,7 +862,7 @@ brCreateTap(char **ifname,
      ifr.ifr_flags = IFF_TAP|IFF_NO_PI;

  # ifdef IFF_VNET_HDR
-    if (vnet_hdr&&  brProbeVnetHdr(fd))
+    if (vnet_hdr&&  virNetDevProbeVnetHdr(fd))
          ifr.ifr_flags |= IFF_VNET_HDR;
  # endif

diff --git a/src/util/bridge.h b/src/util/bridge.h
index 2bfc4b4..44b6631 100644
--- a/src/util/bridge.h
+++ b/src/util/bridge.h
@@ -42,19 +42,19 @@
   */
  #  define BR_INET_ADDR_MAXLEN INET_ADDRSTRLEN

-int     brAddBridge             (const char *brname)
+int virNetDevBridgeCreate(const char *brname)
      ATTRIBUTE_NONNULL(1) ATTRIBUTE_RETURN_CHECK;
-int     brDeleteBridge          (const char *brname)
+int virNetDevBridgeDelete(const char *brname)
      ATTRIBUTE_NONNULL(1) ATTRIBUTE_RETURN_CHECK;
-int     brHasBridge             (const char *brname)
+int virNetDevExists(const char *brname)
      ATTRIBUTE_NONNULL(1) ATTRIBUTE_RETURN_CHECK;

-int     brAddInterface          (const char *brname,
-                                 const char *ifname)
+int virNetDevBridgeAddPort(const char *brname,
+                           const char *ifname)
      ATTRIBUTE_NONNULL(1) ATTRIBUTE_NONNULL(2) ATTRIBUTE_RETURN_CHECK;

-int     brDeleteInterface       (const char *brname,
-                                 const char *ifname)
+int virNetDevBridgeRemovePort(const char *brname,
+                              const char *ifname)
      ATTRIBUTE_NONNULL(1) ATTRIBUTE_NONNULL(2) ATTRIBUTE_RETURN_CHECK;

  enum {
@@ -62,55 +62,55 @@ enum {
      BR_TAP_PERSIST =  (1<<  1),
  };

-int     brAddTap                (const char *brname,
-                                 char **ifname,
-                                 const unsigned char *macaddr,
-                                 int vnet_hdr,
-                                 bool up,
-                                 int *tapfd)
+int virNetDevTapCreateInBridgePort(const char *brname,
+                                   char **ifname,
+                                   const unsigned char *macaddr,
+                                   int vnet_hdr,
+                                   bool up,
+                                   int *tapfd)
      ATTRIBUTE_NONNULL(1) ATTRIBUTE_NONNULL(2) ATTRIBUTE_NONNULL(3)
      ATTRIBUTE_RETURN_CHECK;


-int     brDeleteTap             (const char *ifname)
+int virNetDevTapDelete(const char *ifname)
      ATTRIBUTE_NONNULL(1) ATTRIBUTE_RETURN_CHECK;

-int     brSetInterfaceUp        (const char *ifname,
-                                 int up)
+int virNetDevSetOnline(const char *ifname,
+                       int up)
      ATTRIBUTE_NONNULL(1) ATTRIBUTE_RETURN_CHECK;
-int     brGetInterfaceUp        (const char *ifname,
-                                 int *up)
+int virNetDevIsOnline(const char *ifname,
+                      int *up)
      ATTRIBUTE_NONNULL(1) ATTRIBUTE_NONNULL(2) ATTRIBUTE_RETURN_CHECK;

-int     brAddInetAddress        (const char *ifname,
-                                 virSocketAddr *addr,
-                                 unsigned int prefix)
+int virNetDevSetIPv4Addres(const char *ifname,
Addres->Address
+                           virSocketAddr *addr,
+                           unsigned int prefix)
      ATTRIBUTE_NONNULL(1) ATTRIBUTE_NONNULL(2) ATTRIBUTE_RETURN_CHECK;
-int     brDelInetAddress        (const char *ifname,
-                                 virSocketAddr *addr,
-                                 unsigned int prefix)
+int virNetDevClearIPv4Address(const char *ifname,
+                              virSocketAddr *addr,
+                              unsigned int prefix)
      ATTRIBUTE_NONNULL(1) ATTRIBUTE_NONNULL(2) ATTRIBUTE_RETURN_CHECK;

-int     brSetForwardDelay       (const char *brname,
-                                 int delay)
+int virNetDevBridgeSetSTPDelay(const char *brname,
+                               int delay)
      ATTRIBUTE_NONNULL(1) ATTRIBUTE_RETURN_CHECK;
-int     brGetForwardDelay       (const char *brname,
-                                 int *delay)
+int virNetDevBridgeGetSTPDelay(const char *brname,
+                               int *delay)
      ATTRIBUTE_NONNULL(1) ATTRIBUTE_NONNULL(2) ATTRIBUTE_RETURN_CHECK;
-int     brSetEnableSTP          (const char *brname,
-                                 int enable)
+int virNetDevBridgeSetSTP(const char *brname,
+                          int enable)
      ATTRIBUTE_NONNULL(1) ATTRIBUTE_RETURN_CHECK;
-int     brGetEnableSTP          (const char *brname,
-                                 int *enable)
+int virNetDevBridgeGetSTP(const char *brname,
+                          int *enable)
      ATTRIBUTE_NONNULL(1) ATTRIBUTE_NONNULL(2) ATTRIBUTE_RETURN_CHECK;

-int     brCreateTap             (char **ifname,
-                                 int vnet_hdr,
-                                 int *tapfd)
+int virNetDevTapCreate(char **ifname,
+                       int vnet_hdr,
+                       int *tapfd)
      ATTRIBUTE_NONNULL(1) ATTRIBUTE_RETURN_CHECK;

-int     brSetInterfaceMac       (const char *ifname,
-                                 const unsigned char *macaddr)
+int virNetDevSetMAC(const char *ifname,
+                    const unsigned char *macaddr)
      ATTRIBUTE_NONNULL(1) ATTRIBUTE_NONNULL(2) ATTRIBUTE_RETURN_CHECK;

  # endif /* WITH_BRIDGE */
ACK with nit fixed.

--
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]