[PATCH] debug: assure NULLSTR() around all %s args in debug at top of public APIs

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

 



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    | 36 ++++++++++++++++++------------------
 src/libvirt-host.c      |  6 +++---
 src/libvirt-interface.c |  6 +++---
 src/libvirt-network.c   |  6 +++---
 src/libvirt-nodedev.c   | 10 +++++-----
 src/libvirt-nwfilter.c  |  6 +++---
 src/libvirt-secret.c    |  4 ++--
 src/libvirt-storage.c   | 16 ++++++++--------
 8 files changed, 45 insertions(+), 45 deletions(-)

diff --git a/src/libvirt-domain.c b/src/libvirt-domain.c
index 2edba1a..5907f58 100644
--- a/src/libvirt-domain.c
+++ b/src/libvirt-domain.c
@@ -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,7 +4817,7 @@ 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,
+              dconn, cookiein, cookieinlen, cookieout, cookieoutlen, NULLSTR(uri_in),
               uri_out, flags, NULLSTR(dname), bandwidth, 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();
 
diff --git a/src/libvirt-host.c b/src/libvirt-host.c
index 03bee1f..9c88426 100644
--- a/src/libvirt-host.c
+++ b/src/libvirt-host.c
@@ -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)
diff --git a/src/libvirt-interface.c b/src/libvirt-interface.c
index 4c155ca..3d1a5ff 100644
--- a/src/libvirt-interface.c
+++ b/src/libvirt-interface.c
@@ -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();
 
diff --git a/src/libvirt-network.c b/src/libvirt-network.c
index e3a3650..3136f27 100644
--- a/src/libvirt-network.c
+++ b/src/libvirt-network.c
@@ -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();
 
diff --git a/src/libvirt-nodedev.c b/src/libvirt-nodedev.c
index b6c6d1e..c1ca575 100644
--- a/src/libvirt-nodedev.c
+++ b/src/libvirt-nodedev.c
@@ -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();
 
diff --git a/src/libvirt-nwfilter.c b/src/libvirt-nwfilter.c
index 8bb6fa0..30c7c10 100644
--- a/src/libvirt-nwfilter.c
+++ b/src/libvirt-nwfilter.c
@@ -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();
 
diff --git a/src/libvirt-secret.c b/src/libvirt-secret.c
index e77f223..fa306e3 100644
--- a/src/libvirt-secret.c
+++ b/src/libvirt-secret.c
@@ -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();
 
diff --git a/src/libvirt-storage.c b/src/libvirt-storage.c
index 474f198..66dd9f0 100644
--- a/src/libvirt-storage.c
+++ b/src/libvirt-storage.c
@@ -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();
 
-- 
2.1.0

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