[PATCH 13/38] virlog: Rename virLogDefineOutput to virLogOutputNew

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

 



Preparation for the fact, that opposite to the original define method that took
an already existing global set of outputs and appended/defined a new output,
virLogOutputNew only creates a new output, but caller is responsible for
appending the output to a list and managing the list itself.
---
 src/libvirt_private.syms |  2 +-
 src/util/virlog.c        | 34 +++++++++++++++++-----------------
 src/util/virlog.h        | 14 +++++++-------
 tests/testutils.c        |  4 ++--
 4 files changed, 27 insertions(+), 27 deletions(-)

diff --git a/src/libvirt_private.syms b/src/libvirt_private.syms
index 8773270..62641ab 100644
--- a/src/libvirt_private.syms
+++ b/src/libvirt_private.syms
@@ -1743,7 +1743,6 @@ virLockSpaceReleaseResourcesForOwner;
 # util/virlog.h
 virLogDefineFilter;
 virLogDefineFilters;
-virLogDefineOutput;
 virLogDefineOutputs;
 virLogGetDefaultPriority;
 virLogGetFilters;
@@ -1752,6 +1751,7 @@ virLogGetNbOutputs;
 virLogGetOutputs;
 virLogLock;
 virLogMessage;
+virLogOutputNew;
 virLogParseDefaultPriority;
 virLogParseFilters;
 virLogParseOutputs;
diff --git a/src/util/virlog.c b/src/util/virlog.c
index 387e08a..ec942a3 100644
--- a/src/util/virlog.c
+++ b/src/util/virlog.c
@@ -334,7 +334,7 @@ virLogResetOutputs(void)
 
 
 /**
- * virLogDefineOutput:
+ * virLogOutputNew:
  * @f: the function to call to output a message
  * @c: the function to call to close the output (or NULL)
  * @data: extra data passed as first arg to the function
@@ -349,13 +349,13 @@ virLogResetOutputs(void)
  * Returns -1 in case of failure or the output number if successful
  */
 int
-virLogDefineOutput(virLogOutputFunc f,
-                   virLogCloseFunc c,
-                   void *data,
-                   virLogPriority priority,
-                   virLogDestination dest,
-                   const char *name,
-                   unsigned int flags)
+virLogOutputNew(virLogOutputFunc f,
+                virLogCloseFunc c,
+                void *data,
+                virLogPriority priority,
+                virLogDestination dest,
+                const char *name,
+                unsigned int flags)
 {
     char *ndup = NULL;
     virLogOutputPtr output = NULL;
@@ -716,8 +716,8 @@ virLogCloseFd(void *data)
 static int
 virLogNewOutputToStderr(virLogPriority priority)
 {
-    if (virLogDefineOutput(virLogOutputToFd, NULL, (void *)2L, priority,
-                           VIR_LOG_TO_STDERR, NULL, 0) < 0)
+    if (virLogOutputNew(virLogOutputToFd, NULL, (void *)2L, priority,
+                        VIR_LOG_TO_STDERR, NULL, 0) < 0)
         return -1;
     return 0;
 }
@@ -732,9 +732,9 @@ virLogNewOutputToFile(virLogPriority priority,
     fd = open(file, O_CREAT | O_APPEND | O_WRONLY, S_IRUSR | S_IWUSR);
     if (fd < 0)
         return -1;
-    if (virLogDefineOutput(virLogOutputToFd, virLogCloseFd,
-                           (void *)(intptr_t)fd,
-                           priority, VIR_LOG_TO_FILE, file, 0) < 0) {
+    if (virLogOutputNew(virLogOutputToFd, virLogCloseFd,
+                        (void *)(intptr_t)fd,
+                        priority, VIR_LOG_TO_FILE, file, 0) < 0) {
         VIR_FORCE_CLOSE(fd);
         return -1;
     }
@@ -819,8 +819,8 @@ virLogNewOutputToSyslog(virLogPriority priority,
         return -1;
 
     openlog(current_ident, 0, 0);
-    if (virLogDefineOutput(virLogOutputToSyslog, virLogCloseSyslog, NULL,
-                           priority, VIR_LOG_TO_SYSLOG, ident, 0) < 0) {
+    if (virLogOutputNew(virLogOutputToSyslog, virLogCloseSyslog, NULL,
+                        priority, VIR_LOG_TO_SYSLOG, ident, 0) < 0) {
         closelog();
         VIR_FREE(current_ident);
         return -1;
@@ -1039,8 +1039,8 @@ static int virLogNewOutputToJournald(int priority)
         VIR_LOG_CLOSE(journalfd);
         return -1;
     }
-    if (virLogDefineOutput(virLogOutputToJournald, virLogCloseJournald, NULL,
-                           priority, VIR_LOG_TO_JOURNALD, NULL, 0) < 0) {
+    if (virLogOutputNew(virLogOutputToJournald, virLogCloseJournald, NULL,
+                        priority, VIR_LOG_TO_JOURNALD, NULL, 0) < 0) {
         return -1;
     }
     return 0;
diff --git a/src/util/virlog.h b/src/util/virlog.h
index ff16034..27037a4 100644
--- a/src/util/virlog.h
+++ b/src/util/virlog.h
@@ -188,13 +188,13 @@ extern int virLogSetOutputs(const char *outputs);
 extern int virLogDefineFilter(const char *match,
                               virLogPriority priority,
                               unsigned int flags);
-extern int virLogDefineOutput(virLogOutputFunc f,
-                              virLogCloseFunc c,
-                              void *data,
-                              virLogPriority priority,
-                              virLogDestination dest,
-                              const char *name,
-                              unsigned int flags);
+extern int virLogOutputNew(virLogOutputFunc f,
+                           virLogCloseFunc c,
+                           void *data,
+                           virLogPriority priority,
+                           virLogDestination dest,
+                           const char *name,
+                           unsigned int flags);
 
 /*
  * Internal logging API
diff --git a/tests/testutils.c b/tests/testutils.c
index fc4c339..4998931 100644
--- a/tests/testutils.c
+++ b/tests/testutils.c
@@ -869,8 +869,8 @@ int virtTestMain(int argc,
 
     virLogSetFromEnv();
     if (!getenv("LIBVIRT_DEBUG") && !virLogGetNbOutputs()) {
-        if (virLogDefineOutput(virtTestLogOutput, virtTestLogClose, &testLog,
-                               VIR_LOG_DEBUG, VIR_LOG_TO_STDERR, NULL, 0) < 0)
+        if (virLogOutputNew(virtTestLogOutput, virtTestLogClose, &testLog,
+                            VIR_LOG_DEBUG, VIR_LOG_TO_STDERR, NULL, 0) < 0)
             return EXIT_FAILURE;
     }
 
-- 
2.4.3

--
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]