提交 9d69bc19 编写于 作者: M Michal Privoznik

virhostuptime: Introduce virHostBootTimeInit()

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: NMichal Privoznik <mprivozn@redhat.com>
Reviewed-by: NCole Robinson <crobinso@redhat.com>
上级 40a65ab4
......@@ -2199,6 +2199,7 @@ virHostMemSetParameters;
# util/virhostuptime.h
virHostBootTimeInit;
virHostGetBootTime;
......
......@@ -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;
}
......@@ -25,3 +25,6 @@
int
virHostGetBootTime(unsigned long long *when)
G_GNUC_NO_INLINE;
int
virHostBootTimeInit(void);
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册