[PATCHv2 2/3] Alloc and Free virDaemonLogConfig

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

 



Introduce New functions
virDaemonLogConfigNew/virDaemonLogConfigFree
for alloc and free virDaemonLogConfig

Signed-off-by: Lan Bai <lbai@xxxxxxxx>
---
 src/util/Makefile.inc.am |  2 +-
 src/util/virdaemon.c     | 26 ++++++++++++++++++++++++++
 src/util/virdaemon.h     | 11 +++++++++++
 3 files changed, 38 insertions(+), 1 deletion(-)

diff --git a/src/util/Makefile.inc.am b/src/util/Makefile.inc.am
index cf64220b63..4cac1b07fe 100644
--- a/src/util/Makefile.inc.am
+++ b/src/util/Makefile.inc.am
@@ -44,7 +44,7 @@ UTIL_SOURCES = \
 	util/vircrypto.h \
 	util/virdaemon.c \
 	util/virdaemon.h \
-        util/virdbus.c \
+	util/virdbus.c \
 	util/virdbus.h \
 	util/virdbuspriv.h \
 	util/virdevmapper.c \
diff --git a/src/util/virdaemon.c b/src/util/virdaemon.c
index a2ef48b78b..44bdfb9132 100644
--- a/src/util/virdaemon.c
+++ b/src/util/virdaemon.c
@@ -22,6 +22,7 @@
 
 #include "virdaemon.h"
 #include "virlog.h"
+#include "viralloc.h"
 
 
 /*
@@ -73,3 +74,28 @@ virDaemonSetupLogging(virDaemonLogConfigPtr config,
 
     return 0;
 }
+
+virDaemonLogConfigPtr
+virDaemonLogConfigNew(unsigned int log_level,
+                      char *log_filters,
+                      char *log_outputs)
+{
+    virDaemonLogConfigPtr ret;
+        
+    if (VIR_ALLOC(ret) < 0)
+        return NULL;
+
+    ret->log_level = log_level;
+    ret->log_filters = g_strdup(log_filters);
+    ret->log_outputs = g_strdup(log_outputs);
+       
+    return ret;
+}
+
+void
+virDaemonLogConfigFree(virDaemonLogConfigPtr data)
+{
+    VIR_FREE(data->log_filters);
+    VIR_FREE(data->log_outputs);
+    VIR_FREE(data);    
+}
diff --git a/src/util/virdaemon.h b/src/util/virdaemon.h
index 60b4119f08..46cd80e6a8 100644
--- a/src/util/virdaemon.h
+++ b/src/util/virdaemon.h
@@ -33,3 +33,14 @@ struct _virDaemonLogConfig {
 int virDaemonSetupLogging(virDaemonLogConfigPtr config,
                           const char *output_fname,
                           bool privileged, bool verbose, bool godaemon);
+
+virDaemonLogConfigPtr
+virDaemonLogConfigNew(unsigned int log_level,
+                      char *log_filter,
+                      char *log_outputs);
+
+void
+virDaemonLogConfigFree(virDaemonLogConfigPtr data);
+
+
+
-- 
2.17.1






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

  Powered by Linux