Re: [PATCH v2 1/3] util: make macvtap/macvlan generated name #defines available to other files

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

 



On Tue, Apr 25, 2017 at 02:50:35PM -0400, Laine Stump wrote:
MACVTAP_NAME_PREFIX and MACVLAN_NAME_PREFIX could be useful to other
files if they were defined in virnetdevmacvlan.h instead of
virnetdevmacvlan.c, so do that (while slightly renaming them and also
adding yet another #define that chooses between macvlan/macvtap based
on flags).

This is a prerequisite to fix: https://bugzilla.redhat.com/1335798
---
src/util/virnetdevmacvlan.c | 65 ++++++++++++++++++---------------------------
src/util/virnetdevmacvlan.h |  6 +++++
2 files changed, 32 insertions(+), 39 deletions(-)

diff --git a/src/util/virnetdevmacvlan.c b/src/util/virnetdevmacvlan.c
index 7222b0f..97c8770 100644
--- a/src/util/virnetdevmacvlan.c
+++ b/src/util/virnetdevmacvlan.c
@@ -236,11 +224,11 @@ virNetDevMacVLanReserveName(const char *name, bool quietFail)
    if (virNetDevMacVLanInitialize() < 0)
       return -1;

-    if (STRPREFIX(name, MACVTAP_NAME_PREFIX)) {
-        idstr = name + strlen(MACVTAP_NAME_PREFIX);
+    if (STRPREFIX(name, VIR_NET_GENERATED_MACVTAP_PREFIX)) {
+        idstr = name + strlen(VIR_NET_GENERATED_MACVTAP_PREFIX);
        flags |= VIR_NETDEV_MACVLAN_CREATE_WITH_TAP;
-    } else if (STRPREFIX(name, MACVLAN_NAME_PREFIX)) {
-        idstr = name + strlen(MACVLAN_NAME_PREFIX);
+    } else if (STRPREFIX(name, VIR_NET_GENERATED_MACVLAN_PREFIX)) {
+        idstr = name + strlen(VIR_NET_GENERATED_MACVLAN_PREFIX);
    } else {
        return -2;
    }
@@ -276,11 +264,11 @@ virNetDevMacVLanReleaseName(const char *name)
    if (virNetDevMacVLanInitialize() < 0)
       return -1;

-    if (STRPREFIX(name, MACVTAP_NAME_PREFIX)) {
-        idstr = name + strlen(MACVTAP_NAME_PREFIX);
+    if (STRPREFIX(name, VIR_NET_GENERATED_MACVTAP_PREFIX)) {
+        idstr = name + strlen(VIR_NET_GENERATED_MACVTAP_PREFIX);
        flags |= VIR_NETDEV_MACVLAN_CREATE_WITH_TAP;
-    } else if (STRPREFIX(name, MACVLAN_NAME_PREFIX)) {
-        idstr = name + strlen(MACVLAN_NAME_PREFIX);
+    } else if (STRPREFIX(name, VIR_NET_GENERATED_MACVLAN_PREFIX)) {
+        idstr = name + strlen(VIR_NET_GENERATED_MACVLAN_PREFIX);

Just a note to someone interested as this is pre-existing, but I think
STRSKIP could make these nicer.

Attachment: signature.asc
Description: Digital signature

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