Rearrange header and source files 28/254728/1
authorHyotaek Shim <hyotaek.shim@samsung.com>
Tue, 9 Mar 2021 04:24:11 +0000 (13:24 +0900)
committerHyotaek Shim <hyotaek.shim@samsung.com>
Tue, 9 Mar 2021 04:24:11 +0000 (13:24 +0900)
Change-Id: I7cb9725a5be1ac4ead7cac73d50203f413f669cf
Signed-off-by: Hyotaek Shim <hyotaek.shim@samsung.com>
CMakeLists.txt
src/libgdbus/dbus-iface-system.h [moved from src/libgdbus/dbus-system-iface.h with 100% similarity]
src/libgdbus/libgdbus.c [moved from src/libgdbus/dbus-system.c with 99% similarity]
src/libgdbus/libgdbus.h [moved from src/libgdbus/dbus-system.h with 99% similarity]
src/libsystemd/libsystemd.c [moved from src/libgdbus/dbus-systemd.c with 93% similarity]
src/libsystemd/libsystemd.h [moved from src/libgdbus/dbus-systemd.h with 95% similarity]
src/libsystemd/systemd-state.c [deleted file]
src/libsystemd/systemd-state.h [deleted file]

index d314ee5..e16516d 100644 (file)
@@ -12,16 +12,14 @@ SET(INCLUDEDIR "${PREFIX}/include")
 SET(VERSION 4.1)
 
 SET(libsyscommon_SRCS
-       src/libgdbus/dbus-system.c
-       src/libgdbus/dbus-systemd.c
-       src/libsystemd/systemd-state.c
+       src/libgdbus/libgdbus.c
+       src/libsystemd/libsystemd.c
        src/libcommon/ini-parser.c
 )
 SET(HEADERS
-       src/libgdbus/dbus-system.h
-       src/libgdbus/dbus-system-iface.h
-       src/libgdbus/dbus-systemd.h
-       src/libsystemd/systemd-state.h
+       src/libgdbus/libgdbus.h
+       src/libgdbus/dbus-iface-system.h
+       src/libsystemd/libsystemd.h
        src/libcommon/list.h
        src/libcommon/ini-parser.h
        src/libcommon/file.h
similarity index 99%
rename from src/libgdbus/dbus-system.c
rename to src/libgdbus/libgdbus.c
index 45b0874..499a449 100644 (file)
@@ -24,7 +24,7 @@
 #include <string.h>
 
 #include "shared/log.h"
-#include "dbus-system.h"
+#include "libgdbus.h"
 
 /* 10 seconds */
 #define DBUS_REPLY_TIMEOUT     (10000)
similarity index 99%
rename from src/libgdbus/dbus-system.h
rename to src/libgdbus/libgdbus.h
index c707d19..99fdc3e 100644 (file)
@@ -26,7 +26,7 @@
 #include <stdarg.h>
 #include <assert.h>
 
-#include "dbus-system-iface.h"
+#include "dbus-iface-system.h"
 
 typedef struct {
        const unsigned char *data;
similarity index 93%
rename from src/libgdbus/dbus-systemd.c
rename to src/libsystemd/libsystemd.c
index 14c8a72..a463118 100644 (file)
@@ -21,7 +21,7 @@
 #include <string.h>
 #include <stdint.h>
 #include <stdbool.h>
-#include <libgdbus/dbus-system.h>
+#include <libgdbus/libgdbus.h>
 
 #include "shared/log.h"
 
@@ -483,3 +483,41 @@ GVariant *systemd_get_service_property(const char *unit, const char *property)
        free(escaped);
        return val;
 }
+
+#define SYSTEMD_DBUS_METHOD_SYSTEM_STATE    "SystemState"
+#define SYSTEMD_STATE_RUNNING               "running"
+#define SYSTEMD_STATE_DEGRADED              "degraded"
+
+int check_system_boot_finished(void)
+{
+       char *state = NULL;
+       int ret = 0;
+       size_t len;
+       GVariant *reply = NULL;
+
+       reply = systemd_get_manager_property(SYSTEMD_DBUS_METHOD_SYSTEM_STATE);
+       if (!reply) {
+               _E("Failed to get system state: No reply");
+               goto err;
+       }
+       if (!g_variant_get_safe(reply, "s", &state)) {
+               _E("Failed to get system state(%s)", g_variant_get_type_string(reply));
+               goto err;
+       }
+
+       _I("System state=%s", state);
+
+       len = strlen(state) + 1;
+       if (!strncmp(state, SYSTEMD_STATE_RUNNING, len) ||
+                       !strncmp(state, SYSTEMD_STATE_DEGRADED, len))
+               ret = 1;
+       else
+               ret = 0;
+
+err:
+       if (reply)
+               g_variant_unref(reply);
+       free(state);
+
+       return ret;
+}
similarity index 95%
rename from src/libgdbus/dbus-systemd.h
rename to src/libsystemd/libsystemd.h
index 4d15200..79c9f9b 100644 (file)
@@ -20,7 +20,7 @@
 #ifndef __DBUS_SYSTEMD_H__
 #define __DBUS_SYSTEMD_H__
 
-#include "dbus-system.h"
+#include <libgdbus/libgdbus.h>
 
 #ifdef __cplusplus
 extern "C" {
@@ -49,6 +49,7 @@ GVariant *systemd_get_unit_property   (const char *unit,
 GVariant *systemd_get_service_property (const char *unit,
                                        const char *property);
 
+int check_system_boot_finished(void);
 
 #ifdef __cplusplus
 }
diff --git a/src/libsystemd/systemd-state.c b/src/libsystemd/systemd-state.c
deleted file mode 100644 (file)
index 1c25575..0000000
+++ /dev/null
@@ -1,61 +0,0 @@
-/*
- * libsyscommon
- *
- * Copyright (c) 2019 Samsung Electronics Co., Ltd.
- *
- * Licensed under the Apache License, Version 2.0 (the License);
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-#include <stdio.h>
-#include <string.h>
-#include <libgdbus/dbus-systemd.h>
-
-#include "shared/log.h"
-
-#define SYSTEMD_DBUS_METHOD_SYSTEM_STATE       "SystemState"
-#define SYSTEMD_STATE_RUNNING                          "running"
-#define SYSTEMD_STATE_DEGRADED                         "degraded"
-
-int check_system_boot_finished(void)
-{
-       char *state = NULL;
-       int ret = 0;
-       size_t len;
-       GVariant *reply = NULL;
-
-       reply = systemd_get_manager_property(SYSTEMD_DBUS_METHOD_SYSTEM_STATE);
-       if (!reply) {
-               _E("Failed to get system state: No reply");
-               goto err;
-       }
-       if (!g_variant_get_safe(reply, "s", &state)) {
-               _E("Failed to get system state(%s)", g_variant_get_type_string(reply));
-               goto err;
-       }
-
-       _I("System state=%s", state);
-
-       len = strlen(state) + 1;
-       if (!strncmp(state, SYSTEMD_STATE_RUNNING, len) ||
-               !strncmp(state, SYSTEMD_STATE_DEGRADED, len))
-               ret = 1;
-       else
-       ret = 0;
-
-err:
-       if (reply)
-               g_variant_unref(reply);
-       free(state);
-
-       return ret;
-}
diff --git a/src/libsystemd/systemd-state.h b/src/libsystemd/systemd-state.h
deleted file mode 100644 (file)
index 54b4217..0000000
+++ /dev/null
@@ -1,35 +0,0 @@
-/*
- * libsyscommon
- *
- * Copyright (c) 2019 Samsung Electronics Co., Ltd.
- *
- * Licensed under the Apache License, Version 2.0 (the License);
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-
-#ifndef __SYSTEMD_STATE_H__
-#define __SYSTEMD_STATE_H__
-
-#include "dbus-systemd.h"
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-int check_system_boot_finished(void);
-
-#ifdef __cplusplus
-}
-#endif /* __cplusplus */
-
-#endif __SYSTEMD_STATE_H__