]> git.ipfire.org Git - thirdparty/libvirt.git/commitdiff
virhostuptime: Introduce virHostBootTimeInit()
authorMichal Privoznik <mprivozn@redhat.com>
Thu, 19 Dec 2019 09:11:04 +0000 (10:11 +0100)
committerMichal Privoznik <mprivozn@redhat.com>
Tue, 7 Jan 2020 16:00:10 +0000 (17:00 +0100)
The idea is to offer callers an init function that they can call
independently to ensure that the global variables get
initialized.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Cole Robinson <crobinso@redhat.com>
src/libvirt_private.syms
src/util/virhostuptime.c
src/util/virhostuptime.h

index 1f4d2818497f6d7d6463a0a05d8b2af067ca1518..b97906b852389baebca4ef0e3cf49e3bd6081fe8 100644 (file)
@@ -2199,6 +2199,7 @@ virHostMemSetParameters;
 
 
 # util/virhostuptime.h
+virHostBootTimeInit;
 virHostGetBootTime;
 
 
index 8c49c3d40e652e3c0846cd282fb39c5060847b3e..661ed588cda9896a61553908f58c30801881b9ba 100644 (file)
@@ -126,7 +126,7 @@ virHostGetBootTimeOnceInit(void)
 int
 virHostGetBootTime(unsigned long long *when)
 {
-    if (virOnce(&virHostGetBootTimeOnce, virHostGetBootTimeOnceInit) < 0)
+    if (virHostBootTimeInit() < 0)
         return -1;
 
     if (bootTimeErrno) {
@@ -137,3 +137,13 @@ virHostGetBootTime(unsigned long long *when)
     *when = bootTime;
     return 0;
 }
+
+
+int
+virHostBootTimeInit(void)
+{
+    if (virOnce(&virHostGetBootTimeOnce, virHostGetBootTimeOnceInit) < 0)
+        return -1;
+
+    return 0;
+}
index 7e2c4c0c814e159e735a21ae242595ffe7de4262..1ac638fd6e5e0045d727969d7af8dca08d7e8e13 100644 (file)
@@ -25,3 +25,6 @@
 int
 virHostGetBootTime(unsigned long long *when)
     G_GNUC_NO_INLINE;
+
+int
+virHostBootTimeInit(void);