[libvirt PATCH v2 2/7] util: Introduce virSystemdHasResolved

Jiri Denemark posted 7 patches 8 months, 2 weeks ago
[libvirt PATCH v2 2/7] util: Introduce virSystemdHasResolved
Posted by Jiri Denemark 8 months, 2 weeks ago
Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
---
 src/libvirt_private.syms  |  2 ++
 src/util/virsystemd.c     | 15 +++++++++++++++
 src/util/virsystemd.h     |  2 ++
 src/util/virsystemdpriv.h |  1 +
 4 files changed, 20 insertions(+)

diff --git a/src/libvirt_private.syms b/src/libvirt_private.syms
index c398371734..c336d06fb3 100644
--- a/src/libvirt_private.syms
+++ b/src/libvirt_private.syms
@@ -3489,6 +3489,8 @@ virSystemdHasLogind;
 virSystemdHasLogindResetCachedValue;
 virSystemdHasMachined;
 virSystemdHasMachinedResetCachedValue;
+virSystemdHasResolved;
+virSystemdHasResolvedResetCachedValue;
 virSystemdMakeScopeName;
 virSystemdMakeSliceName;
 virSystemdNotifyStartup;
diff --git a/src/util/virsystemd.c b/src/util/virsystemd.c
index 36820e81fe..fd2b1db3ee 100644
--- a/src/util/virsystemd.c
+++ b/src/util/virsystemd.c
@@ -127,6 +127,7 @@ char *virSystemdMakeSliceName(const char *partition)
 
 static int virSystemdHasMachinedCachedValue = -1;
 static int virSystemdHasLogindCachedValue = -1;
+static int virSystemdHasResolvedCachedValue = -1;
 
 /* Reset the cache from tests for testing the underlying dbus calls
  * as well */
@@ -140,6 +141,12 @@ void virSystemdHasLogindResetCachedValue(void)
     virSystemdHasLogindCachedValue = -1;
 }
 
+void
+virSystemdHasResolvedResetCachedValue(void)
+{
+    virSystemdHasResolvedCachedValue = -1;
+}
+
 
 /**
  * virSystemdHasService:
@@ -198,6 +205,14 @@ virSystemdHasLogind(void)
 }
 
 
+int
+virSystemdHasResolved(void)
+{
+    return virSystemdHasService("org.freedesktop.resolve1",
+                                &virSystemdHasResolvedCachedValue);
+}
+
+
 /**
  * virSystemdGetMachineByPID:
  * @conn: dbus connection
diff --git a/src/util/virsystemd.h b/src/util/virsystemd.h
index 19fb714132..65add8b5b9 100644
--- a/src/util/virsystemd.h
+++ b/src/util/virsystemd.h
@@ -49,6 +49,8 @@ int virSystemdHasMachined(void);
 
 int virSystemdHasLogind(void);
 
+int virSystemdHasResolved(void);
+
 int virSystemdCanSuspend(bool *result);
 
 int virSystemdCanHibernate(bool *result);
diff --git a/src/util/virsystemdpriv.h b/src/util/virsystemdpriv.h
index 736c53d3fa..1f1dda456c 100644
--- a/src/util/virsystemdpriv.h
+++ b/src/util/virsystemdpriv.h
@@ -29,3 +29,4 @@
 
 void virSystemdHasMachinedResetCachedValue(void);
 void virSystemdHasLogindResetCachedValue(void);
+void virSystemdHasResolvedResetCachedValue(void);
-- 
2.43.0
_______________________________________________
Devel mailing list -- devel@lists.libvirt.org
To unsubscribe send an email to devel-leave@lists.libvirt.org