From: Suresh Kumar Narasimhaiah Date: Fri, 15 Mar 2013 17:16:32 +0000 (+0530) Subject: Telephony Daemon upgradation to New Design. X-Git-Tag: 2.1b_release~1 X-Git-Url: http://review.tizen.org/git/?p=platform%2Fcore%2Ftelephony%2Ftelephony-daemon.git;a=commitdiff_plain;h=09f9e8ae406bbd111c72bc11e1d7f9f479ebc6a2 Telephony Daemon upgradation to New Design. --- diff --git a/src/main.c b/src/main.c index 91b1d7b..d2f3bc7 100644 --- a/src/main.c +++ b/src/main.c @@ -73,11 +73,11 @@ static gboolean load_plugins(Server *s, const char *path, int flag_test_load) TcorePlugin *p; struct tcore_plugin_define_desc *desc; - if (!path || !s) + if ((path == NULL) || (s == NULL)) return FALSE; dir = g_dir_open(path, 0, NULL); - if (!dir) + if (dir == NULL) return FALSE; while ((file = g_dir_read_name(dir)) != NULL) { @@ -102,7 +102,7 @@ static gboolean load_plugins(Server *s, const char *path, int flag_test_load) } desc = dlsym(handle, "plugin_define_desc"); - if (!desc) { + if (desc == NULL) { dbg("fail to load symbol: %s", dlerror()); dlclose(handle); g_free(filename); @@ -146,17 +146,17 @@ static gboolean load_plugins(Server *s, const char *path, int flag_test_load) list = tcore_server_ref_plugins(s); for (; list; list = list->next) { p = list->data; - if (!p) + if (p == NULL) continue; desc = (struct tcore_plugin_define_desc *)tcore_plugin_get_description(p); - if (!desc) + if (desc == NULL) continue; - if (!desc->init) + if (desc->init == NULL) continue; - if (!desc->init(p)) { + if (desc->init(p) == FALSE) { dbg("plugin(%s) init failed.", tcore_plugin_get_filename(p)); } } @@ -177,7 +177,7 @@ static void usage(const char *name) static void on_signal_usr1(int signo) { - if (!_server) + if (_server == NULL) return; monitor_server_state(_server); @@ -221,7 +221,7 @@ int main(int argc, char *argv[]) while (1) { opt = getopt_long(argc, argv, "hT", options, &opt_index); - if (-1 == opt) + if (opt == -1) break; switch (opt) { @@ -258,13 +258,13 @@ int main(int argc, char *argv[]) #endif s = tcore_server_new(); - if (!s) { + if (s == NULL) { err("server_new failed."); goto end; } _server = s; - if (!load_plugins(s, plugin_path, flag_test_load)) + if (load_plugins(s, plugin_path, flag_test_load) == FALSE) goto free_end; if (flag_test_load) diff --git a/src/monitor.c b/src/monitor.c index 9981143..37f8ff1 100644 --- a/src/monitor.c +++ b/src/monitor.c @@ -41,7 +41,7 @@ #include "monitor.h" -/* hacking TcoreQueue */ +/* Hacking TcoreQueue */ struct tcore_queue_type { TcorePlugin *plugin; GQueue *gq; @@ -56,7 +56,7 @@ static void _monitor_plugin(Server *s) msg("-- Plugins --"); list = tcore_server_ref_plugins(s); - if (!list) + if (list == NULL) return; do { @@ -86,7 +86,7 @@ static void _monitor_storage(Server *s) msg("-- Storages --"); list = tcore_server_ref_storages(s); - if (!list) + if (list == NULL) return; do { @@ -105,10 +105,10 @@ static void _monitor_communicator(Server *s) GSList *list; Communicator *comm; - msg("-- Coomunicators --"); + msg("-- Communicators --"); list = tcore_server_ref_communicators(s); - if (!list) + if (list == NULL) return; do { @@ -124,65 +124,23 @@ static void _monitor_communicator(Server *s) } while(list); } -static void _monitor_hal(Server *s) +static void _monitor_modems(Server *s) { GSList *list; - TcoreHal *h; - TcoreQueue *q; - TcorePending *pending; - UserRequest *ur; - char *str; - int qlen; - int i; - void *data; - unsigned int data_len; + TcorePlugin *p; - msg("-- Hals --"); + msg("-- Modems --"); - list = tcore_server_ref_hals(s); - if (!list) + list = tcore_server_ref_plugins(s); + if (list == NULL) return; do { - h = list->data; - - str = tcore_hal_get_name(h); - msg("Name: [%s]", str); - msg(" - addr: %p", h); - msg(" - parent_plugin: %p", tcore_hal_ref_plugin(h)); - msg(" - userdata: %p", tcore_hal_ref_user_data(h)); - - q = tcore_hal_ref_queue(h); - if (!q) { - msg(""); - list = list->next; - continue; - } - - if (!(q->gq)) { - msg(""); - list = list->next; + p = list->data; + if (p == NULL) continue; - } - - qlen = tcore_queue_get_length(q); - msg(" - queue: %p, length: %d", q, qlen); - msg(" queue_head: %p", g_queue_peek_head(q->gq)); - for (i = 0; i < qlen; i++) { - pending = g_queue_peek_nth(q->gq, i); - ur = tcore_pending_ref_user_request(pending); - msg(" [%02d] pending=%p, id=0x%x, ur=%p", i, pending, tcore_pending_get_id(pending), ur); - if (ur) { - msg(" ur request command = 0x%x", tcore_user_request_get_command(ur)); - } - data_len = 0; - data = tcore_pending_ref_request_data(pending, &data_len); - msg(" data=%p, data_len=%d", data, data_len); - } - msg(" queue_tail: %p", g_queue_peek_tail(q->gq)); - msg(""); - list = list->next; + tcore_server_print_modems(p); } while(list); } @@ -191,5 +149,5 @@ void monitor_server_state(Server *s) _monitor_plugin(s); _monitor_storage(s); _monitor_communicator(s); - _monitor_hal(s); + _monitor_modems(s); }