[PATCH v2 01/20] virlog: Rename virLogParse* to virLogParseAndDefine*

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



The reason for this is to be later able to split parsing from defining in a
convenient and transparent way, so eventually, the original virLogParse*
(virLogParseAndDefine* after this patch) functions which were named a bit
poorly will be dropped completely.

Signed-off-by: Erik Skultety <eskultet@xxxxxxxxxx>
---
 daemon/libvirtd.c         |  8 ++++----
 src/libvirt_private.syms  |  4 ++--
 src/locking/lock_daemon.c |  8 ++++----
 src/logging/log_daemon.c  |  8 ++++----
 src/util/virlog.c         | 20 ++++++++++----------
 src/util/virlog.h         |  4 ++--
 tests/virlogtest.c        |  4 ++--
 7 files changed, 28 insertions(+), 28 deletions(-)

diff --git a/daemon/libvirtd.c b/daemon/libvirtd.c
index 95c1b1c..8efa69d 100644
--- a/daemon/libvirtd.c
+++ b/daemon/libvirtd.c
@@ -691,10 +691,10 @@ daemonSetupLogging(struct daemonConfig *config,
     virLogSetFromEnv();
 
     if (virLogGetNbFilters() == 0)
-        virLogParseFilters(config->log_filters);
+        virLogParseAndDefineFilters(config->log_filters);
 
     if (virLogGetNbOutputs() == 0)
-        virLogParseOutputs(config->log_outputs);
+        virLogParseAndDefineOutputs(config->log_outputs);
 
     /*
      * Command line override for --verbose
@@ -721,7 +721,7 @@ daemonSetupLogging(struct daemonConfig *config,
 
             if (virAsprintf(&tmp, "%d:journald", priority) < 0)
                 goto error;
-            virLogParseOutputs(tmp);
+            virLogParseAndDefineOutputs(tmp);
             VIR_FREE(tmp);
         }
     }
@@ -764,7 +764,7 @@ daemonSetupLogging(struct daemonConfig *config,
             if (virAsprintf(&tmp, "%d:stderr", virLogGetDefaultPriority()) < 0)
                 goto error;
         }
-        virLogParseOutputs(tmp);
+        virLogParseAndDefineOutputs(tmp);
         VIR_FREE(tmp);
     }
 
diff --git a/src/libvirt_private.syms b/src/libvirt_private.syms
index a32ce1c..35200a3 100644
--- a/src/libvirt_private.syms
+++ b/src/libvirt_private.syms
@@ -1854,9 +1854,9 @@ virLogLock;
 virLogMessage;
 virLogOutputFree;
 virLogOutputListFree;
+virLogParseAndDefineFilters;
+virLogParseAndDefineOutputs;
 virLogParseDefaultPriority;
-virLogParseFilters;
-virLogParseOutputs;
 virLogPriorityFromSyslog;
 virLogProbablyLogMessage;
 virLogReset;
diff --git a/src/locking/lock_daemon.c b/src/locking/lock_daemon.c
index 9509e0c..84c3029 100644
--- a/src/locking/lock_daemon.c
+++ b/src/locking/lock_daemon.c
@@ -476,10 +476,10 @@ virLockDaemonSetupLogging(virLockDaemonConfigPtr config,
     virLogSetFromEnv();
 
     if (virLogGetNbFilters() == 0)
-        virLogParseFilters(config->log_filters);
+        virLogParseAndDefineFilters(config->log_filters);
 
     if (virLogGetNbOutputs() == 0)
-        virLogParseOutputs(config->log_outputs);
+        virLogParseAndDefineOutputs(config->log_outputs);
 
     /*
      * Command line override for --verbose
@@ -499,7 +499,7 @@ virLockDaemonSetupLogging(virLockDaemonConfigPtr config,
         if (access("/run/systemd/journal/socket", W_OK) >= 0) {
             if (virAsprintf(&tmp, "%d:journald", virLogGetDefaultPriority()) < 0)
                 goto error;
-            virLogParseOutputs(tmp);
+            virLogParseAndDefineOutputs(tmp);
             VIR_FREE(tmp);
         }
     }
@@ -543,7 +543,7 @@ virLockDaemonSetupLogging(virLockDaemonConfigPtr config,
             if (virAsprintf(&tmp, "%d:stderr", virLogGetDefaultPriority()) < 0)
                 goto error;
         }
-        virLogParseOutputs(tmp);
+        virLogParseAndDefineOutputs(tmp);
         VIR_FREE(tmp);
     }
 
diff --git a/src/logging/log_daemon.c b/src/logging/log_daemon.c
index 80e75bf..48eece9 100644
--- a/src/logging/log_daemon.c
+++ b/src/logging/log_daemon.c
@@ -404,10 +404,10 @@ virLogDaemonSetupLogging(virLogDaemonConfigPtr config,
     virLogSetFromEnv();
 
     if (virLogGetNbFilters() == 0)
-        virLogParseFilters(config->log_filters);
+        virLogParseAndDefineFilters(config->log_filters);
 
     if (virLogGetNbOutputs() == 0)
-        virLogParseOutputs(config->log_outputs);
+        virLogParseAndDefineOutputs(config->log_outputs);
 
     /*
      * Command line override for --verbose
@@ -427,7 +427,7 @@ virLogDaemonSetupLogging(virLogDaemonConfigPtr config,
         if (access("/run/systemd/journal/socket", W_OK) >= 0) {
             if (virAsprintf(&tmp, "%d:journald", virLogGetDefaultPriority()) < 0)
                 goto error;
-            virLogParseOutputs(tmp);
+            virLogParseAndDefineOutputs(tmp);
             VIR_FREE(tmp);
         }
     }
@@ -471,7 +471,7 @@ virLogDaemonSetupLogging(virLogDaemonConfigPtr config,
             if (virAsprintf(&tmp, "%d:stderr", virLogGetDefaultPriority()) < 0)
                 goto error;
         }
-        virLogParseOutputs(tmp);
+        virLogParseAndDefineOutputs(tmp);
         VIR_FREE(tmp);
     }
 
diff --git a/src/util/virlog.c b/src/util/virlog.c
index 06f9a60..3ada288 100644
--- a/src/util/virlog.c
+++ b/src/util/virlog.c
@@ -1137,7 +1137,7 @@ int virLogPriorityFromSyslog(int priority ATTRIBUTE_UNUSED)
 
 
 static int
-virLogParseOutput(const char *src)
+virLogParseAndDefineOutput(const char *src)
 {
     int ret = -1;
     char **tokens = NULL;
@@ -1209,7 +1209,7 @@ virLogParseOutput(const char *src)
 
 
 /**
- * virLogParseOutputs:
+ * virLogParseAndDefineOutputs:
  * @outputs: string defining a (set of) output(s)
  *
  * The format for an output can be:
@@ -1234,7 +1234,7 @@ virLogParseOutput(const char *src)
  * Returns the number of output parsed or -1 in case of error.
  */
 int
-virLogParseOutputs(const char *src)
+virLogParseAndDefineOutputs(const char *src)
 {
     int ret = -1;
     int count = 0;
@@ -1254,7 +1254,7 @@ virLogParseOutputs(const char *src)
         if (STREQ(strings[i], ""))
             continue;
 
-        if (virLogParseOutput(strings[i]) < 0)
+        if (virLogParseAndDefineOutput(strings[i]) < 0)
             goto cleanup;
 
         count++;
@@ -1268,7 +1268,7 @@ virLogParseOutputs(const char *src)
 
 
 static int
-virLogParseFilter(const char *filter)
+virLogParseAndDefineFilter(const char *filter)
 {
     int ret = -1;
     size_t count = 0;
@@ -1314,7 +1314,7 @@ virLogParseFilter(const char *filter)
 }
 
 /**
- * virLogParseFilters:
+ * virLogParseAndDefineFilters:
  * @filters: string defining a (set of) filter(s)
  *
  * The format for a filter is:
@@ -1332,7 +1332,7 @@ virLogParseFilter(const char *filter)
  * Returns the number of filter parsed or -1 in case of error.
  */
 int
-virLogParseFilters(const char *filters)
+virLogParseAndDefineFilters(const char *filters)
 {
     int ret = -1;
     int count = 0;
@@ -1352,7 +1352,7 @@ virLogParseFilters(const char *filters)
         if (STREQ(strings[i], ""))
             continue;
 
-        if (virLogParseFilter(strings[i]) < 0)
+        if (virLogParseAndDefineFilter(strings[i]) < 0)
             goto cleanup;
 
         count++;
@@ -1530,10 +1530,10 @@ virLogSetFromEnv(void)
         virLogParseDefaultPriority(debugEnv);
     debugEnv = virGetEnvAllowSUID("LIBVIRT_LOG_FILTERS");
     if (debugEnv && *debugEnv)
-        virLogParseFilters(debugEnv);
+        virLogParseAndDefineFilters(debugEnv);
     debugEnv = virGetEnvAllowSUID("LIBVIRT_LOG_OUTPUTS");
     if (debugEnv && *debugEnv)
-        virLogParseOutputs(debugEnv);
+        virLogParseAndDefineOutputs(debugEnv);
 }
 
 
diff --git a/src/util/virlog.h b/src/util/virlog.h
index f6ee8e6..de64f4c 100644
--- a/src/util/virlog.h
+++ b/src/util/virlog.h
@@ -206,8 +206,8 @@ void virLogLock(void);
 void virLogUnlock(void);
 int virLogReset(void);
 int virLogParseDefaultPriority(const char *priority);
-int virLogParseFilters(const char *filters);
-int virLogParseOutputs(const char *output);
+int virLogParseAndDefineFilters(const char *filters);
+int virLogParseAndDefineOutputs(const char *output);
 int virLogPriorityFromSyslog(int priority);
 void virLogMessage(virLogSourcePtr source,
                    virLogPriority priority,
diff --git a/tests/virlogtest.c b/tests/virlogtest.c
index 5c492a2..afcd84a 100644
--- a/tests/virlogtest.c
+++ b/tests/virlogtest.c
@@ -50,7 +50,7 @@ testLogParseOutputs(const void *opaque)
     int noutputs;
     const struct testLogData *data = opaque;
 
-    noutputs = virLogParseOutputs(data->str);
+    noutputs = virLogParseAndDefineOutputs(data->str);
     if (noutputs < 0) {
         if (!data->pass) {
             VIR_TEST_DEBUG("Got expected error: %s\n",
@@ -81,7 +81,7 @@ testLogParseFilters(const void *opaque)
     int nfilters;
     const struct testLogData *data = opaque;
 
-    nfilters = virLogParseFilters(data->str);
+    nfilters = virLogParseAndDefineFilters(data->str);
     if (nfilters < 0) {
         if (!data->pass) {
             VIR_TEST_DEBUG("Got expected error: %s\n",
-- 
2.5.5

--
libvir-list mailing list
libvir-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/libvir-list



[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]