From 7f68002e284654b16cb74a90942f6ce220630324 Mon Sep 17 00:00:00 2001 From: "sanghyeok.oh" Date: Tue, 15 Jan 2019 08:35:12 +0900 Subject: [PATCH] dbus: systemd: change api - start/stop systemd unit move systemd related dbus api to libgdbus(libsyscommon) Change-Id: I6ae0c125dc5293fbc38df7ca3a0ba7cde12a8f38 Signed-off-by: sanghyeok.oh --- src/power/boot.c | 4 ++-- src/power/power-handler.c | 8 ++++---- src/shared/CMakeLists.txt | 1 - src/usb-host-test/usb-host-test.c | 8 ++++---- 4 files changed, 10 insertions(+), 11 deletions(-) diff --git a/src/power/boot.c b/src/power/boot.c index 89bc808..413a968 100644 --- a/src/power/boot.c +++ b/src/power/boot.c @@ -21,13 +21,13 @@ #include #include #include +#include #include "core/log.h" #include "core/device-notifier.h" #include "core/common.h" #include "display/poll.h" #include "display/display-ops.h" -#include "shared/deviced-systemd.h" #define SIGNAL_BOOTING_DONE "BootingDone" #define SYSTEMD_DBUS_SIGNAL_SYSTEM_STARTUP_FINISHED "StartupFinished" @@ -43,7 +43,7 @@ int booting_finished(void) size_t len; GVariant *reply = NULL; - reply = deviced_systemd_get_manager_property(SYSTEMD_DBUS_METHOD_SYSTEM_STATE); + reply = systemd_get_manager_property(SYSTEMD_DBUS_METHOD_SYSTEM_STATE); if (!reply) { _E("Failed to get System State: no reply"); goto err; diff --git a/src/power/power-handler.c b/src/power/power-handler.c index 9b82c50..589dd02 100644 --- a/src/power/power-handler.c +++ b/src/power/power-handler.c @@ -37,6 +37,7 @@ #include #include #include +#include #include "dd-deviced.h" #include "core/log.h" @@ -53,7 +54,6 @@ #include "display/display-ops.h" #include "power-handler.h" #include "apps/apps.h" -#include "shared/deviced-systemd.h" #include "boot.h" #define POWEROFF_DURATION 2 @@ -109,7 +109,7 @@ static void poweroff_start_animation(void) { int ret; - ret = deviced_systemd_start_unit("shutdown-animation.service"); + ret = systemd_start_unit_async("shutdown-animation.service", NULL); if (ret < 0) _E("Failed to start shutdown animation"); @@ -154,13 +154,13 @@ static int disable_systemd_journald(void) { int ret; - ret = deviced_systemd_stop_unit("systemd-journald.socket"); + ret = systemd_stop_unit_async("systemd-journald.socket", NULL); if (ret < 0) { _E("failed to stop 'systemd-journald.socket'"); return ret; } - ret |= deviced_systemd_stop_unit("systemd-journald.service"); + ret = systemd_stop_unit_async("systemd-journald.service", NULL); if (ret < 0) { _E("failed to stop 'systemd-journald.service'"); return ret; diff --git a/src/shared/CMakeLists.txt b/src/shared/CMakeLists.txt index 2ad9dc1..67290f9 100644 --- a/src/shared/CMakeLists.txt +++ b/src/shared/CMakeLists.txt @@ -1,7 +1,6 @@ CMAKE_MINIMUM_REQUIRED(VERSION 2.6) SET(SHARED_SRCS - deviced-systemd.c plugin.c ) diff --git a/src/usb-host-test/usb-host-test.c b/src/usb-host-test/usb-host-test.c index e83811b..7ea07c8 100644 --- a/src/usb-host-test/usb-host-test.c +++ b/src/usb-host-test/usb-host-test.c @@ -23,6 +23,7 @@ #include #include #include +#include #include "core/log.h" #include "core/config-parser.h" @@ -30,7 +31,6 @@ #include "core/device-notifier.h" #include "core/devices.h" #include "core/list.h" -#include "shared/deviced-systemd.h" #define FFS_PATH "/run/usb-host-test-ffs" #define GADGET_SCHEME_PATH "/etc/deviced/usb-host-test/test_gadget.gs" @@ -409,7 +409,7 @@ int start() _E("fail to init dbus signal(%d)", ret); sigid_start = ret; - ret = deviced_systemd_start_unit(SYSTEMD_UNIT_NAME); + ret = systemd_start_unit_sync(SYSTEMD_UNIT_NAME, NULL, -1); if (ret < 0) { _E("Error starting daemon"); /*unregister_dbus_signal_handler(SYSTEMD_DBUS_PATH, @@ -455,13 +455,13 @@ static int stop() sigid_stop = ret; - ret = deviced_systemd_stop_unit(SYSTEMD_UNIT_NAME); + ret = systemd_stop_unit_sync(SYSTEMD_UNIT_NAME, NULL, -1); if (ret < 0) { _E("could not stop socket unit"); goto out; } - ret = deviced_systemd_stop_unit(SYSTEMD_SERVICE_NAME); + ret = systemd_stop_unit_sync(SYSTEMD_SERVICE_NAME, NULL, -1); if (ret < 0) { _E("could not stop service unit"); goto out; -- 2.7.4