Modify external-storage and extended-internal-sd directory paths 03/199903/2
authorpr.jung <pr.jung@samsung.com>
Fri, 15 Feb 2019 08:57:38 +0000 (17:57 +0900)
committerpr.jung <pr.jung@samsung.com>
Mon, 18 Feb 2019 04:47:22 +0000 (13:47 +0900)
Change-Id: Ibb92488d33812d8d0ff3fecd9c0e4016a44aa064
Signed-off-by: pr.jung <pr.jung@samsung.com>
CMakeLists.txt
src/block/block.c
src/core/main.c
src/storage/storage.c

index b83887c..8410163 100644 (file)
@@ -7,6 +7,7 @@ SET(STORAGED_APPS ${CMAKE_SOURCE_DIR}/apps)
 SET(SRCS
        src/core/main.c
        src/core/modules.c
+       src/shared/common.c
 )
 
 INCLUDE_DIRECTORIES(${CMAKE_CURRENT_SOURCE_DIR}/src)
index 0102eea..87ffc88 100644 (file)
@@ -94,8 +94,8 @@
 
 #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"
index 3a202d1..2cacc53 100644 (file)
 #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;
 
@@ -64,6 +68,19 @@ static void dbus_name_acquired(GDBusConnection *connection, const gchar *name, g
        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;
@@ -80,6 +97,7 @@ int main(int argc, char **argv)
        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);
index d4bbcac..4fde666 100644 (file)
@@ -56,7 +56,6 @@
 
 #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"
 
@@ -728,13 +727,6 @@ static void storage_init(void *data)
        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");