]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
bus: introduce bus-locator.[ch]
authorVito Caputo <vcaputo@pengaru.com>
Thu, 7 May 2020 08:16:59 +0000 (01:16 -0700)
committerVito Caputo <vcaputo@pengaru.com>
Thu, 7 May 2020 15:46:40 +0000 (08:46 -0700)
Move BusLocator into its own header, introduce collection of
locators for use throughout the code.

src/shared/bus-locator.c [new file with mode: 0644]
src/shared/bus-locator.h [new file with mode: 0644]
src/shared/bus-util.h
src/shared/meson.build

diff --git a/src/shared/bus-locator.c b/src/shared/bus-locator.c
new file mode 100644 (file)
index 0000000..a79699d
--- /dev/null
@@ -0,0 +1,63 @@
+/* SPDX-License-Identifier: LGPL-2.1+ */
+
+#include "bus-locator.h"
+
+const BusLocator* const bus_home_mgr = &(BusLocator){
+        .destination = "org.freedesktop.home1",
+        .path = "/org/freedesktop/home1",
+        .interface = "org.freedesktop.home1.Manager",
+};
+
+const BusLocator* const bus_import_mgr = &(BusLocator){
+        .destination ="org.freedesktop.import1",
+        .path = "/org/freedesktop/import1",
+        .interface = "org.freedesktop.import1.Manager"
+};
+
+const BusLocator* const bus_locale = &(BusLocator){
+        .destination = "org.freedesktop.locale1",
+        .path = "/org/freedesktop/locale1",
+        .interface = "org.freedesktop.locale1"
+};
+
+const BusLocator* const bus_login_mgr = &(BusLocator){
+        .destination = "org.freedesktop.login1",
+        .path = "/org/freedesktop/login1",
+        .interface = "org.freedesktop.login1.Manager"
+};
+
+const BusLocator* const bus_machine_mgr = &(BusLocator){
+        .destination ="org.freedesktop.machine1",
+        .path = "/org/freedesktop/machine1",
+        .interface = "org.freedesktop.machine1.Manager"
+};
+
+const BusLocator* const bus_network_mgr = &(BusLocator){
+        .destination = "org.freedesktop.network1",
+        .path = "/org/freedesktop/network1",
+        .interface = "org.freedesktop.network1.Manager"
+};
+
+const BusLocator* const bus_portable_mgr = &(BusLocator){
+        .destination = "org.freedesktop.portable1",
+        .path = "/org/freedesktop/portable1",
+        .interface = "org.freedesktop.portable1.Manager"
+};
+
+const BusLocator* const bus_resolve_mgr = &(BusLocator){
+        .destination = "org.freedesktop.resolve1",
+        .path = "/org/freedesktop/resolve1",
+        .interface = "org.freedesktop.resolve1.Manager"
+};
+
+const BusLocator* const bus_systemd_mgr = &(BusLocator){
+        .destination = "org.freedesktop.systemd1",
+        .path = "/org/freedesktop/systemd1",
+        .interface = "org.freedesktop.systemd1.Manager"
+};
+
+const BusLocator* const bus_timedate = &(BusLocator){
+        .destination = "org.freedesktop.timedate1",
+        .path = "/org/freedesktop/timedate1",
+        .interface = "org.freedesktop.timedate1"
+};
diff --git a/src/shared/bus-locator.h b/src/shared/bus-locator.h
new file mode 100644 (file)
index 0000000..91a9aaf
--- /dev/null
@@ -0,0 +1,19 @@
+/* SPDX-License-Identifier: LGPL-2.1+ */
+#pragma once
+
+typedef struct BusLocator {
+        const char    *destination;
+        const char    *path;
+        const char    *interface;
+} BusLocator;
+
+extern const BusLocator* const bus_home_mgr;
+extern const BusLocator* const bus_import_mgr;
+extern const BusLocator* const bus_locale;
+extern const BusLocator* const bus_login_mgr;
+extern const BusLocator* const bus_machine_mgr;
+extern const BusLocator* const bus_network_mgr;
+extern const BusLocator* const bus_portable_mgr;
+extern const BusLocator* const bus_resolve_mgr;
+extern const BusLocator* const bus_systemd_mgr;
+extern const BusLocator* const bus_timedate;
index 7678680daec674332bd7344a06cdd5b5bdb161f0..ef14217e9374278ca9a74b026b5766af1c8d688e 100644 (file)
@@ -9,6 +9,7 @@
 #include "sd-bus.h"
 #include "sd-event.h"
 
+#include "bus-locator.h"
 #include "macro.h"
 #include "set.h"
 #include "string-util.h"
@@ -22,12 +23,6 @@ typedef enum BusTransport {
         _BUS_TRANSPORT_INVALID = -1
 } BusTransport;
 
-typedef struct BusLocator {
-        const char *destination;
-        const char *path;
-        const char *interface;
-} BusLocator;
-
 typedef struct BusObjectImplementation BusObjectImplementation;
 
 typedef struct BusObjectVtablePair {
index 60d6adb068d19d091c355d255b7c9ebc6f549928..301a8334a4dfb4daecaa5aac031f402473eb80fe 100644 (file)
@@ -25,6 +25,8 @@ shared_sources = files('''
         bpf-program.h
         bridge-util.c
         bridge-util.h
+        bus-locator.c
+        bus-locator.h
         bus-log-control-api.c
         bus-log-control-api.h
         bus-polkit.c