[libvirt] [PATCH 02/10] maint: mark translatable string args of VIR_ERROR0

Jim Meyering jim at meyering.net
Thu May 20 07:11:40 UTC 2010


From: Jim Meyering <meyering at 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




More information about the libvir-list mailing list