[PATCH v2 3/3] util: rename/move VIR_NET_GENERATED_PREFIX to be consistent

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

 



... with VIR_NET_GENERATED_MACV???_PREFIX, which is defined in
util/virnetdevmacvlan.h.

Since VIR_NET_GENERATED_PREFIX is used for plain tap devices, it is
renamed to VIR_NET_GENERATED_TAP_PREFIX and moved to virnetdev.h
---
 src/bhyve/bhyve_command.c              | 4 ++--
 src/conf/domain_conf.c                 | 4 ++--
 src/conf/domain_conf.h                 | 4 ----
 src/interface/interface_backend_udev.c | 2 +-
 src/qemu/qemu_interface.c              | 8 ++++----
 src/uml/uml_conf.c                     | 4 ++--
 src/util/virnetdev.h                   | 5 +++++
 7 files changed, 16 insertions(+), 15 deletions(-)

diff --git a/src/bhyve/bhyve_command.c b/src/bhyve/bhyve_command.c
index e9c072b..eae5cb3 100644
--- a/src/bhyve/bhyve_command.c
+++ b/src/bhyve/bhyve_command.c
@@ -88,10 +88,10 @@ bhyveBuildNetArgStr(virConnectPtr conn,
     }
 
     if (!net->ifname ||
-        STRPREFIX(net->ifname, VIR_NET_GENERATED_PREFIX) ||
+        STRPREFIX(net->ifname, VIR_NET_GENERATED_TAP_PREFIX) ||
         strchr(net->ifname, '%')) {
         VIR_FREE(net->ifname);
-        if (VIR_STRDUP(net->ifname, VIR_NET_GENERATED_PREFIX "%d") < 0)
+        if (VIR_STRDUP(net->ifname, VIR_NET_GENERATED_TAP_PREFIX "%d") < 0)
             goto cleanup;
     }
 
diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c
index 36644b8..236e028 100644
--- a/src/conf/domain_conf.c
+++ b/src/conf/domain_conf.c
@@ -9745,7 +9745,7 @@ virDomainNetDefParseXML(virDomainXMLOptionPtr xmlopt,
                 ifname = virXMLPropString(cur, "dev");
                 if (ifname &&
                     (flags & VIR_DOMAIN_DEF_PARSE_INACTIVE) &&
-                    (STRPREFIX(ifname, VIR_NET_GENERATED_PREFIX) ||
+                    (STRPREFIX(ifname, VIR_NET_GENERATED_TAP_PREFIX) ||
                      (prefix && STRPREFIX(ifname, prefix)))) {
                     /* An auto-generated target name, blank it out */
                     VIR_FREE(ifname);
@@ -22150,7 +22150,7 @@ virDomainNetDefFormat(virBufferPtr buf,
 
     if (def->ifname &&
         !((flags & VIR_DOMAIN_DEF_FORMAT_INACTIVE) &&
-          (STRPREFIX(def->ifname, VIR_NET_GENERATED_PREFIX) ||
+          (STRPREFIX(def->ifname, VIR_NET_GENERATED_TAP_PREFIX) ||
            (prefix && STRPREFIX(def->ifname, prefix))))) {
         /* Skip auto-generated target names for inactive config. */
         virBufferEscapeString(buf, "<target dev='%s'/>\n", def->ifname);
diff --git a/src/conf/domain_conf.h b/src/conf/domain_conf.h
index 3b6b174..95848f7 100644
--- a/src/conf/domain_conf.h
+++ b/src/conf/domain_conf.h
@@ -1040,10 +1040,6 @@ struct _virDomainNetDef {
     virNetDevCoalescePtr coalesce;
 };
 
-/* Used for prefix of ifname of any network name generated dynamically
- * by libvirt, and cannot be used for a persistent network name.  */
-# define VIR_NET_GENERATED_PREFIX "vnet"
-
 typedef enum {
     VIR_DOMAIN_CHR_DEVICE_STATE_DEFAULT = 0,
     VIR_DOMAIN_CHR_DEVICE_STATE_CONNECTED,
diff --git a/src/interface/interface_backend_udev.c b/src/interface/interface_backend_udev.c
index 18a45fa..1cd8406 100644
--- a/src/interface/interface_backend_udev.c
+++ b/src/interface/interface_backend_udev.c
@@ -570,7 +570,7 @@ udevBridgeScanDirFilter(const struct dirent *entry)
      * vnet%d. Improvements to this check are welcome.
      */
     if (strlen(entry->d_name) >= 5) {
-        if (STRPREFIX(entry->d_name, VIR_NET_GENERATED_PREFIX) &&
+        if (STRPREFIX(entry->d_name, VIR_NET_GENERATED_TAP_PREFIX) &&
             c_isdigit(entry->d_name[4]))
             return 0;
     }
diff --git a/src/qemu/qemu_interface.c b/src/qemu/qemu_interface.c
index d0850c0..d8a678b 100644
--- a/src/qemu/qemu_interface.c
+++ b/src/qemu/qemu_interface.c
@@ -428,10 +428,10 @@ qemuInterfaceEthernetConnect(virDomainDefPtr def,
     }
 
     if (!net->ifname ||
-        STRPREFIX(net->ifname, VIR_NET_GENERATED_PREFIX) ||
+        STRPREFIX(net->ifname, VIR_NET_GENERATED_TAP_PREFIX) ||
         strchr(net->ifname, '%')) {
         VIR_FREE(net->ifname);
-        if (VIR_STRDUP(net->ifname, VIR_NET_GENERATED_PREFIX "%d") < 0)
+        if (VIR_STRDUP(net->ifname, VIR_NET_GENERATED_TAP_PREFIX "%d") < 0)
             goto cleanup;
         /* avoid exposing vnet%d in getXMLDesc or error outputs */
         template_ifname = true;
@@ -528,10 +528,10 @@ qemuInterfaceBridgeConnect(virDomainDefPtr def,
     }
 
     if (!net->ifname ||
-        STRPREFIX(net->ifname, VIR_NET_GENERATED_PREFIX) ||
+        STRPREFIX(net->ifname, VIR_NET_GENERATED_TAP_PREFIX) ||
         strchr(net->ifname, '%')) {
         VIR_FREE(net->ifname);
-        if (VIR_STRDUP(net->ifname, VIR_NET_GENERATED_PREFIX "%d") < 0)
+        if (VIR_STRDUP(net->ifname, VIR_NET_GENERATED_TAP_PREFIX "%d") < 0)
             goto cleanup;
         /* avoid exposing vnet%d in getXMLDesc or error outputs */
         template_ifname = true;
diff --git a/src/uml/uml_conf.c b/src/uml/uml_conf.c
index bdef783..9bd4f11 100644
--- a/src/uml/uml_conf.c
+++ b/src/uml/uml_conf.c
@@ -112,10 +112,10 @@ umlConnectTapDevice(virDomainDefPtr vm,
     int tapfd = -1;
 
     if (!net->ifname ||
-        STRPREFIX(net->ifname, VIR_NET_GENERATED_PREFIX) ||
+        STRPREFIX(net->ifname, VIR_NET_GENERATED_TAP_PREFIX) ||
         strchr(net->ifname, '%')) {
         VIR_FREE(net->ifname);
-        if (VIR_STRDUP(net->ifname, VIR_NET_GENERATED_PREFIX "%d") < 0)
+        if (VIR_STRDUP(net->ifname, VIR_NET_GENERATED_TAP_PREFIX "%d") < 0)
             goto error;
         /* avoid exposing vnet%d in getXMLDesc or error outputs */
         template_ifname = true;
diff --git a/src/util/virnetdev.h b/src/util/virnetdev.h
index 19036cc..c7494cd 100644
--- a/src/util/virnetdev.h
+++ b/src/util/virnetdev.h
@@ -37,6 +37,11 @@ typedef struct ifreq virIfreq;
 typedef void virIfreq;
 # 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"
+
 typedef enum {
    VIR_NETDEV_RX_FILTER_MODE_NONE = 0,
    VIR_NETDEV_RX_FILTER_MODE_NORMAL,
-- 
2.9.3

--
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]
  Powered by Linux