[libvirt] VIR_ERROR and VIR_DEBUG normalization

Most of the following changes have been induced automatically. The few outliers done manually are marked as such. [PATCH 01/10] maint: use VIR_ERROR0 rather than VIR_ERROR with a bare "%s" [PATCH 02/10] maint: mark translatable string args of VIR_ERROR0 [PATCH 03/10] maint: mark translatable string args of VIR_ERROR [PATCH 04/10] maint: VIR_ERROR/VIR_ERROR0: mark up the remaining ones manually [PATCH 05/10] maint: more of same, but manual: convert VIR_ERROR("%s" to VIR_ERROR0( [PATCH 06/10] maint: change "" in err ? err->message : "" to _("unknown error"), ... [PATCH 07/10] maint: enforce policy wrt VIR_ERROR and VIR_ERROR0 [PATCH 08/10] maint: don't mark VIR_DEBUG or VIR_DEBUG0 diagnostics for translation [PATCH 09/10] maint: enforce policy wrt VIR_DEBUG and VIR_DEBUG0 [PATCH 10/10] maint: update po/POTFILES.in

From: Jim Meyering <meyering@redhat.com> Change VIR_ERROR("%s", "..." to VIR_ERROR0("..." and Change VIR_ERROR("%s", _("...") to VIR_ERROR0(_("...") Use this command: git grep -E -l 'VIR_ERROR\("%s", (_\()?"'|xargs perl -pi -e \ 's/VIR_ERROR\("%s", (_\()?"/VIR_ERROR0($1"/' --- daemon/libvirtd.c | 12 ++++++------ src/phyp/phyp_driver.c | 16 ++++++++-------- src/qemu/qemu_conf.c | 4 ++-- src/qemu/qemu_driver.c | 2 +- 4 files changed, 17 insertions(+), 17 deletions(-) diff --git a/daemon/libvirtd.c b/daemon/libvirtd.c index cc05953..0ac1f5e 100644 --- a/daemon/libvirtd.c +++ b/daemon/libvirtd.c @@ -539,7 +539,7 @@ static int qemudListenUnix(struct qemud_server *server, char ebuf[1024]; if (VIR_ALLOC(sock) < 0) { - VIR_ERROR("%s", _("Failed to allocate memory for struct qemud_socket")); + VIR_ERROR0(_("Failed to allocate memory for struct qemud_socket")); return -1; } @@ -844,12 +844,12 @@ static struct qemud_server *qemudInitialize(void) { server->sigread = server->sigwrite = -1; if (virMutexInit(&server->lock) < 0) { - VIR_ERROR("%s", _("cannot initialize mutex")); + VIR_ERROR0(_("cannot initialize mutex")); VIR_FREE(server); return NULL; } if (virCondInit(&server->job) < 0) { - VIR_ERROR("%s", _("cannot initialize condition variable")); + VIR_ERROR0(_("cannot initialize condition variable")); virMutexDestroy(&server->lock); VIR_FREE(server); return NULL; @@ -1359,7 +1359,7 @@ static int qemudDispatchServer(struct qemud_server *server, struct qemud_socket if (VIR_ALLOC(client) < 0) goto cleanup; if (virMutexInit(&client->lock) < 0) { - VIR_ERROR("%s", _("cannot initialize mutex")); + VIR_ERROR0(_("cannot initialize mutex")); VIR_FREE(client); goto cleanup; } @@ -2771,7 +2771,7 @@ remoteReadConfigFile (struct qemud_server *server, const char *filename) maxbuf = 1024; if (VIR_ALLOC_N(buf, maxbuf) < 0) { - VIR_ERROR("%s", _("Failed to allocate memory for buffer")); + VIR_ERROR0(_("Failed to allocate memory for buffer")); goto free_and_fail; } @@ -2780,7 +2780,7 @@ remoteReadConfigFile (struct qemud_server *server, const char *filename) &grp)) == ERANGE) { maxbuf *= 2; if (maxbuf > 65536 || VIR_REALLOC_N(buf, maxbuf) < 0) { - VIR_ERROR("%s", _("Failed to reallocate enough memory for buffer")); + VIR_ERROR0(_("Failed to reallocate enough memory for buffer")); goto free_and_fail; } } diff --git a/src/phyp/phyp_driver.c b/src/phyp/phyp_driver.c index 8f4f310..fbb094f 100644 --- a/src/phyp/phyp_driver.c +++ b/src/phyp/phyp_driver.c @@ -1233,30 +1233,30 @@ phypDomainDumpXML(virDomainPtr dom, int flags) dom->conn); if (lpar_name == NULL) { - VIR_ERROR("%s", "Unable to determine domain's name."); + VIR_ERROR0("Unable to determine domain's name."); goto err; } if (phypGetLparUUID(def.uuid, dom->id, dom->conn) == -1) { - VIR_ERROR("%s", "Unable to generate random uuid."); + VIR_ERROR0("Unable to generate random uuid."); goto err; } if ((def.maxmem = phypGetLparMem(dom->conn, managed_system, dom->id, 0)) == 0) { - VIR_ERROR("%s", "Unable to determine domain's max memory."); + VIR_ERROR0("Unable to determine domain's max memory."); goto err; } if ((def.memory = phypGetLparMem(dom->conn, managed_system, dom->id, 1)) == 0) { - VIR_ERROR("%s", "Unable to determine domain's memory."); + VIR_ERROR0("Unable to determine domain's memory."); goto err; } if ((def.vcpus = phypGetLparCPU(dom->conn, managed_system, dom->id)) == 0) { - VIR_ERROR("%s", "Unable to determine domain's CPU."); + VIR_ERROR0("Unable to determine domain's CPU."); goto err; } @@ -1695,7 +1695,7 @@ phypBuildLpar(virConnectPtr conn, virDomainDefPtr def) } if (phypUUIDTable_AddLpar(conn, def->uuid, def->id) == -1) { - VIR_ERROR("%s", "Unable to add LPAR to the table"); + VIR_ERROR0("Unable to add LPAR to the table"); goto err; } @@ -1835,13 +1835,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_ERROR("%s", "Unable to write information to local file."); + VIR_ERROR0("Unable to write information to local file."); goto err; } if (safewrite(fd, uuid_table->lpars[i]->uuid, VIR_UUID_BUFLEN) != VIR_UUID_BUFLEN) { - VIR_ERROR("%s", "Unable to write information to local file."); + VIR_ERROR0("Unable to write information to local file."); goto err; } } diff --git a/src/qemu/qemu_conf.c b/src/qemu/qemu_conf.c index 3e334dc..450f3dd 100644 --- a/src/qemu/qemu_conf.c +++ b/src/qemu/qemu_conf.c @@ -254,7 +254,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_ERROR("%s", _("cgroup_controllers must be a list of strings")); + VIR_ERROR0(_("cgroup_controllers must be a list of strings")); virConfFree(conf); return -1; } @@ -292,7 +292,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_ERROR("%s", _("cgroup_device_acl must be a list of strings")); + VIR_ERROR0(_("cgroup_device_acl must be a list of strings")); virConfFree(conf); return -1; } diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c index a519c02..652d3ab 100644 --- a/src/qemu/qemu_driver.c +++ b/src/qemu/qemu_driver.c @@ -1453,7 +1453,7 @@ qemudStartup(int privileged) { return -1; if (virMutexInit(&qemu_driver->lock) < 0) { - VIR_ERROR("%s", _("cannot initialize mutex")); + VIR_ERROR0(_("cannot initialize mutex")); VIR_FREE(qemu_driver); return -1; } -- 1.7.1.259.g3aef8

From: Jim Meyering <meyering@redhat.com> Run this: git grep -l 'VIR_ERROR0\s*("'|xargs perl -pi -e \ 's/(VIR_ERROR0)\s*\((".*?")\)/$1(_($2))/' --- daemon/libvirtd.c | 6 +++--- src/esx/esx_driver.c | 4 ++-- src/node_device/node_device_hal.c | 16 ++++++++-------- src/node_device/node_device_linux_sysfs.c | 2 +- src/node_device/node_device_udev.c | 8 ++++---- src/phyp/phyp_driver.c | 16 ++++++++-------- src/qemu/qemu_driver.c | 4 ++-- src/uml/uml_driver.c | 4 ++-- src/util/cgroup.c | 4 ++-- src/xen/proxy_internal.c | 2 +- 10 files changed, 33 insertions(+), 33 deletions(-) diff --git a/daemon/libvirtd.c b/daemon/libvirtd.c index 0ac1f5e..2f9c871 100644 --- a/daemon/libvirtd.c +++ b/daemon/libvirtd.c @@ -3199,7 +3199,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_ERROR0(_("Event thread startup failed")); goto error; } @@ -3208,14 +3208,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_ERROR0(_("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_ERROR0(_("Network event loop enablement failed")); goto shutdown; } virMutexUnlock(&server->lock); diff --git a/src/esx/esx_driver.c b/src/esx/esx_driver.c index 8e55fc6..7c9c50e 100644 --- a/src/esx/esx_driver.c +++ b/src/esx/esx_driver.c @@ -1892,14 +1892,14 @@ esxDomainGetInfo(virDomainPtr domain, virDomainInfoPtr info) esxVI_PerfEntityMetric_DynamicCast(perfEntityMetricBase); if (perfMetricIntSeries == NULL) { - VIR_ERROR0("QueryPerf returned object with unexpected type"); + VIR_ERROR0(_("QueryPerf returned object with unexpected type")); } perfMetricIntSeries = esxVI_PerfMetricIntSeries_DynamicCast(perfEntityMetric->value); if (perfMetricIntSeries == NULL) { - VIR_ERROR0("QueryPerf returned object with unexpected type"); + VIR_ERROR0(_("QueryPerf returned object with unexpected type")); } for (; perfMetricIntSeries != NULL; diff --git a/src/node_device/node_device_hal.c b/src/node_device/node_device_hal.c index 8113c55..235bf56 100644 --- a/src/node_device/node_device_hal.c +++ b/src/node_device/node_device_hal.c @@ -718,22 +718,22 @@ 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_ERROR0(_("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_ERROR0(_("dbus_bus_get failed")); goto failure; } 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_ERROR0(_("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_ERROR0(_("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 */ @@ -747,7 +747,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_ERROR0(_("dbus_connection_set_watch_functions failed")); goto failure; } @@ -768,13 +768,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_ERROR0(_("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_ERROR0(_("libhal_get_all_devices failed")); goto failure; } for (i = 0; i < num_devs; i++) { @@ -835,7 +835,7 @@ static int halDeviceMonitorReload(void) 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_ERROR0(_("libhal_get_all_devices failed")); return -1; } for (i = 0; i < num_devs; i++) { diff --git a/src/node_device/node_device_linux_sysfs.c b/src/node_device/node_device_linux_sysfs.c index e7f9064..3e0c8cf 100644 --- a/src/node_device/node_device_linux_sysfs.c +++ b/src/node_device/node_device_linux_sysfs.c @@ -272,7 +272,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_ERROR0(_("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 4a9d65f..2e97c26 100644 --- a/src/node_device/node_device_udev.c +++ b/src/node_device/node_device_udev.c @@ -368,7 +368,7 @@ static int udevTranslatePCIIds(unsigned int vendor, const char *vendor_name = NULL, *device_name = NULL; if (pci_system_init() != 0) { - VIR_ERROR0("Failed to initialize libpciaccess"); + VIR_ERROR0(_("Failed to initialize libpciaccess")); goto out; } @@ -1408,7 +1408,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_ERROR0(_("udev_monitor_receive_device returned NULL")); goto out; } @@ -1572,7 +1572,7 @@ static int udevDeviceMonitorStartup(int privileged ATTRIBUTE_UNUSED) } if (virMutexInit(&driverState->lock) < 0) { - VIR_ERROR0("Failed to initialize mutex for driverState"); + VIR_ERROR0(_("Failed to initialize mutex for driverState")); VIR_FREE(priv); VIR_FREE(driverState); ret = -1; @@ -1594,7 +1594,7 @@ static int udevDeviceMonitorStartup(int privileged ATTRIBUTE_UNUSED) if (priv->udev_monitor == NULL) { VIR_FREE(priv); nodeDeviceUnlock(driverState); - VIR_ERROR0("udev_monitor_new_from_netlink returned NULL"); + VIR_ERROR0(_("udev_monitor_new_from_netlink returned NULL")); ret = -1; goto out; } diff --git a/src/phyp/phyp_driver.c b/src/phyp/phyp_driver.c index fbb094f..68b2613 100644 --- a/src/phyp/phyp_driver.c +++ b/src/phyp/phyp_driver.c @@ -1233,30 +1233,30 @@ phypDomainDumpXML(virDomainPtr dom, int flags) dom->conn); if (lpar_name == NULL) { - VIR_ERROR0("Unable to determine domain's name."); + VIR_ERROR0(_("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_ERROR0(_("Unable to generate random uuid.")); goto err; } if ((def.maxmem = phypGetLparMem(dom->conn, managed_system, dom->id, 0)) == 0) { - VIR_ERROR0("Unable to determine domain's max memory."); + VIR_ERROR0(_("Unable to determine domain's max memory.")); goto err; } if ((def.memory = phypGetLparMem(dom->conn, managed_system, dom->id, 1)) == 0) { - VIR_ERROR0("Unable to determine domain's memory."); + VIR_ERROR0(_("Unable to determine domain's memory.")); goto err; } if ((def.vcpus = phypGetLparCPU(dom->conn, managed_system, dom->id)) == 0) { - VIR_ERROR0("Unable to determine domain's CPU."); + VIR_ERROR0(_("Unable to determine domain's CPU.")); goto err; } @@ -1695,7 +1695,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_ERROR0(_("Unable to add LPAR to the table")); goto err; } @@ -1835,13 +1835,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_ERROR0(_("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_ERROR0(_("Unable to write information to local file.")); goto err; } } diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c index 652d3ab..2bd06b5 100644 --- a/src/qemu/qemu_driver.c +++ b/src/qemu/qemu_driver.c @@ -184,7 +184,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_ERROR0(_("Unexpected QEMU monitor still active during domain deletion")); qemuMonitorClose(priv->mon); } VIR_FREE(priv); @@ -1392,7 +1392,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_ERROR0(_("Failed to allocate memory for path")); continue; } diff --git a/src/uml/uml_driver.c b/src/uml/uml_driver.c index 9a9cdc2..55c8ef2 100644 --- a/src/uml/uml_driver.c +++ b/src/uml/uml_driver.c @@ -780,7 +780,7 @@ static int umlCleanupTapDevices(virConnectPtr conn ATTRIBUTE_UNUSED, int err; int ret = 0; brControl *brctl = NULL; - VIR_ERROR0("Cleanup tap"); + VIR_ERROR0(_("Cleanup tap")); if (brInit(&brctl) < 0) return -1; @@ -798,7 +798,7 @@ static int umlCleanupTapDevices(virConnectPtr conn ATTRIBUTE_UNUSED, ret = -1; } } - VIR_ERROR0("Cleanup tap done"); + VIR_ERROR0(_("Cleanup tap done")); brShutdown(brctl); return ret; } diff --git a/src/util/cgroup.c b/src/util/cgroup.c index b8b2eb5..337fddb 100644 --- a/src/util/cgroup.c +++ b/src/util/cgroup.c @@ -83,7 +83,7 @@ static int virCgroupDetectMounts(virCgroupPtr group) mounts = fopen("/proc/mounts", "r"); if (mounts == NULL) { - VIR_ERROR0("Unable to open /proc/mounts"); + VIR_ERROR0(_("Unable to open /proc/mounts")); return -ENOENT; } @@ -136,7 +136,7 @@ static int virCgroupDetectPlacement(virCgroupPtr group) mapping = fopen("/proc/self/cgroup", "r"); if (mapping == NULL) { - VIR_ERROR0("Unable to open /proc/self/cgroup"); + VIR_ERROR0(_("Unable to open /proc/self/cgroup")); return -ENOENT; } diff --git a/src/xen/proxy_internal.c b/src/xen/proxy_internal.c index db209d1..335dfc4 100644 --- a/src/xen/proxy_internal.c +++ b/src/xen/proxy_internal.c @@ -159,7 +159,7 @@ virProxyForkServer(void) if (virExecDaemonize(proxyarg, NULL, NULL, &pid, -1, NULL, NULL, 0, NULL, NULL, NULL) < 0) - VIR_ERROR0("Failed to fork libvirt_proxy"); + VIR_ERROR0(_("Failed to fork libvirt_proxy")); return (0); } -- 1.7.1.259.g3aef8

From: Jim Meyering <meyering@redhat.com> Run this: git grep -l 'VIR_ERROR\s*("'|xargs perl -pi -e \ 's/(VIR_ERROR)\s*\((".*?"),/$1(_($2),/' --- daemon/libvirtd.c | 2 +- src/driver.c | 6 +++--- src/libvirt.c | 2 +- src/lxc/lxc_controller.c | 2 +- src/node_device/node_device_hal.c | 2 +- src/node_device/node_device_linux_sysfs.c | 8 ++++---- src/node_device/node_device_udev.c | 20 ++++++++++---------- src/phyp/phyp_driver.c | 10 +++++----- src/qemu/qemu_conf.c | 2 +- src/qemu/qemu_driver.c | 8 ++++---- src/qemu/qemu_monitor.c | 4 ++-- src/storage/storage_driver.c | 8 ++++---- src/uml/uml_driver.c | 4 ++-- src/util/cgroup.c | 10 +++++----- src/util/util.c | 2 +- 15 files changed, 45 insertions(+), 45 deletions(-) diff --git a/daemon/libvirtd.c b/daemon/libvirtd.c index 2f9c871..04af58f 100644 --- a/daemon/libvirtd.c +++ b/daemon/libvirtd.c @@ -817,7 +817,7 @@ static int qemudInitPaths(struct qemud_server *server, snprintf_error: if (ret) - VIR_ERROR("%s", + VIR_ERROR(_("%s"), _("Resulting path too long for buffer in qemudInitPaths()")); cleanup: diff --git a/src/driver.c b/src/driver.c index e6f3aaa..a6f5558 100644 --- a/src/driver.c +++ b/src/driver.c @@ -64,7 +64,7 @@ virDriverLoadModule(const char *name) handle = dlopen(modfile, RTLD_NOW | RTLD_LOCAL); if (!handle) { - VIR_ERROR("failed to load module %s %s", modfile, dlerror()); + VIR_ERROR(_("failed to load module %s %s"), modfile, dlerror()); goto cleanup; } @@ -74,12 +74,12 @@ virDriverLoadModule(const char *name) regsym = dlsym(handle, regfunc); if (!regsym) { - VIR_ERROR("Missing module registration symbol %s", regfunc); + VIR_ERROR(_("Missing module registration symbol %s"), regfunc); goto cleanup; } if ((*regsym)() < 0) { - VIR_ERROR("Failed module registration %s", regfunc); + VIR_ERROR(_("Failed module registration %s"), regfunc); goto cleanup; } diff --git a/src/libvirt.c b/src/libvirt.c index eb05337..9d42c76 100644 --- a/src/libvirt.c +++ b/src/libvirt.c @@ -976,7 +976,7 @@ int virStateInitialize(int privileged) { for (i = 0 ; i < virStateDriverTabCount ; i++) { if (virStateDriverTab[i]->initialize && virStateDriverTab[i]->initialize(privileged) < 0) { - VIR_ERROR("Initialization of %s state driver failed", + VIR_ERROR(_("Initialization of %s state driver failed"), virStateDriverTab[i]->name); ret = -1; } diff --git a/src/lxc/lxc_controller.c b/src/lxc/lxc_controller.c index 1732780..6b64372 100644 --- a/src/lxc/lxc_controller.c +++ b/src/lxc/lxc_controller.c @@ -302,7 +302,7 @@ static int lxcControllerMain(int monitor, fdArray[0].active = 0; fdArray[1].fd = contPty; fdArray[1].active = 0; - VIR_ERROR("monitor=%d client=%d appPty=%d contPty=%d", monitor,client, appPty, contPty); + VIR_ERROR(_("monitor=%d client=%d appPty=%d contPty=%d"), monitor,client, appPty, contPty); /* create the epoll fild descriptor */ epollFd = epoll_create(2); if (0 > epollFd) { diff --git a/src/node_device/node_device_hal.c b/src/node_device/node_device_hal.c index 235bf56..c2b3c8f 100644 --- a/src/node_device/node_device_hal.c +++ b/src/node_device/node_device_hal.c @@ -787,7 +787,7 @@ static int halDeviceMonitorStartup(int privileged ATTRIBUTE_UNUSED) failure: if (dbus_error_is_set(&err)) { - VIR_ERROR("%s: %s", err.name, err.message); + VIR_ERROR(_("%s: %s"), err.name, err.message); dbus_error_free(&err); } virNodeDeviceObjListFree(&driverState->devs); diff --git a/src/node_device/node_device_linux_sysfs.c b/src/node_device/node_device_linux_sysfs.c index 3e0c8cf..142b882 100644 --- a/src/node_device/node_device_linux_sysfs.c +++ b/src/node_device/node_device_linux_sysfs.c @@ -197,7 +197,7 @@ static int logStrToLong_ui(char const *s, ret = virStrToLong_ui(s, end_ptr, base, result); if (ret != 0) { - VIR_ERROR("Failed to convert '%s' to unsigned int", s); + VIR_ERROR(_("Failed to convert '%s' to unsigned int"), s); } else { VIR_DEBUG("Converted '%s' to unsigned int %u", s, *result); } @@ -264,7 +264,7 @@ static int get_sriov_function(const char *device_link, device_path = canonicalize_file_name (device_link); if (device_path == NULL) { memset(errbuf, '\0', sizeof(errbuf)); - VIR_ERROR("Failed to resolve device link '%s': '%s'", device_link, + VIR_ERROR(_("Failed to resolve device link '%s': '%s'"), device_link, virStrerror(errno, errbuf, sizeof(errbuf))); goto out; } @@ -277,7 +277,7 @@ static int get_sriov_function(const char *device_link, } if (parse_pci_config_address(config_address, *bdf) != 0) { - VIR_ERROR("Failed to parse PCI config address '%s'", config_address); + VIR_ERROR(_("Failed to parse PCI config address '%s'"), config_address); goto out; } @@ -357,7 +357,7 @@ int get_virtual_functions_linux(const char *sysfs_path, /* We should not get back SRIOV_NOT_FOUND in this * case, so if we do, it's an error. */ - VIR_ERROR("Failed to get SR IOV function from device link '%s'", + VIR_ERROR(_("Failed to get SR IOV function from device link '%s'"), device_link); goto out; } else { diff --git a/src/node_device/node_device_udev.c b/src/node_device/node_device_udev.c index 2e97c26..ee90537 100644 --- a/src/node_device/node_device_udev.c +++ b/src/node_device/node_device_udev.c @@ -57,7 +57,7 @@ static int udevStrToLong_ull(char const *s, ret = virStrToLong_ull(s, end_ptr, base, result); if (ret != 0) { - VIR_ERROR("Failed to convert '%s' to unsigned long long", s); + VIR_ERROR(_("Failed to convert '%s' to unsigned long long"), s); } else { VIR_DEBUG("Converted '%s' to unsigned long %llu", s, *result); } @@ -75,7 +75,7 @@ static int udevStrToLong_ui(char const *s, ret = virStrToLong_ui(s, end_ptr, base, result); if (ret != 0) { - VIR_ERROR("Failed to convert '%s' to unsigned int", s); + VIR_ERROR(_("Failed to convert '%s' to unsigned int"), s); } else { VIR_DEBUG("Converted '%s' to unsigned int %u", s, *result); } @@ -92,7 +92,7 @@ static int udevStrToLong_i(char const *s, ret = virStrToLong_i(s, end_ptr, base, result); if (ret != 0) { - VIR_ERROR("Failed to convert '%s' to int", s); + VIR_ERROR(_("Failed to convert '%s' to int"), s); } else { VIR_DEBUG("Converted '%s' to int %u", s, *result); } @@ -737,7 +737,7 @@ static int udevGetSCSIType(unsigned int type, char **typestring) ret = -1; virReportOOMError(); } else { - VIR_ERROR("Failed to find SCSI device type %d", type); + VIR_ERROR(_("Failed to find SCSI device type %d"), type); } } @@ -802,7 +802,7 @@ static int udevProcessSCSIDevice(struct udev_device *device ATTRIBUTE_UNUSED, out: if (ret != 0) { - VIR_ERROR("Failed to process SCSI device with sysfs path '%s'", + VIR_ERROR(_("Failed to process SCSI device with sysfs path '%s'"), def->sysfs_path); } return ret; @@ -1165,7 +1165,7 @@ static int udevGetDeviceDetails(struct udev_device *device, ret = udevProcessStorage(device, def); break; default: - VIR_ERROR("Unknown device type %d", def->caps->type); + VIR_ERROR(_("Unknown device type %d"), def->caps->type); ret = -1; break; } @@ -1286,7 +1286,7 @@ static int udevAddOneDevice(struct udev_device *device) nodeDeviceUnlock(driverState); if (dev == NULL) { - VIR_ERROR("Failed to create device for '%s'", def->name); + VIR_ERROR(_("Failed to create device for '%s'"), def->name); virNodeDeviceDefFree(def); goto out; } @@ -1333,7 +1333,7 @@ static int udevEnumerateDevices(struct udev *udev) ret = udev_enumerate_scan_devices(udev_enumerate); if (0 != ret) { - VIR_ERROR("udev scan devices returned %d", ret); + VIR_ERROR(_("udev scan devices returned %d"), ret); goto out; } @@ -1443,7 +1443,7 @@ udevGetDMIData(union _virNodeDevCapData *data) if (device == NULL) { device = udev_device_new_from_syspath(udev, DMI_DEVPATH_FALLBACK); if (device == NULL) { - VIR_ERROR("Failed to get udev device for syspath '%s' or '%s'", + VIR_ERROR(_("Failed to get udev device for syspath '%s' or '%s'"), DMI_DEVPATH, DMI_DEVPATH_FALLBACK); goto out; } @@ -1534,7 +1534,7 @@ static int udevSetupSystemDev(void) dev = virNodeDeviceAssignDef(&driverState->devs, def); if (dev == NULL) { - VIR_ERROR("Failed to create device for '%s'", def->name); + VIR_ERROR(_("Failed to create device for '%s'"), def->name); goto out; } diff --git a/src/phyp/phyp_driver.c b/src/phyp/phyp_driver.c index 68b2613..4a10461 100644 --- a/src/phyp/phyp_driver.c +++ b/src/phyp/phyp_driver.c @@ -1067,7 +1067,7 @@ phypListDomainsGeneric(virConnectPtr conn, int *ids, int nids, break; else if (ret[i] == '\n') { if (virStrToLong_i(id_c, &char_ptr, 10, &ids[got]) == -1) { - VIR_ERROR("Cannot parse number from '%s'", id_c); + VIR_ERROR(_("Cannot parse number from '%s'"), id_c); goto err; } memset(id_c, 0, 10); @@ -1520,7 +1520,7 @@ phypDomainSetCPU(virDomainPtr dom, unsigned int nvcpus) goto err; if (nvcpus > phypGetLparCPUMAX(dom)) { - VIR_ERROR("%s", + VIR_ERROR(_("%s"), "You are trying to set a number of CPUs bigger than " "the max possible.."); goto err; @@ -1547,7 +1547,7 @@ phypDomainSetCPU(virDomainPtr dom, unsigned int nvcpus) ret = phypExec(session, cmd, &exit_status, dom->conn); if (exit_status < 0) { - VIR_ERROR("%s", + VIR_ERROR(_("%s"), "Possibly you don't have IBM Tools installed in your LPAR." "Contact your support to enable this feature."); goto err; @@ -1690,7 +1690,7 @@ phypBuildLpar(virConnectPtr conn, virDomainDefPtr def) ret = phypExec(session, cmd, &exit_status, conn); if (exit_status < 0) { - VIR_ERROR("%s\"%s\"", "Unable to create LPAR. Reason: ", ret); + VIR_ERROR(_("%s\"%s\""), "Unable to create LPAR. Reason: ", ret); goto err; } @@ -1992,7 +1992,7 @@ phypUUIDTable_Push(virConnectPtr conn) /* end of file */ break; } else { - VIR_ERROR("Failed to read from '%s'", local_file); + VIR_ERROR(_("Failed to read from '%s'"), local_file); goto err; } } diff --git a/src/qemu/qemu_conf.c b/src/qemu/qemu_conf.c index 450f3dd..ee24c4c 100644 --- a/src/qemu/qemu_conf.c +++ b/src/qemu/qemu_conf.c @@ -260,7 +260,7 @@ int qemudLoadDriverConfig(struct qemud_driver *driver, } ctl = virCgroupControllerTypeFromString(pp->str); if (ctl < 0) { - VIR_ERROR("Unknown cgroup controller '%s'", pp->str); + VIR_ERROR(_("Unknown cgroup controller '%s'"), pp->str); virConfFree(conf); return -1; } diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c index 2bd06b5..0f9acb2 100644 --- a/src/qemu/qemu_driver.c +++ b/src/qemu/qemu_driver.c @@ -1367,7 +1367,7 @@ static void qemuDomainSnapshotLoad(void *payload, virDomainObjLock(vm); if (virAsprintf(&snapDir, "%s/%s", baseDir, vm->def->name) < 0) { - VIR_ERROR("Failed to allocate memory for snapshot directory for domain %s", + VIR_ERROR(_("Failed to allocate memory for snapshot directory for domain %s"), vm->def->name); goto cleanup; } @@ -1377,7 +1377,7 @@ static void qemuDomainSnapshotLoad(void *payload, if (!(dir = opendir(snapDir))) { if (errno != ENOENT) - VIR_ERROR("Failed to open snapshot directory %s for domain %s: %s", + VIR_ERROR(_("Failed to open snapshot directory %s for domain %s: %s"), snapDir, vm->def->name, virStrerror(errno, ebuf, sizeof(ebuf))); goto cleanup; @@ -1399,7 +1399,7 @@ static void qemuDomainSnapshotLoad(void *payload, ret = virFileReadAll(fullpath, 1024*1024*1, &xmlStr); if (ret < 0) { /* Nothing we can do here, skip this one */ - VIR_ERROR("Failed to read snapshot file %s: %s", fullpath, + VIR_ERROR(_("Failed to read snapshot file %s: %s"), fullpath, virStrerror(errno, ebuf, sizeof(ebuf))); VIR_FREE(fullpath); continue; @@ -1408,7 +1408,7 @@ static void qemuDomainSnapshotLoad(void *payload, def = virDomainSnapshotDefParseString(xmlStr, 0); if (def == NULL) { /* Nothing we can do here, skip this one */ - VIR_ERROR("Failed to parse snapshot XML from file '%s'", fullpath); + VIR_ERROR(_("Failed to parse snapshot XML from file '%s'"), fullpath); VIR_FREE(fullpath); VIR_FREE(xmlStr); continue; diff --git a/src/qemu/qemu_monitor.c b/src/qemu/qemu_monitor.c index ec22c20..b1254a1 100644 --- a/src/qemu/qemu_monitor.c +++ b/src/qemu/qemu_monitor.c @@ -315,7 +315,7 @@ qemuMonitorIOProcess(qemuMonitorPtr mon) # if DEBUG_RAW_IO char *str1 = qemuMonitorEscapeNonPrintable(msg ? msg->txBuffer : ""); char *str2 = qemuMonitorEscapeNonPrintable(mon->buffer); - VIR_ERROR("Process %d %p %p [[[[%s]]][[[%s]]]", (int)mon->bufferOffset, mon->msg, msg, str1, str2); + VIR_ERROR(_("Process %d %p %p [[[[%s]]][[[%s]]]"), (int)mon->bufferOffset, mon->msg, msg, str1, str2); VIR_FREE(str1); VIR_FREE(str2); # else @@ -509,7 +509,7 @@ qemuMonitorIO(int watch, int fd, int events, void *opaque) { #endif if (mon->fd != fd || mon->watch != watch) { - VIR_ERROR("event from unexpected fd %d!=%d / watch %d!=%d", mon->fd, fd, mon->watch, watch); + VIR_ERROR(_("event from unexpected fd %d!=%d / watch %d!=%d"), mon->fd, fd, mon->watch, watch); failed = 1; } else { if (!mon->lastErrno && diff --git a/src/storage/storage_driver.c b/src/storage/storage_driver.c index 2c69ba9..b148e39 100644 --- a/src/storage/storage_driver.c +++ b/src/storage/storage_driver.c @@ -73,7 +73,7 @@ storageDriverAutostart(virStorageDriverStatePtr driver) { !virStoragePoolObjIsActive(pool)) { virStorageBackendPtr backend; if ((backend = virStorageBackendForType(pool->def->type)) == NULL) { - VIR_ERROR("Missing backend %d", pool->def->type); + VIR_ERROR(_("Missing backend %d"), pool->def->type); virStoragePoolObjUnlock(pool); continue; } @@ -81,7 +81,7 @@ storageDriverAutostart(virStorageDriverStatePtr driver) { if (backend->startPool && backend->startPool(NULL, pool) < 0) { virErrorPtr err = virGetLastError(); - VIR_ERROR("Failed to autostart storage pool '%s': %s", + VIR_ERROR(_("Failed to autostart storage pool '%s': %s"), pool->def->name, err ? err->message : "no error message found"); virStoragePoolObjUnlock(pool); @@ -92,7 +92,7 @@ storageDriverAutostart(virStorageDriverStatePtr driver) { virErrorPtr err = virGetLastError(); if (backend->stopPool) backend->stopPool(NULL, pool); - VIR_ERROR("Failed to autostart storage pool '%s': %s", + VIR_ERROR(_("Failed to autostart storage pool '%s': %s"), pool->def->name, err ? err->message : "no error message found"); virStoragePoolObjUnlock(pool); @@ -634,7 +634,7 @@ storagePoolUndefine(virStoragePoolPtr obj) { if (unlink(pool->autostartLink) < 0 && errno != ENOENT && errno != ENOTDIR) { char ebuf[1024]; - VIR_ERROR("Failed to delete autostart link '%s': %s", + VIR_ERROR(_("Failed to delete autostart link '%s': %s"), pool->autostartLink, virStrerror(errno, ebuf, sizeof ebuf)); } diff --git a/src/uml/uml_driver.c b/src/uml/uml_driver.c index 55c8ef2..da8fd47 100644 --- a/src/uml/uml_driver.c +++ b/src/uml/uml_driver.c @@ -791,10 +791,10 @@ static int umlCleanupTapDevices(virConnectPtr conn ATTRIBUTE_UNUSED, def->type != VIR_DOMAIN_NET_TYPE_NETWORK) continue; - VIR_ERROR("Cleanup '%s'", def->ifname); + VIR_ERROR(_("Cleanup '%s'"), def->ifname); err = brDeleteTap(brctl, def->ifname); if (err) { - VIR_ERROR("Cleanup failed %d", err); + VIR_ERROR(_("Cleanup failed %d"), err); ret = -1; } } diff --git a/src/util/cgroup.c b/src/util/cgroup.c index 337fddb..35e9691 100644 --- a/src/util/cgroup.c +++ b/src/util/cgroup.c @@ -195,7 +195,7 @@ static int virCgroupDetect(virCgroupPtr group) rc = virCgroupDetectMounts(group); if (rc < 0) { - VIR_ERROR("Failed to detect mounts for %s", group->path); + VIR_ERROR(_("Failed to detect mounts for %s"), group->path); return rc; } @@ -217,7 +217,7 @@ static int virCgroupDetect(virCgroupPtr group) continue; if (!group->controllers[i].placement) { - VIR_ERROR("Could not find placement for controller %s at %s", + VIR_ERROR(_("Could not find placement for controller %s at %s"), virCgroupControllerTypeToString(i), group->controllers[i].placement); rc = -ENOENT; @@ -230,7 +230,7 @@ static int virCgroupDetect(virCgroupPtr group) group->controllers[i].placement); } } else { - VIR_ERROR("Failed to detect mapping for %s", group->path); + VIR_ERROR(_("Failed to detect mapping for %s"), group->path); } return rc; @@ -422,7 +422,7 @@ static int virCgroupCpuSetInherit(virCgroupPtr parent, virCgroupPtr group) inherit_values[i], &value); if (rc != 0) { - VIR_ERROR("Failed to get %s %d", inherit_values[i], rc); + VIR_ERROR(_("Failed to get %s %d"), inherit_values[i], rc); break; } @@ -435,7 +435,7 @@ static int virCgroupCpuSetInherit(virCgroupPtr parent, virCgroupPtr group) VIR_FREE(value); if (rc != 0) { - VIR_ERROR("Failed to set %s %d", inherit_values[i], rc); + VIR_ERROR(_("Failed to set %s %d"), inherit_values[i], rc); break; } } diff --git a/src/util/util.c b/src/util/util.c index e937d39..92b9a0f 100644 --- a/src/util/util.c +++ b/src/util/util.c @@ -283,7 +283,7 @@ static int virClearCapabilities(void) capng_clear(CAPNG_SELECT_BOTH); if ((ret = capng_apply(CAPNG_SELECT_BOTH)) < 0) { - VIR_ERROR("cannot clear process capabilities %d", ret); + VIR_ERROR(_("cannot clear process capabilities %d"), ret); return -1; } -- 1.7.1.259.g3aef8

From: Jim Meyering <meyering@redhat.com> Handle concatenated strings manually. --- src/esx/esx_vi.c | 10 +++++----- src/node_device/node_device_udev.c | 20 ++++++++++---------- 2 files changed, 15 insertions(+), 15 deletions(-) diff --git a/src/esx/esx_vi.c b/src/esx/esx_vi.c index 966ef85..4d175e9 100644 --- a/src/esx/esx_vi.c +++ b/src/esx/esx_vi.c @@ -2770,13 +2770,13 @@ esxVI_WaitForTaskCompletion(esxVI_Context *ctx, if (taskInfo->cancelable == esxVI_Boolean_True) { if (esxVI_CancelTask(ctx, task) < 0) { - VIR_ERROR0("Cancelable task is blocked by an " - "unanswered question but cancelation " - "failed"); + VIR_ERROR0(_("Cancelable task is blocked by an " + "unanswered question but cancelation " + "failed")); } } else { - VIR_ERROR0("Non-cancelable task is blocked by an " - "unanswered question"); + VIR_ERROR0(_("Non-cancelable task is blocked by an " + "unanswered question")); } /* FIXME: Enable error reporting here again */ diff --git a/src/node_device/node_device_udev.c b/src/node_device/node_device_udev.c index ee90537..a1ced87 100644 --- a/src/node_device/node_device_udev.c +++ b/src/node_device/node_device_udev.c @@ -122,8 +122,8 @@ static int udevGetDeviceProperty(struct udev_device *udev_device, * of the function must also be changed. */ *property_value = strdup(udev_value); if (*property_value == NULL) { - VIR_ERROR("Failed to allocate memory for property value for " - "property key '%s' on device with sysname '%s'", + VIR_ERROR(_("Failed to allocate memory for property value for " + "property key '%s' on device with sysname '%s'"), property_key, udev_device_get_sysname(udev_device)); virReportOOMError(); ret = PROPERTY_ERROR; @@ -211,8 +211,8 @@ static int udevGetDeviceSysfsAttr(struct udev_device *udev_device, * of the function must also be changed. */ *attr_value = strdup(udev_value); if (*attr_value == NULL) { - VIR_ERROR("Failed to allocate memory for sysfs attribute value for " - "sysfs attribute '%s' on device with sysname '%s'", + VIR_ERROR(_("Failed to allocate memory for sysfs attribute value for " + "sysfs attribute '%s' on device with sysname '%s'"), attr_name, udev_device_get_sysname(udev_device)); virReportOOMError(); ret = PROPERTY_ERROR; @@ -329,8 +329,8 @@ static int udevGenerateDeviceName(struct udev_device *device, if (virBufferError(&buf)) { virBufferFreeAndReset(&buf); - VIR_ERROR("Buffer error when generating device name for device " - "with sysname '%s'", udev_device_get_sysname(device)); + VIR_ERROR(_("Buffer error when generating device name for device " + "with sysname '%s'"), udev_device_get_sysname(device)); ret = -1; } @@ -639,8 +639,8 @@ static int udevProcessSCSIHost(struct udev_device *device ATTRIBUTE_UNUSED, filename = basename(def->sysfs_path); if (!STRPREFIX(filename, "host")) { - VIR_ERROR("SCSI host found, but its udev name '%s' does " - "not begin with 'host'", filename); + VIR_ERROR(_("SCSI host found, but its udev name '%s' does " + "not begin with 'host'"), filename); goto out; } @@ -1401,8 +1401,8 @@ static void udevEventHandleCallback(int watch ATTRIBUTE_UNUSED, udev_fd = udev_monitor_get_fd(udev_monitor); if (fd != udev_fd) { - VIR_ERROR("File descriptor returned by udev %d does not " - "match node device file descriptor %d", fd, udev_fd); + VIR_ERROR(_("File descriptor returned by udev %d does not " + "match node device file descriptor %d"), fd, udev_fd); goto out; } -- 1.7.1.259.g3aef8

From: Jim Meyering <meyering@redhat.com> --- daemon/libvirtd.c | 3 +-- src/phyp/phyp_driver.c | 12 +++++------- 2 files changed, 6 insertions(+), 9 deletions(-) diff --git a/daemon/libvirtd.c b/daemon/libvirtd.c index 04af58f..afa10fb 100644 --- a/daemon/libvirtd.c +++ b/daemon/libvirtd.c @@ -817,8 +817,7 @@ static int qemudInitPaths(struct qemud_server *server, snprintf_error: if (ret) - VIR_ERROR(_("%s"), - _("Resulting path too long for buffer in qemudInitPaths()")); + VIR_ERROR0(_("Resulting path too long for buffer in qemudInitPaths()")); cleanup: VIR_FREE(dir_prefix); diff --git a/src/phyp/phyp_driver.c b/src/phyp/phyp_driver.c index 4a10461..8a9c7a6 100644 --- a/src/phyp/phyp_driver.c +++ b/src/phyp/phyp_driver.c @@ -1520,9 +1520,8 @@ phypDomainSetCPU(virDomainPtr dom, unsigned int nvcpus) goto err; if (nvcpus > phypGetLparCPUMAX(dom)) { - VIR_ERROR(_("%s"), - "You are trying to set a number of CPUs bigger than " - "the max possible.."); + VIR_ERROR0(_("You are trying to set a number of CPUs bigger than " + "the max possible..")); goto err; } @@ -1547,9 +1546,8 @@ phypDomainSetCPU(virDomainPtr dom, unsigned int nvcpus) ret = phypExec(session, cmd, &exit_status, dom->conn); if (exit_status < 0) { - VIR_ERROR(_("%s"), - "Possibly you don't have IBM Tools installed in your LPAR." - "Contact your support to enable this feature."); + VIR_ERROR0(_("Possibly you don't have IBM Tools installed in your LPAR." + "Contact your support to enable this feature.")); goto err; } @@ -1690,7 +1688,7 @@ phypBuildLpar(virConnectPtr conn, virDomainDefPtr def) ret = phypExec(session, cmd, &exit_status, conn); if (exit_status < 0) { - VIR_ERROR(_("%s\"%s\""), "Unable to create LPAR. Reason: ", ret); + VIR_ERROR(_("Unable to create LPAR. Reason: '%s'"), ret); goto err; } -- 1.7.1.259.g3aef8

From: Jim Meyering <meyering@redhat.com> These changes avoid false-positive syntax-check failure, and also make the resulting diagnostics more comprehensible. --- src/qemu/qemu_driver.c | 8 ++++---- src/secret/secret_driver.c | 4 ++-- src/uml/uml_driver.c | 2 +- 3 files changed, 7 insertions(+), 7 deletions(-) diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c index 0f9acb2..97991d7 100644 --- a/src/qemu/qemu_driver.c +++ b/src/qemu/qemu_driver.c @@ -634,7 +634,7 @@ qemuAutostartDomain(void *payload, const char *name ATTRIBUTE_UNUSED, void *opaq virErrorPtr err = virGetLastError(); VIR_ERROR(_("Failed to autostart VM '%s': %s"), vm->def->name, - err ? err->message : ""); + err ? err->message : _("unknown error")); } else { virDomainEventPtr event = virDomainEventNewFromObj(vm, @@ -2895,7 +2895,7 @@ qemudReattachManagedDevice(pciDevice *dev) if (pciReAttachDevice(dev) < 0) { virErrorPtr err = virGetLastError(); VIR_ERROR(_("Failed to re-attach PCI device: %s"), - err ? err->message : ""); + err ? err->message : _("unknown error")); virResetError(err); } } @@ -2914,7 +2914,7 @@ qemuDomainReAttachHostDevices(struct qemud_driver *driver, if (!(pcidevs = qemuGetPciHostDeviceList(def))) { virErrorPtr err = virGetLastError(); VIR_ERROR(_("Failed to allocate pciDeviceList: %s"), - err ? err->message : ""); + err ? err->message : _("unknown error")); virResetError(err); return; } @@ -2932,7 +2932,7 @@ qemuDomainReAttachHostDevices(struct qemud_driver *driver, if (pciResetDevice(dev, driver->activePciHostdevs) < 0) { virErrorPtr err = virGetLastError(); VIR_ERROR(_("Failed to reset PCI device: %s"), - err ? err->message : ""); + err ? err->message : _("unknown error")); virResetError(err); } } diff --git a/src/secret/secret_driver.c b/src/secret/secret_driver.c index 22852a1..01c0034 100644 --- a/src/secret/secret_driver.c +++ b/src/secret/secret_driver.c @@ -1,7 +1,7 @@ /* * secret_driver.c: local driver for secret manipulation API * - * Copyright (C) 2009 Red Hat, Inc. + * Copyright (C) 2009-2010 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 @@ -499,7 +499,7 @@ loadSecrets(virSecretDriverStatePtr driver, virErrorPtr err = virGetLastError(); VIR_ERROR(_("Error reading secret: %s"), - err != NULL ? err->message: ""); + err != NULL ? err->message: _("unknown error")); virResetError(err); continue; } diff --git a/src/uml/uml_driver.c b/src/uml/uml_driver.c index da8fd47..c6d8b65 100644 --- a/src/uml/uml_driver.c +++ b/src/uml/uml_driver.c @@ -157,7 +157,7 @@ umlAutostartDomain(void *payload, const char *name ATTRIBUTE_UNUSED, void *opaqu if (umlStartVMDaemon(data->conn, data->driver, vm) < 0) { virErrorPtr err = virGetLastError(); VIR_ERROR(_("Failed to autostart VM '%s': %s"), - vm->def->name, err ? err->message : ""); + vm->def->name, err ? err->message : _("unknown error")); } } virDomainObjUnlock(vm); -- 1.7.1.259.g3aef8

From: Jim Meyering <meyering@redhat.com> * cfg.mk (msg_gen_function): Add VIR_ERROR and VIR_ERROR0, so that sc_libvirt_unmarked_diagnostics will check them, too. --- cfg.mk | 2 ++ 1 files changed, 2 insertions(+), 0 deletions(-) diff --git a/cfg.mk b/cfg.mk index 04719d4..a26285f 100644 --- a/cfg.mk +++ b/cfg.mk @@ -358,6 +358,8 @@ msg_gen_function += virXendError msg_gen_function += xenapiSessionErrorHandler msg_gen_function += xenUnifiedError msg_gen_function += xenXMError +msg_gen_function += VIR_ERROR +msg_gen_function += VIR_ERROR0 # Uncomment the following and run "make syntax-check" to see diagnostics # that are not yet marked for translation, but that need to be rewritten -- 1.7.1.259.g3aef8

From: Jim Meyering <meyering@redhat.com> Run this command: git grep -l VIR_DEBUG|xargs perl -pi -e \ 's/(VIR_DEBUG0?)\s*\(_\((".*?")\)/$1($2/' --- ...-Step-7-of-8-Implement-the-driver-methods.patch | 4 +- src/node_device/node_device_driver.c | 2 +- src/node_device/node_device_linux_sysfs.c | 6 ++-- src/qemu/qemu_conf.c | 2 +- src/storage/storage_backend_scsi.c | 38 ++++++++++---------- 5 files changed, 26 insertions(+), 26 deletions(-) diff --git a/docs/api_extension/0007-Step-7-of-8-Implement-the-driver-methods.patch b/docs/api_extension/0007-Step-7-of-8-Implement-the-driver-methods.patch index 807ed78..ff1124f 100644 --- a/docs/api_extension/0007-Step-7-of-8-Implement-the-driver-methods.patch +++ b/docs/api_extension/0007-Step-7-of-8-Implement-the-driver-methods.patch @@ -146,7 +146,7 @@ index b84729f..4f73baf 100644 + goto cleanup; + } + -+ VIR_DEBUG(_("Vport operation path is '%s'"), operation_path); ++ VIR_DEBUG("Vport operation path is '%s'", operation_path); + + fd = open(operation_path, O_WRONLY); + @@ -959,7 +959,7 @@ index 0000000..1deb6d2 + char buf[64]; + struct stat st; + -+ VIR_DEBUG(_("Checking if host%d is an FC HBA"), d->scsi_host.host); ++ VIR_DEBUG("Checking if host%d is an FC HBA", d->scsi_host.host); + + if (virAsprintf(&sysfs_path, "%s/host%d", + LINUX_SYSFS_FC_HOST_PREFIX, diff --git a/src/node_device/node_device_driver.c b/src/node_device/node_device_driver.c index b0ea986..a6c1fa0 100644 --- a/src/node_device/node_device_driver.c +++ b/src/node_device/node_device_driver.c @@ -432,7 +432,7 @@ nodeDeviceVportCreateDelete(const int parent_host, goto cleanup; } - VIR_DEBUG(_("Vport operation path is '%s'"), operation_path); + VIR_DEBUG("Vport operation path is '%s'", operation_path); if (virAsprintf(&vport_name, "%s:%s", diff --git a/src/node_device/node_device_linux_sysfs.c b/src/node_device/node_device_linux_sysfs.c index 142b882..c90e72b 100644 --- a/src/node_device/node_device_linux_sysfs.c +++ b/src/node_device/node_device_linux_sysfs.c @@ -53,7 +53,7 @@ static int open_wwn_file(const char *prefix, /* fd will be closed by caller */ if ((*fd = open(wwn_path, O_RDONLY)) != -1) { - VIR_DEBUG(_("Opened WWN path '%s' for reading"), + VIR_DEBUG("Opened WWN path '%s' for reading", wwn_path); } else { VIR_ERROR(_("Failed to open WWN path '%s' for reading"), @@ -79,7 +79,7 @@ int read_wwn_linux(int host, const char *file, char **wwn) memset(buf, 0, sizeof(buf)); if (saferead(fd, buf, sizeof(buf)) < 0) { retval = -1; - VIR_DEBUG(_("Failed to read WWN for host%d '%s'"), + VIR_DEBUG("Failed to read WWN for host%d '%s'", host, file); goto out; } @@ -117,7 +117,7 @@ int check_fc_host_linux(union _virNodeDevCapData *d) int retval = 0; struct stat st; - VIR_DEBUG(_("Checking if host%d is an FC HBA"), d->scsi_host.host); + VIR_DEBUG("Checking if host%d is an FC HBA", d->scsi_host.host); if (virAsprintf(&sysfs_path, "%s/host%d", LINUX_SYSFS_FC_HOST_PREFIX, diff --git a/src/qemu/qemu_conf.c b/src/qemu/qemu_conf.c index ee24c4c..5c14eb8 100644 --- a/src/qemu/qemu_conf.c +++ b/src/qemu/qemu_conf.c @@ -727,7 +727,7 @@ qemudProbeCPUModels(const char *qemu, if (STREQ(arch, "i686") || STREQ(arch, "x86_64")) parse = qemudParseX86Models; else { - VIR_DEBUG(_("don't know how to parse %s CPU models"), arch); + VIR_DEBUG("don't know how to parse %s CPU models", arch); return 0; } diff --git a/src/storage/storage_backend_scsi.c b/src/storage/storage_backend_scsi.c index 0260818..cd01f93 100644 --- a/src/storage/storage_backend_scsi.c +++ b/src/storage/storage_backend_scsi.c @@ -92,7 +92,7 @@ getDeviceType(uint32_t host, goto out; } - VIR_DEBUG(_("Device type is %d"), *type); + VIR_DEBUG("Device type is %d", *type); out: VIR_FREE(type_path); @@ -221,7 +221,7 @@ virStorageBackendSCSINewLun(virStoragePoolObjPtr pool, goto free_vol; } - VIR_DEBUG(_("Trying to create volume for '%s'"), devpath); + VIR_DEBUG("Trying to create volume for '%s'", devpath); /* Now figure out the stable path * @@ -239,7 +239,7 @@ virStorageBackendSCSINewLun(virStoragePoolObjPtr pool, !(STREQ(pool->def->target.path, "/dev") || STREQ(pool->def->target.path, "/dev/"))) { - VIR_DEBUG(_("No stable path found for '%s' in '%s'"), + VIR_DEBUG("No stable path found for '%s' in '%s'", devpath, pool->def->target.path); retval = -1; @@ -301,7 +301,7 @@ getNewStyleBlockDevice(const char *lun_path, goto out; } - VIR_DEBUG(_("Looking for block device in '%s'"), block_path); + VIR_DEBUG("Looking for block device in '%s'", block_path); block_dir = opendir(block_path); if (block_dir == NULL) { @@ -327,7 +327,7 @@ getNewStyleBlockDevice(const char *lun_path, goto out; } - VIR_DEBUG(_("Block device is '%s'"), *block_device); + VIR_DEBUG("Block device is '%s'", *block_device); break; } @@ -366,7 +366,7 @@ getOldStyleBlockDevice(const char *lun_path ATTRIBUTE_UNUSED, goto out; } - VIR_DEBUG(_("Block device is '%s'"), *block_device); + VIR_DEBUG("Block device is '%s'", *block_device); } out: @@ -436,7 +436,7 @@ processLU(virStoragePoolObjPtr pool, int device_type; char *block_device = NULL; - VIR_DEBUG(_("Processing LU %u:%u:%u:%u"), + VIR_DEBUG("Processing LU %u:%u:%u:%u", host, bus, target, lun); if (getDeviceType(host, bus, target, lun, &device_type) < 0) { @@ -457,7 +457,7 @@ processLU(virStoragePoolObjPtr pool, goto out; } - VIR_DEBUG(_("%u:%u:%u:%u is a Direct-Access LUN"), + VIR_DEBUG("%u:%u:%u:%u is a Direct-Access LUN", host, bus, target, lun); if (getBlockDevice(host, bus, target, lun, &block_device) < 0) { @@ -467,13 +467,13 @@ processLU(virStoragePoolObjPtr pool, if (virStorageBackendSCSINewLun(pool, host, bus, target, lun, block_device) < 0) { - VIR_DEBUG(_("Failed to create new storage volume for %u:%u:%u:%u"), + VIR_DEBUG("Failed to create new storage volume for %u:%u:%u:%u", host, bus, target, lun); retval = -1; goto out; } - VIR_DEBUG(_("Created new storage volume for %u:%u:%u:%u successfully"), + VIR_DEBUG("Created new storage volume for %u:%u:%u:%u successfully", host, bus, target, lun); VIR_FREE(type_path); @@ -494,7 +494,7 @@ virStorageBackendSCSIFindLUs(virStoragePoolObjPtr pool, struct dirent *lun_dirent = NULL; char devicepattern[64]; - VIR_DEBUG(_("Discovering LUs on host %u"), scanhost); + VIR_DEBUG("Discovering LUs on host %u", scanhost); virFileWaitForDevices(); @@ -520,7 +520,7 @@ virStorageBackendSCSIFindLUs(virStoragePoolObjPtr pool, continue; } - VIR_DEBUG(_("Found LU '%s'"), lun_dirent->d_name); + VIR_DEBUG("Found LU '%s'", lun_dirent->d_name); processLU(pool, scanhost, bus, target, lun); } @@ -541,7 +541,7 @@ virStorageBackendSCSIGetHostNumber(const char *sysfs_path, DIR *sysdir = NULL; struct dirent *dirent = NULL; - VIR_DEBUG(_("Finding host number from '%s'"), sysfs_path); + VIR_DEBUG("Finding host number from '%s'", sysfs_path); virFileWaitForDevices(); @@ -558,7 +558,7 @@ virStorageBackendSCSIGetHostNumber(const char *sysfs_path, if (STREQLEN(dirent->d_name, "target", strlen("target"))) { if (sscanf(dirent->d_name, "target%u:", host) != 1) { - VIR_DEBUG(_("Failed to parse target '%s'"), dirent->d_name); + VIR_DEBUG("Failed to parse target '%s'", dirent->d_name); retval = -1; break; } @@ -578,7 +578,7 @@ virStorageBackendSCSITriggerRescan(uint32_t host) int retval = 0; char *path; - VIR_DEBUG(_("Triggering rescan of host %d"), host); + VIR_DEBUG("Triggering rescan of host %d", host); if (virAsprintf(&path, "/sys/class/scsi_host/host%u/scan", host) < 0) { virReportOOMError(); @@ -586,7 +586,7 @@ virStorageBackendSCSITriggerRescan(uint32_t host) goto out; } - VIR_DEBUG(_("Scan trigger path is '%s'"), path); + VIR_DEBUG("Scan trigger path is '%s'", path); fd = open(path, O_WRONLY); @@ -612,7 +612,7 @@ virStorageBackendSCSITriggerRescan(uint32_t host) free_path: VIR_FREE(path); out: - VIR_DEBUG(_("Rescan of host %d complete"), host); + VIR_DEBUG("Rescan of host %d complete", host); return retval; } @@ -627,13 +627,13 @@ virStorageBackendSCSIRefreshPool(virConnectPtr conn ATTRIBUTE_UNUSED, pool->def->allocation = pool->def->capacity = pool->def->available = 0; if (sscanf(pool->def->source.adapter, "host%u", &host) != 1) { - VIR_DEBUG(_("Failed to get host number from '%s'"), + VIR_DEBUG("Failed to get host number from '%s'", pool->def->source.adapter); retval = -1; goto out; } - VIR_DEBUG(_("Scanning host%u"), host); + VIR_DEBUG("Scanning host%u", host); if (virStorageBackendSCSITriggerRescan(host) < 0) { retval = -1; -- 1.7.1.259.g3aef8

From: Jim Meyering <meyering@redhat.com> * cfg.mk (sc_prohibit_gettext_markup): Just like VIR_WARN*. --- cfg.mk | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diff --git a/cfg.mk b/cfg.mk index a26285f..2909e3e 100644 --- a/cfg.mk +++ b/cfg.mk @@ -425,7 +425,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_WARN0? *\(_\(' \ + @prohibit='\<VIR_(WARN|DEBUG)0? *\(_\(' \ halt='do not mark these strings for translation' \ $(_sc_search_regexp) -- 1.7.1.259.g3aef8

From: Jim Meyering <meyering@redhat.com> * po/POTFILES.in: Add 3 files. --- po/POTFILES.in | 7 +++++-- 1 files changed, 5 insertions(+), 2 deletions(-) diff --git a/po/POTFILES.in b/po/POTFILES.in index e08b8c8..baaf56f 100644 --- a/po/POTFILES.in +++ b/po/POTFILES.in @@ -18,6 +18,7 @@ src/cpu/cpu_generic.c src/cpu/cpu_map.c src/cpu/cpu_x86.c src/datatypes.c +src/driver.c src/esx/esx_driver.c src/esx/esx_util.c src/esx/esx_vi.c @@ -32,6 +33,7 @@ src/lxc/lxc_controller.c src/lxc/lxc_driver.c src/network/bridge_driver.c src/node_device/node_device_driver.c +src/node_device/node_device_hal.c src/node_device/node_device_linux_sysfs.c src/node_device/node_device_udev.c src/nodeinfo.c @@ -53,8 +55,8 @@ src/qemu/qemu_monitor_text.c src/qemu/qemu_security_dac.c src/remote/remote_driver.c src/secret/secret_driver.c -src/security/security_driver.c src/security/security_apparmor.c +src/security/security_driver.c src/security/security_selinux.c src/security/virt-aa-helper.c src/storage/storage_backend.c @@ -70,6 +72,7 @@ src/uml/uml_conf.c src/uml/uml_driver.c src/util/authhelper.c src/util/bridge.c +src/util/cgroup.c src/util/conf.c src/util/dnsmasq.c src/util/hooks.c @@ -87,10 +90,10 @@ src/util/xml.c src/vbox/vbox_driver.c src/vbox/vbox_tmpl.c src/xen/proxy_internal.c -src/xen/xend_internal.c src/xen/xen_driver.c src/xen/xen_hypervisor.c src/xen/xen_inotify.c +src/xen/xend_internal.c src/xen/xm_internal.c src/xen/xs_internal.c src/xenapi/xenapi_driver.c -- 1.7.1.259.g3aef8

On 05/20/2010 01:11 AM, Jim Meyering wrote:
Most of the following changes have been induced automatically. The few outliers done manually are marked as such.
[PATCH 01/10] maint: use VIR_ERROR0 rather than VIR_ERROR with a bare "%s" [PATCH 02/10] maint: mark translatable string args of VIR_ERROR0 [PATCH 03/10] maint: mark translatable string args of VIR_ERROR [PATCH 04/10] maint: VIR_ERROR/VIR_ERROR0: mark up the remaining ones manually [PATCH 05/10] maint: more of same, but manual: convert VIR_ERROR("%s" to VIR_ERROR0( [PATCH 06/10] maint: change "" in err ? err->message : "" to _("unknown error"), ... [PATCH 07/10] maint: enforce policy wrt VIR_ERROR and VIR_ERROR0 [PATCH 08/10] maint: don't mark VIR_DEBUG or VIR_DEBUG0 diagnostics for translation [PATCH 09/10] maint: enforce policy wrt VIR_DEBUG and VIR_DEBUG0 [PATCH 10/10] maint: update po/POTFILES.in
I glanced through everything in the series, and didn't see any issues other than the possible fact that a 'make syntax-check' could fail when bisecting lands in the middle of the series due to a mismatch in po/POTFILES.in vs. translated strings. But I don't see any better way to arrange the series, so: ACK to all 10. -- Eric Blake eblake@redhat.com +1-801-349-2682 Libvirt virtualization library http://libvirt.org

Eric Blake wrote:
On 05/20/2010 01:11 AM, Jim Meyering wrote:
Most of the following changes have been induced automatically. The few outliers done manually are marked as such.
[PATCH 01/10] maint: use VIR_ERROR0 rather than VIR_ERROR with a bare "%s" [PATCH 02/10] maint: mark translatable string args of VIR_ERROR0 [PATCH 03/10] maint: mark translatable string args of VIR_ERROR [PATCH 04/10] maint: VIR_ERROR/VIR_ERROR0: mark up the remaining ones manually [PATCH 05/10] maint: more of same, but manual: convert VIR_ERROR("%s" to VIR_ERROR0( [PATCH 06/10] maint: change "" in err ? err->message : "" to _("unknown error"), ... [PATCH 07/10] maint: enforce policy wrt VIR_ERROR and VIR_ERROR0 [PATCH 08/10] maint: don't mark VIR_DEBUG or VIR_DEBUG0 diagnostics for translation [PATCH 09/10] maint: enforce policy wrt VIR_DEBUG and VIR_DEBUG0 [PATCH 10/10] maint: update po/POTFILES.in
I glanced through everything in the series, and didn't see any issues other than the possible fact that a 'make syntax-check' could fail when bisecting lands in the middle of the series due to a mismatch in po/POTFILES.in vs. translated strings. But I don't see any better way to arrange the series, so:
Good catch. I debated whether to take the time to find the change set(s) that induced the requirement for those POTFILES.in additions, but didn't think it'd be worthwhile.
ACK to all 10.
Thanks for the review.
participants (2)
-
Eric Blake
-
Jim Meyering