Rename afb-systemd to systemd 43/20843/1
authorJosé Bollo <jose.bollo@iot.bzh>
Thu, 14 Feb 2019 09:15:40 +0000 (10:15 +0100)
committerJose Bollo <jose.bollo@iot.bzh>
Wed, 27 Mar 2019 09:48:40 +0000 (10:48 +0100)
Files "afb-systemd.[ch]" are renamed "systemd.[ch]"
and their functions "afb_systemd_*" are renamed "systemd_*"

Change-Id: I8362a2ca8b71945b54c6ab9a7ead51d9c50bc8e2
Signed-off-by: José Bollo <jose.bollo@iot.bzh>
src/CMakeLists.txt
src/afb-api-dbus.c
src/afb-export.c
src/afb-fdev.c
src/afb-hsrv.c
src/afb-socket.c
src/afb-ws-json1.c
src/systemd.c [moved from src/afb-systemd.c with 85% similarity]
src/systemd.h [moved from src/afb-systemd.h with 74% similarity]

index 086a2aa..3c9763d 100644 (file)
@@ -56,7 +56,6 @@ SET(AFB_LIB_SOURCES
        afb-session.c
        afb-socket.c
        afb-stub-ws.c
-       afb-systemd.c
        afb-trace.c
        afb-websock.c
        afb-ws-client.c
@@ -74,6 +73,7 @@ SET(AFB_LIB_SOURCES
        process-name.c
        sig-monitor.c
        subpath.c
+       systemd.c
        verbose.c
        watchdog.c
        websock.c
index f413294..8c55ed0 100644 (file)
@@ -33,8 +33,6 @@
 
 #include <afb/afb-event-x2.h>
 
-#include "afb-systemd.h"
-
 #include "afb-session.h"
 #include "afb-msg-json.h"
 #include "afb-api.h"
@@ -44,8 +42,9 @@
 #include "afb-cred.h"
 #include "afb-evt.h"
 #include "afb-xreq.h"
-#include "verbose.h"
 
+#include "verbose.h"
+#include "systemd.h"
 
 static const char DEFAULT_PATH_PREFIX[] = "/org/agl/afb/api/";
 
@@ -130,7 +129,7 @@ static struct api_dbus *make_api_dbus_3(int system, const char *path, size_t pat
        }
 
        /* choose the bus */
-       sdbus = (system ? afb_systemd_get_system_bus : afb_systemd_get_user_bus)();
+       sdbus = (system ? systemd_get_system_bus : systemd_get_user_bus)();
        if (sdbus == NULL)
                goto error2;
 
index 0023f71..b5a4b9e 100644 (file)
@@ -39,7 +39,6 @@
 #include "afb-api-so-v2.h"
 #include "afb-api-v3.h"
 #include "afb-common.h"
-#include "afb-systemd.h"
 #include "afb-cred.h"
 #include "afb-evt.h"
 #include "afb-export.h"
@@ -48,6 +47,8 @@
 #include "afb-session.h"
 #include "afb-xreq.h"
 #include "afb-calls.h"
+
+#include "systemd.h"
 #include "jobs.h"
 #include "verbose.h"
 #include "globset.h"
@@ -450,21 +451,21 @@ static int hooked_event_broadcast_cb(struct afb_api_x3 *closure, const char *nam
 static struct sd_event *hooked_get_event_loop(struct afb_api_x3 *closure)
 {
        struct afb_export *export = from_api_x3(closure);
-       struct sd_event *r = afb_systemd_get_event_loop();
+       struct sd_event *r = systemd_get_event_loop();
        return afb_hook_api_get_event_loop(export, r);
 }
 
 static struct sd_bus *hooked_get_user_bus(struct afb_api_x3 *closure)
 {
        struct afb_export *export = from_api_x3(closure);
-       struct sd_bus *r = afb_systemd_get_user_bus();
+       struct sd_bus *r = systemd_get_user_bus();
        return afb_hook_api_get_user_bus(export, r);
 }
 
 static struct sd_bus *hooked_get_system_bus(struct afb_api_x3 *closure)
 {
        struct afb_export *export = from_api_x3(closure);
-       struct sd_bus *r = afb_systemd_get_system_bus();
+       struct sd_bus *r = systemd_get_system_bus();
        return afb_hook_api_get_system_bus(export, r);
 }
 
@@ -536,9 +537,9 @@ static const struct afb_daemon_itf_x1 daemon_itf = {
        .vverbose_v2 = vverbose_cb,
        .event_make = legacy_event_x1_make_cb,
        .event_broadcast = event_broadcast_cb,
-       .get_event_loop = afb_systemd_get_event_loop,
-       .get_user_bus = afb_systemd_get_user_bus,
-       .get_system_bus = afb_systemd_get_system_bus,
+       .get_event_loop = systemd_get_event_loop,
+       .get_user_bus = systemd_get_user_bus,
+       .get_system_bus = systemd_get_system_bus,
        .rootdir_get_fd = afb_common_rootdir_get_fd,
        .rootdir_open_locale = rootdir_open_locale_cb,
        .queue_job = queue_job_cb,
@@ -1051,9 +1052,9 @@ static const struct afb_api_x3_itf api_x3_itf = {
 
        .vverbose = (void*)vverbose_cb,
 
-       .get_event_loop = afb_systemd_get_event_loop,
-       .get_user_bus = afb_systemd_get_user_bus,
-       .get_system_bus = afb_systemd_get_system_bus,
+       .get_event_loop = systemd_get_event_loop,
+       .get_user_bus = systemd_get_user_bus,
+       .get_system_bus = systemd_get_system_bus,
        .rootdir_get_fd = afb_common_rootdir_get_fd,
        .rootdir_open_locale = rootdir_open_locale_cb,
        .queue_job = queue_job_cb,
index 4243637..fa1a402 100644 (file)
 
 #include "fdev.h"
 
-#include "afb-systemd.h"
+#include "systemd.h"
 #include "fdev-systemd.h"
 
 struct fdev *afb_fdev_create(int fd)
 {
-       return fdev_systemd_create(afb_systemd_get_event_loop(), fd);
+       return fdev_systemd_create(systemd_get_event_loop(), fd);
 }
index ba1dac1..ed0adee 100644 (file)
 #include "afb-hsrv.h"
 #include "afb-fdev.h"
 #include "afb-socket.h"
+
 #include "fdev.h"
 #include "verbose.h"
 #include "locale-root.h"
-
-#include "afb-systemd.h"
+#include "systemd.h"
 #include "jobs.h"
 
 #define JSON_CONTENT  "application/json"
index 9f2be98..cf788de 100644 (file)
@@ -31,7 +31,8 @@
 
 #include "afb-fdev.h"
 #include "afb-socket.h"
-#include "afb-systemd.h"
+
+#include "systemd.h"
 #include "fdev.h"
 #include "verbose.h"
 
@@ -228,7 +229,7 @@ static int open_systemd(const char *spec)
        errno = EAFNOSUPPORT;
        return -1;
 #else
-       return afb_systemd_fds_for(spec);
+       return systemd_fds_for(spec);
 #endif
 }
 
index 3bd1472..197d0c8 100644 (file)
@@ -27,7 +27,6 @@
 
 #include "afb-wsj1.h"
 #include "afb-ws-json1.h"
-#include "afb-systemd.h"
 #include "afb-msg-json.h"
 #include "afb-session.h"
 #include "afb-cred.h"
@@ -35,6 +34,8 @@
 #include "afb-xreq.h"
 #include "afb-context.h"
 #include "afb-evt.h"
+
+#include "systemd.h"
 #include "verbose.h"
 #include "fdev.h"
 
similarity index 85%
rename from src/afb-systemd.c
rename to src/systemd.c
index 3fcf761..1adb75a 100644 (file)
@@ -24,7 +24,7 @@
 #include <systemd/sd-bus.h>
 #include <systemd/sd-daemon.h>
 
-#include "afb-systemd.h"
+#include "systemd.h"
 #include "jobs.h"
 
 static struct sd_bus *sdbusopen(struct sd_bus **p, int (*f)(struct sd_bus **))
@@ -35,7 +35,7 @@ static struct sd_bus *sdbusopen(struct sd_bus **p, int (*f)(struct sd_bus **))
                        errno = -rc;
                        *p = NULL;
                } else {
-                       rc = sd_bus_attach_event(*p, afb_systemd_get_event_loop(), 0);
+                       rc = sd_bus_attach_event(*p, systemd_get_event_loop(), 0);
                        if (rc < 0) {
                                sd_bus_unref(*p);
                                errno = -rc;
@@ -46,18 +46,18 @@ static struct sd_bus *sdbusopen(struct sd_bus **p, int (*f)(struct sd_bus **))
        return *p;
 }
 
-struct sd_event *afb_systemd_get_event_loop()
+struct sd_event *systemd_get_event_loop()
 {
        return jobs_get_sd_event();
 }
 
-struct sd_bus *afb_systemd_get_user_bus()
+struct sd_bus *systemd_get_user_bus()
 {
        static struct sd_bus *result = NULL;
        return sdbusopen((void*)&result, (void*)sd_bus_open_user);
 }
 
-struct sd_bus *afb_systemd_get_system_bus()
+struct sd_bus *systemd_get_system_bus()
 {
        static struct sd_bus *result = NULL;
        return sdbusopen((void*)&result, (void*)sd_bus_open_system);
@@ -80,14 +80,14 @@ static char **fds_names()
        return names;
 }
 
-int afb_systemd_fds_init()
+int systemd_fds_init()
 {
        errno = 0;
        fds_names();
        return -!!errno;
 }
 
-int afb_systemd_fds_for(const char *name)
+int systemd_fds_for(const char *name)
 {
        int idx;
        char **names;
similarity index 74%
rename from src/afb-systemd.h
rename to src/systemd.h
index c7b5696..d9efa35 100644 (file)
 struct sd_event;
 struct sd_bus;
 
-extern struct sd_event *afb_systemd_get_event_loop();
-extern struct sd_bus *afb_systemd_get_user_bus();
-extern struct sd_bus *afb_systemd_get_system_bus();
+extern struct sd_event *systemd_get_event_loop();
+extern struct sd_bus *systemd_get_user_bus();
+extern struct sd_bus *systemd_get_system_bus();
 
-extern int afb_systemd_fds_init();
-extern int afb_systemd_fds_for(const char *name);
+extern int systemd_fds_init();
+extern int systemd_fds_for(const char *name);