Re: [libvirt] [PATCH 04/16] Rename low level macvlan creation APIs

2011-11-17 Thread Laine Stump

On 11/15/2011 06:14 AM, Daniel P. Berrange wrote:

From: Daniel P. Berrangeberra...@redhat.com

Rename ifaceMacvtapLinkAdd to virNetDevMacVLanCreate and
ifaceLinkDel to virNetDevMacVLanDelete. Strictly speaking
the latter isn't restricted to macvlan devices, but that's
the only use libvirt has for it.


Also removed the macaddrsize arg from virNetDevMacVLanCreate. This is 
bringing back some memory of a network device type that had a mac 
address  6 bytes in length, but I can't recall what it was, and anyway 
everything else in libvirt assumes VIR_MAC_BUFLEN (6) anyway.


ACK.

--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list


Re: [libvirt] [PATCH 04/16] Rename low level macvlan creation APIs

2011-11-17 Thread Daniel P. Berrange
On Thu, Nov 17, 2011 at 06:04:32AM -0500, Laine Stump wrote:
 On 11/15/2011 06:14 AM, Daniel P. Berrange wrote:
 From: Daniel P. Berrangeberra...@redhat.com
 
 Rename ifaceMacvtapLinkAdd to virNetDevMacVLanCreate and
 ifaceLinkDel to virNetDevMacVLanDelete. Strictly speaking
 the latter isn't restricted to macvlan devices, but that's
 the only use libvirt has for it.
 
 Also removed the macaddrsize arg from virNetDevMacVLanCreate. This
 is bringing back some memory of a network device type that had a mac
 address  6 bytes in length, but I can't recall what it was, and
 anyway everything else in libvirt assumes VIR_MAC_BUFLEN (6) anyway.

Yes, I should have mentioned that. Although the API had a macaddr
length parameter, the caller had hardcoded '6' as the length. Given
that everything in libvirt presumes VIR_MAC_BUFLEN, I didn't see
the point in keeping macaddr length configurable for this one API.


Daniel
-- 
|: http://berrange.com  -o-http://www.flickr.com/photos/dberrange/ :|
|: http://libvirt.org  -o- http://virt-manager.org :|
|: http://autobuild.org   -o- http://search.cpan.org/~danberr/ :|
|: http://entangle-photo.org   -o-   http://live.gnome.org/gtk-vnc :|

--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list


[libvirt] [PATCH 04/16] Rename low level macvlan creation APIs

2011-11-15 Thread Daniel P. Berrange
From: Daniel P. Berrange berra...@redhat.com

Rename ifaceMacvtapLinkAdd to virNetDevMacVLanCreate and
ifaceLinkDel to virNetDevMacVLanDelete. Strictly speaking
the latter isn't restricted to macvlan devices, but that's
the only use libvirt has for it.

* util/interface.c, util/interface.h,
  util/virnetdevmacvlan.c: Rename APIs
---
 src/libvirt_private.syms|4 ++--
 src/util/interface.c|   41 ++---
 src/util/interface.h|   19 +++
 src/util/virnetdevmacvlan.c |   12 ++--
 4 files changed, 37 insertions(+), 39 deletions(-)

diff --git a/src/libvirt_private.syms b/src/libvirt_private.syms
index 03aa711..dcbc8b8 100644
--- a/src/libvirt_private.syms
+++ b/src/libvirt_private.syms
@@ -583,8 +583,8 @@ ifaceGetPhysicalFunction;
 ifaceGetVirtualFunctionIndex;
 ifaceGetVlanID;
 ifaceIsVirtualFunction;
-ifaceLinkDel;
-ifaceMacvtapLinkAdd;
+virNetDevMacVLanCreate;
+virNetDevMacVLanDelete;
 ifaceMacvtapLinkDump;
 ifaceReplaceMacAddress;
 ifaceRestoreMacAddress;
diff --git a/src/util/interface.c b/src/util/interface.c
index 63e6bf7..a1c56f5 100644
--- a/src/util/interface.c
+++ b/src/util/interface.c
@@ -313,12 +313,11 @@ ifaceGetIPAddress(const char *ifname ATTRIBUTE_UNUSED,
 #endif /* __linux__ */
 
 /**
- * ifaceLinkAdd
+ * virNetDevMacVLanCreate:
  *
+ * @ifname: The name the interface is supposed to have; optional parameter
  * @type: The type of device, i.e., macvtap
  * @macaddress: The MAC address of the device
- * @macaddrsize: The size of the MAC address, typically '6'
- * @ifname: The name the interface is supposed to have; optional parameter
  * @srcdev: The name of the 'link' device
  * @macvlan_mode: The macvlan mode to use
  * @retry: Pointer to integer that will be '1' upon return if an interface
@@ -331,12 +330,12 @@ ifaceGetIPAddress(const char *ifname ATTRIBUTE_UNUSED,
  */
 #if defined(__linux__)  WITH_MACVTAP
 int
-ifaceMacvtapLinkAdd(const char *type,
-const unsigned char *macaddress, int macaddrsize,
-const char *ifname,
-const char *srcdev,
-uint32_t macvlan_mode,
-int *retry)
+virNetDevMacVLanCreate(const char *ifname,
+   const char *type,
+   const unsigned char *macaddress,
+   const char *srcdev,
+   uint32_t macvlan_mode,
+   int *retry)
 {
 int rc = 0;
 struct nlmsghdr *resp;
@@ -366,7 +365,7 @@ ifaceMacvtapLinkAdd(const char *type,
 if (nla_put_u32(nl_msg, IFLA_LINK, ifindex)  0)
 goto buffer_too_small;
 
-if (nla_put(nl_msg, IFLA_ADDRESS, macaddrsize, macaddress)  0)
+if (nla_put(nl_msg, IFLA_ADDRESS, VIR_MAC_BUFLEN, macaddress)  0)
 goto buffer_too_small;
 
 if (ifname 
@@ -458,14 +457,12 @@ buffer_too_small:
 
 #else
 
-int
-ifaceMacvtapLinkAdd(const char *type ATTRIBUTE_UNUSED,
-const unsigned char *macaddress ATTRIBUTE_UNUSED,
-int macaddrsize ATTRIBUTE_UNUSED,
-const char *ifname ATTRIBUTE_UNUSED,
-const char *srcdev ATTRIBUTE_UNUSED,
-uint32_t macvlan_mode ATTRIBUTE_UNUSED,
-int *retry ATTRIBUTE_UNUSED)
+int virNetDevMacVLanCreate(const char *ifname ATTRIBUTE_UNUSED,
+   const char *type ATTRIBUTE_UNUSED,
+   const unsigned char *macaddress ATTRIBUTE_UNUSED,
+   const char *srcdev ATTRIBUTE_UNUSED,
+   uint32_t macvlan_mode ATTRIBUTE_UNUSED,
+   int *retry ATTRIBUTE_UNUSED)
 {
 ifaceError(VIR_ERR_INTERNAL_ERROR, %s,
 # if defined(__linux__)  !WITH_MACVTAP
@@ -483,7 +480,7 @@ ifaceMacvtapLinkAdd(const char *type ATTRIBUTE_UNUSED,
 
 
 /**
- * ifaceLinkDel
+ * virNetDevMacVLanDelete:
  *
  * @ifname: Name of the interface
  *
@@ -492,8 +489,7 @@ ifaceMacvtapLinkAdd(const char *type ATTRIBUTE_UNUSED,
  * Returns 0 on success, -1 on fatal error.
  */
 #if defined( __linux__)  WITH_MACVTAP
-int
-ifaceLinkDel(const char *ifname)
+int virNetDevMacVLanDelete(const char *ifname)
 {
 int rc = 0;
 struct nlmsghdr *resp;
@@ -572,8 +568,7 @@ buffer_too_small:
 
 #else
 
-int
-ifaceLinkDel(const char *ifname ATTRIBUTE_UNUSED)
+int virNetDevMacVLanDelete(const char *ifname ATTRIBUTE_UNUSED)
 {
 ifaceError(VIR_ERR_INTERNAL_ERROR, %s,
 # if defined(__linux__)  !WITH_MACVTAP
diff --git a/src/util/interface.h b/src/util/interface.h
index 4adc601..a62f26a 100644
--- a/src/util/interface.h
+++ b/src/util/interface.h
@@ -39,14 +39,17 @@ int ifaceGetVlanID(const char *vlanifname, int *vlanid);
 
 int ifaceGetIPAddress(const char *ifname, virSocketAddrPtr addr);
 
-int ifaceMacvtapLinkAdd(const char *type,
-const unsigned char *macaddress, int macaddrsize,
-const char *ifname,
-