[libvirt] [PATCH] libvirt, logging: cleanup VIR_DEBUG0() VIR_INFO0() VIR_WARN0() VIR_ERROR0()

These VIR_XXXX0 APIs make us confused, use the non-0-suffix APIs instead. How these coversions works? The magic is using ##. #define high_levle_api(fmt, ...) low_levle_api(fmt, ##__VA_ARGS__) When __VA_ARGS__ is empty, "##" will swallow the "," in "fmt," to avoid compile error. example: origin after CPP high_levle_api("%d", a_int) low_levle_api("%d", a_int) high_levle_api("a string") low_levle_api("a string") About 400 conversions. 8 special conversions: VIR_XXXX0("") -> VIR_XXXX(" ") (avoid empty format) 2 conversions VIR_XXXX0(string_literal_with_%) -> VIR_XXXX(%->%%) 0 conversions VIR_XXXX0(non_string_literal) -> VIR_XXXX("%s", non_string_literal) (for security) 6 conversions Signed-off-by: Lai Jiangshan <laijs@cn.fujitsu.com> --- daemon/libvirtd.c | 76 ++++++++++---------- daemon/remote.c | 32 ++++---- daemon/stream.c | 2 +- examples/domain-events/events-c/event-test.c | 10 +-- src/cpu/cpu_x86.c | 4 +- src/esx/esx_driver.c | 8 +- src/esx/esx_vi.c | 12 ++-- src/libvirt.c | 4 +- src/libxl/libxl_driver.c | 18 ++-- src/lxc/lxc_conf.c | 4 +- src/lxc/lxc_container.c | 10 +- src/lxc/lxc_controller.c | 8 +- src/lxc/lxc_driver.c | 12 ++-- src/network/bridge_driver.c | 4 +- src/node_device/node_device_hal.c | 28 ++++---- src/node_device/node_device_linux_sysfs.c | 2 +- src/node_device/node_device_udev.c | 8 +- src/nwfilter/nwfilter_ebiptables_driver.c | 2 +- src/openvz/openvz_driver.c | 6 +- src/phyp/phyp_driver.c | 102 +++++++++++++------------- src/qemu/qemu_audit.c | 30 ++++---- src/qemu/qemu_capabilities.c | 4 +- src/qemu/qemu_cgroup.c | 2 +- src/qemu/qemu_conf.c | 4 +- src/qemu/qemu_domain.c | 2 +- src/qemu/qemu_driver.c | 10 +- src/qemu/qemu_hotplug.c | 22 +++--- src/qemu/qemu_migration.c | 14 ++-- src/qemu/qemu_monitor.c | 2 +- src/qemu/qemu_monitor_json.c | 36 +++++----- src/qemu/qemu_monitor_text.c | 8 +- src/qemu/qemu_process.c | 48 ++++++------ src/remote/remote_driver.c | 64 ++++++++-------- src/secret/secret_driver.c | 2 +- src/storage/storage_backend_logical.c | 2 +- src/test/test_driver.c | 2 +- src/uml/uml_conf.c | 2 +- src/uml/uml_driver.c | 14 ++-- src/util/bridge.c | 10 +- src/util/cgroup.c | 4 +- src/util/command.c | 18 ++-- src/util/event.c | 4 +- src/util/event_poll.c | 2 +- src/util/hash.c | 2 +- src/util/json.c | 8 +- src/util/logging.c | 10 +- src/util/logging.h | 24 ++---- src/util/pci.c | 4 +- src/util/util.c | 8 +- src/util/virtaudit.c | 2 +- src/vbox/vbox_driver.c | 14 ++-- src/vbox/vbox_tmpl.c | 32 ++++---- src/vmx/vmx.c | 4 +- src/xen/xen_driver.c | 28 ++++---- src/xen/xen_hypervisor.c | 18 ++-- src/xen/xen_inotify.c | 12 ++-- src/xen/xend_internal.c | 2 +- src/xen/xs_internal.c | 12 ++-- src/xenxs/xen_sxpr.c | 2 +- 59 files changed, 415 insertions(+), 425 deletions(-) diff --git a/daemon/libvirtd.c b/daemon/libvirtd.c index 42cbe5d..900861a 100644 --- a/daemon/libvirtd.c +++ b/daemon/libvirtd.c @@ -413,11 +413,11 @@ qemudDispatchSignalEvent(int watch ATTRIBUTE_UNUSED, switch (siginfo.si_signo) { case SIGHUP: - VIR_INFO0(_("Reloading configuration on SIGHUP")); + VIR_INFO(_("Reloading configuration on SIGHUP")); virHookCall(VIR_HOOK_DRIVER_DAEMON, "-", VIR_HOOK_DAEMON_OP_RELOAD, SIGHUP, "SIGHUP", NULL); if (virStateReload() < 0) - VIR_WARN0("Error while reloading drivers"); + VIR_WARN("Error while reloading drivers"); break; @@ -566,7 +566,7 @@ static int qemudListenUnix(struct qemud_server *server, char ebuf[1024]; if (VIR_ALLOC(sock) < 0) { - VIR_ERROR0(_("Failed to allocate memory for struct qemud_socket")); + VIR_ERROR(_("Failed to allocate memory for struct qemud_socket")); return -1; } @@ -875,7 +875,7 @@ static struct qemud_server *qemudInitialize(void) { struct qemud_server *server; if (VIR_ALLOC(server) < 0) { - VIR_ERROR0(_("Failed to allocate struct qemud_server")); + VIR_ERROR(_("Failed to allocate struct qemud_server")); return NULL; } @@ -883,12 +883,12 @@ static struct qemud_server *qemudInitialize(void) { server->sigread = server->sigwrite = -1; if (virMutexInit(&server->lock) < 0) { - VIR_ERROR0(_("cannot initialize mutex")); + VIR_ERROR(_("cannot initialize mutex")); VIR_FREE(server); return NULL; } if (virCondInit(&server->job) < 0) { - VIR_ERROR0(_("cannot initialize condition variable")); + VIR_ERROR(_("cannot initialize condition variable")); virMutexDestroy(&server->lock); VIR_FREE(server); return NULL; @@ -1103,7 +1103,7 @@ static int qemudNetworkEnable(struct qemud_server *server) { VIR_EVENT_HANDLE_HANGUP, qemudDispatchServerEvent, server, NULL)) < 0) { - VIR_ERROR0(_("Failed to add server event callback")); + VIR_ERROR(_("Failed to add server event callback")); return -1; } @@ -1189,29 +1189,29 @@ remoteCheckCertificate(struct qemud_client *client) if (status != 0) { if (status & GNUTLS_CERT_INVALID) - VIR_ERROR0(_("The client certificate is not trusted.")); + VIR_ERROR(_("The client certificate is not trusted.")); if (status & GNUTLS_CERT_SIGNER_NOT_FOUND) - VIR_ERROR0(_("The client certificate has unknown issuer.")); + VIR_ERROR(_("The client certificate has unknown issuer.")); if (status & GNUTLS_CERT_REVOKED) - VIR_ERROR0(_("The client certificate has been revoked.")); + VIR_ERROR(_("The client certificate has been revoked.")); #ifndef GNUTLS_1_0_COMPAT if (status & GNUTLS_CERT_INSECURE_ALGORITHM) - VIR_ERROR0(_("The client certificate uses an insecure algorithm.")); + VIR_ERROR(_("The client certificate uses an insecure algorithm.")); #endif goto authdeny; } if (gnutls_certificate_type_get(client->tlssession) != GNUTLS_CRT_X509) { - VIR_ERROR0(_("Only x509 certificates are supported")); + VIR_ERROR(_("Only x509 certificates are supported")); goto authdeny; } if (!(certs = gnutls_certificate_get_peers(client->tlssession, &nCerts))) { - VIR_ERROR0(_("The certificate has no peers")); + VIR_ERROR(_("The certificate has no peers")); goto authdeny; } @@ -1221,12 +1221,12 @@ remoteCheckCertificate(struct qemud_client *client) gnutls_x509_crt_t cert; if (gnutls_x509_crt_init (&cert) < 0) { - VIR_ERROR0(_("Unable to initialize certificate")); + VIR_ERROR(_("Unable to initialize certificate")); goto authfail; } if (gnutls_x509_crt_import(cert, &certs[i], GNUTLS_X509_FMT_DER) < 0) { - VIR_ERROR0(_("Unable to load certificate")); + VIR_ERROR(_("Unable to load certificate")); gnutls_x509_crt_deinit (cert); goto authfail; } @@ -1242,7 +1242,7 @@ remoteCheckCertificate(struct qemud_client *client) if (!remoteCheckDN (name)) { /* This is the most common error: make it informative. */ - VIR_ERROR0(_("Client's Distinguished Name is not on the list " + VIR_ERROR(_("Client's Distinguished Name is not on the list " "of allowed clients (tls_allowed_dn_list). Use " "'certtool -i --infile clientcert.pem' to view the" "Distinguished Name field in the client certificate," @@ -1253,13 +1253,13 @@ remoteCheckCertificate(struct qemud_client *client) } if (gnutls_x509_crt_get_expiration_time (cert) < now) { - VIR_ERROR0(_("The client certificate has expired")); + VIR_ERROR(_("The client certificate has expired")); gnutls_x509_crt_deinit (cert); goto authdeny; } if (gnutls_x509_crt_get_activation_time (cert) > now) { - VIR_ERROR0(_("The client certificate is not yet active")); + VIR_ERROR(_("The client certificate is not yet active")); gnutls_x509_crt_deinit (cert); goto authdeny; } @@ -1285,10 +1285,10 @@ remoteCheckAccess (struct qemud_client *client) /* Verify client certificate. */ if (remoteCheckCertificate (client) == -1) { - VIR_ERROR0(_("remoteCheckCertificate: " + VIR_ERROR(_("remoteCheckCertificate: " "failed to verify client's certificate")); if (!tls_no_verify_certificate) return -1; - else VIR_INFO0(_("remoteCheckCertificate: tls_no_verify_certificate " + else VIR_INFO(_("remoteCheckCertificate: tls_no_verify_certificate " "is set so the bad certificate is ignored")); } @@ -1356,7 +1356,7 @@ static int qemudDispatchServer(struct qemud_server *server, struct qemud_socket return -1; } if (!(addrstr = virSocketFormatAddrFull(&addr, true, ";"))) { - VIR_ERROR0(_("Failed to format addresss: out of memory")); + VIR_ERROR(_("Failed to format addresss: out of memory")); goto error; } @@ -1371,7 +1371,7 @@ static int qemudDispatchServer(struct qemud_server *server, struct qemud_socket if (VIR_RESIZE_N(server->clients, server->nclients_max, server->nclients, 1) < 0) { - VIR_ERROR0(_("Out of memory allocating clients")); + VIR_ERROR(_("Out of memory allocating clients")); goto error; } @@ -1408,7 +1408,7 @@ static int qemudDispatchServer(struct qemud_server *server, struct qemud_socket if (VIR_ALLOC(client) < 0) goto error; if (virMutexInit(&client->lock) < 0) { - VIR_ERROR0(_("cannot initialize mutex")); + VIR_ERROR(_("cannot initialize mutex")); goto error; } @@ -1845,7 +1845,7 @@ readmore: if (!xdr_u_int(&x, &len)) { xdr_destroy (&x); - VIR_DEBUG0("Failed to decode packet length"); + VIR_DEBUG("Failed to decode packet length"); qemudDispatchClientFailure(client); return; } @@ -2298,10 +2298,10 @@ static void qemudInactiveTimer(int timerid, void *data) { if (virStateActive() || server->clients) { - VIR_DEBUG0("Timer expired but still active, not shutting down"); + VIR_DEBUG("Timer expired but still active, not shutting down"); virEventUpdateTimeout(timerid, -1); } else { - VIR_DEBUG0("Timer expired and inactive, shutting down"); + VIR_DEBUG("Timer expired and inactive, shutting down"); server->quitEventThread = 1; } } @@ -2345,7 +2345,7 @@ static void *qemudRunLoop(void *opaque) { (timerid = virEventAddTimeout(-1, qemudInactiveTimer, server, NULL)) < 0) { - VIR_ERROR0(_("Failed to register shutdown timeout")); + VIR_ERROR(_("Failed to register shutdown timeout")); return NULL; } @@ -2354,7 +2354,7 @@ static void *qemudRunLoop(void *opaque) { server->nworkers = max_workers; if (VIR_ALLOC_N(server->workers, server->nworkers) < 0) { - VIR_ERROR0(_("Failed to allocate workers")); + VIR_ERROR(_("Failed to allocate workers")); return NULL; } @@ -2389,7 +2389,7 @@ static void *qemudRunLoop(void *opaque) { virMutexUnlock(&server->lock); if (qemudOneLoop() < 0) { virMutexLock(&server->lock); - VIR_DEBUG0("Loop iteration error, exiting"); + VIR_DEBUG("Loop iteration error, exiting"); break; } virMutexLock(&server->lock); @@ -2879,7 +2879,7 @@ remoteReadConfigFile (struct qemud_server *server, const char *filename) GET_CONF_STR (conf, filename, unix_sock_group); if (unix_sock_group) { if (!server->privileged) { - VIR_WARN0("Cannot set group when not running as root"); + VIR_WARN("Cannot set group when not running as root"); } else { int ret; struct group grpdata, *grp; @@ -2889,7 +2889,7 @@ remoteReadConfigFile (struct qemud_server *server, const char *filename) maxbuf = 1024; if (VIR_ALLOC_N(buf, maxbuf) < 0) { - VIR_ERROR0(_("Failed to allocate memory for buffer")); + VIR_ERROR(_("Failed to allocate memory for buffer")); goto free_and_fail; } @@ -2898,7 +2898,7 @@ remoteReadConfigFile (struct qemud_server *server, const char *filename) &grp)) == ERANGE) { maxbuf *= 2; if (maxbuf > 65536 || VIR_REALLOC_N(buf, maxbuf) < 0) { - VIR_ERROR0(_("Failed to reallocate enough memory for buffer")); + VIR_ERROR(_("Failed to reallocate enough memory for buffer")); goto free_and_fail; } } @@ -3012,13 +3012,13 @@ qemudSetupPrivs (void) if (__init_daemon_priv (PU_RESETGROUPS | PU_CLEARLIMITSET, SYSTEM_UID, SYSTEM_UID, PRIV_XVM_CONTROL, NULL)) { - VIR_ERROR0(_("additional privileges are required")); + VIR_ERROR(_("additional privileges are required")); return -1; } if (priv_set (PRIV_OFF, PRIV_ALLSETS, PRIV_FILE_LINK_ANY, PRIV_PROC_INFO, PRIV_PROC_SESSION, PRIV_PROC_EXEC, PRIV_PROC_FORK, NULL)) { - VIR_ERROR0(_("failed to set reduced privileges")); + VIR_ERROR(_("failed to set reduced privileges")); return -1; } @@ -3084,7 +3084,7 @@ daemonSetupSignals(struct qemud_server *server) VIR_EVENT_HANDLE_READABLE, qemudDispatchSignalEvent, server, NULL) < 0) { - VIR_ERROR0(_("Failed to register callback for signal pipe")); + VIR_ERROR(_("Failed to register callback for signal pipe")); goto error; } @@ -3374,7 +3374,7 @@ int main(int argc, char **argv) { /* Start the event loop in a background thread, since * state initialization needs events to be being processed */ if (qemudStartEventLoop(server) < 0) { - VIR_ERROR0(_("Event thread startup failed")); + VIR_ERROR(_("Event thread startup failed")); goto error; } @@ -3383,14 +3383,14 @@ int main(int argc, char **argv) { * we're ready, since it can take a long time and this will * seriously delay OS bootup process */ if (virStateInitialize(server->privileged) < 0) { - VIR_ERROR0(_("Driver state initialization failed")); + VIR_ERROR(_("Driver state initialization failed")); goto shutdown; } /* Start accepting new clients from network */ virMutexLock(&server->lock); if (qemudNetworkEnable(server) < 0) { - VIR_ERROR0(_("Network event loop enablement failed")); + VIR_ERROR(_("Network event loop enablement failed")); goto shutdown; } virMutexUnlock(&server->lock); diff --git a/daemon/remote.c b/daemon/remote.c index 2220655..c2faf0f 100644 --- a/daemon/remote.c +++ b/daemon/remote.c @@ -359,7 +359,7 @@ static int remoteRelayDomainEventGraphics(virConnectPtr conn ATTRIBUTE_UNUSED, data.subject.subject_len = subject->nidentity; if (VIR_ALLOC_N(data.subject.subject_val, data.subject.subject_len) < 0) { - VIR_WARN0("cannot allocate memory for graphics event subject"); + VIR_WARN("cannot allocate memory for graphics event subject"); return -1; } for (i = 0 ; i < data.subject.subject_len ; i++) { @@ -1754,7 +1754,7 @@ remoteDispatchAuthSaslInit(struct qemud_server *server, VIR_DEBUG("Initialize SASL auth %d", client->fd); if (client->auth != REMOTE_AUTH_SASL || client->saslconn != NULL) { - VIR_ERROR0(_("client tried invalid SASL init request")); + VIR_ERROR(_("client tried invalid SASL init request")); goto authfail; } @@ -1808,7 +1808,7 @@ remoteDispatchAuthSaslInit(struct qemud_server *server, cipher = gnutls_cipher_get(client->tlssession); if (!(ssf = (sasl_ssf_t)gnutls_cipher_get_key_size(cipher))) { - VIR_ERROR0(_("cannot get TLS cipher size")); + VIR_ERROR(_("cannot get TLS cipher size")); sasl_dispose(&client->saslconn); client->saslconn = NULL; goto authfail; @@ -1870,7 +1870,7 @@ remoteDispatchAuthSaslInit(struct qemud_server *server, VIR_DEBUG("Available mechanisms for client: '%s'", mechlist); ret->mechlist = strdup(mechlist); if (!ret->mechlist) { - VIR_ERROR0(_("cannot allocate mechlist")); + VIR_ERROR(_("cannot allocate mechlist")); sasl_dispose(&client->saslconn); client->saslconn = NULL; goto authfail; @@ -1954,7 +1954,7 @@ remoteSASLCheckAccess(struct qemud_server *server, return -1; } if (val == NULL) { - VIR_ERROR0(_("no client username was found")); + VIR_ERROR(_("no client username was found")); remoteDispatchAuthError(rerr); sasl_dispose(&client->saslconn); client->saslconn = NULL; @@ -1964,7 +1964,7 @@ remoteSASLCheckAccess(struct qemud_server *server, client->saslUsername = strdup((const char*)val); if (client->saslUsername == NULL) { - VIR_ERROR0(_("out of memory copying username")); + VIR_ERROR(_("out of memory copying username")); remoteDispatchAuthError(rerr); sasl_dispose(&client->saslconn); client->saslconn = NULL; @@ -2014,7 +2014,7 @@ remoteDispatchAuthSaslStart(struct qemud_server *server, VIR_DEBUG("Start SASL auth %d", client->fd); if (client->auth != REMOTE_AUTH_SASL || client->saslconn == NULL) { - VIR_ERROR0(_("client tried invalid SASL start request")); + VIR_ERROR(_("client tried invalid SASL start request")); goto authfail; } @@ -2115,7 +2115,7 @@ remoteDispatchAuthSaslStep(struct qemud_server *server, VIR_DEBUG("Step SASL auth %d", client->fd); if (client->auth != REMOTE_AUTH_SASL || client->saslconn == NULL) { - VIR_ERROR0(_("client tried invalid SASL start request")); + VIR_ERROR(_("client tried invalid SASL start request")); goto authfail; } @@ -2207,7 +2207,7 @@ remoteDispatchAuthSaslInit(struct qemud_server *server ATTRIBUTE_UNUSED, void *args ATTRIBUTE_UNUSED, remote_auth_sasl_init_ret *ret ATTRIBUTE_UNUSED) { - VIR_ERROR0(_("client tried unsupported SASL init request")); + VIR_ERROR(_("client tried unsupported SASL init request")); PROBE(CLIENT_AUTH_FAIL, "fd=%d, auth=%d", client->fd, REMOTE_AUTH_SASL); remoteDispatchAuthError(rerr); return -1; @@ -2222,7 +2222,7 @@ remoteDispatchAuthSaslStart(struct qemud_server *server ATTRIBUTE_UNUSED, remote_auth_sasl_start_args *args ATTRIBUTE_UNUSED, remote_auth_sasl_start_ret *ret ATTRIBUTE_UNUSED) { - VIR_ERROR0(_("client tried unsupported SASL start request")); + VIR_ERROR(_("client tried unsupported SASL start request")); PROBE(CLIENT_AUTH_FAIL, "fd=%d, auth=%d", client->fd, REMOTE_AUTH_SASL); remoteDispatchAuthError(rerr); return -1; @@ -2237,7 +2237,7 @@ remoteDispatchAuthSaslStep(struct qemud_server *server ATTRIBUTE_UNUSED, remote_auth_sasl_step_args *args ATTRIBUTE_UNUSED, remote_auth_sasl_step_ret *ret ATTRIBUTE_UNUSED) { - VIR_ERROR0(_("client tried unsupported SASL step request")); + VIR_ERROR(_("client tried unsupported SASL step request")); PROBE(CLIENT_AUTH_FAIL, "fd=%d, auth=%d", client->fd, REMOTE_AUTH_SASL); remoteDispatchAuthError(rerr); return -1; @@ -2283,12 +2283,12 @@ remoteDispatchAuthPolkit(struct qemud_server *server, VIR_DEBUG("Start PolicyKit auth %d", client->fd); if (client->auth != REMOTE_AUTH_POLKIT) { - VIR_ERROR0(_("client tried invalid PolicyKit init request")); + VIR_ERROR(_("client tried invalid PolicyKit init request")); goto authfail; } if (qemudGetSocketIdentity(client->fd, &callerUid, &callerPid) < 0) { - VIR_ERROR0(_("cannot get peer socket identity")); + VIR_ERROR(_("cannot get peer socket identity")); goto authfail; } @@ -2375,12 +2375,12 @@ remoteDispatchAuthPolkit(struct qemud_server *server, VIR_DEBUG("Start PolicyKit auth %d", client->fd); if (client->auth != REMOTE_AUTH_POLKIT) { - VIR_ERROR0(_("client tried invalid PolicyKit init request")); + VIR_ERROR(_("client tried invalid PolicyKit init request")); goto authfail; } if (qemudGetSocketIdentity(client->fd, &callerUid, &callerPid) < 0) { - VIR_ERROR0(_("cannot get peer socket identity")); + VIR_ERROR(_("cannot get peer socket identity")); goto authfail; } @@ -2485,7 +2485,7 @@ remoteDispatchAuthPolkit(struct qemud_server *server ATTRIBUTE_UNUSED, void *args ATTRIBUTE_UNUSED, remote_auth_polkit_ret *ret ATTRIBUTE_UNUSED) { - VIR_ERROR0(_("client tried unsupported PolicyKit init request")); + VIR_ERROR(_("client tried unsupported PolicyKit init request")); remoteDispatchAuthError(rerr); return -1; } diff --git a/daemon/stream.c b/daemon/stream.c index b71df92..cada0a1 100644 --- a/daemon/stream.c +++ b/daemon/stream.c @@ -401,7 +401,7 @@ remoteStreamHandleWriteData(struct qemud_client *client, /* Blocking, so indicate we have more todo later */ return 1; } else { - VIR_INFO0("Stream send failed"); + VIR_INFO("Stream send failed"); stream->closed = 1; remoteDispatchError(&rerr); return remoteSerializeReplyError(client, &rerr, &msg->hdr); diff --git a/examples/domain-events/events-c/event-test.c b/examples/domain-events/events-c/event-test.c index 1f46d42..52ec5d0 100644 --- a/examples/domain-events/events-c/event-test.c +++ b/examples/domain-events/events-c/event-test.c @@ -8,10 +8,8 @@ #include <libvirt/libvirt.h> #include <libvirt/virterror.h> -#define VIR_DEBUG0(fmt) printf("%s:%d :: " fmt "\n", \ - __func__, __LINE__) #define VIR_DEBUG(fmt, ...) printf("%s:%d: " fmt "\n", \ - __func__, __LINE__, __VA_ARGS__) + __func__, __LINE__, ##__VA_ARGS__) #define STREQ(a,b) (strcmp(a,b) == 0) #ifndef ATTRIBUTE_UNUSED @@ -304,7 +302,7 @@ int main(int argc, char **argv) sigaction(SIGTERM, &action_stop, NULL); sigaction(SIGINT, &action_stop, NULL); - VIR_DEBUG0("Registering domain event cbs"); + VIR_DEBUG("Registering domain event cbs"); /* Add 2 callbacks to prove this works with more than just one */ callback1ret = virConnectDomainEventRegister(dconn, myDomainEventCallback1, @@ -355,7 +353,7 @@ int main(int argc, char **argv) } } - VIR_DEBUG0("Deregistering event handlers"); + VIR_DEBUG("Deregistering event handlers"); virConnectDomainEventDeregister(dconn, myDomainEventCallback1); virConnectDomainEventDeregisterAny(dconn, callback2ret); virConnectDomainEventDeregisterAny(dconn, callback3ret); @@ -365,7 +363,7 @@ int main(int argc, char **argv) virConnectDomainEventDeregisterAny(dconn, callback7ret); } - VIR_DEBUG0("Closing connection"); + VIR_DEBUG("Closing connection"); if (dconn && virConnectClose(dconn) < 0) { printf("error closing\n"); } diff --git a/src/cpu/cpu_x86.c b/src/cpu/cpu_x86.c index ae8e5e7..4a4272e 100644 --- a/src/cpu/cpu_x86.c +++ b/src/cpu/cpu_x86.c @@ -1183,7 +1183,7 @@ x86Compute(virCPUDefPtr host, x86DataSubtract(cpu_require->data, cpu_disable->data); result = x86ModelCompare(host_model, cpu_require); if (result == SUBSET || result == UNRELATED) { - VIR_DEBUG0("Host CPU does not provide all required features"); + VIR_DEBUG("Host CPU does not provide all required features"); ret = VIR_CPU_COMPARE_INCOMPATIBLE; goto out; } @@ -1204,7 +1204,7 @@ x86Compute(virCPUDefPtr host, if (ret == VIR_CPU_COMPARE_SUPERSET && cpu->type == VIR_CPU_TYPE_GUEST && cpu->match == VIR_CPU_MATCH_STRICT) { - VIR_DEBUG0("Host CPU does not strictly match guest CPU"); + VIR_DEBUG("Host CPU does not strictly match guest CPU"); ret = VIR_CPU_COMPARE_INCOMPATIBLE; goto out; } diff --git a/src/esx/esx_driver.c b/src/esx/esx_driver.c index 7933f11..bd1dc11 100644 --- a/src/esx/esx_driver.c +++ b/src/esx/esx_driver.c @@ -734,7 +734,7 @@ esxConnectToHost(esxPrivate *priv, virConnectAuthPtr auth, /* Warn if host is in maintenance mode */ if (inMaintenanceMode == esxVI_Boolean_True) { - VIR_WARN0("The server is in maintenance mode"); + VIR_WARN("The server is in maintenance mode"); } if (*vCenterIpAddress != NULL) { @@ -2342,7 +2342,7 @@ esxDomainGetInfo(virDomainPtr domain, virDomainInfoPtr info) } if (priv->usedCpuTimeCounterId < 0) { - VIR_WARN0("Could not find 'used CPU time' performance counter"); + VIR_WARN("Could not find 'used CPU time' performance counter"); } } @@ -2374,7 +2374,7 @@ esxDomainGetInfo(virDomainPtr domain, virDomainInfoPtr info) for (perfEntityMetricBase = perfEntityMetricBaseList; perfEntityMetricBase != NULL; perfEntityMetricBase = perfEntityMetricBase->_next) { - VIR_DEBUG0("perfEntityMetric ..."); + VIR_DEBUG("perfEntityMetric ..."); perfEntityMetric = esxVI_PerfEntityMetric_DynamicCast(perfEntityMetricBase); @@ -2398,7 +2398,7 @@ esxDomainGetInfo(virDomainPtr domain, virDomainInfoPtr info) for (; perfMetricIntSeries != NULL; perfMetricIntSeries = perfMetricIntSeries->_next) { - VIR_DEBUG0("perfMetricIntSeries ..."); + VIR_DEBUG("perfMetricIntSeries ..."); for (value = perfMetricIntSeries->value; value != NULL; diff --git a/src/esx/esx_vi.c b/src/esx/esx_vi.c index 2bb1794..ca5376e 100644 --- a/src/esx/esx_vi.c +++ b/src/esx/esx_vi.c @@ -200,7 +200,7 @@ esxVI_CURL_Debug(CURL *curl ATTRIBUTE_UNUSED, curl_infotype type, break; default: - VIR_DEBUG0("unknown"); + VIR_DEBUG("unknown"); break; } @@ -497,7 +497,7 @@ ESX_VI__TEMPLATE__FREE(SharedCURL, if (item->count > 0) { /* Better leak than crash */ - VIR_ERROR0(_("Trying to free SharedCURL object that is still in use")); + VIR_ERROR(_("Trying to free SharedCURL object that is still in use")); return; } @@ -2143,7 +2143,7 @@ esxVI_GetVirtualMachineIdentity(esxVI_ObjectContent *virtualMachine, } else { memset(uuid, 0, VIR_UUID_BUFLEN); - VIR_WARN0("Cannot access UUID, because 'configStatus' property " + VIR_WARN("Cannot access UUID, because 'configStatus' property " "indicates a config problem"); } } @@ -3715,12 +3715,12 @@ esxVI_WaitForTaskCompletion(esxVI_Context *ctx, if (taskInfo->cancelable == esxVI_Boolean_True) { if (esxVI_CancelTask(ctx, task) < 0 && blocked == esxVI_Boolean_True) { - VIR_ERROR0(_("Cancelable task is blocked by an " + VIR_ERROR(_("Cancelable task is blocked by an " "unanswered question but cancelation " "failed")); } } else if (blocked == esxVI_Boolean_True) { - VIR_ERROR0(_("Non-cancelable task is blocked by an " + VIR_ERROR(_("Non-cancelable task is blocked by an " "unanswered question")); } @@ -3776,7 +3776,7 @@ esxVI_WaitForTaskCompletion(esxVI_Context *ctx, } if (esxVI_DestroyPropertyFilter(ctx, propertyFilter) < 0) { - VIR_DEBUG0("DestroyPropertyFilter failed"); + VIR_DEBUG("DestroyPropertyFilter failed"); } if (esxVI_TaskInfoState_CastFromAnyType(propertyValue, finalState) < 0) { diff --git a/src/libvirt.c b/src/libvirt.c index e74e977..54a34cc 100644 --- a/src/libvirt.c +++ b/src/libvirt.c @@ -358,7 +358,7 @@ virInitialize(void) virLogSetFromEnv(); - VIR_DEBUG0("register drivers"); + VIR_DEBUG("register drivers"); #if HAVE_WINSOCK2_H if (winsock_init () == -1) return -1; @@ -1027,7 +1027,7 @@ do_open (const char *name, NULLSTR(ret->uri->user), ret->uri->port, NULLSTR(ret->uri->path)); } else { - VIR_DEBUG0("no name, allowing driver auto-select"); + VIR_DEBUG("no name, allowing driver auto-select"); } /* Cleansing flags */ diff --git a/src/libxl/libxl_driver.c b/src/libxl/libxl_driver.c index a2c8467..47d2396 100644 --- a/src/libxl/libxl_driver.c +++ b/src/libxl/libxl_driver.c @@ -729,14 +729,14 @@ libxlStartup(int privileged) { /* Disable libxl driver if non-root */ if (!privileged) { - VIR_INFO0("Not running privileged, disabling libxenlight driver"); + VIR_INFO("Not running privileged, disabling libxenlight driver"); return 0; } /* Disable driver if legacy xen toolstack (xend) is in use */ cmd = virCommandNewArgList("/usr/sbin/xend", "status", NULL); if (virCommandRun(cmd, &status) == 0 && status == 0) { - VIR_INFO0("Legacy xen tool stack seems to be in use, disabling " + VIR_INFO("Legacy xen tool stack seems to be in use, disabling " "libxenlight driver."); virCommandFree(cmd); return 0; @@ -747,7 +747,7 @@ libxlStartup(int privileged) { return -1; if (virMutexInit(&libxl_driver->lock) < 0) { - VIR_ERROR0(_("cannot initialize mutex")); + VIR_ERROR(_("cannot initialize mutex")); VIR_FREE(libxl_driver); return -1; } @@ -835,19 +835,19 @@ libxlStartup(int privileged) { libxl_driver->logger = (xentoollog_logger *)xtl_createlogger_stdiostream(libxl_driver->logger_file, XTL_DEBUG, 0); if (!libxl_driver->logger) { - VIR_ERROR0(_("cannot create logger for libxenlight")); + VIR_ERROR(_("cannot create logger for libxenlight")); goto fail; } if (libxl_ctx_init(&libxl_driver->ctx, LIBXL_VERSION, libxl_driver->logger)) { - VIR_ERROR0(_("cannot initialize libxenlight context")); + VIR_ERROR(_("cannot initialize libxenlight context")); goto fail; } if ((ver_info = libxl_get_version_info(&libxl_driver->ctx)) == NULL) { - VIR_ERROR0(_("cannot version information from libxenlight")); + VIR_ERROR(_("cannot version information from libxenlight")); goto fail; } libxl_driver->version = (ver_info->xen_version_major * 1000000) + @@ -855,7 +855,7 @@ libxlStartup(int privileged) { if ((libxl_driver->caps = libxlMakeCapabilities(&libxl_driver->ctx)) == NULL) { - VIR_ERROR0(_("cannot create capabilities for libxenlight")); + VIR_ERROR(_("cannot create capabilities for libxenlight")); goto error; } @@ -1958,7 +1958,7 @@ libxlDomainXMLFromNative(virConnectPtr conn, const char * nativeFormat, } if ((ver_info = libxl_get_version_info(&driver->ctx)) == NULL) { - VIR_ERROR0(_("cannot get version information from libxenlight")); + VIR_ERROR(_("cannot get version information from libxenlight")); goto cleanup; } @@ -1999,7 +1999,7 @@ libxlDomainXMLToNative(virConnectPtr conn, const char * nativeFormat, } if ((ver_info = libxl_get_version_info(&driver->ctx)) == NULL) { - VIR_ERROR0(_("cannot get version information from libxenlight")); + VIR_ERROR(_("cannot get version information from libxenlight")); goto cleanup; } diff --git a/src/lxc/lxc_conf.c b/src/lxc/lxc_conf.c index 226a57e..b2586eb 100644 --- a/src/lxc/lxc_conf.c +++ b/src/lxc/lxc_conf.c @@ -60,7 +60,7 @@ virCapsPtr lxcCapsInit(void) */ if (nodeCapsInitNUMA(caps) < 0) { virCapabilitiesFreeNUMAInfo(caps); - VIR_WARN0("Failed to query host NUMA topology, disabling NUMA capabilities"); + VIR_WARN("Failed to query host NUMA topology, disabling NUMA capabilities"); } if (virGetHostUUID(caps->host.host_uuid)) { @@ -151,7 +151,7 @@ int lxcLoadDriverConfig(lxc_driver_t *driver) p = virConfGetValue(conf, "log_with_libvirtd"); if (p) { if (p->type != VIR_CONF_LONG) - VIR_WARN0("lxcLoadDriverConfig: invalid setting: log_with_libvirtd"); + VIR_WARN("lxcLoadDriverConfig: invalid setting: log_with_libvirtd"); else driver->log_libvirtd = p->l; } diff --git a/src/lxc/lxc_container.c b/src/lxc/lxc_container.c index af453f3..b8bf654 100644 --- a/src/lxc/lxc_container.c +++ b/src/lxc/lxc_container.c @@ -244,7 +244,7 @@ static int lxcContainerWaitForContinue(int control) } VIR_FORCE_CLOSE(control); - VIR_DEBUG0("Received container continue message"); + VIR_DEBUG("Received container continue message"); return 0; } @@ -743,7 +743,7 @@ static int lxcContainerDropCapabilities(void) * be unmasked - they can never escape the bounding set. */ #else - VIR_WARN0("libcap-ng support not compiled in, unable to clear capabilities"); + VIR_WARN("libcap-ng support not compiled in, unable to clear capabilities"); #endif return 0; } @@ -892,12 +892,12 @@ int lxcContainerStart(virDomainDefPtr def, flags = CLONE_NEWPID|CLONE_NEWNS|CLONE_NEWUTS|CLONE_NEWIPC|SIGCHLD; if (userns_supported()) { - VIR_DEBUG0("Enable user namespaces"); + VIR_DEBUG("Enable user namespaces"); flags |= CLONE_NEWUSER; } if (def->nets != NULL) { - VIR_DEBUG0("Enable network namespaces"); + VIR_DEBUG("Enable network namespaces"); flags |= CLONE_NEWNET; } @@ -936,7 +936,7 @@ int lxcContainerAvailable(int features) flags |= CLONE_NEWNET; if (VIR_ALLOC_N(stack, getpagesize() * 4) < 0) { - VIR_DEBUG0("Unable to allocate stack"); + VIR_DEBUG("Unable to allocate stack"); return -1; } diff --git a/src/lxc/lxc_controller.c b/src/lxc/lxc_controller.c index 7ea69fb..5c4bd1f 100644 --- a/src/lxc/lxc_controller.c +++ b/src/lxc/lxc_controller.c @@ -315,7 +315,7 @@ static int lxcControllerClearCapabilities(void) return -1; } #else - VIR_WARN0("libcap-ng support not compiled in, unable to clear capabilities"); + VIR_WARN("libcap-ng support not compiled in, unable to clear capabilities"); #endif return 0; } @@ -655,7 +655,7 @@ lxcControllerRun(virDomainDefPtr def, * marked as shared */ if (root) { - VIR_DEBUG0("Setting up private /dev/pts"); + VIR_DEBUG("Setting up private /dev/pts"); if (unshare(CLONE_NEWNS) < 0) { virReportSystemError(errno, "%s", _("Cannot unshare mount namespace")); @@ -691,7 +691,7 @@ lxcControllerRun(virDomainDefPtr def, } if (access(devptmx, R_OK) < 0) { - VIR_WARN0("Kernel does not support private devpts, using shared devpts"); + VIR_WARN("Kernel does not support private devpts, using shared devpts"); VIR_FREE(devptmx); } } @@ -707,7 +707,7 @@ lxcControllerRun(virDomainDefPtr def, goto cleanup; } } else { - VIR_DEBUG0("Opening tty on shared /dev/ptmx"); + VIR_DEBUG("Opening tty on shared /dev/ptmx"); if (virFileOpenTty(&containerPty, &containerPtyPath, 0) < 0) { diff --git a/src/lxc/lxc_driver.c b/src/lxc/lxc_driver.c index b94941d..63ce630 100644 --- a/src/lxc/lxc_driver.c +++ b/src/lxc/lxc_driver.c @@ -1074,7 +1074,7 @@ static int lxcSetupInterfaces(virConnectPtr conn, goto error_exit; } - VIR_DEBUG0("calling vethCreate()"); + VIR_DEBUG("calling vethCreate()"); parentVeth = def->nets[i]->ifname; if (vethCreate(&parentVeth, &containerVeth) < 0) goto error_exit; @@ -2047,19 +2047,19 @@ static int lxcStartup(int privileged) */ ld = getenv("LD_PRELOAD"); if (ld && strstr(ld, "vgpreload")) { - VIR_INFO0("Running under valgrind, disabling driver"); + VIR_INFO("Running under valgrind, disabling driver"); return 0; } /* Check that the user is root, silently disable if not */ if (!privileged) { - VIR_INFO0("Not running privileged, disabling driver"); + VIR_INFO("Not running privileged, disabling driver"); return 0; } /* Check that this is a container enabled kernel */ if (lxcContainerAvailable(0) < 0) { - VIR_INFO0("LXC support not available in this kernel, disabling driver"); + VIR_INFO("LXC support not available in this kernel, disabling driver"); return 0; } @@ -2557,7 +2557,7 @@ static int lxcFreezeContainer(lxc_driver_t *driver, virDomainObjPtr vm) goto error; } if (r == -EBUSY) - VIR_DEBUG0("Writing freezer.state gets EBUSY"); + VIR_DEBUG("Writing freezer.state gets EBUSY"); /* * Unfortunately, returning 0 (success) is likely to happen @@ -2597,7 +2597,7 @@ static int lxcFreezeContainer(lxc_driver_t *driver, virDomainObjPtr vm) check_interval *= exp; VIR_FREE(state); } - VIR_DEBUG0("lxcFreezeContainer timeout"); + VIR_DEBUG("lxcFreezeContainer timeout"); error: /* * If timeout or an error on reading the state occurs, diff --git a/src/network/bridge_driver.c b/src/network/bridge_driver.c index 12050b3..f4ced09 100644 --- a/src/network/bridge_driver.c +++ b/src/network/bridge_driver.c @@ -1197,7 +1197,7 @@ networkAddGeneralIptablesRules(struct network_driver *driver, network->def->bridge, 68) < 0)) { VIR_WARN("Could not add rule to fixup DHCP response checksums " "on network '%s'.", network->def->name); - VIR_WARN0("May need to update iptables package & kernel to support CHECKSUM rule."); + VIR_WARN("May need to update iptables package & kernel to support CHECKSUM rule."); } /* allow DNS requests through to dnsmasq */ @@ -1407,7 +1407,7 @@ networkReloadIptablesRules(struct network_driver *driver) { unsigned int i; - VIR_INFO0(_("Reloading iptables rules")); + VIR_INFO(_("Reloading iptables rules")); for (i = 0 ; i < driver->networks.count ; i++) { virNetworkObjLock(driver->networks.objs[i]); diff --git a/src/node_device/node_device_hal.c b/src/node_device/node_device_hal.c index 3af2bcf..8df2875 100644 --- a/src/node_device/node_device_hal.c +++ b/src/node_device/node_device_hal.c @@ -514,7 +514,7 @@ static void dev_refresh(const char *udi) static void device_added(LibHalContext *ctx ATTRIBUTE_UNUSED, const char *udi) { - VIR_DEBUG0(hal_name(udi)); + VIR_DEBUG("%s", hal_name(udi)); dev_create(udi); } @@ -527,7 +527,7 @@ static void device_removed(LibHalContext *ctx ATTRIBUTE_UNUSED, nodeDeviceLock(driverState); dev = virNodeDeviceFindByName(&driverState->devs,name); - VIR_DEBUG0(name); + VIR_DEBUG("%s", name); if (dev) virNodeDeviceObjRemove(&driverState->devs, dev); else @@ -718,12 +718,12 @@ static int halDeviceMonitorStartup(int privileged ATTRIBUTE_UNUSED) dbus_error_init(&err); hal_ctx = libhal_ctx_new(); if (hal_ctx == NULL) { - VIR_ERROR0(_("libhal_ctx_new returned NULL")); + VIR_ERROR(_("libhal_ctx_new returned NULL")); goto failure; } dbus_conn = dbus_bus_get(DBUS_BUS_SYSTEM, &err); if (dbus_conn == NULL) { - VIR_ERROR0(_("dbus_bus_get failed")); + VIR_ERROR(_("dbus_bus_get failed")); /* We don't want to show a fatal error here, otherwise entire libvirtd shuts down when D-Bus isn't running */ @@ -733,11 +733,11 @@ static int halDeviceMonitorStartup(int privileged ATTRIBUTE_UNUSED) dbus_connection_set_exit_on_disconnect(dbus_conn, FALSE); if (!libhal_ctx_set_dbus_connection(hal_ctx, dbus_conn)) { - VIR_ERROR0(_("libhal_ctx_set_dbus_connection failed")); + VIR_ERROR(_("libhal_ctx_set_dbus_connection failed")); goto failure; } if (!libhal_ctx_init(hal_ctx, &err)) { - VIR_ERROR0(_("libhal_ctx_init failed, haldaemon is probably not running")); + VIR_ERROR(_("libhal_ctx_init failed, haldaemon is probably not running")); /* We don't want to show a fatal error here, otherwise entire libvirtd shuts down when hald isn't running */ @@ -751,7 +751,7 @@ static int halDeviceMonitorStartup(int privileged ATTRIBUTE_UNUSED) remove_dbus_watch, toggle_dbus_watch, NULL, NULL)) { - VIR_ERROR0(_("dbus_connection_set_watch_functions failed")); + VIR_ERROR(_("dbus_connection_set_watch_functions failed")); goto failure; } @@ -772,13 +772,13 @@ static int halDeviceMonitorStartup(int privileged ATTRIBUTE_UNUSED) !libhal_ctx_set_device_lost_capability(hal_ctx, device_cap_lost) || !libhal_ctx_set_device_property_modified(hal_ctx, device_prop_modified) || !libhal_device_property_watch_all(hal_ctx, &err)) { - VIR_ERROR0(_("setting up HAL callbacks failed")); + VIR_ERROR(_("setting up HAL callbacks failed")); goto failure; } udi = libhal_get_all_devices(hal_ctx, &num_devs, &err); if (udi == NULL) { - VIR_ERROR0(_("libhal_get_all_devices failed")); + VIR_ERROR(_("libhal_get_all_devices failed")); goto failure; } for (i = 0; i < num_devs; i++) { @@ -828,18 +828,18 @@ static int halDeviceMonitorReload(void) int num_devs, i; LibHalContext *hal_ctx; - VIR_INFO0("Reloading HAL device state"); + VIR_INFO("Reloading HAL device state"); nodeDeviceLock(driverState); - VIR_INFO0("Removing existing objects"); + VIR_INFO("Removing existing objects"); virNodeDeviceObjListFree(&driverState->devs); nodeDeviceUnlock(driverState); hal_ctx = DRV_STATE_HAL_CTX(driverState); - VIR_INFO0("Creating new objects"); + VIR_INFO("Creating new objects"); dbus_error_init(&err); udi = libhal_get_all_devices(hal_ctx, &num_devs, &err); if (udi == NULL) { - VIR_ERROR0(_("libhal_get_all_devices failed")); + VIR_ERROR(_("libhal_get_all_devices failed")); return -1; } for (i = 0; i < num_devs; i++) { @@ -847,7 +847,7 @@ static int halDeviceMonitorReload(void) VIR_FREE(udi[i]); } VIR_FREE(udi); - VIR_INFO0("HAL device reload complete"); + VIR_INFO("HAL device reload complete"); return 0; } diff --git a/src/node_device/node_device_linux_sysfs.c b/src/node_device/node_device_linux_sysfs.c index ea0b30e..4f4acc7 100644 --- a/src/node_device/node_device_linux_sysfs.c +++ b/src/node_device/node_device_linux_sysfs.c @@ -290,7 +290,7 @@ static int get_sriov_function(const char *device_link, VIR_DEBUG("SR IOV device path is '%s'", device_path); config_address = basename(device_path); if (VIR_ALLOC(*bdf) != 0) { - VIR_ERROR0(_("Failed to allocate memory for PCI device name")); + VIR_ERROR(_("Failed to allocate memory for PCI device name")); goto out; } diff --git a/src/node_device/node_device_udev.c b/src/node_device/node_device_udev.c index 3b987e8..04fcbec 100644 --- a/src/node_device/node_device_udev.c +++ b/src/node_device/node_device_udev.c @@ -1452,7 +1452,7 @@ static void udevEventHandleCallback(int watch ATTRIBUTE_UNUSED, device = udev_monitor_receive_device(udev_monitor); if (device == NULL) { - VIR_ERROR0(_("udev_monitor_receive_device returned NULL")); + VIR_ERROR(_("udev_monitor_receive_device returned NULL")); goto out; } @@ -1634,7 +1634,7 @@ static int udevDeviceMonitorStartup(int privileged) } if (virMutexInit(&driverState->lock) < 0) { - VIR_ERROR0(_("Failed to initialize mutex for driverState")); + VIR_ERROR(_("Failed to initialize mutex for driverState")); VIR_FREE(priv); VIR_FREE(driverState); ret = -1; @@ -1655,7 +1655,7 @@ static int udevDeviceMonitorStartup(int privileged) priv->udev_monitor = udev_monitor_new_from_netlink(udev, "udev"); if (priv->udev_monitor == NULL) { VIR_FREE(priv); - VIR_ERROR0(_("udev_monitor_new_from_netlink returned NULL")); + VIR_ERROR(_("udev_monitor_new_from_netlink returned NULL")); ret = -1; goto out_unlock; } @@ -1753,7 +1753,7 @@ static virStateDriver udevStateDriver = { int udevNodeRegister(void) { - VIR_DEBUG0("Registering udev node device backend"); + VIR_DEBUG("Registering udev node device backend"); registerCommonNodeFuncs(&udevDeviceMonitor); if (virRegisterDeviceMonitor(&udevDeviceMonitor) < 0) { diff --git a/src/nwfilter/nwfilter_ebiptables_driver.c b/src/nwfilter/nwfilter_ebiptables_driver.c index 14ce019..2ff392d 100644 --- a/src/nwfilter/nwfilter_ebiptables_driver.c +++ b/src/nwfilter/nwfilter_ebiptables_driver.c @@ -3303,7 +3303,7 @@ iptablesCheckBridgeNFCallEnabled(bool isIPv6) "'echo 1 > %s'"), isIPv6 ? "6" : "", pathname); - VIR_WARN0(msg); + VIR_WARN("%s", msg); if (isIPv6) lastReportIPv6 = now; else diff --git a/src/openvz/openvz_driver.c b/src/openvz/openvz_driver.c index 0bd007a..9a9ca70 100644 --- a/src/openvz/openvz_driver.c +++ b/src/openvz/openvz_driver.c @@ -211,7 +211,7 @@ static int openvzSetInitialConfig(virDomainDefPtr vmdef) else { if (openvzDomainDefineCmd(prog, OPENVZ_MAX_ARG, vmdef) < 0) { - VIR_ERROR0(_("Error creating command for container")); + VIR_ERROR(_("Error creating command for container")); goto cleanup; } @@ -878,7 +878,7 @@ openvzDomainDefineXML(virConnectPtr conn, const char *xml) vm->persistent = 1; if (openvzSetInitialConfig(vm->def) < 0) { - VIR_ERROR0(_("Error creating initial configuration")); + VIR_ERROR(_("Error creating initial configuration")); goto cleanup; } @@ -966,7 +966,7 @@ openvzDomainCreateXML(virConnectPtr conn, const char *xml, vm->persistent = 1; if (openvzSetInitialConfig(vm->def) < 0) { - VIR_ERROR0(_("Error creating initial configuration")); + VIR_ERROR(_("Error creating initial configuration")); goto cleanup; } diff --git a/src/phyp/phyp_driver.c b/src/phyp/phyp_driver.c index 30d4adf..848adf6 100644 --- a/src/phyp/phyp_driver.c +++ b/src/phyp/phyp_driver.c @@ -309,7 +309,7 @@ phypCapsInit(void) */ if (nodeCapsInitNUMA(caps) < 0) { virCapabilitiesFreeNUMAInfo(caps); - VIR_WARN0 + VIR_WARN ("Failed to query host NUMA topology, disabling NUMA capabilities"); } @@ -449,13 +449,13 @@ phypUUIDTable_WriteFile(virConnectPtr conn) if (safewrite(fd, &uuid_table->lpars[i]->id, sizeof(uuid_table->lpars[i]->id)) != sizeof(uuid_table->lpars[i]->id)) { - VIR_ERROR0(_("Unable to write information to local file.")); + VIR_ERROR(_("Unable to write information to local file.")); goto err; } if (safewrite(fd, uuid_table->lpars[i]->uuid, VIR_UUID_BUFLEN) != VIR_UUID_BUFLEN) { - VIR_ERROR0(_("Unable to write information to local file.")); + VIR_ERROR(_("Unable to write information to local file.")); goto err; } } @@ -507,12 +507,12 @@ phypUUIDTable_Push(virConnectPtr conn) } if (stat(local_file, &local_fileinfo) == -1) { - VIR_WARN0("Unable to stat local file."); + VIR_WARN("Unable to stat local file."); goto err; } if (!(fd = fopen(local_file, "rb"))) { - VIR_WARN0("Unable to open local file."); + VIR_WARN("Unable to open local file."); goto err; } @@ -649,7 +649,7 @@ phypUUIDTable_ReadFile(virConnectPtr conn) int id; if ((fd = open(local_file, O_RDONLY)) == -1) { - VIR_WARN0("Unable to write information to local file."); + VIR_WARN("Unable to write information to local file."); goto err; } @@ -665,14 +665,14 @@ phypUUIDTable_ReadFile(virConnectPtr conn) } uuid_table->lpars[i]->id = id; } else { - VIR_WARN0 + VIR_WARN ("Unable to read from information to local file."); goto err; } rc = read(fd, uuid_table->lpars[i]->uuid, VIR_UUID_BUFLEN); if (rc != VIR_UUID_BUFLEN) { - VIR_WARN0("Unable to read information to local file."); + VIR_WARN("Unable to read information to local file."); goto err; } } @@ -753,7 +753,7 @@ phypUUIDTable_Pull(virConnectPtr conn) rc = libssh2_channel_read(channel, buffer, amount); if (rc > 0) { if (safewrite(fd, buffer, rc) != rc) - VIR_WARN0 + VIR_WARN ("Unable to write information to local file."); got += rc; @@ -828,7 +828,7 @@ phypUUIDTable_Init(virConnectPtr conn) goto cleanup; } if (nids_numdomains != nids_listdomains) { - VIR_ERROR0(_("Unable to determine number of domains.")); + VIR_ERROR(_("Unable to determine number of domains.")); goto cleanup; } @@ -1559,7 +1559,7 @@ phypGetVIOSNextSlotNumber(virConnectPtr conn) virBuffer buf = VIR_BUFFER_INITIALIZER; if (!(profile = phypGetLparProfile(conn, vios_id))) { - VIR_ERROR0(_("Unable to get VIOS profile name.")); + VIR_ERROR(_("Unable to get VIOS profile name.")); return -1; } @@ -1599,17 +1599,17 @@ phypCreateServerSCSIAdapter(virConnectPtr conn) if (! (vios_name = phypGetLparNAME(session, managed_system, vios_id, conn))) { - VIR_ERROR0(_("Unable to get VIOS name")); + VIR_ERROR(_("Unable to get VIOS name")); goto cleanup; } if (!(profile = phypGetLparProfile(conn, vios_id))) { - VIR_ERROR0(_("Unable to get VIOS profile name.")); + VIR_ERROR(_("Unable to get VIOS profile name.")); goto cleanup; } if ((slot = phypGetVIOSNextSlotNumber(conn)) == -1) { - VIR_ERROR0(_("Unable to get free slot number")); + VIR_ERROR(_("Unable to get free slot number")); goto cleanup; } @@ -1742,7 +1742,7 @@ phypAttachDevice(virDomainPtr domain, const char *xml) if (! (vios_name = phypGetLparNAME(session, managed_system, vios_id, conn))) { - VIR_ERROR0(_("Unable to get VIOS name")); + VIR_ERROR(_("Unable to get VIOS name")); goto cleanup; } @@ -1752,11 +1752,11 @@ phypAttachDevice(virDomainPtr domain, const char *xml) /* If not found, let's create one. * */ if (phypCreateServerSCSIAdapter(conn) == -1) { - VIR_ERROR0(_("Unable to create new virtual adapter")); + VIR_ERROR(_("Unable to create new virtual adapter")); goto cleanup; } else { if (!(scsi_adapter = phypGetVIOSFreeSCSIAdapter(conn))) { - VIR_ERROR0(_("Unable to create new virtual adapter")); + VIR_ERROR(_("Unable to create new virtual adapter")); goto cleanup; } } @@ -1777,7 +1777,7 @@ phypAttachDevice(virDomainPtr domain, const char *xml) goto cleanup; if (!(profile = phypGetLparProfile(conn, domain->id))) { - VIR_ERROR0(_("Unable to get VIOS profile name.")); + VIR_ERROR(_("Unable to get VIOS profile name.")); goto cleanup; } @@ -1835,7 +1835,7 @@ phypAttachDevice(virDomainPtr domain, const char *xml) ret = phypExecBuffer(session, &buf, &exit_status, conn, false); if (exit_status < 0 || ret == NULL) { - VIR_ERROR0(_ + VIR_ERROR(_ ("Possibly you don't have IBM Tools installed in your LPAR." "Contact your support to enable this feature.")); goto cleanup; @@ -2018,18 +2018,18 @@ phypStorageVolCreateXML(virStoragePoolPtr pool, if (pool->name != NULL) { spdef->name = pool->name; } else { - VIR_ERROR0(_("Unable to determine storage pool's name.")); + VIR_ERROR(_("Unable to determine storage pool's name.")); goto err; } if (memcpy(spdef->uuid, pool->uuid, VIR_UUID_BUFLEN) == NULL) { - VIR_ERROR0(_("Unable to determine storage pool's uuid.")); + VIR_ERROR(_("Unable to determine storage pool's uuid.")); goto err; } if ((spdef->capacity = phypGetStoragePoolSize(pool->conn, pool->name)) == -1) { - VIR_ERROR0(_("Unable to determine storage pools's size.")); + VIR_ERROR(_("Unable to determine storage pools's size.")); goto err; } @@ -2042,18 +2042,18 @@ phypStorageVolCreateXML(virStoragePoolPtr pool, /*XXX source adapter not working properly, should show hdiskX */ if ((spdef->source.adapter = phypGetStoragePoolDevice(pool->conn, pool->name)) == NULL) { - VIR_ERROR0(_("Unable to determine storage pools's source adapter.")); + VIR_ERROR(_("Unable to determine storage pools's source adapter.")); goto err; } if ((voldef = virStorageVolDefParseString(spdef, xml)) == NULL) { - VIR_ERROR0(_("Error parsing volume XML.")); + VIR_ERROR(_("Error parsing volume XML.")); goto err; } /* checking if this name already exists on this system */ if (phypVolumeLookupByName(pool, voldef->name) != NULL) { - VIR_ERROR0(_("StoragePool name already exists.")); + VIR_ERROR(_("StoragePool name already exists.")); goto err; } @@ -2061,12 +2061,12 @@ phypStorageVolCreateXML(virStoragePoolPtr pool, * in the moment you create the volume. * */ if (voldef->key) { - VIR_ERROR0(_("Key must be empty, Power Hypervisor will create one for you.")); + VIR_ERROR(_("Key must be empty, Power Hypervisor will create one for you.")); goto err; } if (voldef->capacity) { - VIR_ERROR0(_("Capacity cannot be empty.")); + VIR_ERROR(_("Capacity cannot be empty.")); goto err; } @@ -2242,17 +2242,17 @@ phypVolumeGetXMLDesc(virStorageVolPtr vol, unsigned int flags) if (sp->name != NULL) { pool.name = sp->name; } else { - VIR_ERROR0(_("Unable to determine storage sp's name.")); + VIR_ERROR(_("Unable to determine storage sp's name.")); goto err; } if (memcpy(pool.uuid, sp->uuid, VIR_UUID_BUFLEN) == NULL) { - VIR_ERROR0(_("Unable to determine storage sp's uuid.")); + VIR_ERROR(_("Unable to determine storage sp's uuid.")); goto err; } if ((pool.capacity = phypGetStoragePoolSize(sp->conn, sp->name)) == -1) { - VIR_ERROR0(_("Unable to determine storage sps's size.")); + VIR_ERROR(_("Unable to determine storage sps's size.")); goto err; } @@ -2264,14 +2264,14 @@ phypVolumeGetXMLDesc(virStorageVolPtr vol, unsigned int flags) if ((pool.source.adapter = phypGetStoragePoolDevice(sp->conn, sp->name)) == NULL) { - VIR_ERROR0(_("Unable to determine storage sps's source adapter.")); + VIR_ERROR(_("Unable to determine storage sps's source adapter.")); goto err; } if (vol->name != NULL) voldef.name = vol->name; else { - VIR_ERROR0(_("Unable to determine storage pool's name.")); + VIR_ERROR(_("Unable to determine storage pool's name.")); goto err; } @@ -2684,13 +2684,13 @@ phypStoragePoolCreateXML(virConnectPtr conn, /* checking if this name already exists on this system */ if (phypStoragePoolLookupByName(conn, def->name) != NULL) { - VIR_WARN0("StoragePool name already exists."); + VIR_WARN("StoragePool name already exists."); goto err; } /* checking if ID or UUID already exists on this system */ if (phypGetStoragePoolLookUpByUUID(conn, def->uuid) != NULL) { - VIR_WARN0("StoragePool uuid already exists."); + VIR_WARN("StoragePool uuid already exists."); goto err; } @@ -2720,18 +2720,18 @@ phypGetStoragePoolXMLDesc(virStoragePoolPtr pool, unsigned int flags) if (pool->name != NULL) def.name = pool->name; else { - VIR_ERROR0(_("Unable to determine storage pool's name.")); + VIR_ERROR(_("Unable to determine storage pool's name.")); goto err; } if (memcpy(def.uuid, pool->uuid, VIR_UUID_BUFLEN) == NULL) { - VIR_ERROR0(_("Unable to determine storage pool's uuid.")); + VIR_ERROR(_("Unable to determine storage pool's uuid.")); goto err; } if ((def.capacity = phypGetStoragePoolSize(pool->conn, pool->name)) == -1) { - VIR_ERROR0(_("Unable to determine storage pools's size.")); + VIR_ERROR(_("Unable to determine storage pools's size.")); goto err; } @@ -2744,7 +2744,7 @@ phypGetStoragePoolXMLDesc(virStoragePoolPtr pool, unsigned int flags) /*XXX source adapter not working properly, should show hdiskX */ if ((def.source.adapter = phypGetStoragePoolDevice(pool->conn, pool->name)) == NULL) { - VIR_ERROR0(_("Unable to determine storage pools's source adapter.")); + VIR_ERROR(_("Unable to determine storage pools's source adapter.")); goto err; } @@ -3319,30 +3319,30 @@ phypDomainDumpXML(virDomainPtr dom, int flags) dom->conn); if (lpar_name == NULL) { - VIR_ERROR0(_("Unable to determine domain's name.")); + VIR_ERROR(_("Unable to determine domain's name.")); goto err; } if (phypGetLparUUID(def.uuid, dom->id, dom->conn) == -1) { - VIR_ERROR0(_("Unable to generate random uuid.")); + VIR_ERROR(_("Unable to generate random uuid.")); goto err; } if ((def.mem.max_balloon = phypGetLparMem(dom->conn, managed_system, dom->id, 0)) == 0) { - VIR_ERROR0(_("Unable to determine domain's max memory.")); + VIR_ERROR(_("Unable to determine domain's max memory.")); goto err; } if ((def.mem.cur_balloon = phypGetLparMem(dom->conn, managed_system, dom->id, 1)) == 0) { - VIR_ERROR0(_("Unable to determine domain's memory.")); + VIR_ERROR(_("Unable to determine domain's memory.")); goto err; } if ((def.maxvcpus = def.vcpus = phypGetLparCPU(dom->conn, managed_system, dom->id)) == 0) { - VIR_ERROR0(_("Unable to determine domain's CPU.")); + VIR_ERROR(_("Unable to determine domain's CPU.")); goto err; } @@ -3457,15 +3457,15 @@ phypDomainGetInfo(virDomainPtr dom, virDomainInfoPtr info) if ((info->maxMem = phypGetLparMem(dom->conn, managed_system, dom->id, 0)) == 0) - VIR_WARN0("Unable to determine domain's max memory."); + VIR_WARN("Unable to determine domain's max memory."); if ((info->memory = phypGetLparMem(dom->conn, managed_system, dom->id, 1)) == 0) - VIR_WARN0("Unable to determine domain's memory."); + VIR_WARN("Unable to determine domain's memory."); if ((info->nrVirtCpu = phypGetLparCPU(dom->conn, managed_system, dom->id)) == 0) - VIR_WARN0("Unable to determine domain's CPU."); + VIR_WARN("Unable to determine domain's CPU."); return 0; } @@ -3560,7 +3560,7 @@ phypBuildLpar(virConnectPtr conn, virDomainDefPtr def) } if (phypUUIDTable_AddLpar(conn, def->uuid, def->id) == -1) { - VIR_ERROR0(_("Unable to add LPAR to the table")); + VIR_ERROR(_("Unable to add LPAR to the table")); goto cleanup; } @@ -3596,14 +3596,14 @@ phypDomainCreateAndStart(virConnectPtr conn, /* checking if this name already exists on this system */ if (phypGetLparID(session, managed_system, def->name, conn) != -1) { - VIR_WARN0("LPAR name already exists."); + VIR_WARN("LPAR name already exists."); goto err; } /* checking if ID or UUID already exists on this system */ for (i = 0; i < uuid_table->nlpars; i++) { if (lpars[i]->id == def->id || lpars[i]->uuid == def->uuid) { - VIR_WARN0("LPAR ID or UUID already exists."); + VIR_WARN("LPAR ID or UUID already exists."); goto err; } } @@ -3663,7 +3663,7 @@ phypDomainSetVcpusFlags(virDomainPtr dom, unsigned int nvcpus, return 0; if (nvcpus > phypGetLparCPUMAX(dom)) { - VIR_ERROR0(_("You are trying to set a number of CPUs bigger than " + VIR_ERROR(_("You are trying to set a number of CPUs bigger than " "the max possible.")); return 0; } @@ -3686,7 +3686,7 @@ phypDomainSetVcpusFlags(virDomainPtr dom, unsigned int nvcpus, ret = phypExecBuffer(session, &buf, &exit_status, dom->conn, false); if (exit_status < 0) { - VIR_ERROR0(_ + VIR_ERROR(_ ("Possibly you don't have IBM Tools installed in your LPAR." " Contact your support to enable this feature.")); } diff --git a/src/qemu/qemu_audit.c b/src/qemu/qemu_audit.c index 40b68ff..1da0773 100644 --- a/src/qemu/qemu_audit.c +++ b/src/qemu/qemu_audit.c @@ -69,20 +69,20 @@ qemuAuditDisk(virDomainObjPtr vm, virUUIDFormat(vm->def->uuid, uuidstr); if (!(vmname = virAuditEncode("vm", vm->def->name))) { - VIR_WARN0("OOM while encoding audit message"); + VIR_WARN("OOM while encoding audit message"); return; } if (!(oldsrc = virAuditEncode("old-disk", oldDef && oldDef->src ? oldDef->src : "?"))) { - VIR_WARN0("OOM while encoding audit message"); + VIR_WARN("OOM while encoding audit message"); goto cleanup; } if (!(newsrc = virAuditEncode("new-disk", newDef && newDef->src ? newDef->src : "?"))) { - VIR_WARN0("OOM while encoding audit message"); + VIR_WARN("OOM while encoding audit message"); goto cleanup; } @@ -114,7 +114,7 @@ qemuAuditNet(virDomainObjPtr vm, if (newDef) virFormatMacAddr(newDef->mac, newMacstr); if (!(vmname = virAuditEncode("vm", vm->def->name))) { - VIR_WARN0("OOM while encoding audit message"); + VIR_WARN("OOM while encoding audit message"); return; } @@ -155,7 +155,7 @@ qemuAuditNetDevice(virDomainDefPtr vmDef, virDomainNetDefPtr netDef, if (!(vmname = virAuditEncode("vm", vmDef->name)) || !(devname = virAuditEncode("path", device))) { - VIR_WARN0("OOM while encoding audit message"); + VIR_WARN("OOM while encoding audit message"); goto cleanup; } @@ -189,7 +189,7 @@ qemuAuditHostdev(virDomainObjPtr vm, virDomainHostdevDefPtr hostdev, virUUIDFormat(vm->def->uuid, uuidstr); if (!(vmname = virAuditEncode("vm", vm->def->name))) { - VIR_WARN0("OOM while encoding audit message"); + VIR_WARN("OOM while encoding audit message"); return; } @@ -200,7 +200,7 @@ qemuAuditHostdev(virDomainObjPtr vm, virDomainHostdevDefPtr hostdev, hostdev->source.subsys.u.pci.bus, hostdev->source.subsys.u.pci.slot, hostdev->source.subsys.u.pci.function) < 0) { - VIR_WARN0("OOM while encoding audit message"); + VIR_WARN("OOM while encoding audit message"); goto cleanup; } break; @@ -208,7 +208,7 @@ qemuAuditHostdev(virDomainObjPtr vm, virDomainHostdevDefPtr hostdev, if (virAsprintf(&address, "%.3d.%.3d", hostdev->source.subsys.u.usb.bus, hostdev->source.subsys.u.usb.device) < 0) { - VIR_WARN0("OOM while encoding audit message"); + VIR_WARN("OOM while encoding audit message"); goto cleanup; } break; @@ -219,7 +219,7 @@ qemuAuditHostdev(virDomainObjPtr vm, virDomainHostdevDefPtr hostdev, } if (!(device = virAuditEncode("device", VIR_AUDIT_STR(address)))) { - VIR_WARN0("OOM while encoding audit message"); + VIR_WARN("OOM while encoding audit message"); goto cleanup; } @@ -260,7 +260,7 @@ qemuAuditCgroup(virDomainObjPtr vm, virCgroupPtr cgroup, virUUIDFormat(vm->def->uuid, uuidstr); if (!(vmname = virAuditEncode("vm", vm->def->name))) { - VIR_WARN0("OOM while encoding audit message"); + VIR_WARN("OOM while encoding audit message"); return; } @@ -299,7 +299,7 @@ qemuAuditCgroupMajor(virDomainObjPtr vm, virCgroupPtr cgroup, if (virAsprintf(&extra, "major category=%s maj=%02X acl=%s", name, maj, perms) < 0) { - VIR_WARN0("OOM while encoding audit message"); + VIR_WARN("OOM while encoding audit message"); return; } @@ -338,7 +338,7 @@ qemuAuditCgroupPath(virDomainObjPtr vm, virCgroupPtr cgroup, if (!(detail = virAuditEncode("path", path)) || virAsprintf(&extra, "path path=%s rdev=%s acl=%s", path, VIR_AUDIT_STR(rdev), perms) < 0) { - VIR_WARN0("OOM while encoding audit message"); + VIR_WARN("OOM while encoding audit message"); goto cleanup; } @@ -371,7 +371,7 @@ qemuAuditResource(virDomainObjPtr vm, const char *resource, virUUIDFormat(vm->def->uuid, uuidstr); if (!(vmname = virAuditEncode("vm", vm->def->name))) { - VIR_WARN0("OOM while encoding audit message"); + VIR_WARN("OOM while encoding audit message"); return; } @@ -409,7 +409,7 @@ qemuAuditLifecycle(virDomainObjPtr vm, const char *op, virUUIDFormat(vm->def->uuid, uuidstr); if (!(vmname = virAuditEncode("vm", vm->def->name))) { - VIR_WARN0("OOM while encoding audit message"); + VIR_WARN("OOM while encoding audit message"); return; } @@ -462,7 +462,7 @@ qemuAuditSecurityLabel(virDomainObjPtr vm, bool success) virUUIDFormat(vm->def->uuid, uuidstr); if (!(vmname = virAuditEncode("vm", vm->def->name))) { - VIR_WARN0("OOM while encoding audit message"); + VIR_WARN("OOM while encoding audit message"); return; } diff --git a/src/qemu/qemu_capabilities.c b/src/qemu/qemu_capabilities.c index 620143e..ea55df5 100644 --- a/src/qemu/qemu_capabilities.c +++ b/src/qemu/qemu_capabilities.c @@ -806,12 +806,12 @@ virCapsPtr qemuCapsInit(virCapsPtr old_caps) */ if (nodeCapsInitNUMA(caps) < 0) { virCapabilitiesFreeNUMAInfo(caps); - VIR_WARN0("Failed to query host NUMA topology, disabling NUMA capabilities"); + VIR_WARN("Failed to query host NUMA topology, disabling NUMA capabilities"); } if (old_caps == NULL || old_caps->host.cpu == NULL) { if (qemuCapsInitCPU(caps, utsname.machine) < 0) - VIR_WARN0("Failed to get host CPU"); + VIR_WARN("Failed to get host CPU"); } else { caps->host.cpu = old_caps->host.cpu; diff --git a/src/qemu/qemu_cgroup.c b/src/qemu/qemu_cgroup.c index 6f075fb..eba1e73 100644 --- a/src/qemu/qemu_cgroup.c +++ b/src/qemu/qemu_cgroup.c @@ -218,7 +218,7 @@ int qemuSetupCgroup(struct qemud_driver *driver, qemuAuditCgroup(vm, cgroup, "deny", "all", rc == 0); if (rc != 0) { if (rc == -EPERM) { - VIR_WARN0("Group devices ACL is not accessible, disabling whitelisting"); + VIR_WARN("Group devices ACL is not accessible, disabling whitelisting"); goto done; } diff --git a/src/qemu/qemu_conf.c b/src/qemu/qemu_conf.c index bb5421b..f977673 100644 --- a/src/qemu/qemu_conf.c +++ b/src/qemu/qemu_conf.c @@ -287,7 +287,7 @@ int qemudLoadDriverConfig(struct qemud_driver *driver, for (i = 0, pp = p->list; pp; ++i, pp = pp->next) { int ctl; if (pp->type != VIR_CONF_STRING) { - VIR_ERROR0(_("cgroup_controllers must be a list of strings")); + VIR_ERROR(_("cgroup_controllers must be a list of strings")); virConfFree(conf); return -1; } @@ -327,7 +327,7 @@ int qemudLoadDriverConfig(struct qemud_driver *driver, } for (i = 0, pp = p->list; pp; ++i, pp = pp->next) { if (pp->type != VIR_CONF_STRING) { - VIR_ERROR0(_("cgroup_device_acl must be a list of strings")); + VIR_ERROR(_("cgroup_device_acl must be a list of strings")); virConfFree(conf); return -1; } diff --git a/src/qemu/qemu_domain.c b/src/qemu/qemu_domain.c index c61f9bf..19e1938 100644 --- a/src/qemu/qemu_domain.c +++ b/src/qemu/qemu_domain.c @@ -125,7 +125,7 @@ static void qemuDomainObjPrivateFree(void *data) /* This should never be non-NULL if we get here, but just in case... */ if (priv->mon) { - VIR_ERROR0(_("Unexpected QEMU monitor still active during domain deletion")); + VIR_ERROR(_("Unexpected QEMU monitor still active during domain deletion")); qemuMonitorClose(priv->mon); } VIR_FREE(priv); diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c index 0fd0f10..01d4acf 100644 --- a/src/qemu/qemu_driver.c +++ b/src/qemu/qemu_driver.c @@ -217,7 +217,7 @@ qemuSecurityInit(struct qemud_driver *driver) return 0; error: - VIR_ERROR0(_("Failed to initialize security drivers")); + VIR_ERROR(_("Failed to initialize security drivers")); virSecurityManagerFree(mgr); return -1; } @@ -318,7 +318,7 @@ static void qemuDomainSnapshotLoad(void *payload, VIR_INFO("Loading snapshot file '%s'", entry->d_name); if (virAsprintf(&fullpath, "%s/%s", snapDir, entry->d_name) < 0) { - VIR_ERROR0(_("Failed to allocate memory for path")); + VIR_ERROR(_("Failed to allocate memory for path")); continue; } @@ -380,7 +380,7 @@ qemudStartup(int privileged) { return -1; if (virMutexInit(&qemu_driver->lock) < 0) { - VIR_ERROR0(_("cannot initialize mutex")); + VIR_ERROR(_("cannot initialize mutex")); VIR_FREE(qemu_driver); return -1; } @@ -1015,7 +1015,7 @@ qemudGetProcessInfo(unsigned long long *cpuTime, int *lastCpu, int pid, "%*u %*u %*u %*u %*u %*u %*u %*u %*u %*u %*d %d", &usertime, &systime, &cpu) != 3) { VIR_FORCE_FCLOSE(pidinfo); - VIR_WARN0("cannot parse process status data"); + VIR_WARN("cannot parse process status data"); errno = -EINVAL; return -1; } @@ -2067,7 +2067,7 @@ endjob: if (header.was_running && virDomainObjIsActive(vm)) { rc = qemuProcessStartCPUs(driver, vm, dom->conn); if (rc < 0) - VIR_WARN0("Unable to resume guest CPUs after save failure"); + VIR_WARN("Unable to resume guest CPUs after save failure"); } } if (qemuDomainObjEndJob(vm) == 0) diff --git a/src/qemu/qemu_hotplug.c b/src/qemu/qemu_hotplug.c index dae2269..3cf7d35 100644 --- a/src/qemu/qemu_hotplug.c +++ b/src/qemu/qemu_hotplug.c @@ -291,7 +291,7 @@ cleanup: (controller->info.type == VIR_DOMAIN_DEVICE_ADDRESS_TYPE_PCI) && releaseaddr && qemuDomainPCIAddressReleaseAddr(priv->pciaddrs, &controller->info) < 0) - VIR_WARN0("Unable to release PCI address on controller"); + VIR_WARN("Unable to release PCI address on controller"); VIR_FREE(devstr); return ret; @@ -326,7 +326,7 @@ qemuDomainFindOrCreateSCSIDiskController(struct qemud_driver *driver, cont->idx = controller; cont->model = -1; - VIR_INFO0("No SCSI controller present, hotplugging one"); + VIR_INFO("No SCSI controller present, hotplugging one"); if (qemuDomainAttachPciControllerDevice(driver, vm, cont) < 0) { VIR_FREE(cont); @@ -698,7 +698,7 @@ cleanup: (net->info.type == VIR_DOMAIN_DEVICE_ADDRESS_TYPE_PCI) && releaseaddr && qemuDomainPCIAddressReleaseAddr(priv->pciaddrs, &net->info) < 0) - VIR_WARN0("Unable to release PCI address on NIC"); + VIR_WARN("Unable to release PCI address on NIC"); if (ret != 0) virDomainConfNWFilterTeardown(net); @@ -729,7 +729,7 @@ try_remove: qemuDomainObjExitMonitorWithDriver(driver, vm); VIR_FREE(netdev_name); } else { - VIR_WARN0("Unable to remove network backend"); + VIR_WARN("Unable to remove network backend"); } } else { char *hostnet_name; @@ -829,7 +829,7 @@ error: (hostdev->info.type == VIR_DOMAIN_DEVICE_ADDRESS_TYPE_PCI) && releaseaddr && qemuDomainPCIAddressReleaseAddr(priv->pciaddrs, &hostdev->info) < 0) - VIR_WARN0("Unable to release PCI address on host device"); + VIR_WARN("Unable to release PCI address on host device"); qemuDomainReAttachHostdevDevices(driver, &hostdev, 1); @@ -964,7 +964,7 @@ int qemuDomainAttachHostDevice(struct qemud_driver *driver, error: if (virSecurityManagerRestoreHostdevLabel(driver->securityManager, vm, hostdev) < 0) - VIR_WARN0("Unable to restore host device labelling on hotplug fail"); + VIR_WARN("Unable to restore host device labelling on hotplug fail"); return -1; } @@ -1072,7 +1072,7 @@ qemuDomainChangeGraphics(struct qemud_driver *driver, olddev->data.spice.auth.validTo = dev->data.spice.auth.validTo; olddev->data.spice.auth.expires = dev->data.spice.auth.expires; } else { - VIR_DEBUG0("Not updating since password didn't change"); + VIR_DEBUG("Not updating since password didn't change"); ret = 0; } @@ -1393,7 +1393,7 @@ int qemuDomainDetachPciControllerDevice(struct qemud_driver *driver, if (qemuCapsGet(priv->qemuCaps, QEMU_CAPS_DEVICE) && qemuDomainPCIAddressReleaseAddr(priv->pciaddrs, &detach->info) < 0) - VIR_WARN0("Unable to release PCI address on controller"); + VIR_WARN("Unable to release PCI address on controller"); virDomainControllerDefFree(detach); @@ -1485,7 +1485,7 @@ int qemuDomainDetachNetDevice(struct qemud_driver *driver, if (qemuCapsGet(priv->qemuCaps, QEMU_CAPS_DEVICE) && qemuDomainPCIAddressReleaseAddr(priv->pciaddrs, &detach->info) < 0) - VIR_WARN0("Unable to release PCI address on NIC"); + VIR_WARN("Unable to release PCI address on NIC"); virDomainConfNWFilterTeardown(detach); @@ -1602,7 +1602,7 @@ int qemuDomainDetachHostPciDevice(struct qemud_driver *driver, if (qemuCapsGet(priv->qemuCaps, QEMU_CAPS_DEVICE) && qemuDomainPCIAddressReleaseAddr(priv->pciaddrs, &detach->info) < 0) - VIR_WARN0("Unable to release PCI address on host device"); + VIR_WARN("Unable to release PCI address on host device"); if (vm->def->nhostdevs > 1) { memmove(vm->def->hostdevs + i, @@ -1731,7 +1731,7 @@ int qemuDomainDetachHostDevice(struct qemud_driver *driver, if (virSecurityManagerRestoreHostdevLabel(driver->securityManager, vm, dev->data.hostdev) < 0) - VIR_WARN0("Failed to restore host device labelling"); + VIR_WARN("Failed to restore host device labelling"); return ret; } diff --git a/src/qemu/qemu_migration.c b/src/qemu/qemu_migration.c index 6738a53..3214d38 100644 --- a/src/qemu/qemu_migration.c +++ b/src/qemu/qemu_migration.c @@ -122,18 +122,18 @@ qemuMigrationWaitForCompletion(struct qemud_driver *driver, virDomainObjPtr vm) if (priv->jobSignals & QEMU_JOB_SIGNAL_CANCEL) { priv->jobSignals ^= QEMU_JOB_SIGNAL_CANCEL; - VIR_DEBUG0("Cancelling job at client request"); + VIR_DEBUG("Cancelling job at client request"); qemuDomainObjEnterMonitorWithDriver(driver, vm); rc = qemuMonitorMigrateCancel(priv->mon); qemuDomainObjExitMonitorWithDriver(driver, vm); if (rc < 0) { - VIR_WARN0("Unable to cancel job"); + VIR_WARN("Unable to cancel job"); } } else if (priv->jobSignals & QEMU_JOB_SIGNAL_SUSPEND) { priv->jobSignals ^= QEMU_JOB_SIGNAL_SUSPEND; - VIR_DEBUG0("Pausing domain for non-live migration"); + VIR_DEBUG("Pausing domain for non-live migration"); if (qemuMigrationSetOffline(driver, vm) < 0) - VIR_WARN0("Unable to pause domain"); + VIR_WARN("Unable to pause domain"); } else if (priv->jobSignals & QEMU_JOB_SIGNAL_MIGRATE_DOWNTIME) { unsigned long long ms = priv->jobSignalsData.migrateDowntime; @@ -144,7 +144,7 @@ qemuMigrationWaitForCompletion(struct qemud_driver *driver, virDomainObjPtr vm) rc = qemuMonitorSetMigrationDowntime(priv->mon, ms); qemuDomainObjExitMonitorWithDriver(driver, vm); if (rc < 0) - VIR_WARN0("Unable to set migration downtime"); + VIR_WARN("Unable to set migration downtime"); } else if (priv->jobSignals & QEMU_JOB_SIGNAL_MIGRATE_SPEED) { unsigned long bandwidth = priv->jobSignalsData.migrateBandwidth; @@ -155,7 +155,7 @@ qemuMigrationWaitForCompletion(struct qemud_driver *driver, virDomainObjPtr vm) rc = qemuMonitorSetMigrationSpeed(priv->mon, bandwidth); qemuDomainObjExitMonitorWithDriver(driver, vm); if (rc < 0) - VIR_WARN0("Unable to set migration speed"); + VIR_WARN("Unable to set migration speed"); } /* Repeat check because the job signals might have caused @@ -1364,7 +1364,7 @@ qemuMigrationToFile(struct qemud_driver *driver, virDomainObjPtr vm, pipeFD[1]); if (VIR_CLOSE(pipeFD[0]) < 0 || VIR_CLOSE(pipeFD[1]) < 0) - VIR_WARN0("failed to close intermediate pipe"); + VIR_WARN("failed to close intermediate pipe"); } else { rc = qemuMonitorMigrateToFile(priv->mon, QEMU_MONITOR_MIGRATE_BACKGROUND, diff --git a/src/qemu/qemu_monitor.c b/src/qemu/qemu_monitor.c index f89038e..9229942 100644 --- a/src/qemu/qemu_monitor.c +++ b/src/qemu/qemu_monitor.c @@ -1429,7 +1429,7 @@ int qemuMonitorMigrateToFd(qemuMonitorPtr mon, if (ret < 0) { if (qemuMonitorCloseFileHandle(mon, "migrate") < 0) - VIR_WARN0("failed to close migration handle"); + VIR_WARN("failed to close migration handle"); } return ret; diff --git a/src/qemu/qemu_monitor_json.c b/src/qemu/qemu_monitor_json.c index 20a78e1..6be0f1b 100644 --- a/src/qemu/qemu_monitor_json.c +++ b/src/qemu/qemu_monitor_json.c @@ -84,7 +84,7 @@ qemuMonitorJSONIOProcessEvent(qemuMonitorPtr mon, type = virJSONValueObjectGetString(obj, "event"); if (!type) { - VIR_WARN0("missing event type in message"); + VIR_WARN("missing event type in message"); errno = EINVAL; return -1; } @@ -112,18 +112,18 @@ qemuMonitorJSONIOProcessLine(qemuMonitorPtr mon, VIR_DEBUG("Line [%s]", line); if (!(obj = virJSONValueFromString(line))) { - VIR_DEBUG0("Parsing JSON string failed"); + VIR_DEBUG("Parsing JSON string failed"); errno = EINVAL; goto cleanup; } if (obj->type != VIR_JSON_TYPE_OBJECT) { - VIR_DEBUG0("Parsed JSON string isn't an object"); + VIR_DEBUG("Parsed JSON string isn't an object"); errno = EINVAL; } if (virJSONValueObjectHasKey(obj, "QMP") == 1) { - VIR_DEBUG0("Got QMP capabilities data"); + VIR_DEBUG("Got QMP capabilities data"); ret = 0; goto cleanup; } @@ -537,7 +537,7 @@ static void qemuMonitorJSONHandleRTCChange(qemuMonitorPtr mon, virJSONValuePtr d { long long offset = 0; if (virJSONValueObjectGetNumberLong(data, "offset", &offset) < 0) { - VIR_WARN0("missing offset in RTC change event"); + VIR_WARN("missing offset in RTC change event"); offset = 0; } qemuMonitorEmitRTCChange(mon, offset); @@ -552,7 +552,7 @@ static void qemuMonitorJSONHandleWatchdog(qemuMonitorPtr mon, virJSONValuePtr da const char *action; int actionID; if (!(action = virJSONValueObjectGetString(data, "action"))) { - VIR_WARN0("missing action in watchdog event"); + VIR_WARN("missing action in watchdog event"); } if (action) { if ((actionID = qemuMonitorWatchdogActionTypeFromString(action)) < 0) { @@ -582,17 +582,17 @@ static void qemuMonitorJSONHandleIOError(qemuMonitorPtr mon, virJSONValuePtr dat to the application */ if ((action = virJSONValueObjectGetString(data, "action")) == NULL) { - VIR_WARN0("Missing action in disk io error event"); + VIR_WARN("Missing action in disk io error event"); action = "ignore"; } if ((device = virJSONValueObjectGetString(data, "device")) == NULL) { - VIR_WARN0("missing device in disk io error event"); + VIR_WARN("missing device in disk io error event"); } #if 0 if ((reason = virJSONValueObjectGetString(data, "reason")) == NULL) { - VIR_WARN0("missing reason in disk io error event"); + VIR_WARN("missing reason in disk io error event"); reason = ""; } #else @@ -622,11 +622,11 @@ static void qemuMonitorJSONHandleVNC(qemuMonitorPtr mon, virJSONValuePtr data, i virJSONValuePtr server; if (!(client = virJSONValueObjectGet(data, "client"))) { - VIR_WARN0("missing client info in VNC event"); + VIR_WARN("missing client info in VNC event"); return; } if (!(server = virJSONValueObjectGet(data, "server"))) { - VIR_WARN0("missing server info in VNC event"); + VIR_WARN("missing server info in VNC event"); return; } @@ -1504,7 +1504,7 @@ int qemuMonitorJSONSetCPU(qemuMonitorPtr mon, if (qemuMonitorJSONHasError(reply, "CommandNotFound") && qemuMonitorCheckHMP(mon, "cpu_set")) { - VIR_DEBUG0("cpu_set command not found, trying HMP"); + VIR_DEBUG("cpu_set command not found, trying HMP"); ret = qemuMonitorTextSetCPU(mon, cpu, online); goto cleanup; } @@ -2301,7 +2301,7 @@ int qemuMonitorJSONAddDrive(qemuMonitorPtr mon, if (qemuMonitorJSONHasError(reply, "CommandNotFound") && qemuMonitorCheckHMP(mon, "drive_add")) { - VIR_DEBUG0("drive_add command not found, trying HMP"); + VIR_DEBUG("drive_add command not found, trying HMP"); ret = qemuMonitorTextAddDrive(mon, drivestr); goto cleanup; } @@ -2334,10 +2334,10 @@ int qemuMonitorJSONDriveDel(qemuMonitorPtr mon, if (qemuMonitorJSONHasError(reply, "CommandNotFound")) { if (qemuMonitorCheckHMP(mon, "drive_del")) { - VIR_DEBUG0("drive_del command not found, trying HMP"); + VIR_DEBUG("drive_del command not found, trying HMP"); ret = qemuMonitorTextDriveDel(mon, drivestr); } else { - VIR_ERROR0(_("deleting disk is not supported. " + VIR_ERROR(_("deleting disk is not supported. " "This may leak data if disk is reassigned")); ret = 1; } @@ -2404,7 +2404,7 @@ int qemuMonitorJSONCreateSnapshot(qemuMonitorPtr mon, const char *name) if (qemuMonitorJSONHasError(reply, "CommandNotFound") && qemuMonitorCheckHMP(mon, "savevm")) { - VIR_DEBUG0("savevm command not found, trying HMP"); + VIR_DEBUG("savevm command not found, trying HMP"); ret = qemuMonitorTextCreateSnapshot(mon, name); goto cleanup; } @@ -2434,7 +2434,7 @@ int qemuMonitorJSONLoadSnapshot(qemuMonitorPtr mon, const char *name) if (qemuMonitorJSONHasError(reply, "CommandNotFound") && qemuMonitorCheckHMP(mon, "loadvm")) { - VIR_DEBUG0("loadvm command not found, trying HMP"); + VIR_DEBUG("loadvm command not found, trying HMP"); ret = qemuMonitorTextLoadSnapshot(mon, name); goto cleanup; } @@ -2464,7 +2464,7 @@ int qemuMonitorJSONDeleteSnapshot(qemuMonitorPtr mon, const char *name) if (qemuMonitorJSONHasError(reply, "CommandNotFound") && qemuMonitorCheckHMP(mon, "delvm")) { - VIR_DEBUG0("delvm command not found, trying HMP"); + VIR_DEBUG("delvm command not found, trying HMP"); ret = qemuMonitorTextDeleteSnapshot(mon, name); goto cleanup; } diff --git a/src/qemu/qemu_monitor_text.c b/src/qemu/qemu_monitor_text.c index 53781c8..c29b4af 100644 --- a/src/qemu/qemu_monitor_text.c +++ b/src/qemu/qemu_monitor_text.c @@ -84,7 +84,7 @@ int qemuMonitorTextIOProcess(qemuMonitorPtr mon ATTRIBUTE_UNUSED, not consumed anything. We'll restart when more data arrives. */ if (!offset) { #if DEBUG_IO - VIR_DEBUG0("Partial greeting seen, getting out & waiting for more"); + VIR_DEBUG("Partial greeting seen, getting out & waiting for more"); #endif return 0; } @@ -92,7 +92,7 @@ int qemuMonitorTextIOProcess(qemuMonitorPtr mon ATTRIBUTE_UNUSED, used = offset - data + strlen(GREETING_POSTFIX); #if DEBUG_IO - VIR_DEBUG0("Discarded monitor greeting"); + VIR_DEBUG("Discarded monitor greeting"); #endif } @@ -191,7 +191,7 @@ int qemuMonitorTextIOProcess(qemuMonitorPtr mon ATTRIBUTE_UNUSED, #if DEBUG_IO VIR_DEBUG("Finished %d byte reply [%s]", want, msg->rxBuffer); } else { - VIR_DEBUG0("Finished 0 byte reply"); + VIR_DEBUG("Finished 0 byte reply"); #endif } msg->finished = 1; @@ -2386,7 +2386,7 @@ int qemuMonitorTextDriveDel(qemuMonitorPtr mon, } if (strstr(reply, "unknown command:")) { - VIR_ERROR0(_("deleting drive is not supported. " + VIR_ERROR(_("deleting drive is not supported. " "This may leak data if disk is reassigned")); ret = 1; goto cleanup; diff --git a/src/qemu/qemu_process.c b/src/qemu/qemu_process.c index bd7c932..901265e 100644 --- a/src/qemu/qemu_process.c +++ b/src/qemu/qemu_process.c @@ -382,7 +382,7 @@ qemuProcessHandleRTCChange(qemuMonitorPtr mon ATTRIBUTE_UNUSED, vm->def->clock.data.adjustment = offset; if (virDomainSaveStatus(driver->caps, driver->stateDir, vm) < 0) - VIR_WARN0("unable to save domain status with RTC change"); + VIR_WARN("unable to save domain status with RTC change"); virDomainObjUnlock(vm); @@ -1091,7 +1091,7 @@ qemuProcessInitCpuAffinity(virDomainObjPtr vm) unsigned char *cpumap; int cpumaplen; - VIR_DEBUG0("Setting CPU affinity"); + VIR_DEBUG("Setting CPU affinity"); if (nodeGetInfo(NULL, &nodeinfo) < 0) return -1; @@ -1995,7 +1995,7 @@ int qemuProcessStart(virConnectPtr conn, hookData.vm = vm; hookData.driver = driver; - VIR_DEBUG0("Beginning VM startup process"); + VIR_DEBUG("Beginning VM startup process"); if (virDomainObjIsActive(vm)) { qemuReportError(VIR_ERR_OPERATION_INVALID, @@ -2007,7 +2007,7 @@ int qemuProcessStart(virConnectPtr conn, * runtime state to vm->def that won't be persisted. This let's us * report implicit runtime defaults in the XML, like vnc listen/socket */ - VIR_DEBUG0("Setting current domain def as transient"); + VIR_DEBUG("Setting current domain def as transient"); if (virDomainObjSetDefTransient(driver->caps, vm, true) < 0) goto cleanup; @@ -2030,11 +2030,11 @@ int qemuProcessStart(virConnectPtr conn, } /* Must be run before security labelling */ - VIR_DEBUG0("Preparing host devices"); + VIR_DEBUG("Preparing host devices"); if (qemuPrepareHostDevices(driver, vm->def) < 0) goto cleanup; - VIR_DEBUG0("Preparing chr devices"); + VIR_DEBUG("Preparing chr devices"); if (virDomainChrDefForeach(vm->def, true, qemuProcessPrepareChardevDevice, @@ -2043,14 +2043,14 @@ int qemuProcessStart(virConnectPtr conn, /* If you are using a SecurityDriver with dynamic labelling, then generate a security label for isolation */ - VIR_DEBUG0("Generating domain security label (if required)"); + VIR_DEBUG("Generating domain security label (if required)"); if (virSecurityManagerGenLabel(driver->securityManager, vm) < 0) { qemuAuditSecurityLabel(vm, false); goto cleanup; } qemuAuditSecurityLabel(vm, true); - VIR_DEBUG0("Generating setting domain security labels (if required)"); + VIR_DEBUG("Generating setting domain security labels (if required)"); if (virSecurityManagerSetAllLabel(driver->securityManager, vm, stdin_path) < 0) goto cleanup; @@ -2061,7 +2061,7 @@ int qemuProcessStart(virConnectPtr conn, */ struct stat stdin_sb; - VIR_DEBUG0("setting security label on pipe used for migration"); + VIR_DEBUG("setting security label on pipe used for migration"); if (fstat(stdin_fd, &stdin_sb) < 0) { virReportSystemError(errno, @@ -2075,7 +2075,7 @@ int qemuProcessStart(virConnectPtr conn, /* Ensure no historical cgroup for this VM is lying around bogus * settings */ - VIR_DEBUG0("Ensuring no historical cgroup is lying around"); + VIR_DEBUG("Ensuring no historical cgroup is lying around"); qemuRemoveCgroup(driver, vm, 1); if (vm->def->ngraphics == 1) { @@ -2121,11 +2121,11 @@ int qemuProcessStart(virConnectPtr conn, goto cleanup; } - VIR_DEBUG0("Creating domain log file"); + VIR_DEBUG("Creating domain log file"); if ((logfile = qemuDomainCreateLog(driver, vm, false)) < 0) goto cleanup; - VIR_DEBUG0("Determining emulator version"); + VIR_DEBUG("Determining emulator version"); qemuCapsFree(priv->qemuCaps); priv->qemuCaps = NULL; if (qemuCapsExtractVersionInfo(vm->def->emulator, vm->def->os.arch, @@ -2133,7 +2133,7 @@ int qemuProcessStart(virConnectPtr conn, &priv->qemuCaps) < 0) goto cleanup; - VIR_DEBUG0("Setting up domain cgroup (if required)"); + VIR_DEBUG("Setting up domain cgroup (if required)"); if (qemuSetupCgroup(driver, vm) < 0) goto cleanup; @@ -2142,7 +2142,7 @@ int qemuProcessStart(virConnectPtr conn, goto cleanup; } - VIR_DEBUG0("Preparing monitor state"); + VIR_DEBUG("Preparing monitor state"); if (qemuProcessPrepareMonitorChr(driver, priv->monConfig, vm->def->name) < 0) goto cleanup; @@ -2176,7 +2176,7 @@ int qemuProcessStart(virConnectPtr conn, * use in hotplug */ if (qemuCapsGet(priv->qemuCaps, QEMU_CAPS_DEVICE)) { - VIR_DEBUG0("Assigning domain PCI addresses"); + VIR_DEBUG("Assigning domain PCI addresses"); /* Populate cache with current addresses */ if (priv->pciaddrs) { qemuDomainPCIAddressSetFree(priv->pciaddrs); @@ -2195,7 +2195,7 @@ int qemuProcessStart(virConnectPtr conn, priv->persistentAddrs = 0; } - VIR_DEBUG0("Building emulator command line"); + VIR_DEBUG("Building emulator command line"); if (!(cmd = qemuBuildCommandLine(conn, driver, vm->def, priv->monConfig, priv->monJSON != 0, priv->qemuCaps, migrateFrom, stdin_fd, @@ -2297,31 +2297,31 @@ int qemuProcessStart(virConnectPtr conn, if (ret == -1) /* The VM failed to start */ goto cleanup; - VIR_DEBUG0("Waiting for monitor to show up"); + VIR_DEBUG("Waiting for monitor to show up"); if (qemuProcessWaitForMonitor(driver, vm, pos) < 0) goto cleanup; - VIR_DEBUG0("Detecting VCPU PIDs"); + VIR_DEBUG("Detecting VCPU PIDs"); if (qemuProcessDetectVcpuPIDs(driver, vm) < 0) goto cleanup; - VIR_DEBUG0("Setting VCPU affinities"); + VIR_DEBUG("Setting VCPU affinities"); if (qemuProcessSetVcpuAffinites(conn, vm) < 0) goto cleanup; - VIR_DEBUG0("Setting any required VM passwords"); + VIR_DEBUG("Setting any required VM passwords"); if (qemuProcessInitPasswords(conn, driver, vm) < 0) goto cleanup; /* If we have -device, then addresses are assigned explicitly. * If not, then we have to detect dynamic ones here */ if (!qemuCapsGet(priv->qemuCaps, QEMU_CAPS_DEVICE)) { - VIR_DEBUG0("Determining domain device PCI addresses"); + VIR_DEBUG("Determining domain device PCI addresses"); if (qemuProcessInitPCIAddresses(driver, vm) < 0) goto cleanup; } - VIR_DEBUG0("Setting initial memory amount"); + VIR_DEBUG("Setting initial memory amount"); cur_balloon = vm->def->mem.cur_balloon; qemuDomainObjEnterMonitorWithDriver(driver, vm); if (qemuMonitorSetBalloon(priv->mon, cur_balloon) < 0) { @@ -2331,7 +2331,7 @@ int qemuProcessStart(virConnectPtr conn, qemuDomainObjExitMonitorWithDriver(driver, vm); if (!start_paused) { - VIR_DEBUG0("Starting domain CPUs"); + VIR_DEBUG("Starting domain CPUs"); /* Allow the CPUS to start executing */ if (qemuProcessStartCPUs(driver, vm, conn) < 0) { if (virGetLastError() == NULL) @@ -2342,7 +2342,7 @@ int qemuProcessStart(virConnectPtr conn, } - VIR_DEBUG0("Writing domain status to disk"); + VIR_DEBUG("Writing domain status to disk"); if (virDomainSaveStatus(driver->caps, driver->stateDir, vm) < 0) goto cleanup; diff --git a/src/remote/remote_driver.c b/src/remote/remote_driver.c index d076a90..ec16cdf 100644 --- a/src/remote/remote_driver.c +++ b/src/remote/remote_driver.c @@ -923,21 +923,21 @@ doRemoteOpen (virConnectPtr conn, goto failed; } - VIR_DEBUG0("Adding Handler for remote events"); + VIR_DEBUG("Adding Handler for remote events"); /* Set up a callback to listen on the socket data */ if ((priv->watch = virEventAddHandle(priv->sock, VIR_EVENT_HANDLE_READABLE, remoteDomainEventFired, conn, NULL)) < 0) { - VIR_DEBUG0("virEventAddHandle failed: No addHandleImpl defined." + VIR_DEBUG("virEventAddHandle failed: No addHandleImpl defined." " continuing without events."); } else { - VIR_DEBUG0("Adding Timeout for remote event queue flushing"); + VIR_DEBUG("Adding Timeout for remote event queue flushing"); if ( (priv->eventFlushTimer = virEventAddTimeout(-1, remoteDomainEventQueueFlush, conn, NULL)) < 0) { - VIR_DEBUG0("virEventAddTimeout failed: No addTimeoutImpl defined. " + VIR_DEBUG("virEventAddTimeout failed: No addTimeoutImpl defined. " "continuing without events."); virEventRemoveHandle(priv->watch); priv->watch = -1; @@ -1086,7 +1086,7 @@ remoteOpen (virConnectPtr conn, (STREQ(conn->uri->path, "/session") || STRPREFIX(conn->uri->scheme, "test+")) && getuid() > 0) { - VIR_DEBUG0("Auto-spawn user daemon instance"); + VIR_DEBUG("Auto-spawn user daemon instance"); rflags |= VIR_DRV_OPEN_REMOTE_USER; if (!autostart || STRNEQ(autostart, "0")) @@ -1100,10 +1100,10 @@ remoteOpen (virConnectPtr conn, * to the UNIX socket anyway. */ if (!conn->uri) { - VIR_DEBUG0("Auto-probe remote URI"); + VIR_DEBUG("Auto-probe remote URI"); #ifndef __sun if (getuid() > 0) { - VIR_DEBUG0("Auto-spawn user daemon instance"); + VIR_DEBUG("Auto-spawn user daemon instance"); rflags |= VIR_DRV_OPEN_REMOTE_USER; if (!autostart || STRNEQ(autostart, "0")) @@ -1401,7 +1401,7 @@ negotiate_gnutls_on_connection (virConnectPtr conn, /* Verify certificate. */ if (verify_certificate (conn, priv, session) == -1) { - VIR_DEBUG0("failed to verify peer's certificate"); + VIR_DEBUG("failed to verify peer's certificate"); if (!no_verify) goto cleanup; } @@ -3410,7 +3410,7 @@ remoteAuthSASL (virConnectPtr conn, struct private_data *priv, int in_open, int ret = -1; const char *mechlist; - VIR_DEBUG0("Client initialize SASL authentication"); + VIR_DEBUG("Client initialize SASL authentication"); /* Sets up the SASL library as a whole */ err = sasl_client_init(NULL); if (err != SASL_OK) { @@ -3692,7 +3692,7 @@ remoteAuthSASL (virConnectPtr conn, struct private_data *priv, int in_open, priv->is_secure = 1; } - VIR_DEBUG0("SASL authentication complete"); + VIR_DEBUG("SASL authentication complete"); priv->saslconn = saslconn; ret = 0; @@ -3718,7 +3718,7 @@ remoteAuthPolkit (virConnectPtr conn, struct private_data *priv, int in_open, virConnectAuthPtr auth ATTRIBUTE_UNUSED) { remote_auth_polkit_ret ret; - VIR_DEBUG0("Client initialize PolicyKit-1 authentication"); + VIR_DEBUG("Client initialize PolicyKit-1 authentication"); memset (&ret, 0, sizeof ret); if (call (conn, priv, in_open, REMOTE_PROC_AUTH_POLKIT, @@ -3727,7 +3727,7 @@ remoteAuthPolkit (virConnectPtr conn, struct private_data *priv, int in_open, return -1; /* virError already set by call */ } - VIR_DEBUG0("PolicyKit-1 authentication complete"); + VIR_DEBUG("PolicyKit-1 authentication complete"); return 0; } # elif HAVE_POLKIT0 @@ -3747,7 +3747,7 @@ remoteAuthPolkit (virConnectPtr conn, struct private_data *priv, int in_open, NULL, 0, }; - VIR_DEBUG0("Client initialize PolicyKit-0 authentication"); + VIR_DEBUG("Client initialize PolicyKit-0 authentication"); if (auth && auth->cb) { /* Check if the necessary credential type for PolicyKit is supported */ @@ -3757,7 +3757,7 @@ remoteAuthPolkit (virConnectPtr conn, struct private_data *priv, int in_open, } if (allowcb) { - VIR_DEBUG0("Client run callback for PolicyKit authentication"); + VIR_DEBUG("Client run callback for PolicyKit authentication"); /* Run the authentication callback */ if ((*(auth->cb))(&cred, 1, auth->cbdata) < 0) { remoteError(VIR_ERR_AUTH_FAILED, "%s", @@ -3765,10 +3765,10 @@ remoteAuthPolkit (virConnectPtr conn, struct private_data *priv, int in_open, return -1; } } else { - VIR_DEBUG0("Client auth callback does not support PolicyKit"); + VIR_DEBUG("Client auth callback does not support PolicyKit"); } } else { - VIR_DEBUG0("No auth callback provided"); + VIR_DEBUG("No auth callback provided"); } memset (&ret, 0, sizeof ret); @@ -3778,7 +3778,7 @@ remoteAuthPolkit (virConnectPtr conn, struct private_data *priv, int in_open, return -1; /* virError already set by call */ } - VIR_DEBUG0("PolicyKit-0 authentication complete"); + VIR_DEBUG("PolicyKit-0 authentication complete"); return 0; } # endif /* HAVE_POLKIT0 */ @@ -4190,10 +4190,10 @@ remoteStreamEventTimerUpdate(struct private_stream_data *privst) if ((privst->incomingOffset && (privst->cbEvents & VIR_STREAM_EVENT_READABLE)) || (privst->cbEvents & VIR_STREAM_EVENT_WRITABLE)) { - VIR_DEBUG0("Enabling event timer"); + VIR_DEBUG("Enabling event timer"); virEventUpdateTimeout(privst->cbTimer, 0); } else { - VIR_DEBUG0("Disabling event timer"); + VIR_DEBUG("Disabling event timer"); virEventUpdateTimeout(privst->cbTimer, -1); } } @@ -4303,7 +4303,7 @@ remoteStreamHasError(virStreamPtr st) { return 0; } - VIR_DEBUG0("Raising async error"); + VIR_DEBUG("Raising async error"); virRaiseErrorFull(__FILE__, __FUNCTION__, __LINE__, privst->err.domain, privst->err.code, @@ -4395,7 +4395,7 @@ remoteStreamRecv(virStreamPtr st, int ret; if (st->flags & VIR_STREAM_NONBLOCK) { - VIR_DEBUG0("Non-blocking mode and no data available"); + VIR_DEBUG("Non-blocking mode and no data available"); rv = -2; goto cleanup; } @@ -5550,7 +5550,7 @@ processCallDispatchMessage(virConnectPtr conn, struct private_data *priv, if (virDomainEventQueuePush(priv->domainEvents, event) < 0) { - VIR_DEBUG0("Error adding event to queue"); + VIR_DEBUG("Error adding event to queue"); virDomainEventFree(event); } virEventUpdateTimeout(priv->eventFlushTimer, 0); @@ -5594,7 +5594,7 @@ processCallDispatchStream(virConnectPtr conn ATTRIBUTE_UNUSED, case REMOTE_CONTINUE: { int avail = privst->incomingLength - privst->incomingOffset; int need = priv->bufferLength - priv->bufferOffset; - VIR_DEBUG0("Got a stream data packet"); + VIR_DEBUG("Got a stream data packet"); /* XXX flag stream as complete somwhere if need==0 */ @@ -5602,7 +5602,7 @@ processCallDispatchStream(virConnectPtr conn ATTRIBUTE_UNUSED, int extra = need - avail; if (VIR_REALLOC_N(privst->incoming, privst->incomingLength + extra) < 0) { - VIR_DEBUG0("Out of memory handling stream data"); + VIR_DEBUG("Out of memory handling stream data"); return -1; } privst->incomingLength += extra; @@ -5624,9 +5624,9 @@ processCallDispatchStream(virConnectPtr conn ATTRIBUTE_UNUSED, } case REMOTE_OK: - VIR_DEBUG0("Got a synchronous confirm"); + VIR_DEBUG("Got a synchronous confirm"); if (!thecall) { - VIR_DEBUG0("Got unexpected stream finish confirmation"); + VIR_DEBUG("Got unexpected stream finish confirmation"); return -1; } thecall->mode = REMOTE_MODE_COMPLETE; @@ -5634,7 +5634,7 @@ processCallDispatchStream(virConnectPtr conn ATTRIBUTE_UNUSED, case REMOTE_ERROR: if (thecall && thecall->want_reply) { - VIR_DEBUG0("Got a synchronous error"); + VIR_DEBUG("Got a synchronous error"); /* Give the error straight to this call */ memset (&thecall->err, 0, sizeof thecall->err); if (!xdr_remote_error (xdr, &thecall->err)) { @@ -5643,16 +5643,16 @@ processCallDispatchStream(virConnectPtr conn ATTRIBUTE_UNUSED, } thecall->mode = REMOTE_MODE_ERROR; } else { - VIR_DEBUG0("Got a asynchronous error"); + VIR_DEBUG("Got a asynchronous error"); /* No call, so queue the error against the stream */ if (privst->has_error) { - VIR_DEBUG0("Got unexpected duplicate stream error"); + VIR_DEBUG("Got unexpected duplicate stream error"); return -1; } privst->has_error = 1; memset (&privst->err, 0, sizeof privst->err); if (!xdr_remote_error (xdr, &privst->err)) { - VIR_DEBUG0("Failed to unmarshall error"); + VIR_DEBUG("Failed to unmarshall error"); return -1; } } @@ -5813,7 +5813,7 @@ remoteIOEventLoop(virConnectPtr conn, if (fds[1].revents) { ssize_t s; - VIR_DEBUG0("Woken up from poll by other thread"); + VIR_DEBUG("Woken up from poll by other thread"); s = saferead(priv->wakeupReadFD, &ignore, sizeof(ignore)); if (s < 0) { virReportSystemError(errno, "%s", @@ -6199,7 +6199,7 @@ remoteDomainEventFired(int watch, } if (remoteIOHandleInput(conn, priv, 0) < 0) - VIR_DEBUG0("Something went wrong during async message processing"); + VIR_DEBUG("Something went wrong during async message processing"); done: remoteDriverUnlock(priv); diff --git a/src/secret/secret_driver.c b/src/secret/secret_driver.c index 5ca5006..752da98 100644 --- a/src/secret/secret_driver.c +++ b/src/secret/secret_driver.c @@ -1021,7 +1021,7 @@ secretDriverStartup(int privileged) return 0; out_of_memory: - VIR_ERROR0(_("Out of memory initializing secrets")); + VIR_ERROR(_("Out of memory initializing secrets")); error: VIR_FREE(base); secretDriverUnlock(driverState); diff --git a/src/storage/storage_backend_logical.c b/src/storage/storage_backend_logical.c index 7809324..a1ff35b 100644 --- a/src/storage/storage_backend_logical.c +++ b/src/storage/storage_backend_logical.c @@ -332,7 +332,7 @@ virStorageBackendLogicalFindPoolSources(virConnectPtr conn ATTRIBUTE_UNUSED, * worst that happens is that scanning doesn't pick everything up */ if (virRun(scanprog, &exitstatus) < 0) { - VIR_WARN0("Failure when running vgscan to refresh physical volumes"); + VIR_WARN("Failure when running vgscan to refresh physical volumes"); } memset(&sourceList, 0, sizeof(sourceList)); diff --git a/src/test/test_driver.c b/src/test/test_driver.c index 0978214..525fc9a 100644 --- a/src/test/test_driver.c +++ b/src/test/test_driver.c @@ -1164,7 +1164,7 @@ static virDrvOpenStatus testOpen(virConnectPtr conn, if ((privconn->domainEventTimer = virEventAddTimeout(-1, testDomainEventFlush, privconn, NULL)) < 0) - VIR_DEBUG0("virEventAddTimeout failed: No addTimeoutImpl defined. " + VIR_DEBUG("virEventAddTimeout failed: No addTimeoutImpl defined. " "continuing without events."); testDriverUnlock(privconn); } diff --git a/src/uml/uml_conf.c b/src/uml/uml_conf.c index 84b74f3..1673a20 100644 --- a/src/uml/uml_conf.c +++ b/src/uml/uml_conf.c @@ -73,7 +73,7 @@ virCapsPtr umlCapsInit(void) { */ if (nodeCapsInitNUMA(caps) < 0) { virCapabilitiesFreeNUMAInfo(caps); - VIR_WARN0("Failed to query host NUMA topology, disabling NUMA capabilities"); + VIR_WARN("Failed to query host NUMA topology, disabling NUMA capabilities"); } if (virGetHostUUID(caps->host.host_uuid)) { diff --git a/src/uml/uml_driver.c b/src/uml/uml_driver.c index 33849a0..3a725aa 100644 --- a/src/uml/uml_driver.c +++ b/src/uml/uml_driver.c @@ -123,7 +123,7 @@ static int umlSetCloseExec(int fd) { goto error; return 0; error: - VIR_ERROR0(_("Failed to set close-on-exec file descriptor flag")); + VIR_ERROR(_("Failed to set close-on-exec file descriptor flag")); return -1; } @@ -322,10 +322,10 @@ reread: dom->state = VIR_DOMAIN_RUNNING; if (umlOpenMonitor(driver, dom) < 0) { - VIR_WARN0("Could not open monitor for new domain"); + VIR_WARN("Could not open monitor for new domain"); umlShutdownVMDaemon(NULL, driver, dom); } else if (umlIdentifyChrPTY(driver, dom) < 0) { - VIR_WARN0("Could not identify charater devices for new domain"); + VIR_WARN("Could not identify charater devices for new domain"); umlShutdownVMDaemon(NULL, driver, dom); } } @@ -413,7 +413,7 @@ umlStartup(int privileged) uml_driver->caps->privateDataFreeFunc = umlDomainObjPrivateFree; if ((uml_driver->inotifyFD = inotify_init()) < 0) { - VIR_ERROR0(_("cannot initialize inotify")); + VIR_ERROR(_("cannot initialize inotify")); goto error; } @@ -451,7 +451,7 @@ umlStartup(int privileged) return 0; out_of_memory: - VIR_ERROR0(_("umlStartup: out of memory")); + VIR_ERROR(_("umlStartup: out of memory")); error: VIR_FREE(userdir); @@ -782,7 +782,7 @@ static int umlCleanupTapDevices(virConnectPtr conn ATTRIBUTE_UNUSED, int err; int ret = 0; brControl *brctl = NULL; - VIR_ERROR0(_("Cleanup tap")); + VIR_ERROR(_("Cleanup tap")); if (brInit(&brctl) < 0) return -1; @@ -800,7 +800,7 @@ static int umlCleanupTapDevices(virConnectPtr conn ATTRIBUTE_UNUSED, ret = -1; } } - VIR_ERROR0(_("Cleanup tap done")); + VIR_ERROR(_("Cleanup tap done")); brShutdown(brctl); return ret; } diff --git a/src/util/bridge.c b/src/util/bridge.c index 3ed71be..98169ae 100644 --- a/src/util/bridge.c +++ b/src/util/bridge.c @@ -428,13 +428,13 @@ brProbeVnetHdr(int tapfd) struct ifreq dummy; if (ioctl(tapfd, TUNGETFEATURES, &features) != 0) { - VIR_INFO0(_("Not enabling IFF_VNET_HDR; " + VIR_INFO(_("Not enabling IFF_VNET_HDR; " "TUNGETFEATURES ioctl() not implemented")); return 0; } if (!(features & IFF_VNET_HDR)) { - VIR_INFO0(_("Not enabling IFF_VNET_HDR; " + VIR_INFO(_("Not enabling IFF_VNET_HDR; " "TUNGETFEATURES ioctl() reports no IFF_VNET_HDR")); return 0; } @@ -443,17 +443,17 @@ brProbeVnetHdr(int tapfd) * If TUNGETIFF is not implemented then errno == EBADFD. */ if (ioctl(tapfd, TUNGETIFF, &dummy) != -1 || errno != EBADFD) { - VIR_INFO0(_("Not enabling IFF_VNET_HDR; " + VIR_INFO(_("Not enabling IFF_VNET_HDR; " "TUNGETIFF ioctl() not implemented")); return 0; } - VIR_INFO0(_("Enabling IFF_VNET_HDR")); + VIR_INFO(_("Enabling IFF_VNET_HDR")); return 1; # else (void) tapfd; - VIR_INFO0(_("Not enabling IFF_VNET_HDR; disabled at build time")); + VIR_INFO(_("Not enabling IFF_VNET_HDR; disabled at build time")); return 0; # endif } diff --git a/src/util/cgroup.c b/src/util/cgroup.c index 62b371d..2e5ef46 100644 --- a/src/util/cgroup.c +++ b/src/util/cgroup.c @@ -100,7 +100,7 @@ static int virCgroupDetectMounts(virCgroupPtr group) mounts = fopen("/proc/mounts", "r"); if (mounts == NULL) { - VIR_ERROR0(_("Unable to open /proc/mounts")); + VIR_ERROR(_("Unable to open /proc/mounts")); return -ENOENT; } @@ -152,7 +152,7 @@ static int virCgroupDetectPlacement(virCgroupPtr group) mapping = fopen("/proc/self/cgroup", "r"); if (mapping == NULL) { - VIR_ERROR0(_("Unable to open /proc/self/cgroup")); + VIR_ERROR(_("Unable to open /proc/self/cgroup")); return -ENOENT; } diff --git a/src/util/command.c b/src/util/command.c index 862a913..bf47263 100644 --- a/src/util/command.c +++ b/src/util/command.c @@ -559,7 +559,7 @@ virCommandSetWorkingDirectory(virCommandPtr cmd, const char *pwd) if (cmd->pwd) { cmd->has_error = -1; - VIR_DEBUG0("cannot set directory twice"); + VIR_DEBUG("cannot set directory twice"); } else { cmd->pwd = strdup(pwd); if (!cmd->pwd) @@ -579,7 +579,7 @@ virCommandSetInputBuffer(virCommandPtr cmd, const char *inbuf) if (cmd->infd != -1 || cmd->inbuf) { cmd->has_error = -1; - VIR_DEBUG0("cannot specify input twice"); + VIR_DEBUG("cannot specify input twice"); return; } @@ -604,7 +604,7 @@ virCommandSetOutputBuffer(virCommandPtr cmd, char **outbuf) if (cmd->outfdptr) { cmd->has_error = -1; - VIR_DEBUG0("cannot specify output twice"); + VIR_DEBUG("cannot specify output twice"); return; } @@ -628,7 +628,7 @@ virCommandSetErrorBuffer(virCommandPtr cmd, char **errbuf) if (cmd->errfdptr) { cmd->has_error = -1; - VIR_DEBUG0("cannot specify stderr twice"); + VIR_DEBUG("cannot specify stderr twice"); return; } @@ -648,12 +648,12 @@ virCommandSetInputFD(virCommandPtr cmd, int infd) if (cmd->infd != -1 || cmd->inbuf) { cmd->has_error = -1; - VIR_DEBUG0("cannot specify input twice"); + VIR_DEBUG("cannot specify input twice"); return; } if (infd < 0) { cmd->has_error = -1; - VIR_DEBUG0("cannot specify invalid input fd"); + VIR_DEBUG("cannot specify invalid input fd"); return; } @@ -672,7 +672,7 @@ virCommandSetOutputFD(virCommandPtr cmd, int *outfd) if (cmd->outfdptr) { cmd->has_error = -1; - VIR_DEBUG0("cannot specify output twice"); + VIR_DEBUG("cannot specify output twice"); return; } @@ -691,7 +691,7 @@ virCommandSetErrorFD(virCommandPtr cmd, int *errfd) if (cmd->errfdptr) { cmd->has_error = -1; - VIR_DEBUG0("cannot specify stderr twice"); + VIR_DEBUG("cannot specify stderr twice"); return; } @@ -712,7 +712,7 @@ virCommandSetPreExecHook(virCommandPtr cmd, virExecHook hook, void *opaque) if (cmd->hook) { cmd->has_error = -1; - VIR_DEBUG0("cannot specify hook twice"); + VIR_DEBUG("cannot specify hook twice"); return; } cmd->hook = hook; diff --git a/src/util/event.c b/src/util/event.c index bc0129c..cfaffc8 100644 --- a/src/util/event.c +++ b/src/util/event.c @@ -145,7 +145,7 @@ void virEventRegisterImpl(virEventAddHandleFunc addHandle, */ int virEventRegisterDefaultImpl(void) { - VIR_DEBUG0(""); + VIR_DEBUG(" "); virResetLastError(); @@ -185,7 +185,7 @@ int virEventRegisterDefaultImpl(void) */ int virEventRunDefaultImpl(void) { - VIR_DEBUG0(""); + VIR_DEBUG(" "); virResetLastError(); if (virEventPollRunOnce() < 0) { diff --git a/src/util/event_poll.c b/src/util/event_poll.c index c5eedd3..df2b28c 100644 --- a/src/util/event_poll.c +++ b/src/util/event_poll.c @@ -687,7 +687,7 @@ static int virEventPollInterruptLocked(void) return 0; } - VIR_DEBUG0("Interrupting"); + VIR_DEBUG("Interrupting"); if (safewrite(eventLoop.wakeupfd[1], &c, sizeof(c)) != sizeof(c)) return -1; return 0; diff --git a/src/util/hash.c b/src/util/hash.c index 5366dd6..b5ec6af 100644 --- a/src/util/hash.c +++ b/src/util/hash.c @@ -37,7 +37,7 @@ #define virHashIterationError(ret) \ do { \ - VIR_ERROR0(_("Hash operation not allowed during iteration")); \ + VIR_ERROR(_("Hash operation not allowed during iteration")); \ return ret; \ } while (0) diff --git a/src/util/json.c b/src/util/json.c index 0daeae9..850c859 100644 --- a/src/util/json.c +++ b/src/util/json.c @@ -630,7 +630,7 @@ static int virJSONParserInsertValue(virJSONParserPtr parser, } else { virJSONParserStatePtr state; if (!parser->nstate) { - VIR_DEBUG0("got a value to insert without a container"); + VIR_DEBUG("got a value to insert without a container"); return -1; } @@ -639,7 +639,7 @@ static int virJSONParserInsertValue(virJSONParserPtr parser, switch (state->value->type) { case VIR_JSON_TYPE_OBJECT: { if (!state->key) { - VIR_DEBUG0("missing key when inserting object value"); + VIR_DEBUG("missing key when inserting object value"); return -1; } @@ -653,7 +653,7 @@ static int virJSONParserInsertValue(virJSONParserPtr parser, case VIR_JSON_TYPE_ARRAY: { if (state->key) { - VIR_DEBUG0("unexpected key when inserting array value"); + VIR_DEBUG("unexpected key when inserting array value"); return -1; } @@ -663,7 +663,7 @@ static int virJSONParserInsertValue(virJSONParserPtr parser, } break; default: - VIR_DEBUG0("unexpected value type, not a container"); + VIR_DEBUG("unexpected value type, not a container"); return -1; } } diff --git a/src/util/logging.c b/src/util/logging.c index 90d5a99..823e506 100644 --- a/src/util/logging.c +++ b/src/util/logging.c @@ -217,7 +217,7 @@ int virLogStartup(void) { virLogDefaultPriority = VIR_LOG_DEFAULT; virLogUnlock(); if (pbm) - VIR_WARN0(pbm); + VIR_WARN("%s", pbm); return 0; } @@ -478,7 +478,7 @@ virLogEmergencyDumpAll(int signum) { */ int virLogSetDefaultPriority(int priority) { if ((priority < VIR_LOG_DEBUG) || (priority > VIR_LOG_ERROR)) { - VIR_WARN0("Ignoring invalid log level setting."); + VIR_WARN("Ignoring invalid log level setting."); return -1; } if (!virLogInitialized) @@ -1007,7 +1007,7 @@ int virLogParseOutputs(const char *outputs) { ret = count; cleanup: if (ret == -1) - VIR_WARN0("Ignoring invalid log output setting."); + VIR_WARN("Ignoring invalid log output setting."); return ret; } @@ -1063,7 +1063,7 @@ int virLogParseFilters(const char *filters) { ret = count; cleanup: if (ret == -1) - VIR_WARN0("Ignoring invalid log filter setting."); + VIR_WARN("Ignoring invalid log filter setting."); return ret; } @@ -1185,7 +1185,7 @@ int virLogParseDefaultPriority(const char *priority) { else if (STREQ(priority, "4") || STREQ(priority, "error")) ret = virLogSetDefaultPriority(VIR_LOG_ERROR); else - VIR_WARN0("Ignoring invalid log level setting"); + VIR_WARN("Ignoring invalid log level setting"); return ret; } diff --git a/src/util/logging.h b/src/util/logging.h index 0dba78c..e948077 100644 --- a/src/util/logging.h +++ b/src/util/logging.h @@ -32,35 +32,27 @@ */ # ifdef ENABLE_DEBUG # define VIR_DEBUG_INT(category, f, l, fmt,...) \ - virLogMessage(category, VIR_LOG_DEBUG, f, l, 0, fmt, __VA_ARGS__) + virLogMessage(category, VIR_LOG_DEBUG, f, l, 0, fmt, ##__VA_ARGS__) # else # define VIR_DEBUG_INT(category, f, l, fmt,...) \ do { } while (0) # endif /* !ENABLE_DEBUG */ # define VIR_INFO_INT(category, f, l, fmt,...) \ - virLogMessage(category, VIR_LOG_INFO, f, l, 0, fmt, __VA_ARGS__) + virLogMessage(category, VIR_LOG_INFO, f, l, 0, fmt, ##__VA_ARGS__) # define VIR_WARN_INT(category, f, l, fmt,...) \ - virLogMessage(category, VIR_LOG_WARN, f, l, 0, fmt, __VA_ARGS__) + virLogMessage(category, VIR_LOG_WARN, f, l, 0, fmt, ##__VA_ARGS__) # define VIR_ERROR_INT(category, f, l, fmt,...) \ - virLogMessage(category, VIR_LOG_ERROR, f, l, 0, fmt, __VA_ARGS__) + virLogMessage(category, VIR_LOG_ERROR, f, l, 0, fmt, ##__VA_ARGS__) # define VIR_DEBUG(fmt,...) \ - VIR_DEBUG_INT("file." __FILE__, __func__, __LINE__, fmt, __VA_ARGS__) -# define VIR_DEBUG0(msg) \ - VIR_DEBUG_INT("file." __FILE__, __func__, __LINE__, "%s", msg) + VIR_DEBUG_INT("file." __FILE__, __func__, __LINE__, fmt, ##__VA_ARGS__) # define VIR_INFO(fmt,...) \ - VIR_INFO_INT("file." __FILE__, __func__, __LINE__, fmt, __VA_ARGS__) -# define VIR_INFO0(msg) \ - VIR_INFO_INT("file." __FILE__, __func__, __LINE__, "%s", msg) + VIR_INFO_INT("file." __FILE__, __func__, __LINE__, fmt, ##__VA_ARGS__) # define VIR_WARN(fmt,...) \ - VIR_WARN_INT("file." __FILE__, __func__, __LINE__, fmt, __VA_ARGS__) -# define VIR_WARN0(msg) \ - VIR_WARN_INT("file." __FILE__, __func__, __LINE__, "%s", msg) + VIR_WARN_INT("file." __FILE__, __func__, __LINE__, fmt, ##__VA_ARGS__) # define VIR_ERROR(fmt,...) \ - VIR_ERROR_INT("file." __FILE__, __func__, __LINE__, fmt, __VA_ARGS__) -# define VIR_ERROR0(msg) \ - VIR_ERROR_INT("file." __FILE__, __func__, __LINE__, "%s", msg) + VIR_ERROR_INT("file." __FILE__, __func__, __LINE__, fmt, ##__VA_ARGS__) /* * To be made public diff --git a/src/util/pci.c b/src/util/pci.c index d7f74f9..9cc7b20 100644 --- a/src/util/pci.c +++ b/src/util/pci.c @@ -293,7 +293,7 @@ pciIterDevices(pciIterPredicate predicate, dir = opendir(PCI_SYSFS "devices"); if (!dir) { - VIR_WARN0("Failed to open " PCI_SYSFS "devices"); + VIR_WARN("Failed to open " PCI_SYSFS "devices"); return -1; } @@ -1195,7 +1195,7 @@ pciWaitForDeviceCleanup(pciDevice *dev, const char *matcher) * unbind might succeed anyway, and besides, it's very likely we have * no way to report the error */ - VIR_DEBUG0("Failed to open /proc/iomem, trying to continue anyway"); + VIR_DEBUG("Failed to open /proc/iomem, trying to continue anyway"); return 0; } diff --git a/src/util/util.c b/src/util/util.c index 4c50fcb..01ba771 100644 --- a/src/util/util.c +++ b/src/util/util.c @@ -295,7 +295,7 @@ static int virClearCapabilities(void) # else static int virClearCapabilities(void) { -// VIR_WARN0("libcap-ng support not compiled in, unable to clear capabilities"); +// VIR_WARN("libcap-ng support not compiled in, unable to clear capabilities"); return 0; } # endif @@ -682,7 +682,7 @@ __virExec(const char *const*argv, } if ((hook)(data) != 0) { - VIR_DEBUG0("Hook function failed."); + VIR_DEBUG("Hook function failed."); goto fork_error; } @@ -761,7 +761,7 @@ virExecWithHook(const char *const*argv, VIR_DEBUG("%s %s", envp_str, argv_str); VIR_FREE(envp_str); } else { - VIR_DEBUG0(argv_str); + VIR_DEBUG("%s", argv_str); } VIR_FREE(argv_str); @@ -871,7 +871,7 @@ virRunWithHook(const char *const*argv, virReportOOMError(); goto error; } - VIR_DEBUG0(argv_str); + VIR_DEBUG("%s", argv_str); if ((execret = __virExec(argv, NULL, NULL, &childpid, -1, &outfd, &errfd, diff --git a/src/util/virtaudit.c b/src/util/virtaudit.c index de7b357..2f1a529 100644 --- a/src/util/virtaudit.c +++ b/src/util/virtaudit.c @@ -96,7 +96,7 @@ void virAuditSend(const char *file ATTRIBUTE_UNUSED, const char *func, va_start(args, fmt); if (virVasprintf(&str, fmt, args) < 0) { - VIR_WARN0("Out of memory while formatting audit message"); + VIR_WARN("Out of memory while formatting audit message"); str = NULL; } va_end(args); diff --git a/src/vbox/vbox_driver.c b/src/vbox/vbox_driver.c index fc43b8c..eab4679 100644 --- a/src/vbox/vbox_driver.c +++ b/src/vbox/vbox_driver.c @@ -98,36 +98,36 @@ int vboxRegister(void) { * number 51, thus the version ranges in the if statements below. */ if (uVersion >= 2001052 && uVersion < 2002051) { - VIR_DEBUG0("VirtualBox API version: 2.2"); + VIR_DEBUG("VirtualBox API version: 2.2"); driver = &vbox22Driver; networkDriver = &vbox22NetworkDriver; storageDriver = &vbox22StorageDriver; } else if (uVersion >= 2002051 && uVersion < 3000051) { - VIR_DEBUG0("VirtualBox API version: 3.0"); + VIR_DEBUG("VirtualBox API version: 3.0"); driver = &vbox30Driver; networkDriver = &vbox30NetworkDriver; storageDriver = &vbox30StorageDriver; } else if (uVersion >= 3000051 && uVersion < 3001051) { - VIR_DEBUG0("VirtualBox API version: 3.1"); + VIR_DEBUG("VirtualBox API version: 3.1"); driver = &vbox31Driver; networkDriver = &vbox31NetworkDriver; storageDriver = &vbox31StorageDriver; } else if (uVersion >= 3001051 && uVersion < 3002051) { - VIR_DEBUG0("VirtualBox API version: 3.2"); + VIR_DEBUG("VirtualBox API version: 3.2"); driver = &vbox32Driver; networkDriver = &vbox32NetworkDriver; storageDriver = &vbox32StorageDriver; } else if (uVersion >= 3002051 && uVersion < 4000051) { - VIR_DEBUG0("VirtualBox API version: 4.0"); + VIR_DEBUG("VirtualBox API version: 4.0"); driver = &vbox40Driver; networkDriver = &vbox40NetworkDriver; storageDriver = &vbox40StorageDriver; } else { - VIR_DEBUG0("Unsupport VirtualBox API version"); + VIR_DEBUG("Unsupport VirtualBox API version"); } } else { - VIR_DEBUG0("VBoxCGlueInit failed, using dummy driver"); + VIR_DEBUG("VBoxCGlueInit failed, using dummy driver"); } if (virRegisterDriver(driver) < 0) diff --git a/src/vbox/vbox_tmpl.c b/src/vbox/vbox_tmpl.c index 8241d34..80e0a46 100644 --- a/src/vbox/vbox_tmpl.c +++ b/src/vbox/vbox_tmpl.c @@ -1026,7 +1026,7 @@ static virDrvOpenStatus vboxOpen(virConnectPtr conn, #endif /* !(VBOX_API_VERSION == 2002) */ conn->privateData = data; - VIR_DEBUG0("in vboxOpen"); + VIR_DEBUG("in vboxOpen"); return VIR_DRV_OPEN_SUCCESS; } @@ -3733,15 +3733,15 @@ vboxAttachDrives(virDomainDefPtr def, vboxGlobalData *data, IMachine *machine) if (def->disks[i]->readonly) { hardDisk->vtbl->SetType(hardDisk, HardDiskType_Immutable); - VIR_DEBUG0("setting harddisk to readonly"); + VIR_DEBUG("setting harddisk to readonly"); } else if (!def->disks[i]->readonly) { hardDisk->vtbl->SetType(hardDisk, HardDiskType_Normal); - VIR_DEBUG0("setting harddisk type to normal"); + VIR_DEBUG("setting harddisk type to normal"); } if (def->disks[i]->bus == VIR_DOMAIN_DISK_BUS_IDE) { if (STREQ(def->disks[i]->dst, "hdc")) { - VIR_DEBUG0("Not connecting harddisk to hdc as hdc" + VIR_DEBUG("Not connecting harddisk to hdc as hdc" " is taken by CD/DVD Drive"); } else { PRInt32 channel = 0; @@ -4021,10 +4021,10 @@ vboxAttachDrives(virDomainDefPtr def, vboxGlobalData *data, IMachine *machine) if (def->disks[i]->device == VIR_DOMAIN_DISK_DEVICE_DISK) { if (def->disks[i]->readonly) { medium->vtbl->SetType(medium, MediumType_Immutable); - VIR_DEBUG0("setting harddisk to immutable"); + VIR_DEBUG("setting harddisk to immutable"); } else if (!def->disks[i]->readonly) { medium->vtbl->SetType(medium, MediumType_Normal); - VIR_DEBUG0("setting harddisk type to normal"); + VIR_DEBUG("setting harddisk type to normal"); } } @@ -4450,7 +4450,7 @@ vboxAttachDisplay(virDomainDefPtr def, vboxGlobalData *data, IMachine *machine) #endif /* VBOX_API_VERSION >= 4000 */ if (VRDxServer) { VRDxServer->vtbl->SetEnabled(VRDxServer, PR_TRUE); - VIR_DEBUG0("VRDP Support turned ON."); + VIR_DEBUG("VRDP Support turned ON."); #if VBOX_API_VERSION < 3001 if (def->graphics[i]->data.rdp.port) { @@ -4463,7 +4463,7 @@ vboxAttachDisplay(virDomainDefPtr def, vboxGlobalData *data, IMachine *machine) * the default one which is 3389 currently */ VRDxServer->vtbl->SetPort(VRDxServer, 0); - VIR_DEBUG0("VRDP Port changed to default, which is 3389 currently"); + VIR_DEBUG("VRDP Port changed to default, which is 3389 currently"); } #elif VBOX_API_VERSION < 4000 /* 3001 <= VBOX_API_VERSION < 4000 */ PRUnichar *portUtf16 = NULL; @@ -4484,13 +4484,13 @@ vboxAttachDisplay(virDomainDefPtr def, vboxGlobalData *data, IMachine *machine) if (def->graphics[i]->data.rdp.replaceUser) { VRDxServer->vtbl->SetReuseSingleConnection(VRDxServer, PR_TRUE); - VIR_DEBUG0("VRDP set to reuse single connection"); + VIR_DEBUG("VRDP set to reuse single connection"); } if (def->graphics[i]->data.rdp.multiUser) { VRDxServer->vtbl->SetAllowMultiConnection(VRDxServer, PR_TRUE); - VIR_DEBUG0("VRDP set to allow multiple connection"); + VIR_DEBUG("VRDP set to allow multiple connection"); } if (def->graphics[i]->data.rdp.listenAddr) { @@ -6885,7 +6885,7 @@ static virDrvOpenStatus vboxNetworkOpen(virConnectPtr conn, (data->vboxSession == NULL)) goto cleanup; - VIR_DEBUG0("network initialized"); + VIR_DEBUG("network initialized"); /* conn->networkPrivateData = some network specific data */ return VIR_DRV_OPEN_SUCCESS; @@ -6894,7 +6894,7 @@ cleanup: } static int vboxNetworkClose(virConnectPtr conn) { - VIR_DEBUG0("network uninitialized"); + VIR_DEBUG("network uninitialized"); conn->networkPrivateData = NULL; return 0; } @@ -7239,7 +7239,7 @@ static virNetworkPtr vboxNetworkDefineCreateXML(virConnectPtr conn, const char * data->vboxObj->vtbl->CreateDHCPServer(data->vboxObj, networkNameUtf16, &dhcpServer); - VIR_DEBUG0("couldn't find dhcp server so creating one"); + VIR_DEBUG("couldn't find dhcp server so creating one"); } if (dhcpServer) { PRUnichar *ipAddressUtf16 = NULL; @@ -7696,7 +7696,7 @@ static virDrvOpenStatus vboxStorageOpen (virConnectPtr conn, (data->vboxSession == NULL)) goto cleanup; - VIR_DEBUG0("vbox storage initialized"); + VIR_DEBUG("vbox storage initialized"); /* conn->storagePrivateData = some storage specific data */ return VIR_DRV_OPEN_SUCCESS; @@ -7705,7 +7705,7 @@ cleanup: } static int vboxStorageClose (virConnectPtr conn) { - VIR_DEBUG0("vbox storage uninitialized"); + VIR_DEBUG("vbox storage uninitialized"); conn->storagePrivateData = NULL; return 0; } @@ -8245,7 +8245,7 @@ static int vboxStorageVolDelete(virStorageVolPtr vol, #endif /* VBOX_API_VERSION >= 3001 */ if (NS_SUCCEEDED(rc)) { rc = machine->vtbl->SaveSettings(machine); - VIR_DEBUG0("saving machine settings"); + VIR_DEBUG("saving machine settings"); } if (NS_SUCCEEDED(rc)) { diff --git a/src/vmx/vmx.c b/src/vmx/vmx.c index 7758314..b37f03b 100644 --- a/src/vmx/vmx.c +++ b/src/vmx/vmx.c @@ -1789,7 +1789,7 @@ virVMXParseVNC(virConfPtr conf, virDomainGraphicsDefPtr *def) } if (port < 0) { - VIR_WARN0("VNC is enabled but VMX entry 'RemoteDisplay.vnc.port' " + VIR_WARN("VNC is enabled but VMX entry 'RemoteDisplay.vnc.port' " "is missing, the VNC port is unknown"); (*def)->data.vnc.port = 0; @@ -3204,7 +3204,7 @@ virVMXFormatVNC(virDomainGraphicsDefPtr def, virBufferPtr buffer) virBufferAsprintf(buffer, "RemoteDisplay.vnc.enabled = \"true\"\n"); if (def->data.vnc.autoport) { - VIR_WARN0("VNC autoport is enabled, but the automatically assigned " + VIR_WARN("VNC autoport is enabled, but the automatically assigned " "VNC port cannot be read back"); } else { if (def->data.vnc.port < 5900 || def->data.vnc.port > 5964) { diff --git a/src/xen/xen_driver.c b/src/xen/xen_driver.c index dd94fbc..40130e0 100644 --- a/src/xen/xen_driver.c +++ b/src/xen/xen_driver.c @@ -350,35 +350,35 @@ xenUnifiedOpen (virConnectPtr conn, virConnectAuthPtr auth, int flags) /* Hypervisor is only run with privilege & required to succeed */ if (xenHavePrivilege()) { - VIR_DEBUG0("Trying hypervisor sub-driver"); + VIR_DEBUG("Trying hypervisor sub-driver"); if (drivers[XEN_UNIFIED_HYPERVISOR_OFFSET]->open(conn, auth, flags) == VIR_DRV_OPEN_SUCCESS) { - VIR_DEBUG0("Activated hypervisor sub-driver"); + VIR_DEBUG("Activated hypervisor sub-driver"); priv->opened[XEN_UNIFIED_HYPERVISOR_OFFSET] = 1; } } /* XenD is required to succeed if privileged */ - VIR_DEBUG0("Trying XenD sub-driver"); + VIR_DEBUG("Trying XenD sub-driver"); if (drivers[XEN_UNIFIED_XEND_OFFSET]->open(conn, auth, flags) == VIR_DRV_OPEN_SUCCESS) { - VIR_DEBUG0("Activated XenD sub-driver"); + VIR_DEBUG("Activated XenD sub-driver"); priv->opened[XEN_UNIFIED_XEND_OFFSET] = 1; /* XenD is active, so try the xm & xs drivers too, both requird to * succeed if root, optional otherwise */ if (priv->xendConfigVersion <= 2) { - VIR_DEBUG0("Trying XM sub-driver"); + VIR_DEBUG("Trying XM sub-driver"); if (drivers[XEN_UNIFIED_XM_OFFSET]->open(conn, auth, flags) == VIR_DRV_OPEN_SUCCESS) { - VIR_DEBUG0("Activated XM sub-driver"); + VIR_DEBUG("Activated XM sub-driver"); priv->opened[XEN_UNIFIED_XM_OFFSET] = 1; } } - VIR_DEBUG0("Trying XS sub-driver"); + VIR_DEBUG("Trying XS sub-driver"); if (drivers[XEN_UNIFIED_XS_OFFSET]->open(conn, auth, flags) == VIR_DRV_OPEN_SUCCESS) { - VIR_DEBUG0("Activated XS sub-driver"); + VIR_DEBUG("Activated XS sub-driver"); priv->opened[XEN_UNIFIED_XS_OFFSET] = 1; } else { if (xenHavePrivilege()) @@ -388,7 +388,7 @@ xenUnifiedOpen (virConnectPtr conn, virConnectAuthPtr auth, int flags) if (xenHavePrivilege()) { goto fail; /* XenD is mandatory when privileged */ } else { - VIR_DEBUG0("Handing off for remote driver"); + VIR_DEBUG("Handing off for remote driver"); ret = VIR_DRV_OPEN_DECLINED; /* Let remote_driver try instead */ goto clean; } @@ -397,16 +397,16 @@ xenUnifiedOpen (virConnectPtr conn, virConnectAuthPtr auth, int flags) xenNumaInit(conn); if (!(priv->caps = xenHypervisorMakeCapabilities(conn))) { - VIR_DEBUG0("Failed to make capabilities"); + VIR_DEBUG("Failed to make capabilities"); goto fail; } #if WITH_XEN_INOTIFY if (xenHavePrivilege()) { - VIR_DEBUG0("Trying Xen inotify sub-driver"); + VIR_DEBUG("Trying Xen inotify sub-driver"); if (drivers[XEN_UNIFIED_INOTIFY_OFFSET]->open(conn, auth, flags) == VIR_DRV_OPEN_SUCCESS) { - VIR_DEBUG0("Activated Xen inotify sub-driver"); + VIR_DEBUG("Activated Xen inotify sub-driver"); priv->opened[XEN_UNIFIED_INOTIFY_OFFSET] = 1; } } @@ -417,7 +417,7 @@ xenUnifiedOpen (virConnectPtr conn, virConnectAuthPtr auth, int flags) fail: ret = VIR_DRV_OPEN_ERROR; clean: - VIR_DEBUG0("Failed to activate a mandatory sub-driver"); + VIR_DEBUG("Failed to activate a mandatory sub-driver"); for (i = 0 ; i < XEN_UNIFIED_NR_DRIVERS ; i++) if (priv->opened[i]) drivers[i]->close(conn); virMutexDestroy(&priv->lock); @@ -2270,7 +2270,7 @@ xenUnifiedAddDomainInfo(xenUnifiedDomainInfoListPtr list, for (n=0; n < list->count; n++) { if (STREQ(list->doms[n]->name, name) && !memcmp(list->doms[n]->uuid, uuid, VIR_UUID_BUFLEN)) { - VIR_DEBUG0("WARNING: dom already tracked"); + VIR_DEBUG("WARNING: dom already tracked"); return -1; } } diff --git a/src/xen/xen_hypervisor.c b/src/xen/xen_hypervisor.c index 9a5b41d..ac1b685 100644 --- a/src/xen/xen_hypervisor.c +++ b/src/xen/xen_hypervisor.c @@ -2092,13 +2092,13 @@ xenHypervisorInit(void) /* RHEL 5.0 */ dom_interface_version = 3; /* XEN_DOMCTL_INTERFACE_VERSION */ if (virXen_getvcpusinfo(fd, 0, 0, ipt, NULL, 0) == 0){ - VIR_DEBUG0("Using hypervisor call v2, sys ver2 dom ver3"); + VIR_DEBUG("Using hypervisor call v2, sys ver2 dom ver3"); goto done; } /* Fedora 7 */ dom_interface_version = 4; /* XEN_DOMCTL_INTERFACE_VERSION */ if (virXen_getvcpusinfo(fd, 0, 0, ipt, NULL, 0) == 0){ - VIR_DEBUG0("Using hypervisor call v2, sys ver2 dom ver4"); + VIR_DEBUG("Using hypervisor call v2, sys ver2 dom ver4"); goto done; } } @@ -2108,7 +2108,7 @@ xenHypervisorInit(void) /* xen-3.1 */ dom_interface_version = 5; /* XEN_DOMCTL_INTERFACE_VERSION */ if (virXen_getvcpusinfo(fd, 0, 0, ipt, NULL, 0) == 0){ - VIR_DEBUG0("Using hypervisor call v2, sys ver3 dom ver5"); + VIR_DEBUG("Using hypervisor call v2, sys ver3 dom ver5"); goto done; } } @@ -2118,7 +2118,7 @@ xenHypervisorInit(void) /* Fedora 8 */ dom_interface_version = 5; /* XEN_DOMCTL_INTERFACE_VERSION */ if (virXen_getvcpusinfo(fd, 0, 0, ipt, NULL, 0) == 0){ - VIR_DEBUG0("Using hypervisor call v2, sys ver4 dom ver5"); + VIR_DEBUG("Using hypervisor call v2, sys ver4 dom ver5"); goto done; } } @@ -2128,7 +2128,7 @@ xenHypervisorInit(void) /* Xen 3.2, Fedora 9 */ dom_interface_version = 5; /* XEN_DOMCTL_INTERFACE_VERSION */ if (virXen_getvcpusinfo(fd, 0, 0, ipt, NULL, 0) == 0){ - VIR_DEBUG0("Using hypervisor call v2, sys ver6 dom ver5"); + VIR_DEBUG("Using hypervisor call v2, sys ver6 dom ver5"); goto done; } } @@ -2137,7 +2137,7 @@ xenHypervisorInit(void) sys_interface_version = 7; /* XEN_SYSCTL_INTERFACE_VERSION */ if (virXen_getdomaininfo(fd, 0, &info) == 1) { dom_interface_version = 6; /* XEN_DOMCTL_INTERFACE_VERSION */ - VIR_DEBUG0("Using hypervisor call v2, sys ver7 dom ver6"); + VIR_DEBUG("Using hypervisor call v2, sys ver7 dom ver6"); goto done; } @@ -2148,14 +2148,14 @@ xenHypervisorInit(void) sys_interface_version = 8; /* XEN_SYSCTL_INTERFACE_VERSION */ if (virXen_getdomaininfo(fd, 0, &info) == 1) { dom_interface_version = 7; /* XEN_DOMCTL_INTERFACE_VERSION */ - VIR_DEBUG0("Using hypervisor call v2, sys ver8 dom ver7\n"); + VIR_DEBUG("Using hypervisor call v2, sys ver8 dom ver7\n"); goto done; } hypervisor_version = 1; sys_interface_version = -1; if (virXen_getdomaininfo(fd, 0, &info) == 1) { - VIR_DEBUG0("Using hypervisor call v1"); + VIR_DEBUG("Using hypervisor call v1"); goto done; } @@ -2163,7 +2163,7 @@ xenHypervisorInit(void) * we failed to make the getdomaininfolist hypercall */ - VIR_DEBUG0("Failed to find any Xen hypervisor method"); + VIR_DEBUG("Failed to find any Xen hypervisor method"); hypervisor_version = -1; virXenError(VIR_ERR_XEN_CALL, " ioctl %lu", (unsigned long)IOCTL_PRIVCMD_HYPERCALL); diff --git a/src/xen/xen_inotify.c b/src/xen/xen_inotify.c index 9dde72c..6ef5359 100644 --- a/src/xen/xen_inotify.c +++ b/src/xen/xen_inotify.c @@ -105,7 +105,7 @@ xenInotifyXenCacheLookup(virConnectPtr conn, memcpy(uuid, entry->def->uuid, VIR_UUID_BUFLEN); if (!*name) { - VIR_DEBUG0("Error getting dom from def"); + VIR_DEBUG("Error getting dom from def"); virReportOOMError(); return -1; } @@ -149,7 +149,7 @@ xenInotifyXendDomainsDirLookup(virConnectPtr conn, const char *filename, return -1; } memcpy(uuid, priv->configInfoList->doms[i]->uuid, VIR_UUID_BUFLEN); - VIR_DEBUG0("Found dom on list"); + VIR_DEBUG("Found dom on list"); return 0; } } @@ -288,7 +288,7 @@ xenInotifyEvent(int watch ATTRIBUTE_UNUSED, virConnectPtr conn = data; xenUnifiedPrivatePtr priv = NULL; - VIR_DEBUG0("got inotify event"); + VIR_DEBUG("got inotify event"); if( conn && conn->privateData ) { priv = conn->privateData; @@ -450,18 +450,18 @@ xenInotifyOpen(virConnectPtr conn, return -1; } - VIR_DEBUG0("Building initial config cache"); + VIR_DEBUG("Building initial config cache"); if (priv->useXenConfigCache && xenXMConfigCacheRefresh (conn) < 0) { VIR_DEBUG("Failed to enable XM config cache %s", conn->err.message); return -1; } - VIR_DEBUG0("Registering with event loop"); + VIR_DEBUG("Registering with event loop"); /* Add the handle for monitoring */ if ((priv->inotifyWatch = virEventAddHandle(priv->inotifyFD, VIR_EVENT_HANDLE_READABLE, xenInotifyEvent, conn, NULL)) < 0) { - VIR_DEBUG0("Failed to add inotify handle, disabling events"); + VIR_DEBUG("Failed to add inotify handle, disabling events"); } return 0; diff --git a/src/xen/xend_internal.c b/src/xen/xend_internal.c index a4420d8..375c8c6 100644 --- a/src/xen/xend_internal.c +++ b/src/xen/xend_internal.c @@ -3279,7 +3279,7 @@ xenDaemonDomainMigratePerform (virDomainPtr domain, if (ret == 0 && undefined_source) xenDaemonDomainUndefine (domain); - VIR_DEBUG0("migration done"); + VIR_DEBUG("migration done"); return ret; } diff --git a/src/xen/xs_internal.c b/src/xen/xs_internal.c index c318f6c..5d8dc3d 100644 --- a/src/xen/xs_internal.c +++ b/src/xen/xs_internal.c @@ -327,7 +327,7 @@ xenStoreOpen(virConnectPtr conn, xenStoreWatchEvent, conn, NULL)) < 0) - VIR_DEBUG0("Failed to add event handle, disabling events"); + VIR_DEBUG("Failed to add event handle, disabling events"); return 0; } @@ -353,12 +353,12 @@ xenStoreClose(virConnectPtr conn) priv = (xenUnifiedPrivatePtr) conn->privateData; if (xenStoreRemoveWatch(conn, "@introduceDomain", "introduceDomain") < 0) { - VIR_DEBUG0("Warning, could not remove @introduceDomain watch"); + VIR_DEBUG("Warning, could not remove @introduceDomain watch"); /* not fatal */ } if (xenStoreRemoveWatch(conn, "@releaseDomain", "releaseDomain") < 0) { - VIR_DEBUG0("Warning, could not remove @releaseDomain watch"); + VIR_DEBUG("Warning, could not remove @releaseDomain watch"); /* not fatal */ } @@ -1196,7 +1196,7 @@ int xenStoreRemoveWatch(virConnectPtr conn, list->watches[i]->path, list->watches[i]->token)) { - VIR_DEBUG0("WARNING: Could not remove watch"); + VIR_DEBUG("WARNING: Could not remove watch"); /* Not fatal, continue */ } @@ -1351,7 +1351,7 @@ retry: VIR_FREE(new_domids); if (missing && retries--) { - VIR_DEBUG0("Some domains were missing, trying again"); + VIR_DEBUG("Some domains were missing, trying again"); usleep(100 * 1000); goto retry; } @@ -1426,7 +1426,7 @@ retry: VIR_FREE(new_domids); if (!removed && retries--) { - VIR_DEBUG0("No domains removed, retrying"); + VIR_DEBUG("No domains removed, retrying"); usleep(100 * 1000); goto retry; } diff --git a/src/xenxs/xen_sxpr.c b/src/xenxs/xen_sxpr.c index 8690286..a517359 100644 --- a/src/xenxs/xen_sxpr.c +++ b/src/xenxs/xen_sxpr.c @@ -1979,7 +1979,7 @@ xenFormatSxpr(virConnectPtr conn, char *bufout; int hvm = 0, i; - VIR_DEBUG0("Formatting domain sexpr"); + VIR_DEBUG("Formatting domain sexpr"); virBufferAddLit(&buf, "(vm "); virBufferEscapeSexpr(&buf, "(name '%s')", def->name);

On Mon, May 09, 2011 at 05:24:09PM +0800, Lai Jiangshan wrote:
These VIR_XXXX0 APIs make us confused, use the non-0-suffix APIs instead.
How these coversions works? The magic is using ##. #define high_levle_api(fmt, ...) low_levle_api(fmt, ##__VA_ARGS__) When __VA_ARGS__ is empty, "##" will swallow the "," in "fmt," to avoid compile error.
example: origin after CPP high_levle_api("%d", a_int) low_levle_api("%d", a_int) high_levle_api("a string") low_levle_api("a string")
About 400 conversions.
8 special conversions: VIR_XXXX0("") -> VIR_XXXX(" ") (avoid empty format) 2 conversions VIR_XXXX0(string_literal_with_%) -> VIR_XXXX(%->%%) 0 conversions VIR_XXXX0(non_string_literal) -> VIR_XXXX("%s", non_string_literal) (for security) 6 conversions
Signed-off-by: Lai Jiangshan <laijs@cn.fujitsu.com> --- daemon/libvirtd.c | 76 ++++++++++---------- daemon/remote.c | 32 ++++---- daemon/stream.c | 2 +- examples/domain-events/events-c/event-test.c | 10 +-- src/cpu/cpu_x86.c | 4 +- src/esx/esx_driver.c | 8 +- src/esx/esx_vi.c | 12 ++-- src/libvirt.c | 4 +- src/libxl/libxl_driver.c | 18 ++-- src/lxc/lxc_conf.c | 4 +- src/lxc/lxc_container.c | 10 +- src/lxc/lxc_controller.c | 8 +- src/lxc/lxc_driver.c | 12 ++-- src/network/bridge_driver.c | 4 +- src/node_device/node_device_hal.c | 28 ++++---- src/node_device/node_device_linux_sysfs.c | 2 +- src/node_device/node_device_udev.c | 8 +- src/nwfilter/nwfilter_ebiptables_driver.c | 2 +- src/openvz/openvz_driver.c | 6 +- src/phyp/phyp_driver.c | 102 +++++++++++++------------- src/qemu/qemu_audit.c | 30 ++++---- src/qemu/qemu_capabilities.c | 4 +- src/qemu/qemu_cgroup.c | 2 +- src/qemu/qemu_conf.c | 4 +- src/qemu/qemu_domain.c | 2 +- src/qemu/qemu_driver.c | 10 +- src/qemu/qemu_hotplug.c | 22 +++--- src/qemu/qemu_migration.c | 14 ++-- src/qemu/qemu_monitor.c | 2 +- src/qemu/qemu_monitor_json.c | 36 +++++----- src/qemu/qemu_monitor_text.c | 8 +- src/qemu/qemu_process.c | 48 ++++++------ src/remote/remote_driver.c | 64 ++++++++-------- src/secret/secret_driver.c | 2 +- src/storage/storage_backend_logical.c | 2 +- src/test/test_driver.c | 2 +- src/uml/uml_conf.c | 2 +- src/uml/uml_driver.c | 14 ++-- src/util/bridge.c | 10 +- src/util/cgroup.c | 4 +- src/util/command.c | 18 ++-- src/util/event.c | 4 +- src/util/event_poll.c | 2 +- src/util/hash.c | 2 +- src/util/json.c | 8 +- src/util/logging.c | 10 +- src/util/logging.h | 24 ++---- src/util/pci.c | 4 +- src/util/util.c | 8 +- src/util/virtaudit.c | 2 +- src/vbox/vbox_driver.c | 14 ++-- src/vbox/vbox_tmpl.c | 32 ++++---- src/vmx/vmx.c | 4 +- src/xen/xen_driver.c | 28 ++++---- src/xen/xen_hypervisor.c | 18 ++-- src/xen/xen_inotify.c | 12 ++-- src/xen/xend_internal.c | 2 +- src/xen/xs_internal.c | 12 ++-- src/xenxs/xen_sxpr.c | 2 +- 59 files changed, 415 insertions(+), 425 deletions(-)
diff --git a/src/util/logging.h b/src/util/logging.h index 0dba78c..e948077 100644 --- a/src/util/logging.h +++ b/src/util/logging.h @@ -32,35 +32,27 @@ */ # ifdef ENABLE_DEBUG # define VIR_DEBUG_INT(category, f, l, fmt,...) \ - virLogMessage(category, VIR_LOG_DEBUG, f, l, 0, fmt, __VA_ARGS__) + virLogMessage(category, VIR_LOG_DEBUG, f, l, 0, fmt, ##__VA_ARGS__) # else # define VIR_DEBUG_INT(category, f, l, fmt,...) \ do { } while (0) # endif /* !ENABLE_DEBUG */
# define VIR_INFO_INT(category, f, l, fmt,...) \ - virLogMessage(category, VIR_LOG_INFO, f, l, 0, fmt, __VA_ARGS__) + virLogMessage(category, VIR_LOG_INFO, f, l, 0, fmt, ##__VA_ARGS__) # define VIR_WARN_INT(category, f, l, fmt,...) \ - virLogMessage(category, VIR_LOG_WARN, f, l, 0, fmt, __VA_ARGS__) + virLogMessage(category, VIR_LOG_WARN, f, l, 0, fmt, ##__VA_ARGS__) # define VIR_ERROR_INT(category, f, l, fmt,...) \ - virLogMessage(category, VIR_LOG_ERROR, f, l, 0, fmt, __VA_ARGS__) + virLogMessage(category, VIR_LOG_ERROR, f, l, 0, fmt, ##__VA_ARGS__)
# define VIR_DEBUG(fmt,...) \ - VIR_DEBUG_INT("file." __FILE__, __func__, __LINE__, fmt, __VA_ARGS__) -# define VIR_DEBUG0(msg) \ - VIR_DEBUG_INT("file." __FILE__, __func__, __LINE__, "%s", msg) + VIR_DEBUG_INT("file." __FILE__, __func__, __LINE__, fmt, ##__VA_ARGS__) # define VIR_INFO(fmt,...) \ - VIR_INFO_INT("file." __FILE__, __func__, __LINE__, fmt, __VA_ARGS__) -# define VIR_INFO0(msg) \ - VIR_INFO_INT("file." __FILE__, __func__, __LINE__, "%s", msg) + VIR_INFO_INT("file." __FILE__, __func__, __LINE__, fmt, ##__VA_ARGS__) # define VIR_WARN(fmt,...) \ - VIR_WARN_INT("file." __FILE__, __func__, __LINE__, fmt, __VA_ARGS__) -# define VIR_WARN0(msg) \ - VIR_WARN_INT("file." __FILE__, __func__, __LINE__, "%s", msg) + VIR_WARN_INT("file." __FILE__, __func__, __LINE__, fmt, ##__VA_ARGS__) # define VIR_ERROR(fmt,...) \ - VIR_ERROR_INT("file." __FILE__, __func__, __LINE__, fmt, __VA_ARGS__) -# define VIR_ERROR0(msg) \ - VIR_ERROR_INT("file." __FILE__, __func__, __LINE__, "%s", msg) + VIR_ERROR_INT("file." __FILE__, __func__, __LINE__, fmt, ##__VA_ARGS__)
ACK 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 :|

On Mon, May 09, 2011 at 17:24:09 +0800, Lai Jiangshan wrote:
These VIR_XXXX0 APIs make us confused, use the non-0-suffix APIs instead.
How these coversions works? The magic is using ##. #define high_levle_api(fmt, ...) low_levle_api(fmt, ##__VA_ARGS__) When __VA_ARGS__ is empty, "##" will swallow the "," in "fmt," to avoid compile error.
example: origin after CPP high_levle_api("%d", a_int) low_levle_api("%d", a_int) high_levle_api("a string") low_levle_api("a string")
About 400 conversions.
8 special conversions: VIR_XXXX0("") -> VIR_XXXX(" ") (avoid empty format) 2 conversions VIR_XXXX0(string_literal_with_%) -> VIR_XXXX(%->%%) 0 conversions VIR_XXXX0(non_string_literal) -> VIR_XXXX("%s", non_string_literal) (for security) 6 conversions
Hmm, I'm not entirely sure this patch is correct. VIR_XXX0(msg) should really be translated into "%s" format string and msg argument. It definitely needs to be so when msg is translated (i.e., _("...")). Jirka

On Tue, May 10, 2011 at 04:28:22PM +0200, Jiri Denemark wrote:
On Mon, May 09, 2011 at 17:24:09 +0800, Lai Jiangshan wrote:
These VIR_XXXX0 APIs make us confused, use the non-0-suffix APIs instead.
How these coversions works? The magic is using ##. #define high_levle_api(fmt, ...) low_levle_api(fmt, ##__VA_ARGS__) When __VA_ARGS__ is empty, "##" will swallow the "," in "fmt," to avoid compile error.
example: origin after CPP high_levle_api("%d", a_int) low_levle_api("%d", a_int) high_levle_api("a string") low_levle_api("a string")
About 400 conversions.
8 special conversions: VIR_XXXX0("") -> VIR_XXXX(" ") (avoid empty format) 2 conversions VIR_XXXX0(string_literal_with_%) -> VIR_XXXX(%->%%) 0 conversions VIR_XXXX0(non_string_literal) -> VIR_XXXX("%s", non_string_literal) (for security) 6 conversions
Hmm, I'm not entirely sure this patch is correct. VIR_XXX0(msg) should really be translated into "%s" format string and msg argument. It definitely needs to be so when msg is translated (i.e., _("...")).
In 99% of the cases, we don't really need '%s', because the strings are constant. So only the VIR_ERROR0 replacements need to be fixed to pass ("%s", ...) 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 :|

On 05/09/2011 03:24 AM, Lai Jiangshan wrote:
These VIR_XXXX0 APIs make us confused, use the non-0-suffix APIs instead.
How these coversions works? The magic is using ##. #define high_levle_api(fmt, ...) low_levle_api(fmt, ##__VA_ARGS__) When __VA_ARGS__ is empty, "##" will swallow the "," in "fmt," to avoid compile error.
##__VA_ARGS__ is a GNU extension; it does not work on all C99 compilers. I'm worried that this is not portable. -- Eric Blake eblake@redhat.com +1-801-349-2682 Libvirt virtualization library http://libvirt.org

On 05/10/2011 08:52 AM, Eric Blake wrote:
On 05/09/2011 03:24 AM, Lai Jiangshan wrote:
These VIR_XXXX0 APIs make us confused, use the non-0-suffix APIs instead.
How these coversions works? The magic is using ##. #define high_levle_api(fmt, ...) low_levle_api(fmt, ##__VA_ARGS__) When __VA_ARGS__ is empty, "##" will swallow the "," in "fmt," to avoid compile error.
##__VA_ARGS__ is a GNU extension; it does not work on all C99 compilers.
I'm worried that this is not portable.
But, we CAN do: #ifdef __GNUC__ # define high_level(fmt, ...) low_level(fmt, ##__VA_ARGS__) #else # define PP_NARG(...) \ PP_NARG_(__VA_ARGS__,PP_RSEQ_N()) # define PP_NARG_(...) \ PP_ARG_N(__VA_ARGS__) # define PP_ARG_N( \ _1, _2, _3, _4, _5, _6, _7, _8, _9,_10, \ _11,_12,_13,_14,_15,_16,_17,_18,_19,_20, \ _21,_22,_23,_24,_25,_26,_27,_28,_29,_30, \ _31,_32,_33,_34,_35,_36,_37,_38,_39,_40, \ _41,_42,_43,_44,_45,_46,_47,_48,_49,_50, \ _51,_52,_53,_54,_55,_56,_57,_58,_59,_60, \ _61,_62,_63,N,...) N # define PP_RSEQ_N() \ 63,62,61,60, \ 59,58,57,56,55,54,53,52,51,50, \ 49,48,47,46,45,44,43,42,41,40, \ 39,38,37,36,35,34,33,32,31,30, \ 29,28,27,26,25,24,23,22,21,20, \ 19,18,17,16,15,14,13,12,11,10, \ 9,8,7,6,5,4,3,2,1,0 # define VIR_DEBUG(...) VIR_DEBUG ## PP_NARG(__VA_ARGS__) (__VA_ARGS__) # define VIR_DEBUG1(xxx) xxx # define VIR_DEBUG2(xxx, xxx) xxx ... # define VIR_DEBUG63(xxx, ..., xxx) xxx #endif suitably expanded (and we can also place a cap on the maximum number of arguments we ever expect to see in VIR_DEBUG, rather than going all the way to the C99 limit of 63). Thanks to: https://groups.google.com/group/comp.std.c/browse_thread/thread/77ee8c8f92e4... for the idea. Yeah, it's gross, but we limit the grossness to one header, and the rest of the code is more maintainable as a result. -- Eric Blake eblake@redhat.com +1-801-349-2682 Libvirt virtualization library http://libvirt.org

On 05/10/2011 09:29 AM, Eric Blake wrote:
##__VA_ARGS__ is a GNU extension; it does not work on all C99 compilers.
I'm worried that this is not portable.
But, we CAN do:
#ifdef __GNUC__ # define high_level(fmt, ...) low_level(fmt, ##__VA_ARGS__) #else
suitably expanded (and we can also place a cap on the maximum number of arguments we ever expect to see in VIR_DEBUG, rather than going all the way to the C99 limit of 63).
Even simpler, using ideas from https://gustedt.wordpress.com/2010/06/08/detect-empty-macro-arguments/ (and actually tested this time): #define ARG_8(_0, _1, _2, _3, _4, _5, _6, _7, ...) _7 #define HAS_COMMA(...) ARG_8(__VA_ARGS__, 1, 1, 1, 1, 1, 1, 0) # define f(...) f_(f, HAS_COMMA(__VA_ARGS__), __VA_ARGS__) # define f_(a, b, ...) f__(a, b, __VA_ARGS__) # define f__(a, b, ...) a##b(__VA_ARGS__) # define f0(x) printf("%s", x) # define f1(x, ...) printf(x, __VA_ARGS__) I'll work up a followup patch along these lines; it doesn't seem too impossible to guarantee C99 portability for the four macros.
Yeah, it's gross, but we limit the grossness to one header, and the rest of the code is more maintainable as a result.
-- Eric Blake eblake@redhat.com +1-801-349-2682 Libvirt virtualization library http://libvirt.org

Is this OK? "fmt..." #define high_level_api(fmt...) low_level_api(fmt) On 05/10/2011 11:29 PM, Eric Blake wrote:
On 05/10/2011 08:52 AM, Eric Blake wrote:
On 05/09/2011 03:24 AM, Lai Jiangshan wrote:
These VIR_XXXX0 APIs make us confused, use the non-0-suffix APIs instead.
How these coversions works? The magic is using ##. #define high_levle_api(fmt, ...) low_levle_api(fmt, ##__VA_ARGS__) When __VA_ARGS__ is empty, "##" will swallow the "," in "fmt," to avoid compile error.
##__VA_ARGS__ is a GNU extension; it does not work on all C99 compilers.
I'm worried that this is not portable.
But, we CAN do:
#ifdef __GNUC__ # define high_level(fmt, ...) low_level(fmt, ##__VA_ARGS__) #else # define PP_NARG(...) \ PP_NARG_(__VA_ARGS__,PP_RSEQ_N()) # define PP_NARG_(...) \ PP_ARG_N(__VA_ARGS__) # define PP_ARG_N( \ _1, _2, _3, _4, _5, _6, _7, _8, _9,_10, \ _11,_12,_13,_14,_15,_16,_17,_18,_19,_20, \ _21,_22,_23,_24,_25,_26,_27,_28,_29,_30, \ _31,_32,_33,_34,_35,_36,_37,_38,_39,_40, \ _41,_42,_43,_44,_45,_46,_47,_48,_49,_50, \ _51,_52,_53,_54,_55,_56,_57,_58,_59,_60, \ _61,_62,_63,N,...) N # define PP_RSEQ_N() \ 63,62,61,60, \ 59,58,57,56,55,54,53,52,51,50, \ 49,48,47,46,45,44,43,42,41,40, \ 39,38,37,36,35,34,33,32,31,30, \ 29,28,27,26,25,24,23,22,21,20, \ 19,18,17,16,15,14,13,12,11,10, \ 9,8,7,6,5,4,3,2,1,0 # define VIR_DEBUG(...) VIR_DEBUG ## PP_NARG(__VA_ARGS__) (__VA_ARGS__) # define VIR_DEBUG1(xxx) xxx # define VIR_DEBUG2(xxx, xxx) xxx ... # define VIR_DEBUG63(xxx, ..., xxx) xxx #endif
suitably expanded (and we can also place a cap on the maximum number of arguments we ever expect to see in VIR_DEBUG, rather than going all the way to the C99 limit of 63).
Thanks to: https://groups.google.com/group/comp.std.c/browse_thread/thread/77ee8c8f92e4... for the idea.
Yeah, it's gross, but we limit the grossness to one header, and the rest of the code is more maintainable as a result.

On 05/10/2011 08:43 PM, Lai Jiangshan wrote:
Is this OK? "fmt..."
#define high_level_api(fmt...) low_level_api(fmt)
Nope, that's also a gcc extension. But I still think it's possible to define VIR_DEBUG in a way that uses only C99 features while still distinguishing between the 1-arg and multi-arg uses, so I will probably apply your patch plus a followup once I can finish writing and testing my followup. -- Eric Blake eblake@redhat.com +1-801-349-2682 Libvirt virtualization library http://libvirt.org

On 05/09/2011 03:24 AM, Lai Jiangshan wrote:
These VIR_XXXX0 APIs make us confused, use the non-0-suffix APIs instead.
How these coversions works? The magic is using ##. #define high_levle_api(fmt, ...) low_levle_api(fmt, ##__VA_ARGS__) When __VA_ARGS__ is empty, "##" will swallow the "," in "fmt," to avoid compile error.
example: origin after CPP high_levle_api("%d", a_int) low_levle_api("%d", a_int) high_levle_api("a string") low_levle_api("a string")
About 400 conversions.
8 special conversions: VIR_XXXX0("") -> VIR_XXXX(" ") (avoid empty format) 2 conversions
Yuck, that leaves trailing space. I'd rather have a real message.
VIR_XXXX0(string_literal_with_%) -> VIR_XXXX(%->%%) 0 conversions
Good that nothing hit this pattern, because my followup patch will magically transform 1-arg vir_XXXX("xyz") to vir_XXXX("%s", "xyz"), and any doubled-up %% would thus cause a change in output.
VIR_XXXX0(non_string_literal) -> VIR_XXXX("%s", non_string_literal) (for security) 6 conversions
Good. Also, cfg.mk can be simplified (hmm, we don't have any syntax-rules for VIR_INFO, so I'll do that as a followup). Here's what I squashed in; I'll wait to push until my followups have been reviewed. diff --git i/cfg.mk w/cfg.mk index 9ee0dd0..1b60282 100644 --- i/cfg.mk +++ w/cfg.mk @@ -390,7 +390,6 @@ msg_gen_function += ESX_ERROR msg_gen_function += ESX_VI_ERROR msg_gen_function += PHYP_ERROR msg_gen_function += VIR_ERROR -msg_gen_function += VIR_ERROR0 msg_gen_function += VMX_ERROR msg_gen_function += XENXS_ERROR msg_gen_function += eventReportError @@ -525,7 +524,7 @@ sc_copyright_format: # Some functions/macros produce messages intended solely for developers # and maintainers. Do not mark them for translation. sc_prohibit_gettext_markup: - @prohibit='\<VIR_(WARN|DEBUG)0? *\(_\(' \ + @prohibit='\<VIR_(WARN|DEBUG) *\(_\(' \ halt='do not mark these strings for translation' \ $(_sc_search_regexp) diff --git i/src/qemu/qemu_monitor_json.c w/src/qemu/qemu_monitor_json.c index 126003f..047a81f 100644 --- i/src/qemu/qemu_monitor_json.c +++ w/src/qemu/qemu_monitor_json.c @@ -2529,7 +2529,7 @@ int qemuMonitorJSONInjectNMI(qemuMonitorPtr mon) if (qemuMonitorJSONHasError(reply, "CommandNotFound") && qemuMonitorCheckHMP(mon, "inject-nmi")) { - VIR_DEBUG0("inject-nmi command not found, trying HMP"); + VIR_DEBUG("inject-nmi command not found, trying HMP"); ret = qemuMonitorTextInjectNMI(mon); } else { ret = qemuMonitorJSONCheckError(cmd, reply); diff --git i/src/util/event.c w/src/util/event.c index cfaffc8..11f025b 100644 --- i/src/util/event.c +++ w/src/util/event.c @@ -145,7 +145,7 @@ void virEventRegisterImpl(virEventAddHandleFunc addHandle, */ int virEventRegisterDefaultImpl(void) { - VIR_DEBUG(" "); + VIR_DEBUG("registering default event implementation"); virResetLastError(); @@ -185,7 +185,7 @@ int virEventRegisterDefaultImpl(void) */ int virEventRunDefaultImpl(void) { - VIR_DEBUG(" "); + VIR_DEBUG("running default event implementation"); virResetLastError(); if (virEventPollRunOnce() < 0) { -- Eric Blake eblake@redhat.com +1-801-349-2682 Libvirt virtualization library http://libvirt.org

This series is intended as followup to Lai's patch, to get us back to code that can be compiled by any C99 compiler, and extending Lai's cleanups to also cover VIR_DOMAIN_DEBUG0. Eric Blake (3): build: avoid gcc preprocessor extensions build: drop need for VIR_DOMAIN_DEBUG0() maint: omit translation for all VIR_INFO cfg.mk | 2 +- daemon/libvirtd.c | 10 ++-- daemon/remote.c | 8 ++-- examples/domain-events/events-c/event-test.c | 3 +- po/POTFILES.in | 1 - src/libvirt.c | 67 ++++++++++++++++++-------- src/network/bridge_driver.c | 12 ++-- src/qemu/qemu_driver.c | 6 +- src/storage/storage_driver.c | 18 ++++---- src/util/bridge.c | 18 ++++---- src/util/logging.h | 34 +++++++------- 11 files changed, 101 insertions(+), 78 deletions(-) -- 1.7.4.4

Use of ',##__VA_ARGS__' is a gcc extension not guaranteed by C99; thankfully, we can avoid it by lumping the format argument into the var-args set. * src/util/logging.h (VIR_DEBUG_INT, VIR_INFO_INT, VIR_WARN_INT) (VIR_ERROR_INT, VIR_DEBUG, VIR_INFO, VIR_WARN, VIR_ERROR): Stick to C99 var-arg macro syntax. * examples/domain-events/events-c/event-test.c (VIR_DEBUG): Simplify. --- This one turned out to be much simpler than I was fearing; any time we guarantee that (fmt,...) expands to (fmt,##__VA_ARGS__), then we just use one fewer argument (...) expanding to (__VA_ARGS__). examples/domain-events/events-c/event-test.c | 3 +- src/util/logging.h | 34 +++++++++++++------------- 2 files changed, 18 insertions(+), 19 deletions(-) diff --git a/examples/domain-events/events-c/event-test.c b/examples/domain-events/events-c/event-test.c index 52ec5d0..2da58b8 100644 --- a/examples/domain-events/events-c/event-test.c +++ b/examples/domain-events/events-c/event-test.c @@ -8,8 +8,7 @@ #include <libvirt/libvirt.h> #include <libvirt/virterror.h> -#define VIR_DEBUG(fmt, ...) printf("%s:%d: " fmt "\n", \ - __func__, __LINE__, ##__VA_ARGS__) +#define VIR_DEBUG(fmt) printf("%s:%d: " fmt "\n", __func__, __LINE__) #define STREQ(a,b) (strcmp(a,b) == 0) #ifndef ATTRIBUTE_UNUSED diff --git a/src/util/logging.h b/src/util/logging.h index e948077..6683e6f 100644 --- a/src/util/logging.h +++ b/src/util/logging.h @@ -31,28 +31,28 @@ * defined at runtime from the libvirt daemon configuration file */ # ifdef ENABLE_DEBUG -# define VIR_DEBUG_INT(category, f, l, fmt,...) \ - virLogMessage(category, VIR_LOG_DEBUG, f, l, 0, fmt, ##__VA_ARGS__) +# define VIR_DEBUG_INT(category, f, l, ...) \ + virLogMessage(category, VIR_LOG_DEBUG, f, l, 0, __VA_ARGS__) # else -# define VIR_DEBUG_INT(category, f, l, fmt,...) \ +# define VIR_DEBUG_INT(category, f, l, ...) \ do { } while (0) # endif /* !ENABLE_DEBUG */ -# define VIR_INFO_INT(category, f, l, fmt,...) \ - virLogMessage(category, VIR_LOG_INFO, f, l, 0, fmt, ##__VA_ARGS__) -# define VIR_WARN_INT(category, f, l, fmt,...) \ - virLogMessage(category, VIR_LOG_WARN, f, l, 0, fmt, ##__VA_ARGS__) -# define VIR_ERROR_INT(category, f, l, fmt,...) \ - virLogMessage(category, VIR_LOG_ERROR, f, l, 0, fmt, ##__VA_ARGS__) +# define VIR_INFO_INT(category, f, l, ...) \ + virLogMessage(category, VIR_LOG_INFO, f, l, 0, __VA_ARGS__) +# define VIR_WARN_INT(category, f, l, ...) \ + virLogMessage(category, VIR_LOG_WARN, f, l, 0, __VA_ARGS__) +# define VIR_ERROR_INT(category, f, l, ...) \ + virLogMessage(category, VIR_LOG_ERROR, f, l, 0, __VA_ARGS__) -# define VIR_DEBUG(fmt,...) \ - VIR_DEBUG_INT("file." __FILE__, __func__, __LINE__, fmt, ##__VA_ARGS__) -# define VIR_INFO(fmt,...) \ - VIR_INFO_INT("file." __FILE__, __func__, __LINE__, fmt, ##__VA_ARGS__) -# define VIR_WARN(fmt,...) \ - VIR_WARN_INT("file." __FILE__, __func__, __LINE__, fmt, ##__VA_ARGS__) -# define VIR_ERROR(fmt,...) \ - VIR_ERROR_INT("file." __FILE__, __func__, __LINE__, fmt, ##__VA_ARGS__) +# define VIR_DEBUG(...) \ + VIR_DEBUG_INT("file." __FILE__, __func__, __LINE__, __VA_ARGS__) +# define VIR_INFO(...) \ + VIR_INFO_INT("file." __FILE__, __func__, __LINE__, __VA_ARGS__) +# define VIR_WARN(...) \ + VIR_WARN_INT("file." __FILE__, __func__, __LINE__, __VA_ARGS__) +# define VIR_ERROR(...) \ + VIR_ERROR_INT("file." __FILE__, __func__, __LINE__, __VA_ARGS__) /* * To be made public -- 1.7.4.4

On Wed, May 11, 2011 at 14:13:28 -0600, Eric Blake wrote:
Use of ',##__VA_ARGS__' is a gcc extension not guaranteed by C99; thankfully, we can avoid it by lumping the format argument into the var-args set.
* src/util/logging.h (VIR_DEBUG_INT, VIR_INFO_INT, VIR_WARN_INT) (VIR_ERROR_INT, VIR_DEBUG, VIR_INFO, VIR_WARN, VIR_ERROR): Stick to C99 var-arg macro syntax. * examples/domain-events/events-c/event-test.c (VIR_DEBUG): Simplify. ---
This one turned out to be much simpler than I was fearing; any time we guarantee that (fmt,...) expands to (fmt,##__VA_ARGS__), then we just use one fewer argument (...) expanding to (__VA_ARGS__).
examples/domain-events/events-c/event-test.c | 3 +- src/util/logging.h | 34 +++++++++++++------------- 2 files changed, 18 insertions(+), 19 deletions(-)
Nice and simple, ACK. Jirka

On 05/11/2011 02:31 PM, Jiri Denemark wrote:
On Wed, May 11, 2011 at 14:13:28 -0600, Eric Blake wrote:
Use of ',##__VA_ARGS__' is a gcc extension not guaranteed by C99; thankfully, we can avoid it by lumping the format argument into the var-args set.
* src/util/logging.h (VIR_DEBUG_INT, VIR_INFO_INT, VIR_WARN_INT) (VIR_ERROR_INT, VIR_DEBUG, VIR_INFO, VIR_WARN, VIR_ERROR): Stick to C99 var-arg macro syntax. * examples/domain-events/events-c/event-test.c (VIR_DEBUG): Simplify. ---
This one turned out to be much simpler than I was fearing; any time we guarantee that (fmt,...) expands to (fmt,##__VA_ARGS__), then we just use one fewer argument (...) expanding to (__VA_ARGS__).
examples/domain-events/events-c/event-test.c | 3 +- src/util/logging.h | 34 +++++++++++++------------- 2 files changed, 18 insertions(+), 19 deletions(-)
Nice and simple, ACK.
Thanks; I've pushed Lai's cleanup and my followup now. The remaining two patches in this series are still worthwhile cleanups, but as of this patch we're back to the state of no longer relying on gcc extensions. -- Eric Blake eblake@redhat.com +1-801-349-2682 Libvirt virtualization library http://libvirt.org

This one's tricker than the VIR_DEBUG0() removal, but the end result is still C99 compliant, and reasonable with enough comments. * src/libvirt.c (VIR_ARG10, VIR_HAS_COMMA) (VIR_DOMAIN_DEBUG_EXPAND, VIR_DOMAIN_DEBUG_PASTE): New macros. (VIR_DOMAIN_DEBUG): Rewrite to handle one argument, moving multi-argument guts to... (VIR_DOMAIN_DEBUG_1): New macro. (VIR_DOMAIN_DEBUG0): Rename to VIR_DOMAIN_DEBUG_0. --- This one was much tougher, because both fmt and its arguments were optional, and because the expansion does not stick fmt next to __VA_ARGS__. But the end result is still that you can blindly use VIR_DOMAIN_DEBUG with 1 or 3+ arguments, and get the right behavior automagically, instead of having to remember to call a different macro for the 1-arg case. I specifically did not cater to the 2-arg case; that would be easy enough to support, though, if we had a reason for it. src/libvirt.c | 67 +++++++++++++++++++++++++++++++++++++++----------------- 1 files changed, 46 insertions(+), 21 deletions(-) diff --git a/src/libvirt.c b/src/libvirt.c index 13cb74a..79278b9 100644 --- a/src/libvirt.c +++ b/src/libvirt.c @@ -311,10 +311,26 @@ static struct gcry_thread_cbs virTLSThreadImpl = { NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL }; -/* Helper macro to print debugging information about a domain DOM, - * followed by a literal string FMT and any other printf arguments. - */ -#define VIR_DOMAIN_DEBUG(dom, fmt, ...) \ +/* Helper macros to implement VIR_DOMAIN_DEBUG using just C99. This + * assumes you pass fewer than 10 arguments to VIR_DOMAIN_DEBUG, but + * can easily be expanded if needed. */ +#define VIR_ARG10(_1, _2, _3, _4, _5, _6, _7, _8, _9, _10, ...) _10 +#define VIR_HAS_COMMA(...) VIR_ARG10(__VA_ARGS__, 1, 1, 1, 1, 1, 1, 1, 1, 0) + +/* Form the name VIR_DOMAIN_DEBUG_[01], then call that macro, + * according to how many arguments are present. Two-phase due to + * macro expansion rules. */ +#define VIR_DOMAIN_DEBUG_EXPAND(a, b, ...) \ + VIR_DOMAIN_DEBUG_PASTE(a, b, __VA_ARGS__) +#define VIR_DOMAIN_DEBUG_PASTE(a, b, ...) \ + a##b(__VA_ARGS__) + +/* Internal use only, when VIR_DOMAIN_DEBUG has one argument. */ +#define VIR_DOMAIN_DEBUG_0(dom) \ + VIR_DOMAIN_DEBUG_1(dom, "%s", "") + +/* Internal use only, when VIR_DOMAIN_DEBUG has three or more arguments. */ +#define VIR_DOMAIN_DEBUG_1(dom, fmt, ...) \ char _uuidstr[VIR_UUID_STRING_BUFLEN]; \ const char *_domname = NULL; \ \ @@ -328,7 +344,16 @@ static struct gcry_thread_cbs virTLSThreadImpl = { VIR_DEBUG("dom=%p, (VM: name=%s, uuid=%s), " fmt, \ dom, NULLSTR(_domname), _uuidstr, __VA_ARGS__) -#define VIR_DOMAIN_DEBUG0(dom) VIR_DOMAIN_DEBUG(dom, "%s", "") +/** + * VIR_DOMAIN_DEBUG: + * @dom: domain + * @fmt: optional format for additional information + * @...: optional arguments corresponding to @fmt. + */ +#define VIR_DOMAIN_DEBUG(...) \ + VIR_DOMAIN_DEBUG_EXPAND(VIR_DOMAIN_DEBUG_, \ + VIR_HAS_COMMA(__VA_ARGS__), \ + __VA_ARGS__) /** * virInitialize: @@ -1767,7 +1792,7 @@ error: virConnectPtr virDomainGetConnect (virDomainPtr dom) { - VIR_DOMAIN_DEBUG0(dom); + VIR_DOMAIN_DEBUG(dom); virResetLastError(); @@ -2036,7 +2061,7 @@ virDomainDestroy(virDomainPtr domain) { virConnectPtr conn; - VIR_DOMAIN_DEBUG0(domain); + VIR_DOMAIN_DEBUG(domain); virResetLastError(); @@ -2079,7 +2104,7 @@ error: int virDomainFree(virDomainPtr domain) { - VIR_DOMAIN_DEBUG0(domain); + VIR_DOMAIN_DEBUG(domain); virResetLastError(); @@ -2145,7 +2170,7 @@ virDomainSuspend(virDomainPtr domain) { virConnectPtr conn; - VIR_DOMAIN_DEBUG0(domain); + VIR_DOMAIN_DEBUG(domain); virResetLastError(); @@ -2191,7 +2216,7 @@ virDomainResume(virDomainPtr domain) { virConnectPtr conn; - VIR_DOMAIN_DEBUG0(domain); + VIR_DOMAIN_DEBUG(domain); virResetLastError(); @@ -2429,7 +2454,7 @@ virDomainShutdown(virDomainPtr domain) { virConnectPtr conn; - VIR_DOMAIN_DEBUG0(domain); + VIR_DOMAIN_DEBUG(domain); virResetLastError(); @@ -2614,7 +2639,7 @@ error: unsigned int virDomainGetID(virDomainPtr domain) { - VIR_DOMAIN_DEBUG0(domain); + VIR_DOMAIN_DEBUG(domain); virResetLastError(); @@ -2640,7 +2665,7 @@ virDomainGetOSType(virDomainPtr domain) { virConnectPtr conn; - VIR_DOMAIN_DEBUG0(domain); + VIR_DOMAIN_DEBUG(domain); virResetLastError(); @@ -2682,7 +2707,7 @@ virDomainGetMaxMemory(virDomainPtr domain) { virConnectPtr conn; - VIR_DOMAIN_DEBUG0(domain); + VIR_DOMAIN_DEBUG(domain); virResetLastError(); @@ -4923,7 +4948,7 @@ int virDomainUndefine(virDomainPtr domain) { virConnectPtr conn; - VIR_DOMAIN_DEBUG0(domain); + VIR_DOMAIN_DEBUG(domain); virResetLastError(); @@ -5046,7 +5071,7 @@ int virDomainCreate(virDomainPtr domain) { virConnectPtr conn; - VIR_DOMAIN_DEBUG0(domain); + VIR_DOMAIN_DEBUG(domain); virResetLastError(); @@ -5596,7 +5621,7 @@ virDomainGetMaxVcpus(virDomainPtr domain) { virConnectPtr conn; - VIR_DOMAIN_DEBUG0(domain); + VIR_DOMAIN_DEBUG(domain); virResetLastError(); @@ -11661,7 +11686,7 @@ error: */ int virDomainIsPersistent(virDomainPtr dom) { - VIR_DOMAIN_DEBUG0(dom); + VIR_DOMAIN_DEBUG(dom); virResetLastError(); @@ -11694,7 +11719,7 @@ error: */ int virDomainIsUpdated(virDomainPtr dom) { - VIR_DOMAIN_DEBUG0(dom); + VIR_DOMAIN_DEBUG(dom); virResetLastError(); @@ -12633,7 +12658,7 @@ virDomainAbortJob(virDomainPtr domain) { virConnectPtr conn; - VIR_DOMAIN_DEBUG0(domain); + VIR_DOMAIN_DEBUG(domain); virResetLastError(); @@ -13126,7 +13151,7 @@ virDomainSnapshotNum(virDomainPtr domain, unsigned int flags) { virConnectPtr conn; - VIR_DOMAIN_DEBUG0(domain); + VIR_DOMAIN_DEBUG(domain); virResetLastError(); -- 1.7.4.4

On Wed, May 11, 2011 at 14:13:29 -0600, Eric Blake wrote:
This one's tricker than the VIR_DEBUG0() removal, but the end result is still C99 compliant, and reasonable with enough comments.
* src/libvirt.c (VIR_ARG10, VIR_HAS_COMMA) (VIR_DOMAIN_DEBUG_EXPAND, VIR_DOMAIN_DEBUG_PASTE): New macros. (VIR_DOMAIN_DEBUG): Rewrite to handle one argument, moving multi-argument guts to... (VIR_DOMAIN_DEBUG_1): New macro. (VIR_DOMAIN_DEBUG0): Rename to VIR_DOMAIN_DEBUG_0. ---
This one was much tougher, because both fmt and its arguments were optional, and because the expansion does not stick fmt next to __VA_ARGS__. But the end result is still that you can blindly use VIR_DOMAIN_DEBUG with 1 or 3+ arguments, and get the right behavior automagically, instead of having to remember to call a different macro for the 1-arg case.
I specifically did not cater to the 2-arg case; that would be easy enough to support, though, if we had a reason for it.
src/libvirt.c | 67 +++++++++++++++++++++++++++++++++++++++----------------- 1 files changed, 46 insertions(+), 21 deletions(-)
diff --git a/src/libvirt.c b/src/libvirt.c index 13cb74a..79278b9 100644 --- a/src/libvirt.c +++ b/src/libvirt.c @@ -311,10 +311,26 @@ static struct gcry_thread_cbs virTLSThreadImpl = { NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL };
-/* Helper macro to print debugging information about a domain DOM, - * followed by a literal string FMT and any other printf arguments. - */ -#define VIR_DOMAIN_DEBUG(dom, fmt, ...) \ +/* Helper macros to implement VIR_DOMAIN_DEBUG using just C99. This + * assumes you pass fewer than 10 arguments to VIR_DOMAIN_DEBUG, but + * can easily be expanded if needed. */ +#define VIR_ARG10(_1, _2, _3, _4, _5, _6, _7, _8, _9, _10, ...) _10 +#define VIR_HAS_COMMA(...) VIR_ARG10(__VA_ARGS__, 1, 1, 1, 1, 1, 1, 1, 1, 0) + +/* Form the name VIR_DOMAIN_DEBUG_[01], then call that macro, + * according to how many arguments are present. Two-phase due to + * macro expansion rules. */ +#define VIR_DOMAIN_DEBUG_EXPAND(a, b, ...) \ + VIR_DOMAIN_DEBUG_PASTE(a, b, __VA_ARGS__) +#define VIR_DOMAIN_DEBUG_PASTE(a, b, ...) \ + a##b(__VA_ARGS__) + +/* Internal use only, when VIR_DOMAIN_DEBUG has one argument. */ +#define VIR_DOMAIN_DEBUG_0(dom) \ + VIR_DOMAIN_DEBUG_1(dom, "%s", "") + +/* Internal use only, when VIR_DOMAIN_DEBUG has three or more arguments. */ +#define VIR_DOMAIN_DEBUG_1(dom, fmt, ...) \ char _uuidstr[VIR_UUID_STRING_BUFLEN]; \ const char *_domname = NULL; \ \
Personally I would prefer this macro to be ``do { ... } while (0)'' but that a preexisting issue and given that it's only used at the beginning of functions I guess I can live without this modification. Heh, that's a pure ugliness. But at least it's a self-contained ugliness and serves a good purpose. ACK Jirka

* src/libvirt.c (VIR_DOMAIN_DEBUG_1): Convert to single statement. Suggested by Jiri Denemark. ---
Personally I would prefer this macro to be ``do { ... } while (0)'' but that a preexisting issue and given that it's only used at the beginning of functions I guess I can live without this modification.
I think this falls under the trivial rule, so I'm posting it as part of the series.
Heh, that's a pure ugliness. But at least it's a self-contained ugliness and serves a good purpose. ACK
I've pushed 2 and 2.5 now. src/libvirt.c | 35 +++++++++++++++++++++-------------- 1 files changed, 21 insertions(+), 14 deletions(-) diff --git a/src/libvirt.c b/src/libvirt.c index 79278b9..0726df4 100644 --- a/src/libvirt.c +++ b/src/libvirt.c @@ -313,7 +313,12 @@ static struct gcry_thread_cbs virTLSThreadImpl = { /* Helper macros to implement VIR_DOMAIN_DEBUG using just C99. This * assumes you pass fewer than 10 arguments to VIR_DOMAIN_DEBUG, but - * can easily be expanded if needed. */ + * can easily be expanded if needed. + * + * Note that gcc provides extensions of "define a(b...) b" or + * "define a(b,...) b,##__VA_ARGS__" as a means of eliding a comma + * when no var-args are present, but we don't want to require gcc. + */ #define VIR_ARG10(_1, _2, _3, _4, _5, _6, _7, _8, _9, _10, ...) _10 #define VIR_HAS_COMMA(...) VIR_ARG10(__VA_ARGS__, 1, 1, 1, 1, 1, 1, 1, 1, 0) @@ -330,19 +335,21 @@ static struct gcry_thread_cbs virTLSThreadImpl = { VIR_DOMAIN_DEBUG_1(dom, "%s", "") /* Internal use only, when VIR_DOMAIN_DEBUG has three or more arguments. */ -#define VIR_DOMAIN_DEBUG_1(dom, fmt, ...) \ - char _uuidstr[VIR_UUID_STRING_BUFLEN]; \ - const char *_domname = NULL; \ - \ - if (!VIR_IS_DOMAIN(dom)) { \ - memset(_uuidstr, 0, sizeof(_uuidstr)); \ - } else { \ - virUUIDFormat((dom)->uuid, _uuidstr); \ - _domname = (dom)->name; \ - } \ - \ - VIR_DEBUG("dom=%p, (VM: name=%s, uuid=%s), " fmt, \ - dom, NULLSTR(_domname), _uuidstr, __VA_ARGS__) +#define VIR_DOMAIN_DEBUG_1(dom, fmt, ...) \ + do { \ + char _uuidstr[VIR_UUID_STRING_BUFLEN]; \ + const char *_domname = NULL; \ + \ + if (!VIR_IS_DOMAIN(dom)) { \ + memset(_uuidstr, 0, sizeof(_uuidstr)); \ + } else { \ + virUUIDFormat((dom)->uuid, _uuidstr); \ + _domname = (dom)->name; \ + } \ + \ + VIR_DEBUG("dom=%p, (VM: name=%s, uuid=%s), " fmt, \ + dom, NULLSTR(_domname), _uuidstr, __VA_ARGS__); \ + } while (0) /** * VIR_DOMAIN_DEBUG: -- 1.7.4.4

We were 31/73 on whether to translate; since less than 50% translated and since VIR_INFO is less than VIR_WARN which also doesn't translate, this makes sense. * cfg.mk (sc_prohibit_gettext_markup): Add VIR_INFO, since it falls between WARN and DEBUG. * daemon/libvirtd.c (qemudDispatchSignalEvent, remoteCheckAccess) (qemudDispatchServer): Adjust offenders. * daemon/remote.c (remoteDispatchAuthPolkit): Likewise. * src/network/bridge_driver.c (networkReloadIptablesRules) (networkStartNetworkDaemon, networkShutdownNetworkDaemon) (networkCreate, networkDefine, networkUndefine): Likewise. * src/qemu/qemu_driver.c (qemudDomainDefine) (qemudDomainUndefine): Likewise. * src/storage/storage_driver.c (storagePoolCreate) (storagePoolDefine, storagePoolUndefine, storagePoolStart) (storagePoolDestroy, storagePoolDelete, storageVolumeCreateXML) (storageVolumeCreateXMLFrom, storageVolumeDelete): Likewise. * src/util/bridge.c (brProbeVnetHdr): Likewise. * po/POTFILES.in: Drop src/util/bridge.c. --- I noticed this inconsistency while reviewing Lai's patch. cfg.mk | 2 +- daemon/libvirtd.c | 10 +++++----- daemon/remote.c | 8 ++++---- po/POTFILES.in | 1 - src/network/bridge_driver.c | 12 ++++++------ src/qemu/qemu_driver.c | 6 +++--- src/storage/storage_driver.c | 18 +++++++++--------- src/util/bridge.c | 18 +++++++++--------- 8 files changed, 37 insertions(+), 38 deletions(-) diff --git a/cfg.mk b/cfg.mk index 1b60282..4fd6c98 100644 --- a/cfg.mk +++ b/cfg.mk @@ -524,7 +524,7 @@ sc_copyright_format: # Some functions/macros produce messages intended solely for developers # and maintainers. Do not mark them for translation. sc_prohibit_gettext_markup: - @prohibit='\<VIR_(WARN|DEBUG) *\(_\(' \ + @prohibit='\<VIR_(WARN|INFO|DEBUG) *\(_\(' \ halt='do not mark these strings for translation' \ $(_sc_search_regexp) diff --git a/daemon/libvirtd.c b/daemon/libvirtd.c index 900861a..6f470c2 100644 --- a/daemon/libvirtd.c +++ b/daemon/libvirtd.c @@ -413,7 +413,7 @@ qemudDispatchSignalEvent(int watch ATTRIBUTE_UNUSED, switch (siginfo.si_signo) { case SIGHUP: - VIR_INFO(_("Reloading configuration on SIGHUP")); + VIR_INFO("Reloading configuration on SIGHUP"); virHookCall(VIR_HOOK_DRIVER_DAEMON, "-", VIR_HOOK_DAEMON_OP_RELOAD, SIGHUP, "SIGHUP", NULL); if (virStateReload() < 0) @@ -429,7 +429,7 @@ qemudDispatchSignalEvent(int watch ATTRIBUTE_UNUSED, break; default: - VIR_INFO(_("Received unexpected signal %d"), siginfo.si_signo); + VIR_INFO("Received unexpected signal %d", siginfo.si_signo); break; } @@ -1288,8 +1288,8 @@ remoteCheckAccess (struct qemud_client *client) VIR_ERROR(_("remoteCheckCertificate: " "failed to verify client's certificate")); if (!tls_no_verify_certificate) return -1; - else VIR_INFO(_("remoteCheckCertificate: tls_no_verify_certificate " - "is set so the bad certificate is ignored")); + else VIR_INFO("remoteCheckCertificate: tls_no_verify_certificate " + "is set so the bad certificate is ignored"); } if (client->tx) { @@ -1445,7 +1445,7 @@ static int qemudDispatchServer(struct qemud_server *server, struct qemud_socket /* Client is running as root, so disable auth */ if (uid == 0) { - VIR_INFO(_("Turn off polkit auth for privileged client pid %d from %s"), + VIR_INFO("Turn off polkit auth for privileged client pid %d from %s", pid, client->addrstr); client->auth = REMOTE_AUTH_NONE; } diff --git a/daemon/remote.c b/daemon/remote.c index c2faf0f..1b424fe 100644 --- a/daemon/remote.c +++ b/daemon/remote.c @@ -2292,7 +2292,7 @@ remoteDispatchAuthPolkit(struct qemud_server *server, goto authfail; } - VIR_INFO(_("Checking PID %d running as %d"), callerPid, callerUid); + VIR_INFO("Checking PID %d running as %d", callerPid, callerUid); rv = snprintf(pidbuf, sizeof pidbuf, "%d", callerPid); if (rv < 0 || rv >= sizeof pidbuf) { @@ -2319,7 +2319,7 @@ remoteDispatchAuthPolkit(struct qemud_server *server, } PROBE(CLIENT_AUTH_ALLOW, "fd=%d, auth=%d, username=%s", client->fd, REMOTE_AUTH_POLKIT, (char *)ident); - VIR_INFO(_("Policy allowed action %s from pid %d, uid %d"), + VIR_INFO("Policy allowed action %s from pid %d, uid %d", action, callerPid, callerUid); ret->complete = 1; client->auth = REMOTE_AUTH_NONE; @@ -2390,7 +2390,7 @@ remoteDispatchAuthPolkit(struct qemud_server *server, goto authfail; } - VIR_INFO(_("Checking PID %d running as %d"), callerPid, callerUid); + VIR_INFO("Checking PID %d running as %d", callerPid, callerUid); dbus_error_init(&err); if (!(pkcaller = polkit_caller_new_from_pid(server->sysbus, callerPid, &err))) { @@ -2450,7 +2450,7 @@ remoteDispatchAuthPolkit(struct qemud_server *server, } PROBE(CLIENT_AUTH_ALLOW, "fd=%d, auth=%d, username=%s", client->fd, REMOTE_AUTH_POLKIT, ident); - VIR_INFO(_("Policy allowed action %s from pid %d, uid %d, result %s"), + VIR_INFO("Policy allowed action %s from pid %d, uid %d, result %s", action, callerPid, callerUid, polkit_result_to_string_representation(pkresult)); ret->complete = 1; diff --git a/po/POTFILES.in b/po/POTFILES.in index 96180d5..dd44da2 100644 --- a/po/POTFILES.in +++ b/po/POTFILES.in @@ -86,7 +86,6 @@ src/test/test_driver.c src/uml/uml_conf.c src/uml/uml_driver.c src/util/authhelper.c -src/util/bridge.c src/util/cgroup.c src/util/command.c src/util/conf.c diff --git a/src/network/bridge_driver.c b/src/network/bridge_driver.c index feaedf4..d6030a4 100644 --- a/src/network/bridge_driver.c +++ b/src/network/bridge_driver.c @@ -1407,7 +1407,7 @@ networkReloadIptablesRules(struct network_driver *driver) { unsigned int i; - VIR_INFO(_("Reloading iptables rules")); + VIR_INFO("Reloading iptables rules"); for (i = 0 ; i < driver->networks.count ; i++) { virNetworkObjLock(driver->networks.objs[i]); @@ -1752,7 +1752,7 @@ networkStartNetworkDaemon(struct network_driver *driver, } VIR_FREE(macTapIfName); - VIR_INFO(_("Starting up network '%s'"), network->def->name); + VIR_INFO("Starting up network '%s'", network->def->name); network->active = 1; return 0; @@ -1825,7 +1825,7 @@ static int networkShutdownNetworkDaemon(struct network_driver *driver, char *stateFile; char *macTapIfName; - VIR_INFO(_("Shutting down network '%s'"), network->def->name); + VIR_INFO("Shutting down network '%s'", network->def->name); if (!virNetworkObjIsActive(network)) return 0; @@ -2127,7 +2127,7 @@ static virNetworkPtr networkCreate(virConnectPtr conn, const char *xml) { goto cleanup; } - VIR_INFO(_("Creating network '%s'"), network->def->name); + VIR_INFO("Creating network '%s'", network->def->name); ret = virGetNetwork(conn, network->def->name, network->def->uuid); cleanup: @@ -2199,7 +2199,7 @@ static virNetworkPtr networkDefine(virConnectPtr conn, const char *xml) { dnsmasqContextFree(dctx); } - VIR_INFO(_("Defining network '%s'"), network->def->name); + VIR_INFO("Defining network '%s'", network->def->name); ret = virGetNetwork(conn, network->def->name, network->def->uuid); cleanup: @@ -2286,7 +2286,7 @@ static int networkUndefine(virNetworkPtr net) { } - VIR_INFO(_("Undefining network '%s'"), network->def->name); + VIR_INFO("Undefining network '%s'", network->def->name); virNetworkRemoveInactive(&driver->networks, network); network = NULL; diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c index b368614..732c187 100644 --- a/src/qemu/qemu_driver.c +++ b/src/qemu/qemu_driver.c @@ -3757,7 +3757,7 @@ static virDomainPtr qemudDomainDefine(virConnectPtr conn, const char *xml) { if (virDomainSaveConfig(driver->configDir, vm->newDef ? vm->newDef : vm->def) < 0) { - VIR_INFO(_("Defining domain '%s'"), vm->def->name); + VIR_INFO("Defining domain '%s'", vm->def->name); virDomainRemoveInactive(&driver->domains, vm); vm = NULL; @@ -3770,7 +3770,7 @@ static virDomainPtr qemudDomainDefine(virConnectPtr conn, const char *xml) { VIR_DOMAIN_EVENT_DEFINED_ADDED : VIR_DOMAIN_EVENT_DEFINED_UPDATED); - VIR_INFO(_("Creating domain '%s'"), vm->def->name); + VIR_INFO("Creating domain '%s'", vm->def->name); dom = virGetDomain(conn, vm->def->name, vm->def->uuid); if (dom) dom->id = vm->def->id; @@ -3820,7 +3820,7 @@ static int qemudDomainUndefine(virDomainPtr dom) { VIR_DOMAIN_EVENT_UNDEFINED, VIR_DOMAIN_EVENT_UNDEFINED_REMOVED); - VIR_INFO(_("Undefining domain '%s'"), vm->def->name); + VIR_INFO("Undefining domain '%s'", vm->def->name); virDomainRemoveInactive(&driver->domains, vm); vm = NULL; diff --git a/src/storage/storage_driver.c b/src/storage/storage_driver.c index 9328ca4..903ecee 100644 --- a/src/storage/storage_driver.c +++ b/src/storage/storage_driver.c @@ -551,7 +551,7 @@ storagePoolCreate(virConnectPtr conn, pool = NULL; goto cleanup; } - VIR_INFO(_("Creating storage pool '%s'"), pool->def->name); + VIR_INFO("Creating storage pool '%s'", pool->def->name); pool->active = 1; ret = virGetStoragePool(conn, pool->def->name, pool->def->uuid); @@ -593,7 +593,7 @@ storagePoolDefine(virConnectPtr conn, } def = NULL; - VIR_INFO(_("Defining storage pool '%s'"), pool->def->name); + VIR_INFO("Defining storage pool '%s'", pool->def->name); ret = virGetStoragePool(conn, pool->def->name, pool->def->uuid); cleanup: @@ -643,7 +643,7 @@ storagePoolUndefine(virStoragePoolPtr obj) { VIR_FREE(pool->configFile); VIR_FREE(pool->autostartLink); - VIR_INFO(_("Undefining storage pool '%s'"), pool->def->name); + VIR_INFO("Undefining storage pool '%s'", pool->def->name); virStoragePoolObjRemove(&driver->pools, pool); pool = NULL; ret = 0; @@ -691,7 +691,7 @@ storagePoolStart(virStoragePoolPtr obj, goto cleanup; } - VIR_INFO(_("Starting up storage pool '%s'"), pool->def->name); + VIR_INFO("Starting up storage pool '%s'", pool->def->name); pool->active = 1; ret = 0; @@ -779,7 +779,7 @@ storagePoolDestroy(virStoragePoolPtr obj) { virStoragePoolObjClearVols(pool); pool->active = 0; - VIR_INFO(_("Shutting down storage pool '%s'"), pool->def->name); + VIR_INFO("Shutting down storage pool '%s'", pool->def->name); if (pool->configFile == NULL) { virStoragePoolObjRemove(&driver->pools, pool); @@ -836,7 +836,7 @@ storagePoolDelete(virStoragePoolPtr obj, } if (backend->deletePool(obj->conn, pool, flags) < 0) goto cleanup; - VIR_INFO(_("Deleting storage pool '%s'"), pool->def->name); + VIR_INFO("Deleting storage pool '%s'", pool->def->name); ret = 0; cleanup: @@ -1366,7 +1366,7 @@ storageVolumeCreateXML(virStoragePoolPtr obj, } - VIR_INFO(_("Creating volume '%s' in storage pool '%s'"), + VIR_INFO("Creating volume '%s' in storage pool '%s'", volobj->name, pool->def->name); ret = volobj; volobj = NULL; @@ -1526,7 +1526,7 @@ storageVolumeCreateXMLFrom(virStoragePoolPtr obj, goto cleanup; } - VIR_INFO(_("Creating volume '%s' in storage pool '%s'"), + VIR_INFO("Creating volume '%s' in storage pool '%s'", volobj->name, pool->def->name); ret = volobj; volobj = NULL; @@ -1932,7 +1932,7 @@ storageVolumeDelete(virStorageVolPtr obj, for (i = 0 ; i < pool->volumes.count ; i++) { if (pool->volumes.objs[i] == vol) { - VIR_INFO(_("Deleting volume '%s' from storage pool '%s'"), + VIR_INFO("Deleting volume '%s' from storage pool '%s'", vol->name, pool->def->name); virStorageVolDefFree(vol); vol = NULL; diff --git a/src/util/bridge.c b/src/util/bridge.c index 98169ae..7204e64 100644 --- a/src/util/bridge.c +++ b/src/util/bridge.c @@ -1,5 +1,5 @@ /* - * Copyright (C) 2007, 2009 Red Hat, Inc. + * Copyright (C) 2007, 2009, 2011 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 @@ -428,14 +428,14 @@ brProbeVnetHdr(int tapfd) struct ifreq dummy; if (ioctl(tapfd, TUNGETFEATURES, &features) != 0) { - VIR_INFO(_("Not enabling IFF_VNET_HDR; " - "TUNGETFEATURES ioctl() not implemented")); + VIR_INFO("Not enabling IFF_VNET_HDR; " + "TUNGETFEATURES ioctl() not implemented"); return 0; } if (!(features & IFF_VNET_HDR)) { - VIR_INFO(_("Not enabling IFF_VNET_HDR; " - "TUNGETFEATURES ioctl() reports no IFF_VNET_HDR")); + VIR_INFO("Not enabling IFF_VNET_HDR; " + "TUNGETFEATURES ioctl() reports no IFF_VNET_HDR"); return 0; } @@ -443,17 +443,17 @@ brProbeVnetHdr(int tapfd) * If TUNGETIFF is not implemented then errno == EBADFD. */ if (ioctl(tapfd, TUNGETIFF, &dummy) != -1 || errno != EBADFD) { - VIR_INFO(_("Not enabling IFF_VNET_HDR; " - "TUNGETIFF ioctl() not implemented")); + VIR_INFO("Not enabling IFF_VNET_HDR; " + "TUNGETIFF ioctl() not implemented"); return 0; } - VIR_INFO(_("Enabling IFF_VNET_HDR")); + VIR_INFO("Enabling IFF_VNET_HDR"); return 1; # else (void) tapfd; - VIR_INFO(_("Not enabling IFF_VNET_HDR; disabled at build time")); + VIR_INFO("Not enabling IFF_VNET_HDR; disabled at build time"); return 0; # endif } -- 1.7.4.4

On Wed, May 11, 2011 at 14:13:30 -0600, Eric Blake wrote:
We were 31/73 on whether to translate; since less than 50% translated and since VIR_INFO is less than VIR_WARN which also doesn't translate, this makes sense.
* cfg.mk (sc_prohibit_gettext_markup): Add VIR_INFO, since it falls between WARN and DEBUG. * daemon/libvirtd.c (qemudDispatchSignalEvent, remoteCheckAccess) (qemudDispatchServer): Adjust offenders. * daemon/remote.c (remoteDispatchAuthPolkit): Likewise. * src/network/bridge_driver.c (networkReloadIptablesRules) (networkStartNetworkDaemon, networkShutdownNetworkDaemon) (networkCreate, networkDefine, networkUndefine): Likewise. * src/qemu/qemu_driver.c (qemudDomainDefine) (qemudDomainUndefine): Likewise. * src/storage/storage_driver.c (storagePoolCreate) (storagePoolDefine, storagePoolUndefine, storagePoolStart) (storagePoolDestroy, storagePoolDelete, storageVolumeCreateXML) (storageVolumeCreateXMLFrom, storageVolumeDelete): Likewise. * src/util/bridge.c (brProbeVnetHdr): Likewise. * po/POTFILES.in: Drop src/util/bridge.c. ---
I noticed this inconsistency while reviewing Lai's patch.
cfg.mk | 2 +- daemon/libvirtd.c | 10 +++++----- daemon/remote.c | 8 ++++---- po/POTFILES.in | 1 - src/network/bridge_driver.c | 12 ++++++------ src/qemu/qemu_driver.c | 6 +++--- src/storage/storage_driver.c | 18 +++++++++--------- src/util/bridge.c | 18 +++++++++--------- 8 files changed, 37 insertions(+), 38 deletions(-)
Fewer translated messages make for less frequent headaches for developers :-P Moreover this change really makes sense since the messages are not directly visible to users. ACK Jirka

On 05/11/2011 03:08 PM, Jiri Denemark wrote:
On Wed, May 11, 2011 at 14:13:30 -0600, Eric Blake wrote:
We were 31/73 on whether to translate; since less than 50% translated and since VIR_INFO is less than VIR_WARN which also doesn't translate, this makes sense.
* cfg.mk (sc_prohibit_gettext_markup): Add VIR_INFO, since it falls between WARN and DEBUG.
Fewer translated messages make for less frequent headaches for developers :-P Moreover this change really makes sense since the messages are not directly visible to users.
ACK
Thanks; pushed. -- Eric Blake eblake@redhat.com +1-801-349-2682 Libvirt virtualization library http://libvirt.org
participants (4)
-
Daniel P. Berrange
-
Eric Blake
-
Jiri Denemark
-
Lai Jiangshan