Just Apply Tizen coding rule 77/121877/4 accepted/tizen_common accepted/tizen_ivi accepted/tizen_mobile accepted/tizen_tv accepted/tizen_wearable accepted/tizen/common/20170330.151648 accepted/tizen/ivi/20170330.224606 accepted/tizen/mobile/20170330.224503 accepted/tizen/tv/20170330.224534 accepted/tizen/unified/20170330.224630 accepted/tizen/wearable/20170330.224551 submit/tizen/20170330.015416
authorHaejeong Kim <backto.kim@samsung.com>
Wed, 29 Mar 2017 08:50:46 +0000 (17:50 +0900)
committerHaejeong Kim <backto.kim@samsung.com>
Wed, 29 Mar 2017 23:57:39 +0000 (08:57 +0900)
Change-Id: I4d23ff6a2759524f809785ac1643f6e4ed882f1f

26 files changed:
lib/include/media-server-ipc.h
lib/include/media-util-err.h
lib/include/media-util-internal.h
lib/include/media-util-noti-common.h
lib/include/media-util-noti-internal.h
lib/include/media-util-noti.h
lib/include/media-util-register.h
lib/include/private.h [changed mode: 0644->0755]
src/common/include/media-common-db-svc.h
src/common/include/media-common-dbg.h
src/common/include/media-common-system.h
src/common/include/media-common-types.h
src/common/media-common-db-svc.c
src/common/media-common-utils.c
src/scanner-v2/include/media-scanner-extract-v2.h
src/scanner-v2/media-scanner-db-manage-v2.c
src/scanner-v2/media-scanner-device-block-v2.c
src/scanner-v2/media-scanner-extract-v2.c
src/scanner-v2/media-scanner-scan-v2.c
src/scanner-v2/media-scanner-socket-v2.c
src/scanner-v2/media-scanner-v2.c
src/scanner/media-scanner-device-block.c
src/scanner/media-scanner-socket.c
src/server/media-server-db-manage.c
src/server/media-server-main.c
src/server/media-server-socket.c

index 3ffccf0..48bc91a 100755 (executable)
 #define MS_TIMEOUT_SEC_10                                      10              /**< Response from Server time out */
 #define MS_TIMEOUT_SEC_20                      20              /**< Response from Media server time out */
 
-typedef enum{
+typedef enum {
        MS_DB_BATCH_UPDATE_PORT = 0,    /**< Media DB batch update */
        MS_SCAN_DAEMON_PORT,            /**< Port of communication between scanner and server */
-       MS_SCANNER_PORT,                /**< Directory Scanner */
-       MS_DB_UPDATE_PORT,              /**< Media DB Update */
-       MS_THUMB_CREATOR_PORT,  /**< Create thumbnail */
+       MS_SCANNER_PORT,                                /**< Directory Scanner */
+       MS_DB_UPDATE_PORT,                      /**< Media DB Update */
+       MS_THUMB_CREATOR_PORT,          /**< Create thumbnail */
        MS_THUMB_COMM_PORT,             /**< Port of communication between creator and server */
-       MS_THUMB_DAEMON_PORT,   /**< Port of Thumbnail server */
-       MS_DCM_CREATOR_PORT,    /**< Create DCM service */
-       MS_DCM_COMM_PORT,       /**< Port of communication between creator and server */
-       MS_DCM_DAEMON_PORT,     /**< Port of DCM service */
+       MS_THUMB_DAEMON_PORT,           /**< Port of Thumbnail server */
+       MS_DCM_CREATOR_PORT,                    /**< Create DCM service */
+       MS_DCM_COMM_PORT,                       /**< Port of communication between creator and server */
+       MS_DCM_DAEMON_PORT,                     /**< Port of DCM service */
        MS_PORT_MAX,
-}ms_msg_port_type_e;
+} ms_msg_port_type_e;
 
 #define MAX_MSG_SIZE                           4096*2
 #define MAX_FILEPATH_LEN                       4096
 
-typedef enum{
+typedef enum {
        MS_MSG_DB_UPDATE = 0,           /**< Media DB Update */
        MS_MSG_DB_UPDATE_BATCH_START,           /**< Start of media DB update batch */
        MS_MSG_DB_UPDATE_BATCH,                         /**< Perform of media DB update batch */
@@ -73,23 +73,21 @@ typedef enum{
        MS_MSG_RECEIVE_MSG_FAILED,   /**ms_ipc_receive_message_tcp failed**/
        MS_MSG_MEDIA_DB_MALFORMED,
        MS_MSG_MAX                                                      /**< Invalid msg type */
-}ms_msg_type_e;
+} ms_msg_type_e;
 
 #define MS_SCANNER_FIFO_PATH_REQ "/tmp/media-scanner-fifo-req"
 #define MS_SCANNER_FIFO_PATH_RES "/tmp/media-scanner-fifo-res"
 #define MS_SCANNER_FIFO_MODE 0666
 
-typedef struct
-{
+typedef struct {
        int sock_fd;
        int port;
        char *sock_path;
-}ms_sock_info_s;
+} ms_sock_info_s;
 
 #define MS_UUID_SIZE 37 /* size of uuid + NULL */
 
-typedef struct
-{
+typedef struct {
        ms_msg_type_e msg_type;
        int pid;
        uid_t uid;
@@ -97,7 +95,7 @@ typedef struct
        size_t msg_size; /*this is size of message below and this does not include the terminationg null byte ('\0'). */
        char storage_id[MS_UUID_SIZE];
        char msg[MAX_MSG_SIZE];
-}ms_comm_msg_s;
+} ms_comm_msg_s;
 
 typedef enum {
        CLIENT_SOCKET,
@@ -113,7 +111,7 @@ typedef struct {
        ms_msg_type_e msg_type;
 } ms_thumb_server_msg;
 
-typedef struct _thumbMsg{
+typedef struct _thumbMsg {
        int msg_type;
        int request_id;
        int status;
index 4d25ff0..8753161 100755 (executable)
 #ifndef _MEDIA_UTIL_ERR_H_
 #define _MEDIA_UTIL_ERR_H_
 
-#define MS_MEDIA_ERR_NONE                                              0
+#define MS_MEDIA_ERR_NONE                                                      0
 
 /* Internal operation error*/
-#define MS_MEDIA_ERR_INTERNAL                                  -1
-#define MS_MEDIA_ERR_INVALID_PARAMETER                         -2      /* Invalid parameter(s) */
-#define MS_MEDIA_ERR_INVALID_PATH                              -3      /* Invalid path */
+#define MS_MEDIA_ERR_INTERNAL                                          -1
+#define MS_MEDIA_ERR_INVALID_PARAMETER                 -2      /* Invalid parameter(s) */
+#define MS_MEDIA_ERR_INVALID_PATH                                      -3      /* Invalid path */
 #define MS_MEDIA_ERR_OUT_OF_MEMORY                             -4      /* Out of memory */
-#define MS_MEDIA_ERR_NOT_ENOUGH_SPACE                  -5   /* not enough space in storage */
-#define MS_MEDIA_ERR_DB_RESET                                          -6   /* media DB is reset */
+#define MS_MEDIA_ERR_NOT_ENOUGH_SPACE                  -5      /* not enough space in storage */
+#define MS_MEDIA_ERR_DB_RESET                                          -6      /* media DB is reset */
 
 /* DB operation error*/
-#define MS_MEDIA_ERR_DB_CONNECT_FAIL                           -101    /* connecting database fails */
-#define MS_MEDIA_ERR_DB_DISCONNECT_FAIL                        -102    /* disconnecting database fails */
-#define MS_MEDIA_ERR_DB_INSERT_FAIL                            -103    /* inserting record fails */
-#define MS_MEDIA_ERR_DB_DELETE_FAIL                            -104    /* deleting record fails */
-#define MS_MEDIA_ERR_DB_UPDATE_FAIL                            -105    /* updating record fails */
-#define MS_MEDIA_ERR_DB_BUSY_FAIL                                      -106    /* DB Busy */
+#define MS_MEDIA_ERR_DB_CONNECT_FAIL                           -101    /* connecting database fails */
+#define MS_MEDIA_ERR_DB_DISCONNECT_FAIL                        -102    /* disconnecting database fails */
+#define MS_MEDIA_ERR_DB_INSERT_FAIL                            -103    /* inserting record fails */
+#define MS_MEDIA_ERR_DB_DELETE_FAIL                            -104    /* deleting record fails */
+#define MS_MEDIA_ERR_DB_UPDATE_FAIL                            -105    /* updating record fails */
+#define MS_MEDIA_ERR_DB_BUSY_FAIL                                      -106    /* DB Busy */
 #define MS_MEDIA_ERR_DB_SERVER_BUSY_FAIL                       -107    /* DB Server Busy */
-#define MS_MEDIA_ERR_DB_CONSTRAINT_FAIL                        -108    /* DB CONSTRAINT fails - In case of insert, the record already exists */
+#define MS_MEDIA_ERR_DB_CONSTRAINT_FAIL                        -108    /* DB CONSTRAINT fails - In case of insert, the record already exists */
 #define MS_MEDIA_ERR_DB_BATCH_UPDATE_BUSY              -109    /* Batch update thread is full */
 #define MS_MEDIA_ERR_DB_NO_RECORD                              -110    /* Item not found in DB */
 #define MS_MEDIA_ERR_DB_CORRUPT                                        -112    /* DB corrut error */
 #define MS_MEDIA_ERR_SOCKET_INTERNAL                           -250    /* receive error from socket API */
 
 /* DIRECTORY error*/
-#define MS_MEDIA_ERR_DIR_OPEN_FAIL                             -501    /* direcotry opennig fails */
+#define MS_MEDIA_ERR_DIR_OPEN_FAIL                             -501    /* direcotry opennig fails */
 #define MS_MEDIA_ERR_DIR_CLOSE_FAIL                            -502    /* directory closing fails */
-#define MS_MEDIA_ERR_DIR_READ_FAIL                             -503    /* directory reading fails */
-#define MS_MEDIA_ERR_DIR_NOT_EXIST                             -504    /* directory does not exist */
+#define MS_MEDIA_ERR_DIR_READ_FAIL                             -503    /* directory reading fails */
+#define MS_MEDIA_ERR_DIR_NOT_EXIST                             -504    /* directory does not exist */
 
 /* FILE error*/
-#define MS_MEDIA_ERR_FILE_OPEN_FAIL                            -601    /* file opennig fails */
-#define MS_MEDIA_ERR_FILE_CLOSE_FAIL                           -602    /* file closing fails */
-#define MS_MEDIA_ERR_FILE_READ_FAIL                            -603    /* file reading fails */
-#define MS_MEDIA_ERR_FILE_WRITE_FAIL                           -604    /* file writing fails */
-#define MS_MEDIA_ERR_FILE_NOT_EXIST                            -605    /* file does not exist */
+#define MS_MEDIA_ERR_FILE_OPEN_FAIL                            -601    /* file opennig fails */
+#define MS_MEDIA_ERR_FILE_CLOSE_FAIL                           -602    /* file closing fails */
+#define MS_MEDIA_ERR_FILE_READ_FAIL                            -603    /* file reading fails */
+#define MS_MEDIA_ERR_FILE_WRITE_FAIL                           -604    /* file writing fails */
+#define MS_MEDIA_ERR_FILE_NOT_EXIST                            -605    /* file does not exist */
 #define MS_MEDIA_ERR_FILE_IO                                           -606    /* file does not exist */
 
 /* MEDIA SERVER error*/
index 46d2f29..5f13cef 100755 (executable)
@@ -31,9 +31,9 @@
 #define TRUE 1
 #endif
 
-#define MS_SAFE_FREE(src)              { if (src) {free(src); src = NULL;} }
-#define MS_MALLOC(src, size)   { if (size > SIZE_MAX || size <= 0) {src = NULL;} \
-                                                       else { src = malloc(size); if (src) memset(src, 0x0, size);} }
+#define MS_SAFE_FREE(src)              { if (src) {free(src); src = NULL; } }
+#define MS_MALLOC(src, size)   { if (size > SIZE_MAX || size <= 0) {src = NULL; } \
+                                                       else { src = malloc(size); if (src) memset(src, 0x0, size); } }
 #define MS_STRING_VALID(str)   \
        ((str != NULL && strlen(str) > 0) ? TRUE : FALSE)
 
index db17465..8b789c9 100755 (executable)
@@ -29,13 +29,13 @@ extern "C" {
 typedef enum {
        MS_MEDIA_ITEM_FILE                      = 0,
        MS_MEDIA_ITEM_DIRECTORY = 1,
-}media_item_type_e;
+} media_item_type_e;
 
 typedef enum {
        MS_MEDIA_ITEM_INSERT            = 0,
-       MS_MEDIA_ITEM_DELETE            = 1,
+       MS_MEDIA_ITEM_DELETE            = 1,
        MS_MEDIA_ITEM_UPDATE            = 2,
-}media_item_update_type_e;
+} media_item_update_type_e;
 
 typedef enum {
        MS_MEDIA_UNKNOWN        = -1,    /**< Unknown Conntent*/
@@ -44,7 +44,7 @@ typedef enum {
        MS_MEDIA_SOUND  = 2,            /**< Sound Content like Ringtone*/
        MS_MEDIA_MUSIC  = 3,            /**< Music Content like mp3*/
        MS_MEDIA_OTHER  = 4,            /**< Invalid Content*/
-}media_type_e;
+} media_type_e;
 
 typedef void (*db_update_cb)(int pid, /* mandatory */
                                                        media_item_type_e item, /* mandatory */
index 3e58f4a..d1e63cf 100755 (executable)
@@ -37,11 +37,11 @@ extern "C" {
 #include "media-util-noti-common.h"
 
 /**
-* @fn          int media_db_update_subscribe(void);
-* @brief               This function announce media database is updated to other applications.<br>
-* @return      This function returns 0 on success, and -1 on failure.
+* @fn                  int media_db_update_subscribe(void);
+* @brief               This function announce media database is updated to other applications.<br>
+* @return              This function returns 0 on success, and -1 on failure.
 * @param[in]   none
-* @remark      This function is recommandation for other application being aware of database updating.<br>
+* @remark              This function is recommandation for other application being aware of database updating.<br>
 * @par example
 * @code
 
@@ -51,7 +51,7 @@ extern "C" {
 
 void callback()
 {
-        printf("listen dbus from media-server\n");
+       printf("listen dbus from media-server\n");
 }
 
 int
index 6950837..2670c21 100755 (executable)
@@ -29,11 +29,11 @@ extern "C" {
 #include "media-util-noti-common.h"
 
 /**
-* @fn          int media_db_update_subscribe(void);
-* @brief               This function announce media database is updated to other applications.<br>
-* @return      This function returns 0 on success, and -1 on failure.
+* @fn                  int media_db_update_subscribe(void);
+* @brief               This function announce media database is updated to other applications.<br>
+* @return              This function returns 0 on success, and -1 on failure.
 * @param[in]   none
-* @remark      This function is recommandation for other application being aware of database updating.<br>
+* @remark              This function is recommandation for other application being aware of database updating.<br>
 * @par example
 * @code
 
@@ -43,7 +43,7 @@ extern "C" {
 
 void callback()
 {
-        printf("listen dbus from media-server\n");
+       printf("listen dbus from media-server\n");
 }
 
 int
index 2f47bc5..35cb3c8 100755 (executable)
@@ -29,8 +29,7 @@
 extern "C" {
 #endif
 
-typedef enum
-{
+typedef enum {
        MEDIA_DIRECTORY_SCAN = 0,
        MEDIA_FILES_REGISTER,
        MEDIA_REQUEST_SCAN_PARTIAL,
@@ -39,13 +38,12 @@ typedef enum
        MEDIA_REQUEST_ERROR_SERVER_RECEIVE_MSG_FAILED,
 } media_request_type_e;
 
-typedef struct
-{
+typedef struct {
        int pid;
        int result;
        int request_type;
        char *complete_path; /* if the request type is MEDIA_FILES_REGISTER, this value will be NULL. */
-}media_request_result_s;
+} media_request_result_s;
 
 typedef void (*scan_complete_cb)(media_request_result_s *, void *);
 typedef void (*insert_complete_cb)(media_request_result_s *, void *);
old mode 100644 (file)
new mode 100755 (executable)
index 26be51f..8411ef1
@@ -40,24 +40,24 @@ static inline tizen_profile_t _get_tizen_profile()
 
        system_info_get_platform_string("http://tizen.org/feature/profile", &profileName);
        switch (*profileName) {
-               case 'm':
-               case 'M':
-                       profile = TIZEN_PROFILE_MOBILE;
-                       break;
-               case 'w':
-               case 'W':
-                       profile = TIZEN_PROFILE_WEARABLE;
-                       break;
-               case 't':
-               case 'T':
-                       profile = TIZEN_PROFILE_TV;
-                       break;
-               case 'i':
-               case 'I':
-                       profile = TIZEN_PROFILE_IVI;
-                       break;
-               default: // common or unknown ==> ALL ARE COMMON.
-                       profile = TIZEN_PROFILE_COMMON;
+       case 'm':
+       case 'M':
+               profile = TIZEN_PROFILE_MOBILE;
+               break;
+       case 'w':
+       case 'W':
+               profile = TIZEN_PROFILE_WEARABLE;
+               break;
+       case 't':
+       case 'T':
+               profile = TIZEN_PROFILE_TV;
+               break;
+       case 'i':
+       case 'I':
+               profile = TIZEN_PROFILE_IVI;
+               break;
+       default: // common or unknown ==> ALL ARE COMMON.
+               profile = TIZEN_PROFILE_COMMON;
        }
        free(profileName);
 
index 66a6a80..90d8115 100755 (executable)
@@ -49,9 +49,9 @@ typedef enum {
 
 typedef enum {
        MS_ITEM_INSERT          = 0,
-       MS_ITEM_DELETE          = 1,
-       MS_ITEM_UPDATE          = 2,
-}ms_noti_type_e;
+       MS_ITEM_DELETE          = 1,
+       MS_ITEM_UPDATE  = 2,
+} ms_noti_type_e;
 
 typedef int (*CONNECT)(void**, uid_t, char **);
 typedef int (*DISCONNECT)(void*, char **);
index 862159b..6f6c027 100755 (executable)
                        LOGE(fmt" : STANDARD ERROR [%s]", strerror_r(errno, buf, BUF_LENGTH)); \
                } while (0)
 
-#define MS_DBG_SLOG(fmt, args...) do{ if (true) { \
+#define MS_DBG_SLOG(fmt, args...) do { if (true) { \
                SECURE_LOGD(fmt "\n" , ##args); \
-               }} while (false)
+               } } while (false)
 
-#define MS_DBG(fmt, args...) do{ if (true) { \
+#define MS_DBG(fmt, args...) do { if (true) { \
                LOGD(fmt "\n" , ##args); \
-               }} while (false)
+               } } while (false)
 
-#define MS_DBG_INFO(fmt, args...) do{ if (true) { \
+#define MS_DBG_INFO(fmt, args...) do { if (true) { \
                LOGI(fmt "\n" , ##args); \
-               }} while (false)
+               } } while (false)
 
-#define MS_DBG_WARN(fmt, args...) do{ if (true) { \
+#define MS_DBG_WARN(fmt, args...) do { if (true) { \
                LOGW(fmt "\n", ##args); \
-               }} while (false)
+               } } while (false)
 
-#define MS_DBG_ERR(fmt, args...) do{ if (true) { \
+#define MS_DBG_ERR(fmt, args...) do { if (true) { \
                LOGE(fmt "\n", ##args); \
-               }} while (false)
+               } } while (false)
 
-#define MS_DBG_FENTER() do{ if (true) { \
+#define MS_DBG_FENTER() do { if (true) { \
                LOGD("<ENTER> \n"); \
-               }} while (false)
+               } } while (false)
 
-#define MS_DBG_FLEAVE() do{ if (true) { \
+#define MS_DBG_FLEAVE() do { if (true) { \
                LOGD("<LEAVE> \n"); \
-               }} while (false)
+               } } while (false)
 
 #endif /*_MEDIA_COMMON_DBG_H_*/
index 9886b80..b601b8a 100755 (executable)
@@ -42,7 +42,7 @@ typedef enum {
        MS_STG_TYPE_MAX,
 } ms_stg_type_e;
 
-typedef struct ms_block_info_s{
+typedef struct ms_block_info_s {
        char *mount_path;
        int state;
        int block_type;
@@ -60,7 +60,7 @@ int ms_sys_unset_device_block_event_cb(void);
 int ms_sys_get_device_list(ms_stg_type_e stg_type, GArray **dev_list);
 int ms_sys_release_device_list(GArray **dev_list);
 
-typedef struct ms_power_info_s{
+typedef struct ms_power_info_s {
        int option;
 } ms_power_info_s;
 
index f690cdf..8d47b13 100755 (executable)
@@ -54,9 +54,9 @@ typedef enum {
 /*Use for Poweroff sequence*/
 #define POWEROFF -1 /*This number uses for stopping Scannig thread*/
 
-#define MS_SAFE_FREE(src)              { if (src) {free(src); src = NULL;} }
-#define MS_MALLOC(src, size)   { if (size > SIZE_MAX || size <= 0) {src = NULL;} \
-                                                       else { src = malloc(size); if (src) memset(src, 0x0, size);} }
+#define MS_SAFE_FREE(src)              { if (src) {free(src); src = NULL; } }
+#define MS_MALLOC(src, size)   { if (size > SIZE_MAX || size <= 0) {src = NULL; } \
+                                                       else { src = malloc(size); if (src) memset(src, 0x0, size); } }
 #define MS_STRING_VALID(str)   \
                                                                ((str != NULL && strlen(str) > 0) ? TRUE : FALSE)
 
@@ -126,30 +126,30 @@ typedef struct ms_otg_data {
 
 /*use for MS_SCANNER_STATUS */
 typedef enum {
-       MS_STORAGE_SCAN_NONE,                   /**< Media Scanner not detect storage yet*/
+       MS_STORAGE_SCAN_NONE,                   /**< Media Scanner not detect storage yet*/
        MS_STORAGE_SCAN_PREPARE,                        /**< Media Scanner detect storage but not scanning yet*/
        MS_STORAGE_SCAN_PROCESSING,             /**< Media Scanner Start Scanning storage*/
-       MS_STORAGE_SCAN_STOP,                   /**< Stop scanning storage*/
-       MS_STORAGE_SCAN_DONE,                   /**< Scanning Done but need to extract metadata*/
+       MS_STORAGE_SCAN_STOP,                           /**< Stop scanning storage*/
+       MS_STORAGE_SCAN_DONE,                   /**< Scanning Done but need to extract metadata*/
        MS_STORAGE_SCAN_META_PROCESSING,        /**< Scanning Done and start to extract metadata*/
        MS_STORAGE_SCAN_META_STOP,              /**< Stop extract metadata*/
-       MS_STORAGE_SCAN_COMPLETE,               /**< Complete scanning*/
-}ms_storage_scan_status_e;
+       MS_STORAGE_SCAN_COMPLETE,               /**< Complete scanning*/
+} ms_storage_scan_status_e;
 
 /*use for MS_DIR_SCANNER_STATUS */
 typedef enum {
-       MS_DIR_SCAN_NONE                = 0,                    /**< Media Scanner not detect storage yet*/
-       MS_DIR_SCAN_PREPARE                             = 1,                    /**< Media Scanner detect storage but not scanning yet*/
-       MS_DIR_SCAN_PROCESSING                  = 2,                    /**< Media Scanner Start Scanning storage*/
-       MS_DIR_SCAN_STOP                                = 3,                    /**< Stop scanning storage*/
-       MS_DIR_SCAN_DONE                                = 4,                    /**< Scanning Done but need to extract metadata*/
-       MS_DIR_SCAN_META_PROCESSING             = 5,                    /**< Scanning Done and start to extract metadata*/
-       MS_DIR_SCAN_META_STOP                   = 6,                    /**< Stop extract metadata*/
-       MS_DIR_SCAN_COMPLETE                    = 7,                    /**< Complete scanning*/
-}ms_dir_scan_status_e;
+       MS_DIR_SCAN_NONE                                = 0,                    /**< Media Scanner not detect storage yet*/
+       MS_DIR_SCAN_PREPARE                     = 1,                    /**< Media Scanner detect storage but not scanning yet*/
+       MS_DIR_SCAN_PROCESSING          = 2,                    /**< Media Scanner Start Scanning storage*/
+       MS_DIR_SCAN_STOP                                = 3,                    /**< Stop scanning storage*/
+       MS_DIR_SCAN_DONE                                = 4,                    /**< Scanning Done but need to extract metadata*/
+       MS_DIR_SCAN_META_PROCESSING     = 5,                    /**< Scanning Done and start to extract metadata*/
+       MS_DIR_SCAN_META_STOP           = 6,                    /**< Stop extract metadata*/
+       MS_DIR_SCAN_COMPLETE                    = 7,                    /**< Complete scanning*/
+} ms_dir_scan_status_e;
 
 #if 0
-typedef enum{
+typedef enum {
        MEDIA_SCAN_PREPARE              = 0,    /**< Prepare scanning*/
        MEDIA_SCAN_PROCESSING   = 1,    /**< Process scanning*/
        MEDIA_SCAN_STOP                 = 2,    /**< Stop scanning*/
@@ -159,9 +159,9 @@ typedef enum{
        MEDIA_EXTRACT_PROCESSING        = 6,    /**< Process extract*/
        MEDIA_EXTRACT_STOP                      = 7,    /**< Stop extract*/
        MEDIA_EXTRACT_COMPLETE          = 8             /**< Complete extract*/
-}media_scan_status_e;
+} media_scan_status_e;
 #else
-typedef enum{
+typedef enum {
        MEDIA_SCAN_PREPARE              = 0,    /**< Prepare scanning*/
        MEDIA_SCAN_PROCESSING   = 1,    /**< Process scanning*/
        MEDIA_SCAN_STOP                 = 2,    /**< Stop scanning*/
@@ -170,10 +170,10 @@ typedef enum{
        MEDIA_EXTRACT_PROCESSING        = 5,    /**< Process extract*/
        MEDIA_EXTRACT_STOP                      = 6,    /**< Stop extract*/
        MEDIA_EXTRACT_COMPLETE          = 7             /**< Complete extract*/
-}media_scan_status_e;
+} media_scan_status_e;
 #endif
 
-typedef enum{
+typedef enum {
        MS_MEDIA_TYPE_IMAGE     = 0,    /**< Image Content*/
        MS_MEDIA_TYPE_VIDEO     = 1,    /**< Video Content*/
        MS_MEDIA_TYPE_SOUND     = 2,    /**< Sound Content like Ringtone*/
@@ -182,7 +182,7 @@ typedef enum{
        MS_MEDIA_TYPE_PVR       = 5,    /**< PVR Content*/
        MS_MEDIA_TYPE_UHD       = 6,    /**< UHD Content*/
        MS_SVC_MEDIA_TYPE_SCSA  = 7,    /**< SCSA Content*/
-}ms_media_type_e;
+} ms_media_type_e;
 
 
 /**
index bf6b57e..224e897 100755 (executable)
@@ -1547,7 +1547,7 @@ int ms_get_folder_scan_status(void **handle, const char *storage_id, const char
                }
        }
 
-       MS_DBG("OK path = [%s],  scan_status = [%d]", path, *scan_status);
+       MS_DBG("OK path = [%s], scan_status = [%d]", path, *scan_status);
 
        return res;
 }
@@ -1570,7 +1570,7 @@ int ms_set_folder_scan_status(void **handle, const char *storage_id, const char
                }
        }
 
-       MS_DBG("OK path = [%s],  scan_status = [%d]", path, scan_status);
+       MS_DBG("OK path = [%s], scan_status = [%d]", path, scan_status);
 
        return res;
 }
index e7ef1d5..13d7d25 100755 (executable)
 
 /* it's for 32bit file offset */
 struct statvfs_32 {
-        unsigned long int f_bsize;
-        unsigned long int f_frsize;
-        unsigned long int f_blocks;
-        unsigned long int f_bfree;
-        unsigned long int f_bavail;
-        unsigned long int f_files;
-        unsigned long int f_ffree;
-        unsigned long int f_favail;
-        unsigned long int f_fsid;
+       unsigned long int f_bsize;
+       unsigned long int f_frsize;
+       unsigned long int f_blocks;
+       unsigned long int f_bfree;
+       unsigned long int f_bavail;
+       unsigned long int f_files;
+       unsigned long int f_ffree;
+       unsigned long int f_favail;
+       unsigned long int f_fsid;
 #ifdef _STATVFSBUF_F_UNUSED
-        int __f_unused;
+       int __f_unused;
 #endif
-        unsigned long int f_flag;
-        unsigned long int f_namemax;
-        int __f_spare[6];
+       unsigned long int f_flag;
+       unsigned long int f_namemax;
+       int __f_spare[6];
 };
 
 bool ms_is_mmc_inserted(void)
@@ -111,7 +111,7 @@ static char* __media_get_path(uid_t uid)
        }
 
        ret = getgrnam_r("users", &grpinfo, grpbuf, grpbufsize, &grpresult);
-       if((ret == 0) && (grpresult != NULL)) {
+       if ((ret == 0) && (grpresult != NULL)) {
 //             MS_DBG("getgrnam_r users success...\n");
        } else {
                MS_DBG_ERR("getgrnam_r users failed ret[%d]", ret);
@@ -138,7 +138,7 @@ static char* __media_get_path(uid_t uid)
                }
 
                ret = getpwuid_r(uid, &pwdinfo, pwdbuf, pwdbufsize, &pwdresult);
-               if((ret == 0) && (pwdresult != NULL)) {
+               if ((ret == 0) && (pwdresult != NULL)) {
 //                     MS_DBG("getpwuid uid[%d] success\n", uid);
                } else {
                        MS_DBG_ERR("getpwuid uid[%d] failed ret[%d]", uid, ret);
@@ -174,7 +174,7 @@ ms_storage_type_t ms_get_storage_type_by_full(const char *path, uid_t uid)
                return MS_MEDIA_ERR_INVALID_PATH;
 
 #ifdef _USE_SENIOR_MODE
-       if(ms_is_support_senior_mode()) {
+       if (ms_is_support_senior_mode()) {
                if (strncmp(path, MEDIA_ROOT_PATH_SENIOR_MODE, strlen(MEDIA_ROOT_PATH_SENIOR_MODE)) == 0) {
                        return MS_STORAGE_EXTERNAL;
                }
@@ -361,13 +361,13 @@ static int get_memory_size(const char *path, struct statvfs_32 *buf)
                return MS_MEDIA_ERR_INTERNAL;
        }
 
-       buf->f_bsize  = s.f_bsize;
+       buf->f_bsize = s.f_bsize;
        buf->f_frsize = s.f_frsize;
        buf->f_blocks = (unsigned long)s.f_blocks;
-       buf->f_bfree  = (unsigned long)s.f_bfree;
+       buf->f_bfree = (unsigned long)s.f_bfree;
        buf->f_bavail = (unsigned long)s.f_bavail;
-       buf->f_files  = (unsigned long)s.f_files;
-       buf->f_ffree  = (unsigned long)s.f_ffree;
+       buf->f_files = (unsigned long)s.f_files;
+       buf->f_ffree = (unsigned long)s.f_ffree;
        buf->f_favail = (unsigned long)s.f_favail;
        buf->f_fsid = s.f_fsid;
        buf->f_flag = s.f_flag;
@@ -415,7 +415,7 @@ bool ms_is_support_senior_mode()
 {
        bool bSupportSeniorMode = false;
 
-       if(system_info_get_value_bool(SYSTEM_INFO_KEY_GET_SENIOR_MODE_SUPPORTED, &bSupportSeniorMode) != SYSTEM_INFO_ERROR_NONE) {
+       if (system_info_get_value_bool(SYSTEM_INFO_KEY_GET_SENIOR_MODE_SUPPORTED, &bSupportSeniorMode) != SYSTEM_INFO_ERROR_NONE) {
                MS_DBG_ERR("Get senior mode support failed");
                return false;
        }
@@ -497,8 +497,8 @@ int ms_check_ignore_dir(const char *full_path, uid_t uid)
                }
 
 #ifdef _USE_SENIOR_MODE
-               if(ms_is_support_senior_mode()) {
-                       if(strcmp(dir_path, MEDIA_ROOT_PATH_SENIOR_MODE) == 0)
+               if (ms_is_support_senior_mode()) {
+                       if (strcmp(dir_path, MEDIA_ROOT_PATH_SENIOR_MODE) == 0)
                                break;
                }
 #endif
@@ -628,7 +628,7 @@ char* ms_get_path(uid_t uid)
        }
 
        ret = getgrnam_r("users", &grpinfo, grpbuf, grpbufsize, &grpresult);
-       if((ret == 0) && (grpresult != NULL)) {
+       if ((ret == 0) && (grpresult != NULL)) {
 //             MS_DBG("getgrnam_r users success...\n");
        } else {
                MS_DBG_ERR("getgrnam_r users failed ret[%d]", ret);
@@ -656,7 +656,7 @@ char* ms_get_path(uid_t uid)
                }
 
                ret = getpwuid_r(uid, &pwdinfo, pwdbuf, pwdbufsize, &pwdresult);
-               if((ret == 0) && (pwdresult != NULL)) {
+               if ((ret == 0) && (pwdresult != NULL)) {
 //                     MS_DBG("getpwuid uid[%d] success\n", uid);
                } else {
                        MS_DBG_ERR("getpwuid uid[%d] failed ret[%d]", uid, ret);
@@ -711,7 +711,7 @@ bool ms_storage_mount_status(const char* start_path)
                count = usb_device_list_get_count(list);
                if (count > 0) {
                        err = usb_device_list_get_first(list, &device);
-                       if(err != USB_ERROR_LIST_FAILED_TO_GET && device != NULL) {
+                       if (err != USB_ERROR_LIST_FAILED_TO_GET && device != NULL) {
                                mount_path = usb_device_get_mountpath(device);
                                if (mount_path != NULL) {
                                        MS_DBG_WARN("mount_path [%s]", mount_path);
@@ -725,8 +725,8 @@ bool ms_storage_mount_status(const char* start_path)
                        }
 
                        if (ret != true) {
-                               while(usb_device_list_get_next(list, &device) == 0) {
-                                       if(device != NULL) {
+                               while (usb_device_list_get_next(list, &device) == 0) {
+                                       if (device != NULL) {
                                                mount_path = usb_device_get_mountpath(device);
                                                if (mount_path != NULL) {
                                                        MS_DBG_WARN("mount_path [%s]", mount_path);
@@ -766,7 +766,7 @@ bool ms_is_valid_path(const char *path, uid_t uid)
                return false;
 
 #ifdef _USE_SENIOR_MODE
-       if(ms_is_support_senior_mode()) {
+       if (ms_is_support_senior_mode()) {
                if (strncmp(path, MEDIA_ROOT_PATH_SENIOR_MODE, strlen(MEDIA_ROOT_PATH_SENIOR_MODE)) == 0)
                        return true;
        }
@@ -884,7 +884,7 @@ int ms_check_size_mediadb(uid_t uid, double *db_size)
 
        ret = media_db_get_media_db_path(uid, &db_path);
 
-       if(stat(db_path, &buf) == 0) {
+       if (stat(db_path, &buf) == 0) {
                *db_size = buf.st_size;
        } else {
                MS_DBG_STRERROR("stat failed");
index d42d05f..a97966f 100755 (executable)
 #ifndef _MEDIA_SCANNER_EXTRACT_V2_H_
 #define _MEDIA_SCANNER_EXTRACT_V2_H_
 
-typedef struct _s_extract_item{
+typedef struct _s_extract_item {
        char* path;
        int pid;
-}s_extract_item;
+} s_extract_item;
 
 typedef enum {
        MS_EXTRACT_STORAGE = 0,
index bf49765..b2ae5fe 100755 (executable)
@@ -101,14 +101,13 @@ static int __msc_get_invalid_storage(void *handle, GArray **storage_list)
        }\r
 \r
        if (*storage_list == NULL) {\r
-               *storage_list = g_array_new (FALSE, FALSE, sizeof (char*));\r
+               *storage_list = g_array_new(FALSE, FALSE, sizeof(char*));\r
        }\r
 \r
-       while(sqlite3_step(sql_stmt) == SQLITE_ROW)\r
-       {\r
+       while (sqlite3_step(sql_stmt) == SQLITE_ROW) {\r
                storage_uuid = strdup((const char *)sqlite3_column_text(sql_stmt, 0));\r
                MS_DBG_WARN("INVALID STORAGE ID : %s", storage_uuid);\r
-               g_array_append_val (*storage_list, storage_uuid);\r
+               g_array_append_val(*storage_list, storage_uuid);\r
        }\r
 \r
        if (sql_stmt) sqlite3_finalize(sql_stmt);\r
@@ -130,7 +129,7 @@ static int __msc_cleanup_invalid_storage_table(void *handle, GArray *storage_lis
        } else {\r
                count = storage_list->len;\r
 \r
-               for (i = 0; i < count; i ++) {\r
+               for (i = 0; i < count; i++) {\r
                        storage_uuid = g_array_index(storage_list, char*, i);\r
                        sql = sqlite3_mprintf("drop table '%s'", storage_uuid);\r
                        ret = sqlite3_exec(handle, sql, NULL, NULL, &zErrMsg);\r
@@ -158,7 +157,7 @@ static int __msc_cleanup_invalid_folder(void *handle, GArray *storage_list)
        } else {\r
                count = storage_list->len;\r
 \r
-               for (i = 0; i < count; i ++) {\r
+               for (i = 0; i < count; i++) {\r
                        storage_uuid = g_array_index(storage_list, char*, i);\r
                        sql = sqlite3_mprintf("delete from folder where storage_uuid = '%s'", storage_uuid);\r
                        ret = sqlite3_exec(handle, sql, NULL, NULL, &zErrMsg);\r
@@ -186,7 +185,7 @@ static int __msc_cleanup_invalid_storage(void *handle, GArray *storage_list)
        } else {\r
                count = storage_list->len;\r
 \r
-               for (i = 0; i < count; i ++) {\r
+               for (i = 0; i < count; i++) {\r
                        storage_uuid = g_array_index(storage_list, char*, i);\r
                        sql = sqlite3_mprintf("delete from storage where storage_uuid = '%s'", storage_uuid);\r
                        ret = sqlite3_exec(handle, sql, NULL, NULL, &zErrMsg);\r
@@ -269,7 +268,7 @@ int msc_cleanup_invalid_values(uid_t uid)
        ms_check_size_mediadb(uid, &db_size);\r
        MS_DBG_ERR("END CLEANUP MEDIA DB[%lf]", db_size);\r
 \r
-       for (i = 0; i < count; i ++) {\r
+       for (i = 0; i < count; i++) {\r
                storage_uuid = g_array_index(storage_list, char*, 0);\r
                MS_SAFE_FREE(storage_uuid);\r
                g_array_remove_index(storage_list, 0);\r
index 02a6517..8659838 100755 (executable)
@@ -146,9 +146,9 @@ void msc_device_block_changed_cb(usb_device_h usb_device, char *action, void *us
                MS_DBG_WARN("===========================================================");
                MS_DBG_WARN("USB BLOCKED, mountpath : %s", mount_path);
                MS_DBG_WARN("===========================================================");
-               int status  = -1;
+               int status = -1;
 
-               if(!ms_config_get_int(VCONFKEY_FILEMANAGER_DB_STATUS, &status)) {
+               if (!ms_config_get_int(VCONFKEY_FILEMANAGER_DB_STATUS, &status)) {
                        MS_DBG_ERR("ms_config_get_int[VCONFKEY_FILEMANAGER_DB_STATUS]");
                }
 
index 8e8b38e..82a3ab7 100755 (executable)
@@ -70,12 +70,12 @@ static int __msc_resume_extract();
 static int __msc_pause_extract();
 static int __msc_extract_set_db_status(ms_db_status_type_t status);
 
-typedef struct{
+typedef struct {
        int media_type;
        char *path;
-}ms_item_info_s;
+} ms_item_info_s;
 
-#define SAFE_FREE(src)      { if(src) {free(src); src = NULL;}}
+#define SAFE_FREE(src) { if (src) {free(src); src = NULL; } }
 
 static int __msc_folder_bulk_extract(void **handle, const char* storage_id, int storage_type, const char *path, int scan_type, int burst, int pid, uid_t uid, unsigned int *io_err_count, bool is_end);
 
@@ -121,12 +121,12 @@ int __msc_folder_bulk_extract(void **handle, const char* storage_id, int storage
        int extract_count = 0;
 
        ret = ms_get_extract_list(handle, storage_id, storage_type, scan_type, path, burst, uid, (void*)&data_array);
-       if(ret != MS_MEDIA_ERR_NONE) {
+       if (ret != MS_MEDIA_ERR_NONE) {
                MS_DBG_ERR("ms_get_extract_list failed!!!\n");
                return ret;
        }
 
-       if(data_array == NULL) {
+       if (data_array == NULL) {
                MS_DBG_ERR("data_array is NULL!!!\n");
                return MS_MEDIA_ERR_INTERNAL;
        }
@@ -142,32 +142,32 @@ int __msc_folder_bulk_extract(void **handle, const char* storage_id, int storage
                }
 
                db_data = g_array_index(data_array, ms_item_info_s*, 0);
-               g_array_remove_index (data_array, 0);
+               g_array_remove_index(data_array, 0);
 
                tmp_ret = ms_update_one_extract_item(handle, storage_id, storage_type, db_data, burst);
-               if(tmp_ret == MS_MEDIA_ERR_NONE) {
+               if (tmp_ret == MS_MEDIA_ERR_NONE) {
                        extract_count++;
                } else if (tmp_ret == MS_MEDIA_ERR_FILE_IO) {
                        (*io_err_count)++;
                }
 
-               if(db_data) {
+               if (db_data) {
                        SAFE_FREE(db_data->path);
                        free(db_data);
                        db_data = NULL;
                }
        }
 
-       if(extract_count > 0) {
+       if (extract_count > 0) {
                ret = ms_query_do_update_list(handle);
        }
 
        while (data_array->len != 0) {
                db_data = NULL;
                db_data = g_array_index(data_array, ms_item_info_s*, 0);
-               g_array_remove_index (data_array, 0);
+               g_array_remove_index(data_array, 0);
 
-               if(db_data) {
+               if (db_data) {
                        SAFE_FREE(db_data->path);
                        free(db_data);
                        db_data = NULL;
@@ -351,7 +351,7 @@ gboolean msc_storage_extract_thread(void *data)
 
                io_err_count = 0;
 
-               MS_DBG_WARN("STORAGE extract START extract len is %d ",         g_async_queue_length(storage_extract_queue));
+               MS_DBG_WARN("STORAGE extract START extract len is %d ", g_async_queue_length(storage_extract_queue));
 
                scan_type = extract_data->msg_type;
                if (scan_type != MS_MSG_STORAGE_ALL
@@ -361,7 +361,7 @@ gboolean msc_storage_extract_thread(void *data)
                        goto NEXT;
                }
 
-               uid =extract_data->uid;
+               uid = extract_data->uid;
 
                /*connect to media db, if conneting is failed, db updating is stopped*/
                err = ms_connect_db(&handle, uid);
@@ -642,7 +642,7 @@ int _msc_set_extract_item(s_extract_item** item, const char* path, int pid)
                extract_item->pid = -1;
        } else {
                extract_item = (s_extract_item*)malloc(sizeof(s_extract_item));
-               if(extract_item == NULL) {
+               if (extract_item == NULL) {
                        MS_DBG_ERR("malloc item failed");
                        return MS_MEDIA_ERR_INTERNAL;
                }
@@ -672,12 +672,12 @@ int msc_set_cancel_extract_item(const char* cancel_path, int pid)
        int ret = -1;
        MS_DBG_WARN("msc_set_cancel_extract_item begin");
        g_mutex_lock(&extract_item_mutex);
-       if(cancel_path == NULL) {
+       if (cancel_path == NULL) {
                MS_DBG_ERR("cancel_path invalid...");
                return ret;
        }
 
-       if(cur_extract_item && cur_extract_item->path) {
+       if (cur_extract_item && cur_extract_item->path) {
                if ((strcmp(cur_extract_item->path, cancel_path) == 0) && (pid == cur_extract_item->pid)) {
                        ret = _msc_set_extract_item(&cancel_extract_item, cancel_path, pid);
                }
@@ -774,7 +774,7 @@ static int __msc_check_extract_stop_status(int scan_type, ms_storage_type_t stor
                if ((cancel_extract_item != NULL) && (cancel_extract_item->path != NULL)) {
                        MS_DBG_WARN("check cancel storage [%s][%s]", cancel_extract_item->path, start_path);
                        if ((strncmp(cancel_extract_item->path, start_path, strlen(cancel_extract_item->path)) == 0)
-                               && (cancel_extract_item->pid == -1 || cancel_extract_item->pid == pid)){
+                               && (cancel_extract_item->pid == -1 || cancel_extract_item->pid == pid)) {
                                MS_DBG_WARN("Receive cancel request [%s][%s]. STOP scan!!", cancel_extract_item->path, start_path);
                                unsigned int path_len = strlen(cancel_extract_item->path);
 
@@ -882,16 +882,16 @@ int msc_get_remain_extract_request(ms_extract_type_e scan_type, int *remain_requ
        int ret = MS_MEDIA_ERR_NONE;
 
        switch (scan_type) {
-               case MS_EXTRACT_STORAGE:
-                       *remain_request = g_async_queue_length(storage_extract_queue);
-                       break;
-               case MS_EXTRACT_DIRECTORY:
-                       *remain_request = g_async_queue_length(folder_extract_queue);
-                       break;
-               default:
-                       MS_DBG_ERR("invalid parameter");
-                       ret = MS_MEDIA_ERR_INVALID_PARAMETER;
-                       break;
+       case MS_EXTRACT_STORAGE:
+               *remain_request = g_async_queue_length(storage_extract_queue);
+               break;
+       case MS_EXTRACT_DIRECTORY:
+               *remain_request = g_async_queue_length(folder_extract_queue);
+               break;
+       default:
+               MS_DBG_ERR("invalid parameter");
+               ret = MS_MEDIA_ERR_INVALID_PARAMETER;
+               break;
        }
 
        return ret;
index 6168edc..40b7421 100755 (executable)
@@ -1288,7 +1288,7 @@ gboolean msc_directory_scan_thread(void *data)
                        MS_DBG_ERR("counting invalid items failed");
                }
 
-               if (ms_delete_invalid_items_in_folder(handle, storage_id, scan_data->msg, is_recursive, uid)  != MS_MEDIA_ERR_NONE) {
+               if (ms_delete_invalid_items_in_folder(handle, storage_id, scan_data->msg, is_recursive, uid) != MS_MEDIA_ERR_NONE) {
                        MS_DBG_ERR("deleting invalid items in folder failed");
                }
 
index 84f4f24..605b0b2 100755 (executable)
@@ -71,7 +71,7 @@ static int _msc_remove_request(GAsyncQueue *req_queue, ms_comm_msg_s *recv_msg)
                temp_scan_queue = g_async_queue_new();
 
                MS_DBG_WARN("start update scan_queue2");
-               for (i = 0; i <len; i++) {
+               for (i = 0; i < len; i++) {
                        /*create new queue to compare request*/
                        msg = g_async_queue_pop(scan_queue2);
                        MS_DBG_WARN("msg->msg[%s], msg->pid[%d]", msg->msg, msg->pid);
@@ -86,13 +86,13 @@ static int _msc_remove_request(GAsyncQueue *req_queue, ms_comm_msg_s *recv_msg)
 
                len = g_async_queue_length(temp_scan_queue);
                int j = 0;
-               for (; j <len; j++) {
+               for (; j < len; j++) {
                        msg = g_async_queue_pop(temp_scan_queue);
                        if (msg) {
                                g_async_queue_push(scan_queue2, GINT_TO_POINTER(msg));
                        }
                }
-               g_async_queue_unref (temp_scan_queue);
+               g_async_queue_unref(temp_scan_queue);
                MS_DBG_WARN("end update scan_queue2");
        }
 
@@ -128,7 +128,7 @@ END_REMOVE_REQUEST:
                                        g_async_queue_push(folder_extract_queue, GINT_TO_POINTER(msg));
                                }
                        }
-                       g_async_queue_unref (temp_extract_queue);
+                       g_async_queue_unref(temp_extract_queue);
                        MS_DBG_WARN("end update folder_extract_queue");
                }
        }
@@ -172,43 +172,43 @@ gboolean msc_receive_request(GIOChannel *src, GIOCondition condition, gpointer d
        req_num = recv_msg->msg_type;
 
        switch (req_num) {
-               case MS_MSG_BULK_INSERT:
-               case MS_MSG_BURSTSHOT_INSERT:
-                       {
-                               MS_DBG_INFO("BULK INSERT");
-                               /* request bulk insert*/
-                               g_async_queue_push(reg_queue2, GINT_TO_POINTER(recv_msg));
-                       }
-                       break;
-               case MS_MSG_DIRECTORY_SCANNING:
-               case MS_MSG_DIRECTORY_SCANNING_NON_RECURSIVE:
-                       {
-                               /* this request from another apps */
-                               /* set the scan data for scanning thread */
-                               g_async_queue_push(scan_queue2, GINT_TO_POINTER(recv_msg));
-                       }
-                       break;
-               case MS_MSG_STORAGE_ALL:
-               case MS_MSG_STORAGE_PARTIAL:
-               case MS_MSG_STORAGE_INVALID:
-                       {
-                               /* this request from media-server */
-                               g_async_queue_push(storage_queue2, GINT_TO_POINTER(recv_msg));
-                       }
-                       break;
-               case MS_MSG_DIRECTORY_SCANNING_CANCEL:
-                       {
-                               _msc_remove_request(scan_queue2, recv_msg);
-                               msc_send_result(MS_MEDIA_ERR_SCANNER_FORCE_STOP, recv_msg);
-                               MS_SAFE_FREE(recv_msg);
-                       }
-                       break;
-               default:
-                       {
-                               MS_DBG_ERR("THIS REQUEST IS INVALID %d", req_num);
-                               MS_SAFE_FREE(recv_msg);
-                       }
-                       break;
+       case MS_MSG_BULK_INSERT:
+       case MS_MSG_BURSTSHOT_INSERT:
+               {
+                       MS_DBG_INFO("BULK INSERT");
+                       /* request bulk insert*/
+                       g_async_queue_push(reg_queue2, GINT_TO_POINTER(recv_msg));
+               }
+               break;
+       case MS_MSG_DIRECTORY_SCANNING:
+       case MS_MSG_DIRECTORY_SCANNING_NON_RECURSIVE:
+               {
+                       /* this request from another apps */
+                       /* set the scan data for scanning thread */
+                       g_async_queue_push(scan_queue2, GINT_TO_POINTER(recv_msg));
+               }
+               break;
+       case MS_MSG_STORAGE_ALL:
+       case MS_MSG_STORAGE_PARTIAL:
+       case MS_MSG_STORAGE_INVALID:
+               {
+                       /* this request from media-server */
+                       g_async_queue_push(storage_queue2, GINT_TO_POINTER(recv_msg));
+               }
+               break;
+       case MS_MSG_DIRECTORY_SCANNING_CANCEL:
+               {
+                       _msc_remove_request(scan_queue2, recv_msg);
+                       msc_send_result(MS_MEDIA_ERR_SCANNER_FORCE_STOP, recv_msg);
+                       MS_SAFE_FREE(recv_msg);
+               }
+               break;
+       default:
+               {
+                       MS_DBG_ERR("THIS REQUEST IS INVALID %d", req_num);
+                       MS_SAFE_FREE(recv_msg);
+               }
+               break;
        }
 
        /*Active flush */
index 013672f..ac7f042 100755 (executable)
@@ -1,5 +1,5 @@
 /*
- *  Media Server
+ * Media Server
  *
  * Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved.
  *
@@ -121,7 +121,7 @@ static void _power_off_cb(void* data)
 
        if (g_main_loop_is_running(scanner_mainloop2)) g_main_loop_quit(scanner_mainloop2);
 
-       if(!ms_config_set_int(MSC_VCONF_KEY_SCANNER_POWEROFF_STATUS, 1)) {
+       if (!ms_config_set_int(MSC_VCONF_KEY_SCANNER_POWEROFF_STATUS, 1)) {
                MS_DBG_ERR("set power off status to 1 failed");
        }
 
@@ -173,7 +173,7 @@ void _msc_datadisc_vconf_cb(void *data)
                        MS_DBG_WARN("[DISC INSERTED]");
                } else {
                        MS_DBG_WARN("[DISC REMOVED]");
-                       int status  = -1;
+                       int status = -1;
 
                        /* check mount path */
                        if (!ms_config_get_str(MS_DISC_PATH, &disc_path)) {
@@ -191,7 +191,7 @@ void _msc_datadisc_vconf_cb(void *data)
                                ms_config_set_int(MS_DISC_ACCESS_STATE, MS_DISC_ACCESS);
                        }
 
-                       if(!ms_config_get_int(VCONFKEY_FILEMANAGER_DB_STATUS, &status)) {
+                       if (!ms_config_get_int(VCONFKEY_FILEMANAGER_DB_STATUS, &status)) {
                                MS_DBG_ERR("ms_config_get_int[VCONFKEY_FILEMANAGER_DB_STATUS]");
                        }
 
@@ -274,7 +274,7 @@ int main(int argc, char **argv)
                return MS_MEDIA_ERR_FILE_OPEN_FAIL;
        }
 
-       if(!ms_config_set_int(MSC_VCONF_KEY_SCANNER_POWEROFF_STATUS, 0)) {
+       if (!ms_config_set_int(MSC_VCONF_KEY_SCANNER_POWEROFF_STATUS, 0)) {
                MS_DBG_ERR("set power off status to 0 failed");
        }
 
@@ -307,7 +307,7 @@ int main(int argc, char **argv)
        msc_send_ready();
        MS_DBG_WARN("[No-Error] ========== Scanner is ready ========");
 
-       MS_DBG_WARN("[No-Error] ========== Scanner is running  ========");
+       MS_DBG_WARN("[No-Error] ========== Scanner is running ========");
 
 #ifdef _SET_VIP_PROCESS
        /*Set VIP Process*/
@@ -338,7 +338,7 @@ int main(int argc, char **argv)
        ms_unload_functions();
 
 EXIT:
-       if(!ms_config_set_int(MSC_VCONF_KEY_SCANNER_POWEROFF_STATUS, 0)) {
+       if (!ms_config_set_int(MSC_VCONF_KEY_SCANNER_POWEROFF_STATUS, 0)) {
                MS_DBG_ERR("set power off status to 0 failed");
        }
 
index cac7e9e..a3ddebe 100755 (executable)
@@ -1,5 +1,5 @@
 /*
- *  Media Server
+ * Media Server
  *
  * Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved.
  *
@@ -92,13 +92,13 @@ void msc_device_block_changed_cb(usb_device_h usb_device, char *action, void *us
 
        mount_path = usb_device_get_mountpath(usb_device);
 
-        if (!strcmp(action, "blocked")) {
+       if (!strcmp(action, "blocked")) {
                MS_DBG_WARN("===========================================================");
                MS_DBG_WARN("USB BLOCKED, mountpath : %s", mount_path);
                MS_DBG_WARN("===========================================================");
-               int status  = -1;
+               int status = -1;
 
-               if(!ms_config_get_int(VCONFKEY_FILEMANAGER_DB_STATUS, &status)) {
+               if (!ms_config_get_int(VCONFKEY_FILEMANAGER_DB_STATUS, &status)) {
                        MS_DBG_ERR("ms_config_get_int[VCONFKEY_FILEMANAGER_DB_STATUS]");
                }
                if (!(g_async_queue_length(storage_queue) == 0 && status == VCONFKEY_FILEMANAGER_DB_UPDATED)) {
@@ -109,7 +109,7 @@ void msc_device_block_changed_cb(usb_device_h usb_device, char *action, void *us
                        MS_DBG_WARN("Doing directory scanning. Set cancel path");
                        msc_set_cancel_path(mount_path);
                }
-        }
+       }
 
        free_usb_device_h(usb_device);
 
index 6a1c1c9..3209ca8 100755 (executable)
@@ -70,45 +70,45 @@ gboolean msc_receive_request(GIOChannel *src, GIOCondition condition, gpointer d
        req_num = recv_msg->msg_type;
 
        switch (req_num) {
-               case MS_MSG_BULK_INSERT:
-               case MS_MSG_BURSTSHOT_INSERT:
-                       {
-                               MS_DBG_INFO("BULK INSERT");
-                               /* request bulk insert*/
-                               msc_push_scan_request(MS_SCAN_REGISTER, recv_msg);
-                       }
-                       break;
-               case MS_MSG_DIRECTORY_SCANNING:
-               case MS_MSG_DIRECTORY_SCANNING_NON_RECURSIVE:
-                       {
-                               /* this request from another apps */
-                               /* set the scan data for scanning thread */
-                               msc_push_scan_request(MS_SCAN_DIRECTORY, recv_msg);
-                       }
-                       break;
-               case MS_MSG_STORAGE_ALL:
-               case MS_MSG_STORAGE_PARTIAL:
-               case MS_MSG_STORAGE_INVALID:
-                       {
-                               /* this request from media-server */
-                               msc_push_scan_request(MS_SCAN_STORAGE, recv_msg);
-                       }
-                       break;
-               case MS_MSG_DIRECTORY_SCANNING_CANCEL:
-                       {
-                               msc_remove_dir_scan_request(recv_msg);
-                               MS_SAFE_FREE(recv_msg);
-                       }
-                       break;
-               case MS_MSG_STORAGE_META:
-                       msc_metadata_update_thread(recv_msg);
-                       break;
-               default:
-                       {
-                               MS_DBG_ERR("THIS REQUEST IS INVALID %d", req_num);
-                               MS_SAFE_FREE(recv_msg);
-                       }
-                       break;
+       case MS_MSG_BULK_INSERT:
+       case MS_MSG_BURSTSHOT_INSERT:
+               {
+                       MS_DBG_INFO("BULK INSERT");
+                       /* request bulk insert*/
+                       msc_push_scan_request(MS_SCAN_REGISTER, recv_msg);
+               }
+               break;
+       case MS_MSG_DIRECTORY_SCANNING:
+       case MS_MSG_DIRECTORY_SCANNING_NON_RECURSIVE:
+               {
+                       /* this request from another apps */
+                       /* set the scan data for scanning thread */
+                       msc_push_scan_request(MS_SCAN_DIRECTORY, recv_msg);
+               }
+               break;
+       case MS_MSG_STORAGE_ALL:
+       case MS_MSG_STORAGE_PARTIAL:
+       case MS_MSG_STORAGE_INVALID:
+               {
+                       /* this request from media-server */
+                       msc_push_scan_request(MS_SCAN_STORAGE, recv_msg);
+               }
+               break;
+       case MS_MSG_DIRECTORY_SCANNING_CANCEL:
+               {
+                       msc_remove_dir_scan_request(recv_msg);
+                       MS_SAFE_FREE(recv_msg);
+               }
+               break;
+       case MS_MSG_STORAGE_META:
+               msc_metadata_update_thread(recv_msg);
+               break;
+       default:
+               {
+                       MS_DBG_ERR("THIS REQUEST IS INVALID %d", req_num);
+                       MS_SAFE_FREE(recv_msg);
+               }
+               break;
        }
 
        /*Active flush */
index e488d71..ba954f7 100755 (executable)
@@ -1,5 +1,5 @@
 /*\r
- *  Media Server\r
+ * Media Server\r
  *\r
  * Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved.\r
  *\r
@@ -44,9 +44,9 @@ int ms_reset_mediadb(uid_t uid)
        ret = media_db_get_media_db_path(uid, &db_path);\r
        if ((ret == MS_MEDIA_ERR_NONE) && (db_path != NULL)) {\r
                char command_line[MS_FILE_PATH_LEN_MAX] = {0,};\r
-               snprintf(command_line, sizeof(command_line), "%s %s %s",  command, dummy_path, db_path);\r
+               snprintf(command_line, sizeof(command_line), "%s %s %s", command, dummy_path, db_path);\r
 \r
-               MS_DBG_ERR("[RESET COMMAND %s]",command_line);\r
+               MS_DBG_ERR("[RESET COMMAND %s]", command_line);\r
                WEXITSTATUS(system(command_line));\r
        }\r
 \r
@@ -75,18 +75,18 @@ static int __ms_remake_mediadb(uid_t uid)
        ms_config_set_int(MS_DB_RESET, 1);\r
 \r
        ms_reset_mediadb(uid);\r
-       \r
+\r
        ms_connect_db(&handle, uid);\r
 \r
        MS_DBG_WARN("START WRITE SCHEMA");\r
-       if (ms_check_db_upgrade(handle, uid)  != MS_MEDIA_ERR_NONE) {\r
+       if (ms_check_db_upgrade(handle, uid) != MS_MEDIA_ERR_NONE) {\r
                MS_DBG_ERR("ms_check_db_upgrade fail");\r
        }\r
        MS_DBG_WARN("END WRITE SCHEMA");\r
-       \r
+\r
        /*disconnect form media db*/\r
        if (handle) ms_disconnect_db(&handle);\r
-       \r
+\r
        /*unload functions*/\r
        ms_unload_functions();\r
 \r
@@ -117,9 +117,9 @@ int ms_check_corrupt_mediadb(void)
        MediaDBHandle *db_handle = NULL;\r
        uid_t uid = MEDIA_DEFAULT_UID;\r
 \r
-       ms_sys_get_uid(&uid);   \r
+       ms_sys_get_uid(&uid);\r
 \r
-       if(media_db_connect(&db_handle, uid, TRUE) != MS_MEDIA_ERR_NONE) {\r
+       if (media_db_connect(&db_handle, uid, TRUE) != MS_MEDIA_ERR_NONE) {\r
                MS_DBG_ERR("Failed to connect DB\n");\r
                return MS_MEDIA_ERR_DB_CONNECT_FAIL;\r
        }\r
index 5e84cd0..6317f67 100755 (executable)
@@ -385,7 +385,7 @@ void _ms_change_lang_vconf_cb(keynode_t *key, void* data)
        }
 
        if (need_update == TRUE) {
-               uid_t uid  = MEDIA_DEFAULT_UID;
+               uid_t uid = MEDIA_DEFAULT_UID;
                ms_sys_get_uid(&uid);
                ms_send_storage_scan_request(NULL, INTERNAL_STORAGE_ID, MS_SCAN_META, uid);
        } else {
@@ -823,7 +823,7 @@ static void __ms_check_mediadb(void)
                MS_DBG_ERR("ms_set_storage_scan_status fail");
 
        /*update just valid type*/
-       if (ms_set_all_storage_validity(db_handle, 0, uid)  != MS_MEDIA_ERR_NONE)
+       if (ms_set_all_storage_validity(db_handle, 0, uid) != MS_MEDIA_ERR_NONE)
                MS_DBG_ERR("ms_set_all_storage_validity fail");
 
 #ifdef _USE_SENIOR_MODE
index da9ba9b..048850d 100755 (executable)
@@ -111,7 +111,7 @@ static int __ms_find_owner(int pid, const char *req_path, ms_req_owner_data **ow
 
        if (owner_list != NULL) {
                len = owner_list->len;
-               MS_DBG("length list :  %d", len);
+               MS_DBG("length list : %d", len);
 
                for (i = 0; i < len; i++) {
                        data = g_array_index(owner_list, ms_req_owner_data*, i);
@@ -152,7 +152,7 @@ int ms_reset_ownerlist()
 
        if (owner_list != NULL) {
                len = owner_list->len;
-               MS_DBG("length list :  %d", len);
+               MS_DBG("length list : %d", len);
 
                for (i = 0; i < len; i++) {
                        data = g_array_index(owner_list, ms_req_owner_data*, 0);
@@ -247,7 +247,7 @@ static int __ms_recovery_media_db(uid_t uid)
        ms_connect_db(&handle, uid);
 
        MS_DBG_WARN("START WRITE SCHEMA");
-       if (ms_check_db_upgrade(handle, uid)  != MS_MEDIA_ERR_NONE) {
+       if (ms_check_db_upgrade(handle, uid) != MS_MEDIA_ERR_NONE) {
                MS_DBG_ERR("ms_check_db_upgrade fail");
        }
        MS_DBG_WARN("END WRITE SCHEMA");
@@ -511,7 +511,7 @@ int ms_send_storage_scan_request_senior_mode(void **handle)
        int validity = 0;
        ms_dir_scan_type_t scan_type = MS_SCAN_ALL;
        char *storage_path = NULL;
-       char* storage_id =  strdup("familytv");
+       char* storage_id = strdup("familytv");
        char* path = MEDIA_ROOT_PATH_SENIOR_MODE;
 
        ms_sys_get_uid(&uid);