[libvirt] [PATCHv2 05/10] virterror: start messages with lower case

Eric Blake eblake at redhat.com
Thu May 13 01:08:49 UTC 2010


A mix of half-and-half was unappealing; starting with lower case
matches with GNU Coding Standards, thus giving a more consistent feel.

* src/util/virterror.c (virErrorGenericFailure, virRaiseErrorFull)
(virErrorMsg): Adjust messages to start with lower case, except
when first word is acronym.
* src/storage/storage_backend.c (virStorageBackendRunProgRegex):
Likewise.
---

I know that libvirt is not bound by GNU Coding Standards, but since it
runs primarily on GNU/Linux systems, there's something to be said for
a consistent look and feel.

I tried enabling sc_error_message_uppercase in cfg.mk, but that still
has some false positives as well as probably missing several existing
cases, so that is not part of this patch.

 src/storage/storage_backend.c |    2 +-
 src/util/virterror.c          |   52 ++++++++++++++++++++--------------------
 2 files changed, 27 insertions(+), 27 deletions(-)

diff --git a/src/storage/storage_backend.c b/src/storage/storage_backend.c
index 7df61cd..e9a84fb 100644
--- a/src/storage/storage_backend.c
+++ b/src/storage/storage_backend.c
@@ -1222,7 +1222,7 @@ virStorageBackendRunProgRegex(virStoragePoolObjPtr pool,
             char error[100];
             regerror(err, &reg[i], error, sizeof(error));
             virStorageReportError(VIR_ERR_INTERNAL_ERROR,
-                                  _("Failed to compile regex %s"), error);
+                                  _("failed to compile regex %s"), error);
             for (j = 0 ; j <= i ; j++)
                 regfree(&reg[j]);
             VIR_FREE(reg);
diff --git a/src/util/virterror.c b/src/util/virterror.c
index f442fae..00da698 100644
--- a/src/util/virterror.c
+++ b/src/util/virterror.c
@@ -232,7 +232,7 @@ virErrorGenericFailure(virErrorPtr err)
     err->code = VIR_ERR_INTERNAL_ERROR;
     err->domain = VIR_FROM_NONE;
     err->level = VIR_ERR_ERROR;
-    err->message = strdup(_("Unknown failure"));
+    err->message = strdup(_("unknown failure"));
 }


@@ -698,7 +698,7 @@ virRaiseErrorFull(virConnectPtr conn ATTRIBUTE_UNUSED,
      * formats the message
      */
     if (fmt == NULL) {
-        str = strdup(_("No error message provided"));
+        str = strdup(_("no error message provided"));
     } else {
         VIR_GET_VAR_STR(fmt, str);
     }
@@ -940,13 +940,13 @@ virErrorMsg(virErrorNumber error, const char *info)
             info = NULL;
             break;
         case VIR_WAR_NO_NETWORK:
-            errmsg = _("Failed to find the network");
+            errmsg = _("failed to find the network");
             break;
         case VIR_ERR_NO_DOMAIN:
-            errmsg = _("Domain not found");
+            errmsg = _("domain not found");
             break;
         case VIR_ERR_NO_NETWORK:
-            errmsg = _("Network not found");
+            errmsg = _("network not found");
             break;
         case VIR_ERR_INVALID_MAC:
             errmsg = _("invalid MAC address");
@@ -955,10 +955,10 @@ virErrorMsg(virErrorNumber error, const char *info)
             errmsg = _("authentication failed");
             break;
         case VIR_ERR_NO_STORAGE_POOL:
-            errmsg = _("Storage pool not found");
+            errmsg = _("storage pool not found");
             break;
         case VIR_ERR_NO_STORAGE_VOL:
-            errmsg = _("Storage volume not found");
+            errmsg = _("storage volume not found");
             break;
         case VIR_ERR_INVALID_STORAGE_POOL:
             /* FIXME: Adjust all callers before unifying semantics.  */
@@ -977,28 +977,28 @@ virErrorMsg(virErrorNumber error, const char *info)
             info = NULL;
             break;
         case VIR_WAR_NO_STORAGE:
-            errmsg = _("Failed to find a storage driver");
+            errmsg = _("failed to find a storage driver");
             break;
         case VIR_WAR_NO_NODE:
-            errmsg = _("Failed to find a node driver");
+            errmsg = _("failed to find a node driver");
             break;
         case VIR_ERR_INVALID_NODE_DEVICE:
             errmsg = _("invalid node device pointer");
             break;
         case VIR_ERR_NO_NODE_DEVICE:
-            errmsg = _("Node device not found");
+            errmsg = _("node device not found");
             break;
         case VIR_ERR_NO_SECURITY_MODEL:
-            errmsg = _("Security model not found");
+            errmsg = _("security model not found");
             break;
         case VIR_ERR_OPERATION_INVALID:
-            errmsg = _("Requested operation is not valid");
+            errmsg = _("requested operation is not valid");
             break;
         case VIR_WAR_NO_INTERFACE:
-            errmsg = _("Failed to find the interface");
+            errmsg = _("failed to find the interface");
             break;
         case VIR_ERR_NO_INTERFACE:
-            errmsg = _("Interface not found");
+            errmsg = _("interface not found");
             break;
         case VIR_ERR_INVALID_INTERFACE:
             /* FIXME: Adjust all callers before unifying semantics.  */
@@ -1012,43 +1012,43 @@ virErrorMsg(virErrorNumber error, const char *info)
             errmsg = _("multiple matching interfaces found");
             break;
         case VIR_WAR_NO_SECRET:
-            errmsg = _("Failed to find a secret storage driver");
+            errmsg = _("failed to find a secret storage driver");
             break;
         case VIR_ERR_INVALID_SECRET:
-            errmsg = _("Invalid secret");
+            errmsg = _("invalid secret");
             break;
         case VIR_ERR_NO_SECRET:
-            errmsg = _("Secret not found");
+            errmsg = _("secret not found");
             break;
         case VIR_WAR_NO_NWFILTER:
-            errmsg = _("Failed to start the nwfilter driver");
+            errmsg = _("failed to start the nwfilter driver");
             break;
         case VIR_ERR_INVALID_NWFILTER:
-            errmsg = _("Invalid network filter");
+            errmsg = _("invalid network filter");
             break;
         case VIR_ERR_NO_NWFILTER:
-            errmsg = _("Network filter not found");
+            errmsg = _("network filter not found");
             break;
         case VIR_ERR_BUILD_FIREWALL:
-            errmsg = _("Error while building firewall");
+            errmsg = _("error while building firewall");
             break;
         case VIR_ERR_CONFIG_UNSUPPORTED:
             errmsg = _("unsupported configuration");
             break;
         case VIR_ERR_OPERATION_TIMEOUT:
-            errmsg = _("Timed out during operation");
+            errmsg = _("timed out during operation");
             break;
         case VIR_ERR_MIGRATE_PERSIST_FAILED:
-            errmsg = _("Failed to make domain persistent after migration");
+            errmsg = _("failed to make domain persistent after migration");
             break;
         case VIR_ERR_HOOK_SCRIPT_FAILED:
-            errmsg = _("Hook script execution failed");
+            errmsg = _("hook script execution failed");
             break;
         case VIR_ERR_INVALID_DOMAIN_SNAPSHOT:
-            errmsg = _("Invalid snapshot");
+            errmsg = _("invalid snapshot");
             break;
         case VIR_ERR_NO_DOMAIN_SNAPSHOT:
-            errmsg = _("Domain snapshot not found");
+            errmsg = _("domain snapshot not found");
             break;

         case VIR_ERR_CALL_FAILED: /* DEPRECATED, use VIR_ERR_NO_SUPPORT */
-- 
1.7.0.1




More information about the libvir-list mailing list