]> xenbits.xensource.com Git - libvirt.git/commitdiff
util: Introduce virSystemdHasResolved
authorJiri Denemark <jdenemar@redhat.com>
Thu, 25 Jan 2024 11:45:26 +0000 (12:45 +0100)
committerJiri Denemark <jdenemar@redhat.com>
Wed, 7 Feb 2024 13:19:42 +0000 (14:19 +0100)
Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
src/libvirt_private.syms
src/util/virsystemd.c
src/util/virsystemd.h
src/util/virsystemdpriv.h

index c39837173481522341cfd0a83dba772aeeec8216..c336d06fb36221dcb07df2bdea31d40551e268e0 100644 (file)
@@ -3489,6 +3489,8 @@ virSystemdHasLogind;
 virSystemdHasLogindResetCachedValue;
 virSystemdHasMachined;
 virSystemdHasMachinedResetCachedValue;
+virSystemdHasResolved;
+virSystemdHasResolvedResetCachedValue;
 virSystemdMakeScopeName;
 virSystemdMakeSliceName;
 virSystemdNotifyStartup;
index 36820e81feff8383128ef22f0be00def0b3070fb..fd2b1db3ee76a43dd86cef180723504ada7d9a89 100644 (file)
@@ -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
index 19fb714132e62e3cda1d2229a58b66dc34acb210..65add8b5b938566875c195441dab490e82e4f963 100644 (file)
@@ -49,6 +49,8 @@ int virSystemdHasMachined(void);
 
 int virSystemdHasLogind(void);
 
+int virSystemdHasResolved(void);
+
 int virSystemdCanSuspend(bool *result);
 
 int virSystemdCanHibernate(bool *result);
index 736c53d3fadbdb6bf09f0c5fd67ee4e2695160cd..1f1dda456ccdab01bf23ae5977a5cf0db9742379 100644 (file)
@@ -29,3 +29,4 @@
 
 void virSystemdHasMachinedResetCachedValue(void);
 void virSystemdHasLogindResetCachedValue(void);
+void virSystemdHasResolvedResetCachedValue(void);