Re: [libvirt] [PATCH 03/28] global: consistently use IP rather than Ip in identifiers

2016-06-24 Thread Laine Stump

On 06/23/2016 04:25 PM, John Ferlan wrote:


On 06/22/2016 01:37 PM, Laine Stump wrote:

I'm tired of mistyping this all the time, so let's do it the same all
the time (similar to how we changed all "Pci" to "PCI" awhile back).

(NB: I've left alone some things in the esx and vbox drivers because
I'm unable to compile them and they weren't obviously *not* a part of
some API. I also didn't change a couple of variables named,
e.g. "somethingIptables", because they were derived from the name of
the "iptables" command)
---
  src/conf/domain_conf.c| 24 +-
  src/conf/domain_conf.h| 12 ++---
  src/conf/interface_conf.c | 38 +++
  src/conf/interface_conf.h |  8 ++--
  src/conf/network_conf.c   | 80 +++
  src/conf/network_conf.h   | 20 
  src/conf/networkcommon_conf.c |  6 +--
  src/esx/esx_driver.c  | 44 -
  src/esx/esx_interface_driver.c|  4 +-
  src/esx/esx_vi.c  |  4 +-
  src/esx/esx_vi.h  |  2 +-
  src/libvirt_private.syms  | 10 ++--
  src/lxc/lxc_container.c   |  2 +-
  src/lxc/lxc_native.c  |  4 +-
  src/network/bridge_driver.c   | 74 ++--
  src/network/bridge_driver_linux.c | 70 +--
  src/nwfilter/nwfilter_ebiptables_driver.c | 24 +-
  src/openvz/openvz_conf.c  |  2 +-
  src/qemu/qemu_driver.c|  2 +-
  src/util/virsocketaddr.c  |  4 +-
  src/util/virsocketaddr.h  |  2 +-
  src/vbox/vbox_network.c   |  8 ++--
  src/xenconfig/xen_common.c|  2 +-
  src/xenconfig/xen_sxpr.c  |  4 +-
  24 files changed, 225 insertions(+), 225 deletions(-)


It's a type "A" type change ;-)

I think I am going to need that eye exam after all...

[...]



diff --git a/src/conf/interface_conf.c b/src/conf/interface_conf.c
index 26e55cc..40f1958 100644
--- a/src/conf/interface_conf.c
+++ b/src/conf/interface_conf.c
@@ -45,7 +45,7 @@ virInterfaceDefDevFormat(virBufferPtr buf, const 
virInterfaceDef *def,
   virInterfaceType parentIfType);
  
  static

-void virInterfaceIpDefFree(virInterfaceIpDefPtr def)
+void virInterfaceIPDefFree(virInterfaceIPDefPtr def)
  {
  if (def == NULL)
  return;
@@ -61,7 +61,7 @@ void virInterfaceProtocolDefFree(virInterfaceProtocolDefPtr 
def)
  if (def == NULL)
  return;
  for (i = 0; i < def->nips; i++)
-virInterfaceIpDefFree(def->ips[i]);
+virInterfaceIPDefFree(def->ips[i]);
  VIR_FREE(def->ips);
  VIR_FREE(def->family);
  VIR_FREE(def->gateway);
@@ -281,7 +281,7 @@ virInterfaceDefParseDhcp(virInterfaceProtocolDefPtr def,
  }
  
  static int

-virInterfaceDefParseIp(virInterfaceIpDefPtr def,
+virInterfaceDefParseIP(virInterfaceIPDefPtr def,
 xmlXPathContextPtr ctxt)
  {
  int ret = 0;
@@ -310,7 +310,7 @@ virInterfaceDefParseProtoIPv4(virInterfaceProtocolDefPtr 
def,
  {
  xmlNodePtr dhcp;
  xmlNodePtr *ipNodes = NULL;
-int nIpNodes, ret = -1;
+int nIPNodes, ret = -1;

You changed a variable name here which while I suppose is correct leads
me to wonder why "ipNodes" wasn't changed as well.

In the long run though, in whatever manner "ip" is used, it should be
consistent between "n[ip|IP]Nodes" and [ip|IP]Nodes... I'd lean towards
ipNodes and nipNodes...


I agree with you (although I can't really articulate why). The nIPNodes 
was an oversight. I'll fix it before pushing.






  size_t i;
  char *tmp;
  
@@ -323,26 +323,26 @@ virInterfaceDefParseProtoIPv4(virInterfaceProtocolDefPtr def,

  return -1;
  }
  
-nIpNodes = virXPathNodeSet("./ip", ctxt, &ipNodes);

-if (nIpNodes < 0)
+nIPNodes = virXPathNodeSet("./ip", ctxt, &ipNodes);
+if (nIPNodes < 0)
  return -1;
  if (ipNodes == NULL)
  return 0;
  
-if (VIR_ALLOC_N(def->ips, nIpNodes) < 0)

+if (VIR_ALLOC_N(def->ips, nIPNodes) < 0)
  goto error;
  
  def->nips = 0;

-for (i = 0; i < nIpNodes; i++) {
+for (i = 0; i < nIPNodes; i++) {
  
-virInterfaceIpDefPtr ip;

+virInterfaceIPDefPtr ip;
  
  if (VIR_ALLOC(ip) < 0)

  goto error;
  
  ctxt->node = ipNodes[i];

-if (virInterfaceDefParseIp(ip, ctxt) < 0) {
-virInterfaceIpDefFree(ip);
+if (virInterfaceDefParseIP(ip, ctxt) < 0) {
+virInterfaceIPDefFree(ip);
  goto error;
  }
  def->ips[def->nips++] = ip;
@@ -361,7 +361,7 @@ virInterfaceDefParseProtoIPv6(virInterfaceProtocolDefPtr 
def,
  {
  xmlNodePtr dhcp, autoconf;
  xmlNodePtr *ipNodes = NULL;
-int nIpNodes, ret = -1;
+

Re: [libvirt] [PATCH 03/28] global: consistently use IP rather than Ip in identifiers

2016-06-23 Thread John Ferlan


On 06/22/2016 01:37 PM, Laine Stump wrote:
> I'm tired of mistyping this all the time, so let's do it the same all
> the time (similar to how we changed all "Pci" to "PCI" awhile back).
> 
> (NB: I've left alone some things in the esx and vbox drivers because
> I'm unable to compile them and they weren't obviously *not* a part of
> some API. I also didn't change a couple of variables named,
> e.g. "somethingIptables", because they were derived from the name of
> the "iptables" command)
> ---
>  src/conf/domain_conf.c| 24 +-
>  src/conf/domain_conf.h| 12 ++---
>  src/conf/interface_conf.c | 38 +++
>  src/conf/interface_conf.h |  8 ++--
>  src/conf/network_conf.c   | 80 
> +++
>  src/conf/network_conf.h   | 20 
>  src/conf/networkcommon_conf.c |  6 +--
>  src/esx/esx_driver.c  | 44 -
>  src/esx/esx_interface_driver.c|  4 +-
>  src/esx/esx_vi.c  |  4 +-
>  src/esx/esx_vi.h  |  2 +-
>  src/libvirt_private.syms  | 10 ++--
>  src/lxc/lxc_container.c   |  2 +-
>  src/lxc/lxc_native.c  |  4 +-
>  src/network/bridge_driver.c   | 74 ++--
>  src/network/bridge_driver_linux.c | 70 +--
>  src/nwfilter/nwfilter_ebiptables_driver.c | 24 +-
>  src/openvz/openvz_conf.c  |  2 +-
>  src/qemu/qemu_driver.c|  2 +-
>  src/util/virsocketaddr.c  |  4 +-
>  src/util/virsocketaddr.h  |  2 +-
>  src/vbox/vbox_network.c   |  8 ++--
>  src/xenconfig/xen_common.c|  2 +-
>  src/xenconfig/xen_sxpr.c  |  4 +-
>  24 files changed, 225 insertions(+), 225 deletions(-)
> 

It's a type "A" type change ;-)

I think I am going to need that eye exam after all...

[...]


> diff --git a/src/conf/interface_conf.c b/src/conf/interface_conf.c
> index 26e55cc..40f1958 100644
> --- a/src/conf/interface_conf.c
> +++ b/src/conf/interface_conf.c
> @@ -45,7 +45,7 @@ virInterfaceDefDevFormat(virBufferPtr buf, const 
> virInterfaceDef *def,
>   virInterfaceType parentIfType);
>  
>  static
> -void virInterfaceIpDefFree(virInterfaceIpDefPtr def)
> +void virInterfaceIPDefFree(virInterfaceIPDefPtr def)
>  {
>  if (def == NULL)
>  return;
> @@ -61,7 +61,7 @@ void virInterfaceProtocolDefFree(virInterfaceProtocolDefPtr 
> def)
>  if (def == NULL)
>  return;
>  for (i = 0; i < def->nips; i++)
> -virInterfaceIpDefFree(def->ips[i]);
> +virInterfaceIPDefFree(def->ips[i]);
>  VIR_FREE(def->ips);
>  VIR_FREE(def->family);
>  VIR_FREE(def->gateway);
> @@ -281,7 +281,7 @@ virInterfaceDefParseDhcp(virInterfaceProtocolDefPtr def,
>  }
>  
>  static int
> -virInterfaceDefParseIp(virInterfaceIpDefPtr def,
> +virInterfaceDefParseIP(virInterfaceIPDefPtr def,
> xmlXPathContextPtr ctxt)
>  {
>  int ret = 0;
> @@ -310,7 +310,7 @@ virInterfaceDefParseProtoIPv4(virInterfaceProtocolDefPtr 
> def,
>  {
>  xmlNodePtr dhcp;
>  xmlNodePtr *ipNodes = NULL;
> -int nIpNodes, ret = -1;
> +int nIPNodes, ret = -1;

You changed a variable name here which while I suppose is correct leads
me to wonder why "ipNodes" wasn't changed as well.

In the long run though, in whatever manner "ip" is used, it should be
consistent between "n[ip|IP]Nodes" and [ip|IP]Nodes... I'd lean towards
ipNodes and nipNodes...


>  size_t i;
>  char *tmp;
>  
> @@ -323,26 +323,26 @@ 
> virInterfaceDefParseProtoIPv4(virInterfaceProtocolDefPtr def,
>  return -1;
>  }
>  
> -nIpNodes = virXPathNodeSet("./ip", ctxt, &ipNodes);
> -if (nIpNodes < 0)
> +nIPNodes = virXPathNodeSet("./ip", ctxt, &ipNodes);
> +if (nIPNodes < 0)
>  return -1;
>  if (ipNodes == NULL)
>  return 0;
>  
> -if (VIR_ALLOC_N(def->ips, nIpNodes) < 0)
> +if (VIR_ALLOC_N(def->ips, nIPNodes) < 0)
>  goto error;
>  
>  def->nips = 0;
> -for (i = 0; i < nIpNodes; i++) {
> +for (i = 0; i < nIPNodes; i++) {
>  
> -virInterfaceIpDefPtr ip;
> +virInterfaceIPDefPtr ip;
>  
>  if (VIR_ALLOC(ip) < 0)
>  goto error;
>  
>  ctxt->node = ipNodes[i];
> -if (virInterfaceDefParseIp(ip, ctxt) < 0) {
> -virInterfaceIpDefFree(ip);
> +if (virInterfaceDefParseIP(ip, ctxt) < 0) {
> +virInterfaceIPDefFree(ip);
>  goto error;
>  }
>  def->ips[def->nips++] = ip;
> @@ -361,7 +361,7 @@ virInterfaceDefParseProtoIPv6(virInterfaceProtocolDefPtr 
> def,
>  {
>  xmlNodePtr dhcp, autoconf;
>  xmlNodePtr *ipNodes = NULL;
> -int nIpNodes, ret = -1;
> +int

[libvirt] [PATCH 03/28] global: consistently use IP rather than Ip in identifiers

2016-06-22 Thread Laine Stump
I'm tired of mistyping this all the time, so let's do it the same all
the time (similar to how we changed all "Pci" to "PCI" awhile back).

(NB: I've left alone some things in the esx and vbox drivers because
I'm unable to compile them and they weren't obviously *not* a part of
some API. I also didn't change a couple of variables named,
e.g. "somethingIptables", because they were derived from the name of
the "iptables" command)
---
 src/conf/domain_conf.c| 24 +-
 src/conf/domain_conf.h| 12 ++---
 src/conf/interface_conf.c | 38 +++
 src/conf/interface_conf.h |  8 ++--
 src/conf/network_conf.c   | 80 +++
 src/conf/network_conf.h   | 20 
 src/conf/networkcommon_conf.c |  6 +--
 src/esx/esx_driver.c  | 44 -
 src/esx/esx_interface_driver.c|  4 +-
 src/esx/esx_vi.c  |  4 +-
 src/esx/esx_vi.h  |  2 +-
 src/libvirt_private.syms  | 10 ++--
 src/lxc/lxc_container.c   |  2 +-
 src/lxc/lxc_native.c  |  4 +-
 src/network/bridge_driver.c   | 74 ++--
 src/network/bridge_driver_linux.c | 70 +--
 src/nwfilter/nwfilter_ebiptables_driver.c | 24 +-
 src/openvz/openvz_conf.c  |  2 +-
 src/qemu/qemu_driver.c|  2 +-
 src/util/virsocketaddr.c  |  4 +-
 src/util/virsocketaddr.h  |  2 +-
 src/vbox/vbox_network.c   |  8 ++--
 src/xenconfig/xen_common.c|  2 +-
 src/xenconfig/xen_sxpr.c  |  4 +-
 24 files changed, 225 insertions(+), 225 deletions(-)

diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c
index 8ff836c..e57655e 100644
--- a/src/conf/domain_conf.c
+++ b/src/conf/domain_conf.c
@@ -6104,11 +6104,11 @@ virDomainHostdevDefParseXMLSubsys(xmlNodePtr node,
 return ret;
 }
 
-static virDomainNetIpDefPtr
-virDomainNetIpParseXML(xmlNodePtr node)
+static virDomainNetIPDefPtr
+virDomainNetIPParseXML(xmlNodePtr node)
 {
 /* Parse the prefix in every case */
-virDomainNetIpDefPtr ip = NULL, ret = NULL;
+virDomainNetIPDefPtr ip = NULL, ret = NULL;
 char *prefixStr = NULL;
 unsigned int prefixValue = 0;
 char *familyStr = NULL;
@@ -6230,7 +6230,7 @@ virDomainHostdevDefParseXMLCaps(xmlNodePtr node 
ATTRIBUTE_UNUSED,
 if (nipnodes) {
 size_t i;
 for (i = 0; i < nipnodes; i++) {
-virDomainNetIpDefPtr ip = virDomainNetIpParseXML(ipnodes[i]);
+virDomainNetIPDefPtr ip = virDomainNetIPParseXML(ipnodes[i]);
 
 if (!ip)
 goto error;
@@ -8862,12 +8862,12 @@ virDomainActualNetDefParseXML(xmlNodePtr node,
 
 
 int
-virDomainNetAppendIpAddress(virDomainNetDefPtr def,
+virDomainNetAppendIPAddress(virDomainNetDefPtr def,
 const char *address,
 int family,
 unsigned int prefix)
 {
-virDomainNetIpDefPtr ipDef = NULL;
+virDomainNetIPDefPtr ipDef = NULL;
 if (VIR_ALLOC(ipDef) < 0)
 return -1;
 
@@ -8939,7 +8939,7 @@ virDomainNetDefParseXML(virDomainXMLOptionPtr xmlopt,
 int ret, val;
 size_t i;
 size_t nips = 0;
-virDomainNetIpDefPtr *ips = NULL;
+virDomainNetIPDefPtr *ips = NULL;
 size_t nroutes = 0;
 virNetworkRouteDefPtr *routes = NULL;
 
@@ -9039,9 +9039,9 @@ virDomainNetDefParseXML(virDomainXMLOptionPtr xmlopt,
 ctxt->node = tmpnode;
 }
 } else if (xmlStrEqual(cur->name, BAD_CAST "ip")) {
-virDomainNetIpDefPtr ip = NULL;
+virDomainNetIPDefPtr ip = NULL;
 
-if (!(ip = virDomainNetIpParseXML(cur)))
+if (!(ip = virDomainNetIPParseXML(cur)))
 goto error;
 
 if (VIR_APPEND_ELEMENT(ips, nips, ip) < 0)
@@ -20239,7 +20239,7 @@ virDomainFSDefFormat(virBufferPtr buf,
 }
 
 static int
-virDomainNetIpsFormat(virBufferPtr buf, virDomainNetIpDefPtr *ips, size_t nips)
+virDomainNetIPsFormat(virBufferPtr buf, virDomainNetIPDefPtr *ips, size_t nips)
 {
 size_t i;
 
@@ -20433,7 +20433,7 @@ virDomainHostdevDefFormatCaps(virBufferPtr buf,
 virBufferAddLit(buf, "\n");
 
 if (def->source.caps.type == VIR_DOMAIN_HOSTDEV_CAPS_TYPE_NET) {
-if (virDomainNetIpsFormat(buf, def->source.caps.u.net.ips,
+if (virDomainNetIPsFormat(buf, def->source.caps.u.net.ips,
  def->source.caps.u.net.nips) < 0)
 return -1;
 if (virDomainNetRoutesFormat(buf, def->source.caps.u.net.routes,
@@ -20852,7 +20852,7 @@ virDomainNetDefFormat(virBufferPtr buf,
 return -1;
 }
 
-if (virDomainNetIps