
On 07/18/2012 05:52 AM, Daniel P. Berrange wrote:
From: "Daniel P. Berrange" <berrange@redhat.com>
Update the storage driver to use virReportError instead of the virStorageReportError custom macro
Signed-off-by: Daniel P. Berrange <berrange@redhat.com> ---
Still big, but not as big as 7/13. Again, mostly mechanical, and I didn't spot any blatant problems. ACK.
+++ b/src/storage/storage_backend_rbd.c @@ -145,8 +145,8 @@ static int virStorageBackendRBDOpenRADOSConn(virStorageBackendRBDStatePtr *ptr, pool->def->source.hosts[i].name, pool->def->source.hosts[i].port); } else { - virStorageReportError(VIR_ERR_INTERNAL_ERROR, - _("received malformed monitor, check the XML definition")); + virReportError(VIR_ERR_INTERNAL_ERROR, + _("received malformed monitor, check the XML definition"));
Another case of missing "%s", worth a separate cleanup patch. [hmm, wonder how hard it would be to make cfg.mk detect a message without a '%' as part of syntax-check, rather than the current approach of building with NLS disabled to trigger a gcc warning]
+++ b/src/storage/storage_driver.c @@ -475,7 +475,7 @@ static int storagePoolIsActive(virStoragePoolPtr pool) obj = virStoragePoolObjFindByUUID(&driver->pools, pool->uuid); storageDriverUnlock(driver); if (!obj) { - virStorageReportError(VIR_ERR_NO_STORAGE_POOL, NULL); + virReportError(VIR_ERR_NO_STORAGE_POOL, NULL);
While this still gives a working error message, it's pretty weak, and I've noticed that at least on FreeBSD, the gcc version tends to issue warnings about a NULL format string. Maybe someday we should require all errors to have a message, rather than our current practice of permitting NULL for a default message. Or perhaps we could trivially silence those warnings if we make the virReportError macro expand to 'format ? format : ""' instead of 'format', but then you get into issues that gcc also warns about passing "" as a format string. But that gets hairy fast to support a macro with no format string by default (witness VIR_HAS_COMMA and other goop in libvirt.c to allow VIR_DOMAIN_DEBUG() to be smart). So for now, nothing to change here, at least without a real report of a build failure somewhere. -- Eric Blake eblake@redhat.com +1-919-301-3266 Libvirt virtualization library http://libvirt.org