]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
varlink-idl: introduce c/.h file for common varlink IDL structures
authorLennart Poettering <lennart@poettering.net>
Thu, 10 Oct 2024 08:33:50 +0000 (10:33 +0200)
committerLennart Poettering <lennart@poettering.net>
Fri, 11 Oct 2024 08:41:06 +0000 (10:41 +0200)
Some structures we'll use in various varlink interfaces, move them to a
common .c/.h file. For now this is only the dual timestamp object, but
there will be more soon.

src/shared/meson.build
src/shared/varlink-idl-common.c [new file with mode: 0644]
src/shared/varlink-idl-common.h [new file with mode: 0644]
src/shared/varlink-io.systemd.Machine.c

index e759293364df7c92a05b38c92ca3e94a1fbf8395..42dd32024a24d209eb47538ee0bb4590940a48aa 100644 (file)
@@ -177,6 +177,7 @@ shared_sources = files(
         'user-record.c',
         'userdb-dropin.c',
         'userdb.c',
+        'varlink-idl-common.c',
         'varlink-io.systemd.BootControl.c',
         'varlink-io.systemd.Credentials.c',
         'varlink-io.systemd.Hostname.c',
diff --git a/src/shared/varlink-idl-common.c b/src/shared/varlink-idl-common.c
new file mode 100644 (file)
index 0000000..9ed5230
--- /dev/null
@@ -0,0 +1,12 @@
+/* SPDX-License-Identifier: LGPL-2.1-or-later */
+
+#include "sd-varlink-idl.h"
+
+#include "varlink-idl-common.h"
+
+SD_VARLINK_DEFINE_STRUCT_TYPE(
+                Timestamp,
+                SD_VARLINK_FIELD_COMMENT("Timestamp in µs in the CLOCK_REALTIME clock (wallclock)"),
+                SD_VARLINK_DEFINE_FIELD(realtime, SD_VARLINK_INT, SD_VARLINK_NULLABLE),
+                SD_VARLINK_FIELD_COMMENT("Timestamp in µs in the CLOCK_MONOTONIC clock"),
+                SD_VARLINK_DEFINE_FIELD(monotonic, SD_VARLINK_INT, SD_VARLINK_NULLABLE));
diff --git a/src/shared/varlink-idl-common.h b/src/shared/varlink-idl-common.h
new file mode 100644 (file)
index 0000000..088d19b
--- /dev/null
@@ -0,0 +1,6 @@
+/* SPDX-License-Identifier: LGPL-2.1-or-later */
+#pragma once
+
+#include "sd-varlink-idl.h"
+
+extern const sd_varlink_symbol vl_type_Timestamp;
index 17e0d79ec49a97f5d7d850ebd91877d6c8cdedf6..d9a0b3fbaff0835e674ba09faea6a62f507930ed 100644 (file)
@@ -3,6 +3,7 @@
 #include "sd-varlink-idl.h"
 
 #include "bus-polkit.h"
+#include "varlink-idl-common.h"
 #include "varlink-io.systemd.Machine.h"
 
 static SD_VARLINK_DEFINE_METHOD(
@@ -21,13 +22,6 @@ static SD_VARLINK_DEFINE_METHOD(
                 SD_VARLINK_DEFINE_INPUT(allocateUnit,      SD_VARLINK_BOOL,   SD_VARLINK_NULLABLE),
                 VARLINK_DEFINE_POLKIT_INPUT);
 
-static SD_VARLINK_DEFINE_STRUCT_TYPE(
-                Timestamp,
-                SD_VARLINK_FIELD_COMMENT("Timestamp in µs in the CLOCK_REALTIME clock (wallclock)"),
-                SD_VARLINK_DEFINE_FIELD(realtime, SD_VARLINK_INT, SD_VARLINK_NULLABLE),
-                SD_VARLINK_FIELD_COMMENT("Timestamp in µs in the CLOCK_MONOTONIC clock"),
-                SD_VARLINK_DEFINE_FIELD(monotonic, SD_VARLINK_INT, SD_VARLINK_NULLABLE));
-
 static SD_VARLINK_DEFINE_METHOD(
                 Unregister,
                 SD_VARLINK_FIELD_COMMENT("The name of a machine to unregister."),