To support unified system service, plugin package is added.
storaged-unified-system-plugin rpm is newly added to install
libunified-system-service-storaged.so.
Service execution will be replaced as a library init/exit() way.
With this, unified-system-service can run system services as a thread
simultaneously.
To avoid dbus rule conflict, a part of dbus conf rule is removed as
different config file 'org.tizen.system.storage-unified-system-service.conf'.
This file will replace org.tizen.system.storage.conf by the postscript
of plugin rpm when it is installed.
Change-Id: If8339b900bd6b7aef2004a382e6a6b10eb846297
Signed-off-by: SangYoun Kwak <sy.kwak@samsung.com>
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
TARGET_LINK_LIBRARIES(${PROJECT_NAME} ${${PROJECT_NAME}_pkgs_LDFLAGS} "-ldl" "-lm")
INSTALL(TARGETS ${PROJECT_NAME} DESTINATION bin)
+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} COMPONENT RuntimeLibraries)
+
INSTALL(FILES ${CMAKE_SOURCE_DIR}/conf/org.tizen.system.storage.conf DESTINATION /etc/dbus-1/system.d)
+INSTALL(FILES ${CMAKE_SOURCE_DIR}/conf/org.tizen.system.storage-unified-system-service.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)
--- /dev/null
+<!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>
%if %{extended_storage}
BuildRequires: pkgconfig(ode)
%endif
+BuildRequires: pkgconfig(hal-api-common)
#For /usr/bin/msgfmt
BuildRequires: gettext-tools
%description
storage daemon.
+%package unified-system-plugin
+Summary: unified-system-service plugin
+Requires: %{name} = %{version}-%{release}
+%description unified-system-plugin
+unified-system-service plugin
+
%package module_block
Summary: block module plugin
Requires: %{name} = %{version}-%{release}
systemctl restart storaged.service
fi
+%post unified-system-plugin
+mv %{_sysconfdir}/dbus-1/system.d/org.tizen.system.storage-unified-system-service.conf \
+ %{_sysconfdir}/dbus-1/system.d/org.tizen.system.storage.conf
+
%postun
systemctl daemon-reload
%{_unitdir}/storaged.service.d/storaged.asan.conf
%endif
+%files unified-system-plugin
+%manifest %{name}.manifest
+%license LICENSE.Apache-2.0
+%config %{_sysconfdir}/dbus-1/system.d/org.tizen.system.storage-unified-system-service.conf
+%{_libdir}/libunified-system-service-storaged.so
+%if "%{asan}" == "1"
+%{_unitdir}/storaged.service.d/storaged.asan.conf
+%endif
+
%files module_block
%manifest %{name}.manifest
%license LICENSE.Apache-2.0
#include <sys/types.h>
#include <sys/stat.h>
+#include <unified-system-service-common.h>
+
#include "log.h"
#include "modules.h"
#include "storaged_common.h"
}
-int main(int argc, char **argv)
+static int storaged_init(void *data)
{
- int ret;
guint timer;
+ int ret;
dbus_handle_h handle = NULL;
- loop = g_main_loop_new(NULL, TRUE);
- if (!loop) {
- _E("Failed to make main loop.");
- return -ENOMEM;
- }
-
handle = gdbus_get_connection(G_BUS_TYPE_SYSTEM, FALSE);
if (!handle)
- _E("Failed to get dbus connection.");;
+ _E("Failed to get dbus connection.");
dir_init();
modules_init(NULL);
_E("Failed to aw_register.");
}
- g_main_loop_run(loop);
+ return 0;
+}
+static int storaged_exit(void *data)
+{
modules_deinit(NULL);
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,
+};