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
#include <string.h>
#include "shared/log.h"
-#include "dbus-system.h"
+#include "libgdbus.h"
/* 10 seconds */
#define DBUS_REPLY_TIMEOUT (10000)
#include <stdarg.h>
#include <assert.h>
-#include "dbus-system-iface.h"
+#include "dbus-iface-system.h"
typedef struct {
const unsigned char *data;
#include <string.h>
#include <stdint.h>
#include <stdbool.h>
-#include <libgdbus/dbus-system.h>
+#include <libgdbus/libgdbus.h>
#include "shared/log.h"
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;
+}
#ifndef __DBUS_SYSTEMD_H__
#define __DBUS_SYSTEMD_H__
-#include "dbus-system.h"
+#include <libgdbus/libgdbus.h>
#ifdef __cplusplus
extern "C" {
GVariant *systemd_get_service_property (const char *unit,
const char *property);
+int check_system_boot_finished(void);
#ifdef __cplusplus
}
+++ /dev/null
-/*
- * 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;
-}
+++ /dev/null
-/*
- * 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__