unified-system-plugin: Revert changes for supporting unified-system-service package 71/325471/4
authorSangYoun Kwak <sy.kwak@samsung.com>
Tue, 10 Jun 2025 11:57:54 +0000 (20:57 +0900)
committerSangYoun Kwak <sy.kwak@samsung.com>
Tue, 10 Jun 2025 12:20:06 +0000 (21:20 +0900)
Since the 'run multiple services in one process' feature will be
implemented with united-service, previous implementations should be
removed.

This reverts commits below(old to new):
 * c4236143e4b338d711fe3c57c1fdb8b5d92dc646
 * edf84604d085871db10c1ee57b87fb16a5888af4
 * b5c0b7f06e15ba50ad825bc054ed3db7347d9114
 * dab783680bfd8e060d9f67a54a0f71e237861dac

Change-Id: I0068cdaff7dfeb26187352f7b7e331fd0930482e
Signed-off-by: SangYoun Kwak <sy.kwak@samsung.com>
CMakeLists.txt
conf/org.tizen.system.storage-unified-system-service.conf [deleted file]
packaging/storaged.spec
src/core/main.c
src/shared/common.c

index 470231b2bba32dffdf4bb1eda2150ab84cffa3e2..6577dd966a3f0ea3fe7d51ed5ff96d575e740810 100644 (file)
@@ -3,7 +3,6 @@ PROJECT(storaged C)
 
 SET(CMAKE_VERBOSE_MAKEFILE OFF)
 SET(STORAGED_APPS ${CMAKE_SOURCE_DIR}/apps)
-SET(LIBRARY_NAME "unified-system-service-storaged")
 
 SET(SRCS
        src/core/main.c
@@ -42,33 +41,23 @@ FOREACH(flag ${${PROJECT_NAME}_pkgs_CFLAGS})
 ENDFOREACH(flag)
 
 SET(EXTRA_CFLAGS "${EXTRA_CFLAGS} -fvisibility=hidden -Werror -rdynamic -Wno-deprecated-declarations")
-SET(EXTRA_CFLAGS "${EXTRA_CFLAGS} -g -fno-omit-frame-pointer -finstrument-functions -DUNIFIED_SYSTEM_SERVICE_ENABLED=${ENABLE_UNIFIED_SYSTEM_SERVICE}")
+SET(EXTRA_CFLAGS "${EXTRA_CFLAGS} -g -fno-omit-frame-pointer -finstrument-functions")
 SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${EXTRA_CFLAGS} -lrt -fPIE")
 SET(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -pie")
 # To apply Armoring(Full RELRO), which means GOT Table becomes read-only.
 SET(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -Wl,-z,relro,-z,now")
 
-if(${ENABLE_UNIFIED_SYSTEM_SERVICE})
-ADD_LIBRARY(${LIBRARY_NAME} SHARED ${SRCS})
-TARGET_LINK_LIBRARIES(${LIBRARY_NAME} ${${PROJECT_NAME}_pkgs_LDFLAGS} "-ldl" "-lm")
-INSTALL(TARGETS ${LIBRARY_NAME} DESTINATION ${LIB_INSTALL_DIR}/system/plugin/ COMPONENT RuntimeLibraries)
-else()
 ADD_EXECUTABLE(${PROJECT_NAME} ${SRCS})
 TARGET_LINK_LIBRARIES(${PROJECT_NAME} ${${PROJECT_NAME}_pkgs_LDFLAGS} "-ldl" "-lm")
 INSTALL(TARGETS ${PROJECT_NAME} DESTINATION bin)
-endif()
 
-if (${ENABLE_UNIFIED_SYSTEM_SERVICE})
-INSTALL(FILES ${CMAKE_SOURCE_DIR}/conf/org.tizen.system.storage-unified-system-service.conf DESTINATION /etc/dbus-1/system.d)
-else()
 INSTALL(FILES ${CMAKE_SOURCE_DIR}/conf/org.tizen.system.storage.conf DESTINATION /etc/dbus-1/system.d)
+INSTALL(FILES ${CMAKE_SOURCE_DIR}/conf/block.conf DESTINATION /etc/storaged)
+INSTALL(FILES ${CMAKE_SOURCE_DIR}/conf/storage.conf DESTINATION /etc/storaged)
 INSTALL(FILES ${CMAKE_SOURCE_DIR}/systemd/org.tizen.system.storage.service DESTINATION /usr/share/dbus-1/system-services)
 INSTALL(DIRECTORY ${CMAKE_SOURCE_DIR}/systemd/ DESTINATION lib/systemd/system
        FILES_MATCHING
        PATTERN "storaged.service")
-endif()
-INSTALL(FILES ${CMAKE_SOURCE_DIR}/conf/block.conf DESTINATION /etc/storaged)
-INSTALL(FILES ${CMAKE_SOURCE_DIR}/conf/storage.conf DESTINATION /etc/storaged)
 
 IF(BLOCK_MODULE STREQUAL on)
        ADD_SUBDIRECTORY(src/block)
diff --git a/conf/org.tizen.system.storage-unified-system-service.conf b/conf/org.tizen.system.storage-unified-system-service.conf
deleted file mode 100644 (file)
index b95c178..0000000
+++ /dev/null
@@ -1,64 +0,0 @@
-<!DOCTYPE busconfig PUBLIC "-//freedesktop//DTD D-BUS Bus Configuration 1.0//EN"
- "http://www.freedesktop.org/standards/dbus/1.0/busconfig.dtd">
-
-<busconfig>
-    <policy user="root">
-        <allow own="org.tizen.system.storage"/>
-        <allow send_destination="org.tizen.system.storage"/>
-    </policy>
-
-    <policy user="security_fw">
-        <allow send_destination="org.tizen.system.storage"
-                send_path="/Org/Tizen/System/Storage/Block/Manager"
-                send_member="GetControl"/>
-        <allow send_destination="org.tizen.system.storage"
-                send_path="/Org/Tizen/System/Storage/Block/Manager"
-                send_member="Control"/>
-    </policy>
-
-    <policy context="default">
-        <deny own="org.tizen.system.storage"/>
-
-        <!-- /Org/Tizen/System/Storage/Storage -->
-        <allow send_destination="org.tizen.system.storage"
-                send_path="/Org/Tizen/System/Storage/Storage"
-                send_member="GetStatus"/>
-        <allow send_destination="org.tizen.system.storage"
-                send_path="/Org/Tizen/System/Storage/Storage"
-                send_member="getstorage"/>
-        <allow send_destination="org.tizen.system.storage"
-                send_path="/Org/Tizen/System/Storage/Storage"
-                send_member="GetStatvfs"/>
-        <allow send_destination="org.tizen.system.storage"
-                send_path="/Org/Tizen/System/Storage/Storage"
-                send_member="GetStorageLevel"/>
-
-        <!-- /Org/Tizen/System/Storage/Block/Manager -->
-        <check send_destination="org.tizen.system.storage"
-                send_path="/Org/Tizen/System/Storage/Block/Manager"
-                privilege="http://tizen.org/privilege/externalstorage"/>
-
-        <deny send_destination="org.tizen.system.storage"
-                send_path="/Org/Tizen/System/Storage/Block/Manager"
-                send_member="GetControl"/>
-        <deny send_destination="org.tizen.system.storage"
-                send_path="/Org/Tizen/System/Storage/Block/Manager"
-                send_member="Control"/>
-
-        <allow send_destination="org.tizen.system.storage"
-                send_path="/Org/Tizen/System/Storage/Block/Manager"
-                send_member="ShowDeviceList"/>
-        <allow send_destination="org.tizen.system.storage"
-                send_path="/Org/Tizen/System/Storage/Block/Manager"
-                send_member="GetDeviceList"/>
-        <allow send_destination="org.tizen.system.storage"
-                send_path="/Org/Tizen/System/Storage/Block/Manager"
-                send_member="GetDeviceList2"/>
-        <allow send_destination="org.tizen.system.storage"
-                send_path="/Org/Tizen/System/Storage/Block/Manager"
-                send_member="GetDeviceInfo"/>
-        <allow send_destination="org.tizen.system.storage"
-                send_path="/Org/Tizen/System/Storage/Block/Manager"
-                send_member="GetMmcPrimary"/>
-    </policy>
-</busconfig>
index a5a59149deffd663efe048017e9ae67b010eb5bc..d0d0e5a4eabcdcae558348180277c45c5a57df0e 100644 (file)
@@ -1,7 +1,6 @@
 #These options are DEACTIVATED by default.
 %bcond_with emulator
 %define extended_storage 0
-%define enable_unified_system_service 0
 
 Name:       storaged
 Summary:    Storaged
@@ -41,7 +40,6 @@ BuildRequires:  pkgconfig(efl-extension)
 %if %{extended_storage}
 BuildRequires:  pkgconfig(ode)
 %endif
-BuildRequires:  pkgconfig(hal-api-common)
 
 #For /usr/bin/msgfmt
 BuildRequires: gettext-tools
@@ -112,7 +110,6 @@ This package can be installed optional for auto dbus test.
        -DBLOCK_TMPFS=on \
        -DSTORAGE_MODULE=on \
        -DEXTENDED_STORAGE=%{extended_storage} \
-       -DENABLE_UNIFIED_SYSTEM_SERVICE=%{enable_unified_system_service} \
        -DCRITICAL_LOG_MODULE=on \
        #eol
 
@@ -125,9 +122,7 @@ make %{?jobs:-j%jobs}
 rm -rf %{buildroot}
 %make_install
 
-%if %{enable_unified_system_service} != 1
 %install_service delayed.target.wants storaged.service
-%endif
 
 %if "%{asan}" == "1"
 mkdir -p %{buildroot}%{_unitdir}/storaged.service.d
@@ -137,11 +132,6 @@ install -m 644 systemd/storaged.asan.conf %{buildroot}%{_unitdir}/storaged.servi
 %find_lang extended-sd
 
 %post
-%if %{enable_unified_system_service}
-mv %{_sysconfdir}/dbus-1/system.d/org.tizen.system.storage-unified-system-service.conf \
-       %{_sysconfdir}/dbus-1/system.d/org.tizen.system.storage.conf
-%endif
-
 systemctl daemon-reload
 if [ "$1" == "1" ]; then
     systemctl restart storaged.service
@@ -153,16 +143,11 @@ systemctl daemon-reload
 %files
 %manifest %{name}.manifest
 %license LICENSE.Apache-2.0
-%if %{enable_unified_system_service}
-%config %{_sysconfdir}/dbus-1/system.d/org.tizen.system.storage-unified-system-service.conf
-%{_libdir}/system/plugin/libunified-system-service-storaged.so
-%else
 %config %{_sysconfdir}/dbus-1/system.d/org.tizen.system.storage.conf
 %{_datadir}/dbus-1/system-services/org.tizen.system.storage.service
 %{_unitdir}/delayed.target.wants/storaged.service
 %{_unitdir}/storaged.service
 %{_bindir}/storaged
-%endif
 %if "%{asan}" == "1"
 %{_unitdir}/storaged.service.d/storaged.asan.conf
 %endif
index b0baa98293cecbede187f2548c5ca85d4169d69b..ad5e94871a892228f98caeddc9ddc789aea7b6c4 100644 (file)
@@ -27,8 +27,6 @@
 #include <sys/types.h>
 #include <sys/stat.h>
 
-#include <unified-system-service-common.h>
-
 #include "log.h"
 #include "modules.h"
 #include "storaged_common.h"
@@ -83,7 +81,7 @@ static void dir_init(void)
 
 }
 
-static int storaged_init(void *data)
+int main(int argc, char **argv)
 {
        guint timer;
        int ret;
@@ -92,6 +90,12 @@ static int storaged_init(void *data)
        if (!g_handle)
                _E("Failed to get dbus connection.");
 
+       loop = g_main_loop_new(NULL, TRUE);
+       if (!loop) {
+               _E("Failed to make main loop.");
+               return -ENOMEM;
+       }
+
        dir_init();
        modules_init((void *)&g_handle);
 
@@ -111,12 +115,8 @@ static int storaged_init(void *data)
                        _E("Failed to aw_register.");
        }
 
-       return 0;
-}
+       g_main_loop_run(loop);
 
-static int storaged_exit(void *data)
-{
-       int ret = 0;
        modules_deinit(NULL);
 
        if (!g_handle)
@@ -133,29 +133,3 @@ static int storaged_exit(void *data)
 
        return 0;
 }
-
-int main(int argc, char **argv)
-{
-       loop = g_main_loop_new(NULL, TRUE);
-       if (!loop) {
-               _E("Failed to make main loop.");
-               return -ENOMEM;
-       }
-
-       storaged_init(NULL);
-
-       g_main_loop_run(loop);
-
-       storaged_exit(NULL);
-
-       return 0;
-}
-
-__attribute__ ((visibility("default")))
-unified_system_service unified_system_service_storaged_data = {
-       .name           = "unified-system-service-storaged",
-       .early_init     = NULL,
-       .init           = storaged_init,
-       .exit           = storaged_exit,
-       .late_exit      = NULL,
-};
index 61614182d77293bc9d76f4ab554ed366fbf70079..225cd021c86c320fb00cdc1c602696dc3d5e70b4 100644 (file)
@@ -21,7 +21,6 @@
 #include <stdlib.h>
 #include <stdbool.h>
 #include <unistd.h>
-#include <spawn.h>
 #include <sys/types.h>
 #include <sys/wait.h>
 #include <sys/stat.h>
@@ -46,8 +45,6 @@
 #define MODEL_NAME      "http://tizen.org/system/model_name"
 #define MODEL_EMULATOR  "Emulator"
 
-static int g_unified_system_service_on = UNIFIED_SYSTEM_SERVICE_ENABLED;
-
 static const char *rm_arg[] = {
        "/usr/bin/rm",
        "-rf", NULL, NULL,
@@ -110,7 +107,7 @@ static void child(int argc, const char *argv[])
                exit(EXIT_FAILURE);
 }
 
-int run_fork(int argc, const char *argv[])
+int run_child(int argc, const char *argv[])
 {
        pid_t pid;
        struct sigaction act, oldact;
@@ -151,57 +148,6 @@ int run_fork(int argc, const char *argv[])
        return r;
 }
 
-int run_posix_spawn(int argc, const char *argv[])
-{
-       pid_t pid;
-       int status;
-       int r = 0;
-       FILE *fp;
-       posix_spawnattr_t attr;
-       sigset_t sigmask;
-       sigset_t sigdefault;
-
-       if (!argv)
-               return -EINVAL;
-
-       fp = fopen(argv[0], "r");
-       if (fp == NULL) {
-               _E("Failed to %s: %d", argv[0], errno);
-               return -errno;
-       }
-       fclose(fp);
-
-       posix_spawnattr_init(&attr);
-       sigemptyset(&sigmask);
-       sigemptyset(&sigdefault);
-       sigprocmask(SIG_BLOCK, &sigmask, NULL);
-
-       posix_spawnattr_setsigmask(&attr, &sigmask);
-       posix_spawnattr_setsigdefault(&attr, &sigdefault);
-       posix_spawnattr_setflags(&attr, POSIX_SPAWN_SETSIGMASK | POSIX_SPAWN_SETSIGDEF);
-
-       r = posix_spawn(&pid, argv[0], NULL, &attr, (char**)argv, NULL);
-       if (r != 0)
-               _E("Failed to posix_spawn: %d", r);
-
-       waitpid(pid, &status, 0);
-       _I("Process(%d) terminated by exit(%d).", pid, WEXITSTATUS(status));
-
-       r = posix_spawnattr_destroy(&attr);
-       if (r != 0)
-               _E("Failed to posix_spawnattr_destroy: %d", r);
-
-       return r;
-}
-
-int run_child(int argc, const char *argv[])
-{
-       if (g_unified_system_service_on)
-               return run_posix_spawn(argc, argv);
-       else
-               return run_fork(argc, argv);
-}
-
 int remove_directory(const char*path)
 {
        int argc;