]> xenbits.xensource.com Git - libvirt.git/commitdiff
debug: assure NULLSTR() around all %s args in debug at top of public APIs
authorLaine Stump <laine@laine.org>
Wed, 27 May 2015 17:44:21 +0000 (13:44 -0400)
committerLaine Stump <laine@laine.org>
Thu, 28 May 2015 17:13:45 +0000 (13:13 -0400)
There are also a couple that were very uninformatively just logging
the value of the pointer rather than the string itself:

* the "name" arg to virNodeDeviceLookupByName()
* wwnn and wwpn args to virNodeDeviceLookupSCSIHostByWWN()

All char*'s that make sense should now have their contents logged
rather than the pointer, and all %s args should now be inside
NULLSTR().

src/libvirt-domain.c
src/libvirt-host.c
src/libvirt-interface.c
src/libvirt-network.c
src/libvirt-nodedev.c
src/libvirt-nwfilter.c
src/libvirt-secret.c
src/libvirt-storage.c

index 2edba1a5a8d00e8f6312c3c973b076455feb3aef..c40826deff3725466c8e092944bb3d8334bc24ec 100644 (file)
@@ -167,7 +167,7 @@ virDomainPtr
 virDomainCreateXML(virConnectPtr conn, const char *xmlDesc,
                    unsigned int flags)
 {
-    VIR_DEBUG("conn=%p, xmlDesc=%s, flags=%x", conn, xmlDesc, flags);
+    VIR_DEBUG("conn=%p, xmlDesc=%s, flags=%x", conn, NULLSTR(xmlDesc), flags);
 
     virResetLastError();
 
@@ -235,7 +235,7 @@ virDomainCreateXMLWithFiles(virConnectPtr conn, const char *xmlDesc,
                             unsigned int flags)
 {
     VIR_DEBUG("conn=%p, xmlDesc=%s, nfiles=%u, files=%p, flags=%x",
-              conn, xmlDesc, nfiles, files, flags);
+              conn, NULLSTR(xmlDesc), nfiles, files, flags);
 
     virResetLastError();
 
@@ -413,7 +413,7 @@ virDomainLookupByUUIDString(virConnectPtr conn, const char *uuidstr)
 virDomainPtr
 virDomainLookupByName(virConnectPtr conn, const char *name)
 {
-    VIR_DEBUG("conn=%p, name=%s", conn, name);
+    VIR_DEBUG("conn=%p, name=%s", conn, NULLSTR(name));
 
     virResetLastError();
 
@@ -955,7 +955,7 @@ virDomainSaveFlags(virDomainPtr domain, const char *to,
 int
 virDomainRestore(virConnectPtr conn, const char *from)
 {
-    VIR_DEBUG("conn=%p, from=%s", conn, from);
+    VIR_DEBUG("conn=%p, from=%s", conn, NULLSTR(from));
 
     virResetLastError();
 
@@ -1025,7 +1025,7 @@ virDomainRestoreFlags(virConnectPtr conn, const char *from, const char *dxml,
                       unsigned int flags)
 {
     VIR_DEBUG("conn=%p, from=%s, dxml=%s, flags=%x",
-              conn, from, NULLSTR(dxml), flags);
+              conn, NULLSTR(from), NULLSTR(dxml), flags);
 
     virResetLastError();
 
@@ -1089,7 +1089,7 @@ virDomainSaveImageGetXMLDesc(virConnectPtr conn, const char *file,
                              unsigned int flags)
 {
     VIR_DEBUG("conn=%p, file=%s, flags=%x",
-              conn, file, flags);
+              conn, NULLSTR(file), flags);
 
     virResetLastError();
 
@@ -1162,7 +1162,7 @@ virDomainSaveImageDefineXML(virConnectPtr conn, const char *file,
                             const char *dxml, unsigned int flags)
 {
     VIR_DEBUG("conn=%p, file=%s, dxml=%s, flags=%x",
-              conn, file, dxml, flags);
+              conn, NULLSTR(file), NULLSTR(dxml), flags);
 
     virResetLastError();
 
@@ -2623,7 +2623,7 @@ virConnectDomainXMLFromNative(virConnectPtr conn,
                               unsigned int flags)
 {
     VIR_DEBUG("conn=%p, format=%s, config=%s, flags=%x",
-              conn, nativeFormat, nativeConfig, flags);
+              conn, NULLSTR(nativeFormat), NULLSTR(nativeConfig), flags);
 
     virResetLastError();
 
@@ -2673,7 +2673,7 @@ virConnectDomainXMLToNative(virConnectPtr conn,
                             unsigned int flags)
 {
     VIR_DEBUG("conn=%p, format=%s, xml=%s, flags=%x",
-              conn, nativeFormat, domainXml, flags);
+              conn, NULLSTR(nativeFormat), NULLSTR(domainXml), flags);
 
     virResetLastError();
 
@@ -4597,7 +4597,7 @@ virDomainMigrateFinish(virConnectPtr dconn,
 {
     VIR_DEBUG("dconn=%p, dname=%s, cookie=%p, cookielen=%d, uri=%s, "
               "flags=%lx", dconn, NULLSTR(dname), cookie, cookielen,
-              uri, flags);
+              NULLSTR(uri), flags);
 
     virResetLastError();
 
@@ -4639,8 +4639,8 @@ virDomainMigratePrepare2(virConnectPtr dconn,
 {
     VIR_DEBUG("dconn=%p, cookie=%p, cookielen=%p, uri_in=%s, uri_out=%p,"
               "flags=%lx, dname=%s, bandwidth=%lu, dom_xml=%s", dconn,
-              cookie, cookielen, uri_in, uri_out, flags, NULLSTR(dname),
-              bandwidth, dom_xml);
+              cookie, cookielen, NULLSTR(uri_in), uri_out, flags, NULLSTR(dname),
+              bandwidth, NULLSTR(dom_xml));
 
     virResetLastError();
 
@@ -4681,7 +4681,7 @@ virDomainMigrateFinish2(virConnectPtr dconn,
 {
     VIR_DEBUG("dconn=%p, dname=%s, cookie=%p, cookielen=%d, uri=%s, "
               "flags=%lx, retcode=%d", dconn, NULLSTR(dname), cookie,
-              cookielen, uri, flags, retcode);
+              cookielen, NULLSTR(uri), flags, retcode);
 
     virResetLastError();
 
@@ -4721,7 +4721,7 @@ virDomainMigratePrepareTunnel(virConnectPtr conn,
 {
     VIR_DEBUG("conn=%p, stream=%p, flags=%lx, dname=%s, "
               "bandwidth=%lu, dom_xml=%s", conn, st, flags,
-              NULLSTR(dname), bandwidth, dom_xml);
+              NULLSTR(dname), bandwidth, NULLSTR(dom_xml));
 
     virResetLastError();
 
@@ -4817,8 +4817,8 @@ virDomainMigratePrepare3(virConnectPtr dconn,
     VIR_DEBUG("dconn=%p, cookiein=%p, cookieinlen=%d, cookieout=%p, "
               "cookieoutlen=%p, uri_in=%s, uri_out=%p, flags=%lx, dname=%s, "
               "bandwidth=%lu, dom_xml=%s",
-              dconn, cookiein, cookieinlen, cookieout, cookieoutlen, uri_in,
-              uri_out, flags, NULLSTR(dname), bandwidth, dom_xml);
+              dconn, cookiein, cookieinlen, cookieout, cookieoutlen, NULLSTR(uri_in),
+              uri_out, flags, NULLSTR(dname), bandwidth, NULLSTR(dom_xml));
 
     virResetLastError();
 
@@ -4866,7 +4866,7 @@ virDomainMigratePrepareTunnel3(virConnectPtr conn,
               "cookieoutlen=%p, flags=%lx, dname=%s, bandwidth=%lu, "
               "dom_xml=%s",
               conn, st, cookiein, cookieinlen, cookieout, cookieoutlen, flags,
-              NULLSTR(dname), bandwidth, dom_xml);
+              NULLSTR(dname), bandwidth, NULLSTR(dom_xml));
 
     virResetLastError();
 
@@ -6377,7 +6377,7 @@ virDomainGetBlockInfo(virDomainPtr domain, const char *disk,
 virDomainPtr
 virDomainDefineXML(virConnectPtr conn, const char *xml)
 {
-    VIR_DEBUG("conn=%p, xml=%s", conn, xml);
+    VIR_DEBUG("conn=%p, xml=%s", conn, NULLSTR(xml));
 
     virResetLastError();
 
@@ -6425,7 +6425,7 @@ virDomainDefineXML(virConnectPtr conn, const char *xml)
 virDomainPtr
 virDomainDefineXMLFlags(virConnectPtr conn, const char *xml, unsigned int flags)
 {
-    VIR_DEBUG("conn=%p, xml=%s flags=%x", conn, xml, flags);
+    VIR_DEBUG("conn=%p, xml=%s flags=%x", conn, NULLSTR(xml), flags);
 
     virResetLastError();
 
index 03bee1f5df04ad36fc4a7557174c47766ec37b20..9c88426ec48df17dbacc3106f4418706afbaabcc 100644 (file)
@@ -321,7 +321,7 @@ int
 virConnectGetMaxVcpus(virConnectPtr conn,
                       const char *type)
 {
-    VIR_DEBUG("conn=%p, type=%s", conn, type);
+    VIR_DEBUG("conn=%p, type=%s", conn, NULLSTR(type));
 
     virResetLastError();
 
@@ -965,7 +965,7 @@ virConnectCompareCPU(virConnectPtr conn,
                      const char *xmlDesc,
                      unsigned int flags)
 {
-    VIR_DEBUG("conn=%p, xmlDesc=%s, flags=%x", conn, xmlDesc, flags);
+    VIR_DEBUG("conn=%p, xmlDesc=%s, flags=%x", conn, NULLSTR(xmlDesc), flags);
 
     virResetLastError();
 
@@ -1009,7 +1009,7 @@ virConnectGetCPUModelNames(virConnectPtr conn, const char *arch, char ***models,
                            unsigned int flags)
 {
     VIR_DEBUG("conn=%p, arch=%s, models=%p, flags=%x",
-              conn, arch, models, flags);
+              conn, NULLSTR(arch), models, flags);
     virResetLastError();
 
     if (models)
index 4c155ca17b744d955a9573746f6771eb15d0561c..3d1a5ff8dbbb25f4cbf1ffe37e59afe0eba95d48 100644 (file)
@@ -284,7 +284,7 @@ virConnectListDefinedInterfaces(virConnectPtr conn,
 virInterfacePtr
 virInterfaceLookupByName(virConnectPtr conn, const char *name)
 {
-    VIR_DEBUG("conn=%p, name=%s", conn, name);
+    VIR_DEBUG("conn=%p, name=%s", conn, NULLSTR(name));
 
     virResetLastError();
 
@@ -323,7 +323,7 @@ virInterfaceLookupByName(virConnectPtr conn, const char *name)
 virInterfacePtr
 virInterfaceLookupByMACString(virConnectPtr conn, const char *macstr)
 {
-    VIR_DEBUG("conn=%p, macstr=%s", conn, macstr);
+    VIR_DEBUG("conn=%p, macstr=%s", conn, NULLSTR(macstr));
 
     virResetLastError();
 
@@ -464,7 +464,7 @@ virInterfaceGetXMLDesc(virInterfacePtr iface, unsigned int flags)
 virInterfacePtr
 virInterfaceDefineXML(virConnectPtr conn, const char *xml, unsigned int flags)
 {
-    VIR_DEBUG("conn=%p, xml=%s, flags=%x", conn, xml, flags);
+    VIR_DEBUG("conn=%p, xml=%s, flags=%x", conn, NULLSTR(xml), flags);
 
     virResetLastError();
 
index e3a36500831cf7163c57f21970968be99557586b..3136f27eea48f79ddbfe1da1f3970427e8d30e13 100644 (file)
@@ -290,7 +290,7 @@ virConnectListDefinedNetworks(virConnectPtr conn, char **const names,
 virNetworkPtr
 virNetworkLookupByName(virConnectPtr conn, const char *name)
 {
-    VIR_DEBUG("conn=%p, name=%s", conn, name);
+    VIR_DEBUG("conn=%p, name=%s", conn, NULLSTR(name));
 
     virResetLastError();
 
@@ -404,7 +404,7 @@ virNetworkLookupByUUIDString(virConnectPtr conn, const char *uuidstr)
 virNetworkPtr
 virNetworkCreateXML(virConnectPtr conn, const char *xmlDesc)
 {
-    VIR_DEBUG("conn=%p, xmlDesc=%s", conn, xmlDesc);
+    VIR_DEBUG("conn=%p, xmlDesc=%s", conn, NULLSTR(xmlDesc));
 
     virResetLastError();
 
@@ -444,7 +444,7 @@ virNetworkCreateXML(virConnectPtr conn, const char *xmlDesc)
 virNetworkPtr
 virNetworkDefineXML(virConnectPtr conn, const char *xml)
 {
-    VIR_DEBUG("conn=%p, xml=%s", conn, xml);
+    VIR_DEBUG("conn=%p, xml=%s", conn, NULLSTR(xml));
 
     virResetLastError();
 
index b6c6d1e96a409dbd301ccfcb497b89ed039ee41b..c1ca5750511a5f025106bd024893442de8707bd8 100644 (file)
@@ -1,7 +1,7 @@
 /*
  * libvirt-nodedev.c: entry points for virNodeDevPtr APIs
  *
- * Copyright (C) 2006-2014 Red Hat, Inc.
+ * Copyright (C) 2006-2015 Red Hat, Inc.
  *
  * This library is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
@@ -160,7 +160,7 @@ virNodeListDevices(virConnectPtr conn,
                    unsigned int flags)
 {
     VIR_DEBUG("conn=%p, cap=%s, names=%p, maxnames=%d, flags=%x",
-          conn, cap, names, maxnames, flags);
+              conn, NULLSTR(cap), names, maxnames, flags);
 
     virResetLastError();
 
@@ -199,7 +199,7 @@ virNodeListDevices(virConnectPtr conn,
 virNodeDevicePtr
 virNodeDeviceLookupByName(virConnectPtr conn, const char *name)
 {
-    VIR_DEBUG("conn=%p, name=%p", conn, name);
+    VIR_DEBUG("conn=%p, name=%s", conn, NULLSTR(name));
 
     virResetLastError();
 
@@ -242,7 +242,7 @@ virNodeDeviceLookupSCSIHostByWWN(virConnectPtr conn,
                                  const char *wwpn,
                                  unsigned int flags)
 {
-    VIR_DEBUG("conn=%p, wwnn=%p, wwpn=%p, flags=%x", conn, wwnn, wwpn, flags);
+    VIR_DEBUG("conn=%p, wwnn=%s, wwpn=%s, flags=%x", conn, NULLSTR(wwnn), NULLSTR(wwpn), flags);
 
     virResetLastError();
 
@@ -694,7 +694,7 @@ virNodeDeviceCreateXML(virConnectPtr conn,
                        const char *xmlDesc,
                        unsigned int flags)
 {
-    VIR_DEBUG("conn=%p, xmlDesc=%s, flags=%x", conn, xmlDesc, flags);
+    VIR_DEBUG("conn=%p, xmlDesc=%s, flags=%x", conn, NULLSTR(xmlDesc), flags);
 
     virResetLastError();
 
index 8bb6fa0e78f8e36fb90388ec997c534ab7242b4f..30c7c1040c910ece3909a7ec364eb131568fef65 100644 (file)
@@ -1,7 +1,7 @@
 /*
  * libvirt-nwfilter.c: entry points for virNwfilterPtr APIs
  *
- * Copyright (C) 2006-2014 Red Hat, Inc.
+ * Copyright (C) 2006-2015 Red Hat, Inc.
  *
  * This library is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
@@ -162,7 +162,7 @@ virConnectListNWFilters(virConnectPtr conn, char **const names, int maxnames)
 virNWFilterPtr
 virNWFilterLookupByName(virConnectPtr conn, const char *name)
 {
-    VIR_DEBUG("conn=%p, name=%s", conn, name);
+    VIR_DEBUG("conn=%p, name=%s", conn, NULLSTR(name));
 
     virResetLastError();
 
@@ -382,7 +382,7 @@ virNWFilterGetUUIDString(virNWFilterPtr nwfilter, char *buf)
 virNWFilterPtr
 virNWFilterDefineXML(virConnectPtr conn, const char *xmlDesc)
 {
-    VIR_DEBUG("conn=%p, xmlDesc=%s", conn, xmlDesc);
+    VIR_DEBUG("conn=%p, xmlDesc=%s", conn, NULLSTR(xmlDesc));
 
     virResetLastError();
 
index e77f223df515893ee1a5960ea5b54182cfb3c02d..fa306e3b1db7ee338558a12523efd9a6d36de274 100644 (file)
@@ -1,7 +1,7 @@
 /*
  * libvirt-secret.c: entry points for virSecretPtr APIs
  *
- * Copyright (C) 2006-2014 Red Hat, Inc.
+ * Copyright (C) 2006-2015 Red Hat, Inc.
  *
  * This library is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
@@ -336,7 +336,7 @@ virSecretLookupByUsage(virConnectPtr conn,
 virSecretPtr
 virSecretDefineXML(virConnectPtr conn, const char *xml, unsigned int flags)
 {
-    VIR_DEBUG("conn=%p, xml=%s, flags=%x", conn, xml, flags);
+    VIR_DEBUG("conn=%p, xml=%s, flags=%x", conn, NULLSTR(xml), flags);
 
     virResetLastError();
 
index 474f198511a16656d742dc34b72ab5eb007676ab..66dd9f0b8e37ec34397d368964830b9072acd633 100644 (file)
@@ -364,7 +364,7 @@ virStoragePoolPtr
 virStoragePoolLookupByName(virConnectPtr conn,
                            const char *name)
 {
-    VIR_DEBUG("conn=%p, name=%s", conn, name);
+    VIR_DEBUG("conn=%p, name=%s", conn, NULLSTR(name));
 
     virResetLastError();
 
@@ -521,7 +521,7 @@ virStoragePoolCreateXML(virConnectPtr conn,
                         const char *xmlDesc,
                         unsigned int flags)
 {
-    VIR_DEBUG("conn=%p, xmlDesc=%s, flags=%x", conn, xmlDesc, flags);
+    VIR_DEBUG("conn=%p, xmlDesc=%s, flags=%x", conn, NULLSTR(xmlDesc), flags);
 
     virResetLastError();
 
@@ -564,7 +564,7 @@ virStoragePoolDefineXML(virConnectPtr conn,
                         const char *xml,
                         unsigned int flags)
 {
-    VIR_DEBUG("conn=%p, xml=%s, flags=%x", conn, xml, flags);
+    VIR_DEBUG("conn=%p, xml=%s, flags=%x", conn, NULLSTR(xml), flags);
 
     virResetLastError();
 
@@ -1290,7 +1290,7 @@ virStorageVolPtr
 virStorageVolLookupByName(virStoragePoolPtr pool,
                           const char *name)
 {
-    VIR_DEBUG("pool=%p, name=%s", pool, name);
+    VIR_DEBUG("pool=%p, name=%s", pool, NULLSTR(name));
 
     virResetLastError();
 
@@ -1330,7 +1330,7 @@ virStorageVolPtr
 virStorageVolLookupByKey(virConnectPtr conn,
                          const char *key)
 {
-    VIR_DEBUG("conn=%p, key=%s", conn, key);
+    VIR_DEBUG("conn=%p, key=%s", conn, NULLSTR(key));
 
     virResetLastError();
 
@@ -1370,7 +1370,7 @@ virStorageVolPtr
 virStorageVolLookupByPath(virConnectPtr conn,
                           const char *path)
 {
-    VIR_DEBUG("conn=%p, path=%s", conn, path);
+    VIR_DEBUG("conn=%p, path=%s", conn, NULLSTR(path));
 
     virResetLastError();
 
@@ -1463,7 +1463,7 @@ virStorageVolCreateXML(virStoragePoolPtr pool,
                        const char *xmlDesc,
                        unsigned int flags)
 {
-    VIR_DEBUG("pool=%p, xmlDesc=%s, flags=%x", pool, xmlDesc, flags);
+    VIR_DEBUG("pool=%p, xmlDesc=%s, flags=%x", pool, NULLSTR(xmlDesc), flags);
 
     virResetLastError();
 
@@ -1516,7 +1516,7 @@ virStorageVolCreateXMLFrom(virStoragePoolPtr pool,
                            unsigned int flags)
 {
     VIR_DEBUG("pool=%p, xmlDesc=%s, clonevol=%p, flags=%x",
-              pool, xmlDesc, clonevol, flags);
+              pool, NULLSTR(xmlDesc), clonevol, flags);
 
     virResetLastError();