Exclude scanner-v2 from public build 09/230109/2
authorMinje Ahn <minje.ahn@samsung.com>
Wed, 8 Apr 2020 04:12:14 +0000 (13:12 +0900)
committerMinje Ahn <minje.ahn@samsung.com>
Wed, 8 Apr 2020 04:35:06 +0000 (13:35 +0900)
Changed to build the scanner-v2 only for TV profile (Exclude scanner-v1 when TV profile build)

Change-Id: I0d5fa8c32ec53c3d704ce5ca23157b59fabc11aa
Signed-off-by: Minje Ahn <minje.ahn@samsung.com>
Makefile.am
packaging/media-server.spec
src/common/include/media-common-system.h
src/common/media-common-system.c
src/scanner-v2/include/media-scanner-device-block-v2.h
src/scanner-v2/media-scanner-device-block-v2.c
src/scanner-v2/media-scanner-scan-v2.c
src/scanner-v2/media-scanner-v2.c
src/scanner/media-scanner.c
src/server/media-server-main.c

index 95f5751..e0efedf 100755 (executable)
@@ -94,10 +94,13 @@ libmedia_utils_la_LIBADD  =   $(GLIB_LIBS) \
                              $(CYNARA_CREDS_SOCKET_LIBS) \
                              $(SYSTEM_INFO_LIBS)
 
-bin_PROGRAMS = media-server \
-               media-scanner \
-               media-scanner-v2 \
-               mediadb-update
+bin_PROGRAMS = media-server mediadb-update
+if !USE_PRODUCT_TV
+bin_PROGRAMS += media-scanner
+else
+bin_PROGRAMS += media-scanner-v2
+endif
+
 ######################################################
 #media server
 ######################################################
@@ -142,6 +145,7 @@ media_server_LDADD += $(SECURITY_LIBS) \
 ######################################################
 #media scanner v1
 ######################################################
+if !USE_PRODUCT_TV
 media_scanner_SOURCES = src/common/media-common-utils.c \
                        src/common/media-common-system.c \
                        src/common/media-common-external-storage.c \
@@ -159,6 +163,7 @@ media_scanner_LDFLAGS = -pie
 
 media_scanner_LDADD = $(COMMON_LDADD)
 
+else
 ######################################################
 #media scanner v2
 ######################################################
@@ -190,7 +195,7 @@ media_scanner_v2_LDADD = $(COMMON_LDADD)
 media_scanner_v2_LDADD += $(USB_DEVICE_LIBS) \
                           $(POWER_DEFS_LIBS) \
                           $(POWER_TV_LIBS)
-
+endif
 ######################################################
 #mediadb_udpate
 ######################################################
index fd0033e..c8b8371 100755 (executable)
@@ -135,8 +135,11 @@ chmod 755 /etc/gumd/useradd.d/30_media-server-add.post
 %manifest %{name}.manifest
 %defattr(-,root,root,-)
 %{_bindir}/media-server
-%{_bindir}/media-scanner
+%if 0%{?product_tv}
 %{_bindir}/media-scanner-v2
+%else
+%{_bindir}/media-scanner
+%endif
 %{_bindir}/mediadb-update
 %if 0%{?gtests:1}
 %{_bindir}/gtest*
index 3a79898..1041724 100755 (executable)
@@ -58,12 +58,8 @@ int ms_sys_set_device_block_event_cb(usb_connected_cb usr_callback, void *usr_da
 void ms_sys_unset_device_block_event_cb(void);
 int ms_sys_get_device_list(ms_stg_type_e stg_type, GArray **dev_list);
 
-typedef struct ms_power_info_s {
-       int option;
-} ms_power_info_s;
-
 #ifdef _USE_DEVICED_DBUS
-typedef void (*power_off_cb)(ms_power_info_s *power_info, void *user_data);
+typedef void (*power_off_cb)(void *user_data);
 int ms_sys_set_poweroff_cb(power_off_cb user_callback, void *user_data);
 #else
 int ms_sys_set_poweroff_cb(device_changed_cb user_callback, void *user_data);
index dd7bb4d..17ae1ef 100644 (file)
@@ -477,7 +477,6 @@ static void __poweroff_signal_cb(GDBusConnection *connection,
        int val_int = 0;
 
        power_off_cb cb_func = (power_off_cb)usr_cb;
-       ms_power_info_s *power_info = NULL;
 
        MS_DBG_FENTER();
 
@@ -503,7 +502,7 @@ static void __poweroff_signal_cb(GDBusConnection *connection,
                MS_DBG_WARN("PREPARE POWER OFF");
 
        if (val_int == 2 || val_int == 3)
-               cb_func(power_info, usr_data);
+               cb_func(usr_data);
 
        MS_SAFE_FREE(type_str);
 }
@@ -563,9 +562,9 @@ int ms_sys_set_poweroff_cb(device_changed_cb user_callback, void *user_data)
 }
 #endif
 
-#ifdef _USE_DEVICED_DBUS
 void ms_sys_unset_poweroff_cb(void)
 {
+#ifdef _USE_DEVICED_DBUS
        if (g_pwr_bus == NULL)
                return;
 
@@ -574,12 +573,9 @@ void ms_sys_unset_poweroff_cb(void)
        g_pwr_bus = NULL;
 
        MS_SAFE_FREE(g_pwr_cb_data);
-}
 #else
-void ms_sys_unset_poweroff_cb(void)
-{
        device_power_unsubscribe_standby(g_user_callback);
        g_user_callback = NULL;
-}
 #endif
+}
 
index 814d1a4..d7ac4a0 100755 (executable)
 
 #include "media-common-system.h"
 
-#ifdef _USE_DEVICED_DBUS
-void msc_device_block_changed_cb(ms_block_info_s *block_info, void *user_data);
-#else
 void msc_device_block_changed_cb(usb_device_h usb_device, char *action, void *user_data);
-#endif
 
 #endif
index 466b590..c16bff2 100755 (executable)
 #include "media-scanner-common-v2.h"
 #define VCONFKEY_PRIVATE_EXTRACTSTATUS "db/private/extractstatus"
 
-#ifdef _USE_DEVICED_DBUS
-static void __msc_usb_remove_event(const char *mount_path)
-{
-       MS_DBG_WARN("USB REMOVED, mountpath : %s", mount_path);
-
-       int update_status = -1;
-       int remain_request = 0;
-       bool status = false;
-
-       if (!ms_config_get_int(VCONFKEY_FILEMANAGER_DB_STATUS, &update_status))
-               MS_DBG_ERR("ms_config_get_int[VCONFKEY_FILEMANAGER_DB_STATUS]");
-
-       if (msc_get_remain_scan_request(MS_SCAN_STORAGE, &remain_request) == MS_MEDIA_ERR_NONE) {
-               if (!(remain_request == 0 && update_status == VCONFKEY_FILEMANAGER_DB_UPDATED))
-                       msc_set_blocked_path(mount_path);
-
-               remain_request = 0;
-       }
-
-
-       if (msc_get_dir_scan_status(&status) == MS_MEDIA_ERR_NONE) {
-               if (status)
-                       MS_DBG_WARN("Doing directory scanning");
-
-               status = false;
-       }
-
-       if (msc_get_remain_extract_request(MS_EXTRACT_STORAGE, &remain_request) == MS_MEDIA_ERR_NONE) {
-               if (!(remain_request == 0 && update_status == VCONFKEY_FILEMANAGER_DB_UPDATED))
-                       msc_set_extract_blocked_path(mount_path);
-
-               remain_request = 0;
-       }
-
-       if (msc_get_dir_scan_status(&status) == MS_MEDIA_ERR_NONE) {
-               if (status) {
-                       MS_DBG_WARN("Doing directory extracting. Set cancel path");
-                       msc_set_extract_cancel_path(mount_path);
-               }
-               status = false;
-       }
-}
-#endif
-
-#ifdef _USE_DEVICED_DBUS
-void msc_device_block_changed_cb(ms_block_info_s *block_info, void *user_data)
-{
-       if (block_info->block_type == 0) {
-               if (block_info->state == MS_STG_INSERTED) {
-                       MS_DBG_WARN("GET THE USB INSERT EVENT");
-               } else {
-                       MS_DBG_WARN("GET THE USB REMOVE EVENT");
-                       __msc_usb_remove_event(block_info->mount_path);
-               }
-       }
-}
-#else
 extern GAsyncQueue *storage_queue2;
 extern GAsyncQueue *storage_extract_queue;
 extern int g_directory_scan_processing2;
@@ -146,4 +89,3 @@ void msc_device_block_changed_cb(usb_device_h usb_device, char *action, void *us
        free_usb_device_h(usb_device);
        MS_DBG_ERR("_usb_event_callback END");
 }
-#endif
index 2dd1d60..aae6393 100644 (file)
@@ -30,9 +30,7 @@
 #include <dirent.h>
 #include <malloc.h>
 #include <vconf.h>
-#ifndef _USE_DEVICED_DBUS
 #include <usb-device.h>
-#endif
 
 #include "media-util.h"
 #include "media-server-ipc.h"
index 7b93ead..a48a1f6 100644 (file)
@@ -58,7 +58,6 @@ static GMainLoop *scanner_mainloop2 = NULL;
 static void __msc_add_event_receiver(void *data);
 static void __msc_remove_event_receiver(void);
 
-#ifndef _USE_DEVICED_DBUS
 static void _power_off_cb(void* data)
 {
        ms_comm_msg_s *scan_data;
@@ -122,7 +121,6 @@ static void _power_off_cb(void* data)
 
        MS_DBG_ERR("POWER OFF END");
 }
-#endif
 
 #ifdef _USE_SENIOR_MODE
 extern GAsyncQueue *storage_queue2;
@@ -312,22 +310,12 @@ EXIT:
        return 0;
 }
 
-#ifdef _USE_DEVICED_DBUS
-static void __msc_power_off_cb(ms_power_info_s *power_info, void* data)
-{
-       msc_stop_scan_thread();
-       msc_stop_extract_thread();
-
-       if (g_main_loop_is_running(scanner_mainloop2)) g_main_loop_quit(scanner_mainloop2);
-}
-#else
 static int __msc_power_off_cb(int option, void *data)
 {
        _power_off_cb(NULL);
 
        return MS_MEDIA_ERR_NONE;
 }
-#endif
 
 static void __msc_add_event_receiver(void *data)
 {
index 0b59374..cd8f0c6 100755 (executable)
 
 static GMainLoop *scanner_mainloop = NULL;
 
-#ifdef _USE_DEVICED_DBUS
-static void __msc_power_off_cb(ms_power_info_s *power_info, void* data);
-#else
-static int __msc_power_off_cb(int option, void *data);
-#endif
-static void __msc_add_event_receiver(void *data);
-static void __msc_remove_event_receiver(void);
+
+static void __msc_power_off_cb(void *data)
+{
+       msc_send_power_off_request();
+
+       if (g_main_loop_is_running(scanner_mainloop))
+               g_main_loop_quit(scanner_mainloop);
+}
 
 int main(int argc, char **argv)
 {
@@ -58,7 +59,7 @@ int main(int argc, char **argv)
        int fd = -1;
 
        /*set power off callback function*/
-       __msc_add_event_receiver(NULL);
+       ms_sys_set_poweroff_cb(__msc_power_off_cb, NULL);
 
        /*load functions from plusin(s)*/
        err = ms_load_functions();
@@ -128,40 +129,10 @@ int main(int argc, char **argv)
        /*unload functions*/
        ms_unload_functions();
 
-       __msc_remove_event_receiver();
-
+       ms_sys_unset_poweroff_cb();
 EXIT:
        MS_DBG_INFO("SCANNER is shutting down");
 
        return 0;
 }
 
-#ifdef _USE_DEVICED_DBUS
-static void __msc_power_off_cb(ms_power_info_s *power_info, void* data)
-{
-       msc_send_power_off_request();
-
-       if (g_main_loop_is_running(scanner_mainloop)) g_main_loop_quit(scanner_mainloop);
-}
-#else
-static int __msc_power_off_cb(int option, void *data)
-{
-       msc_send_power_off_request();
-
-       if (g_main_loop_is_running(scanner_mainloop)) g_main_loop_quit(scanner_mainloop);
-
-       return MS_MEDIA_ERR_NONE;
-}
-#endif
-
-static void __msc_add_event_receiver(void *data)
-{
-       /*set power off callback function*/
-       ms_sys_set_poweroff_cb(__msc_power_off_cb, NULL);
-}
-
-static void __msc_remove_event_receiver(void)
-{
-       ms_sys_unset_poweroff_cb();
-}
-
index ecc4203..b7bb994 100644 (file)
@@ -57,10 +57,6 @@ static void __ms_update_storage_status(void);
 static void __ms_add_signal_handler(void);
 static void __ms_add_event_receiver(GIOChannel *channel);
 static void __ms_add_request_receiver(GMainLoop *mainloop, GIOChannel **channel);
-#ifdef _USE_DEVICED_DBUS
-static void __ms_remove_event_receiver(void);
-static void __ms_remove_request_receiver(GIOChannel *channel);
-#endif
 
 static bool __ms_is_dcm_supported(void);
 static bool __ms_is_external_supported(void);
@@ -263,8 +259,9 @@ int ms_write_media_server_status(void)
 
 
 #ifdef _USE_DEVICED_DBUS
-void _power_off_cb(ms_power_info_s *power_info, void* data)
+static void __power_off_cb(void *data)
 {
+       int fd = -1;
        MS_DBG_ERR("POWER OFF");
 
        GIOChannel *channel = (GIOChannel *)data;
@@ -281,9 +278,18 @@ void _power_off_cb(ms_power_info_s *power_info, void* data)
        if (db_mainloop && g_main_loop_is_running(db_mainloop))
                g_main_loop_quit(db_mainloop);
 
-       __ms_remove_request_receiver(channel);
+       /*close an IO channel*/
+       fd = g_io_channel_unix_get_fd(channel);
+       g_io_channel_shutdown(channel, FALSE, NULL);
+       g_io_channel_unref(channel);
+
+       if (fd > 0) {
+               if (close(fd) < 0)
+                       MS_DBG_STRERROR("CLOSE ERROR");
+       }
 
-       __ms_remove_event_receiver();
+       ms_sys_unset_device_block_event_cb();
+       ms_sys_unset_poweroff_cb();
 }
 #endif
 
@@ -553,34 +559,11 @@ static void __ms_add_event_receiver(GIOChannel *channel)
 #endif
        /*set power off callback function*/
 #ifdef _USE_DEVICED_DBUS
-       ms_sys_set_poweroff_cb(_power_off_cb, channel);
+       ms_sys_set_poweroff_cb(__power_off_cb, channel);
 #endif
        ms_sys_set_device_block_event_cb(ms_device_block_changed_cb, NULL);
 }
 
-#ifdef _USE_DEVICED_DBUS
-static void __ms_remove_event_receiver(void)
-{
-       ms_sys_unset_device_block_event_cb();
-       ms_sys_unset_poweroff_cb();
-}
-
-static void __ms_remove_request_receiver(GIOChannel *channel)
-{
-       int fd = -1;
-
-       /*close an IO channel*/
-       fd = g_io_channel_unix_get_fd(channel);
-       g_io_channel_shutdown(channel, FALSE, NULL);
-       g_io_channel_unref(channel);
-
-       if (fd > 0) {
-               if (close(fd) < 0)
-                       MS_DBG_STRERROR("CLOSE ERROR");
-       }
-}
-#endif
-
 static void __ms_add_signal_handler(void)
 {
        struct sigaction sigset;