SET(SRCS
src/core/main.c
src/core/modules.c
+ src/shared/common.c
)
INCLUDE_DIRECTORIES(${CMAKE_CURRENT_SOURCE_DIR}/src)
#define BLOCK_CONF_FILE "/etc/storaged/block.conf"
-#define EXTERNAL_STORAGE_PATH "/run/external-storage"
-#define EXTENDED_INTERNAL_PATH "/run/extended-internal-sd"
+#define EXTERNAL_STORAGE_PATH "/run/storaged/external-storage"
+#define EXTENDED_INTERNAL_PATH "/run/storaged/extended-internal-sd"
#define PATH_LEN 55
#define EXTENDEDSD_MOUNT_PATH "/opt/extendedsd"
#include <systemd/sd-daemon.h>
#include <glib.h>
#include <libgdbus/dbus-system.h>
+#include <sys/types.h>
+#include <sys/stat.h>
#include "log.h"
#include "modules.h"
+#include "storaged_common.h"
#define WATCHDOG_TIMEOUT 15 /* Seconds */
+#define STORAGED_DIR_PATH "/run/storaged"
static GMainLoop *loop;
sd_notify(0, "READY=1");
}
+static void dir_init(void)
+{
+ int ret;
+
+ ret = remove_directory(STORAGED_DIR_PATH);
+ if (ret < 0)
+ _E("Failed to remove directory");
+ ret = mkdir(STORAGED_DIR_PATH, 0644);
+ if (ret < 0)
+ _E("Failed to make directory: %d", errno);
+
+}
+
int main(int argc, char **argv)
{
int ret;
if (!handle)
_E("Fail to get dbus connection");;
+ dir_init();
modules_init(NULL);
ret = dbus_handle_request_bus_name(handle, STORAGED_BUS_NAME, dbus_name_acquired, NULL);
#define STORAGE_CONF_FILE "/etc/storaged/storage.conf"
-#define STORAGED_DIR_PATH "/run/storaged"
#define NEED_CLEANUP_DIR_PATH "/run/storaged/needcleanup"
#define NEED_CLEANUP_FILE_PATH "/run/storaged/needcleanup/trigger"
if (ret < 0)
_E("Failed to register dbus interface and methods(%d)", ret);
- ret = remove_directory(STORAGED_DIR_PATH);
- if (ret < 0)
- _E("Failed to remove directory");
- ret = mkdir(STORAGED_DIR_PATH, 0644);
- if (ret < 0)
- _E("Failed to make directory: %d", errno);
-
ret = remove_directory(NEED_CLEANUP_DIR_PATH);
if (ret < 0)
_E("Failed to remove directory");