From: hj kim Date: Thu, 9 Jan 2020 01:41:49 +0000 (+0900) Subject: Apply Tizen naming convention for internal functions. X-Git-Tag: submit/tizen/20200109.233217^0 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=refs%2Fchanges%2F90%2F221990%2F3;p=platform%2Fcore%2Fapi%2Fmedia-controller.git Apply Tizen naming convention for internal functions. Change-Id: I6dc03a36252d181e96f3774368732f79dda9aa27 --- diff --git a/packaging/capi-media-controller.spec b/packaging/capi-media-controller.spec index 7f52ca9..5ac6873 100644 --- a/packaging/capi-media-controller.spec +++ b/packaging/capi-media-controller.spec @@ -1,6 +1,6 @@ Name: capi-media-controller Summary: A media controller library in Tizen Native API -Version: 0.2.8 +Version: 0.2.9 Release: 1 Group: Multimedia/API License: Apache-2.0 diff --git a/svc/include/media_controller_svc.h b/svc/include/media_controller_svc.h index a895e5f..d931749 100755 --- a/svc/include/media_controller_svc.h +++ b/svc/include/media_controller_svc.h @@ -23,16 +23,6 @@ extern "C" { #endif /* __cplusplus */ -typedef struct { - GQueue *queue; - GSource *source; -} mc_manage_queue_t; - -typedef struct { - mc_manage_queue_t *request; - GList *connected_apps; -} mc_service_t; - gpointer mc_svc_thread(void *data); GMainLoop *mc_svc_get_main_loop(void); int mc_svc_get_connection_cnt(void); diff --git a/svc/media_controller_svc.c b/svc/media_controller_svc.c index 79e1cc1..cbf832c 100644 --- a/svc/media_controller_svc.c +++ b/svc/media_controller_svc.c @@ -50,6 +50,16 @@ typedef struct { GList *cmds_to_send; } mc_app_data_set_t; +typedef struct { + GQueue *queue; + GSource *source; +} mc_manage_queue_t; + +typedef struct { + mc_manage_queue_t *request; + GList *connected_apps; +} mc_service_t; + static int __mc_sys_get_uid(uid_t *uid) { uid_t *list = NULL; @@ -200,7 +210,7 @@ static int __mc_list_remove_item(GList **list, int index) return MEDIA_CONTROLLER_ERROR_NONE; } -static int _mc_service_init(mc_service_t **data) +static int __mc_service_init(mc_service_t **data) { int res = MEDIA_CONTROLLER_ERROR_NONE; mc_service_t *_service_data = (mc_service_t *)calloc(1, sizeof(mc_service_t)); @@ -218,7 +228,7 @@ static int _mc_service_init(mc_service_t **data) return MEDIA_CONTROLLER_ERROR_NONE; } -static void _mc_service_deinit(mc_service_t *data) +static void __mc_service_deinit(mc_service_t *data) { if (data != NULL) { if (data->request != NULL) @@ -229,7 +239,7 @@ static void _mc_service_deinit(mc_service_t *data) } } -static int _mc_service_check_db(uid_t uid) +static int __mc_service_check_db(uid_t uid) { int res = MEDIA_CONTROLLER_ERROR_NONE; sqlite3 *db_handle = NULL; @@ -278,7 +288,7 @@ static int _mc_service_check_db(uid_t uid) return res; } -static int _mc_service_reset_db(uid_t uid) +static int __mc_service_reset_db(uid_t uid) { int res = MEDIA_CONTROLLER_ERROR_NONE; int version = 0; @@ -365,28 +375,28 @@ static int _mc_service_reset_db(uid_t uid) return res; } -static gboolean _mc_service_is_valid_queue(mc_service_t *data) +static gboolean __mc_service_is_valid_queue(mc_service_t *data) { return (data && data->request && data->request->queue); } -static gboolean _mc_service_is_exist_pid(GList *list, int pid, mc_priv_type_e priv_type) +static gboolean __mc_service_is_exist_pid(GList *list, int pid, mc_priv_type_e priv_type) { return (__mc_list_get_index(list, pid, priv_type) != -1); } -static gboolean _mc_service_is_valid_connection(GList *connected_list, mc_comm_msg_s *request_msg) +static gboolean __mc_service_is_valid_connection(GList *connected_list, mc_comm_msg_s *request_msg) { if (request_msg->msg_type != MC_MSG_SERVER_CONNECTION) { if (connected_list == NULL) return FALSE; - if (!_mc_service_is_exist_pid(connected_list, request_msg->pid, request_msg->priv_type)) + if (!__mc_service_is_exist_pid(connected_list, request_msg->pid, request_msg->priv_type)) return FALSE; } return TRUE; } -static int _mc_service_add_connection(GList **connected_list, mc_comm_msg_s *request_msg) +static int __mc_service_add_connection(GList **connected_list, mc_comm_msg_s *request_msg) { mc_debug_fenter(); @@ -395,7 +405,7 @@ static int _mc_service_add_connection(GList **connected_list, mc_comm_msg_s *req mc_retvm_if(request_msg == NULL, MEDIA_CONTROLLER_ERROR_INVALID_PARAMETER, "request_msg is NULL"); mc_retvm_if(((request_msg->priv_type != MC_PRIV_TYPE_SERVER) && (request_msg->priv_type != MC_PRIV_TYPE_CLIENT)), MEDIA_CONTROLLER_ERROR_INVALID_PARAMETER, "invalid priv_type[%d]", request_msg->priv_type); - if (*connected_list != NULL && _mc_service_is_exist_pid(*connected_list, request_msg->pid, request_msg->priv_type)) { + if (*connected_list != NULL && __mc_service_is_exist_pid(*connected_list, request_msg->pid, request_msg->priv_type)) { mc_error("Already connected[%d]", g_connection_cnt); return MEDIA_CONTROLLER_ERROR_INVALID_PARAMETER; } @@ -422,7 +432,7 @@ static int _mc_service_add_connection(GList **connected_list, mc_comm_msg_s *req return MEDIA_CONTROLLER_ERROR_NONE; } -static int _mc_service_remove_connection(GList **connected_list, mc_comm_msg_s *request_msg) +static int __mc_service_remove_connection(GList **connected_list, mc_comm_msg_s *request_msg) { mc_debug_fenter(); @@ -440,14 +450,14 @@ static int _mc_service_remove_connection(GList **connected_list, mc_comm_msg_s * return MEDIA_CONTROLLER_ERROR_NONE; } -static int _mc_service_add_cmd_to_send(GList **connected_list, mc_comm_msg_s *request_msg) +static int __mc_service_add_cmd_to_send(GList **connected_list, mc_comm_msg_s *request_msg) { g_list_foreach(*connected_list, __mc_add_cmd_to_send, request_msg); return MEDIA_CONTROLLER_ERROR_NONE; } -static int _mc_service_remove_cmd_to_send(GList **connected_list, mc_comm_msg_s *request_msg) +static int __mc_service_remove_cmd_to_send(GList **connected_list, mc_comm_msg_s *request_msg) { mc_list_user_data *user_data = calloc(1, sizeof(mc_list_user_data)); mc_retvm_if(!user_data, MEDIA_CONTROLLER_ERROR_OUT_OF_MEMORY, "memory allocation is failed"); @@ -515,7 +525,7 @@ static int __mc_notify_server_updated(const char *server_name, mc_server_state_e return MEDIA_CONTROLLER_ERROR_NONE; } -static int _mc_service_app_dead_handler(int pid, void *data) +static int __mc_service_app_dead_handler(int pid, void *data) { mc_service_t *_service_data = (mc_service_t *)data; GList *iter = NULL; @@ -551,14 +561,14 @@ static int _mc_service_app_dead_handler(int pid, void *data) return AUL_R_OK; } -gboolean _mc_service_process(gpointer data) +static gboolean __mc_service_process(gpointer data) { int length_of_queue = 0; int send_msg = MEDIA_CONTROLLER_ERROR_NONE; mc_service_t *_service_data = (mc_service_t*)data; mc_retvm_if(!_service_data, FALSE, "invalid data"); - mc_retvm_if(!_mc_service_is_valid_queue(_service_data), FALSE, "invalid queue"); + mc_retvm_if(!__mc_service_is_valid_queue(_service_data), FALSE, "invalid queue"); GQueue *request_queue = _service_data->request->queue; length_of_queue = g_queue_get_length(request_queue); @@ -585,7 +595,7 @@ gboolean _mc_service_process(gpointer data) goto ERROR; } - if (!_mc_service_is_valid_connection(_service_data->connected_apps, request_msg)) { + if (!__mc_service_is_valid_connection(_service_data->connected_apps, request_msg)) { mc_error("Wrong message"); send_msg = MEDIA_CONTROLLER_ERROR_INVALID_OPERATION; goto ERROR; @@ -607,12 +617,12 @@ gboolean _mc_service_process(gpointer data) } } } else if (request_msg->msg_type == MC_MSG_CLIENT_SET) { - send_msg = _mc_service_add_cmd_to_send(&(_service_data->connected_apps), request_msg); + send_msg = __mc_service_add_cmd_to_send(&(_service_data->connected_apps), request_msg); } else if (request_msg->msg_type == MC_MSG_CLIENT_GET) { - send_msg = _mc_service_remove_cmd_to_send(&(_service_data->connected_apps), request_msg); + send_msg = __mc_service_remove_cmd_to_send(&(_service_data->connected_apps), request_msg); } else if (request_msg->msg_type == MC_MSG_SERVER_CONNECTION) { if (MC_STRING_VALID(request_msg->msg)) { - send_msg = _mc_service_add_connection(&(_service_data->connected_apps), request_msg); + send_msg = __mc_service_add_connection(&(_service_data->connected_apps), request_msg); if (send_msg == MEDIA_CONTROLLER_ERROR_NONE) send_msg = mc_db_add_application(request_msg->uid, request_msg->msg, request_msg->priv_type); } else { @@ -621,7 +631,7 @@ gboolean _mc_service_process(gpointer data) } } else if (request_msg->msg_type == MC_MSG_SERVER_DISCONNECTION) { if (MC_STRING_VALID(request_msg->msg)) { - send_msg = _mc_service_remove_connection(&(_service_data->connected_apps), request_msg); + send_msg = __mc_service_remove_connection(&(_service_data->connected_apps), request_msg); if (send_msg == MEDIA_CONTROLLER_ERROR_NONE) send_msg = mc_db_remove_application(request_msg->uid, request_msg->msg, request_msg->priv_type); } else { @@ -650,7 +660,7 @@ ERROR: return G_SOURCE_CONTINUE; } -gboolean _mc_read_service_request_tcp_socket(GIOChannel *src, GIOCondition condition, gpointer data) +static gboolean __mc_read_service_request_tcp_socket(GIOChannel *src, GIOCondition condition, gpointer data) { int sock = -1; int client_sock = -1; @@ -732,7 +742,7 @@ gboolean _mc_read_service_request_tcp_socket(GIOChannel *src, GIOCondition condi /* push received message to queue */ if (!_service_data->request->source) { _service_data->request->source = g_idle_source_new(); - g_source_set_callback(_service_data->request->source, _mc_service_process, _service_data, NULL); + g_source_set_callback(_service_data->request->source, __mc_service_process, _service_data, NULL); g_source_attach(_service_data->request->source, g_main_context_get_thread_default()); } @@ -775,10 +785,10 @@ gpointer mc_svc_thread(gpointer data) mc_debug_fenter(); /* Init data */ - ret = _mc_service_init(&mc_service_data); + ret = __mc_service_init(&mc_service_data); if (ret != MEDIA_CONTROLLER_ERROR_NONE) { mc_error("Failed to create data"); - _mc_service_deinit(mc_service_data); + __mc_service_deinit(mc_service_data); return FALSE; } @@ -786,14 +796,14 @@ gpointer mc_svc_thread(gpointer data) ret = __mc_sys_get_uid(&uid); if (ret < 0) { mc_debug("Failed to get login user (%d)", ret); - _mc_service_deinit(mc_service_data); + __mc_service_deinit(mc_service_data); return FALSE; } else { mc_debug("%d sys get UID[%d]", ret, uid); } /* Check database */ - ret = _mc_service_check_db(uid); + ret = __mc_service_check_db(uid); if (ret != MEDIA_CONTROLLER_ERROR_NONE) { mc_error("DB is malformed. Start to remove"); ret = mc_db_util_remove_db(uid); @@ -803,10 +813,10 @@ gpointer mc_svc_thread(gpointer data) } /* Reset database */ - ret = _mc_service_reset_db(uid); + ret = __mc_service_reset_db(uid); if (ret != MEDIA_CONTROLLER_ERROR_NONE) { mc_error("Failed to reset database"); - _mc_service_deinit(mc_service_data); + __mc_service_deinit(mc_service_data); return FALSE; } @@ -814,22 +824,22 @@ gpointer mc_svc_thread(gpointer data) ret = mc_ipc_create_server_socket(MC_DB_UPDATE_PORT, &sockfd); if (ret != MEDIA_CONTROLLER_ERROR_NONE) { mc_error("Failed to create socket"); - _mc_service_deinit(mc_service_data); + __mc_service_deinit(mc_service_data); return FALSE; } ret = mc_cynara_enable_credentials_passing(sockfd); if (ret != MEDIA_CONTROLLER_ERROR_NONE) { mc_error("Failed to append socket options"); - _mc_service_deinit(mc_service_data); + __mc_service_deinit(mc_service_data); close(sockfd); return FALSE; } /* Register app_dead signal handler */ - if (aul_listen_app_dead_signal(_mc_service_app_dead_handler, mc_service_data) != AUL_R_OK) { + if (aul_listen_app_dead_signal(__mc_service_app_dead_handler, mc_service_data) != AUL_R_OK) { mc_error("Failed to register app_dead signal"); - _mc_service_deinit(mc_service_data); + __mc_service_deinit(mc_service_data); close(sockfd); return FALSE; } @@ -848,7 +858,7 @@ gpointer mc_svc_thread(gpointer data) source = g_io_create_watch(channel, G_IO_IN); /* Set callback to be called when socket is readable */ - g_source_set_callback(source, (GSourceFunc)_mc_read_service_request_tcp_socket, mc_service_data, NULL); + g_source_set_callback(source, (GSourceFunc)__mc_read_service_request_tcp_socket, mc_service_data, NULL); g_source_attach(source, context); g_main_context_push_thread_default(context); @@ -865,7 +875,7 @@ gpointer mc_svc_thread(gpointer data) if (aul_listen_app_dead_signal(NULL, NULL) != AUL_R_OK) mc_error("Failed to unregister app_dead signal"); - _mc_service_deinit(mc_service_data); + __mc_service_deinit(mc_service_data); /* Free resources */ g_io_channel_shutdown(channel, FALSE, NULL);