Reduce log to make easy to read 98/202298/2
authorYu <jiung.yu@samsung.com>
Wed, 27 Mar 2019 01:54:06 +0000 (10:54 +0900)
committerYu <jiung.yu@samsung.com>
Wed, 27 Mar 2019 02:07:02 +0000 (11:07 +0900)
Change-Id: Ibe2b16d0b2e02504cd615248dd40daf75b5103b0
Signed-off-by: Yu Jiung <jiung.yu@samsung.com>
packaging/inm-manager.spec
src/inm-congestion-mon.c
src/inm-connman-service.c
src/inm-netlink.c
src/inm-rtnl.c
src/inm-telephony.c
src/inm-util.c

index d6aaf2e7f4a8946d343ac258d0162c2a4d86b93a..f0ad41123846e15af56ca5ddda20c7188807d5a6 100644 (file)
@@ -1,6 +1,6 @@
 Name:       inm-manager
 Summary:    INM(Intelligent Network Monitoring) daemon
-Version:    0.0.17
+Version:    0.0.18
 Release:    1
 Group:      Network & Connectivity/Other
 License:    Apache-2.0
index 7ee1db921ac7e42e29bd3f459451a1ab86c6cc71..261b8af08f850c42536c753c5b1d9c77e6ca0a37 100644 (file)
@@ -119,7 +119,9 @@ static int __inm_check_congestion_status(int *status)
        double tcp_retrans_data =   curr_retrans - prev_retrans ;
        double tcp_trans_data = curr_transmit - prev_transmit;
 
-       INM_LOGI("transmitted %lf retarnsmitted %lf after 10 seconds", tcp_trans_data, tcp_retrans_data);
+       INM_LOGI("transmitted %lf retarnsmitted %lf after 10 seconds",
+                       tcp_trans_data,
+                       tcp_retrans_data);
 
        if (tcp_retrans_data == 0 && tcp_trans_data == 0)
                INM_LOGI("Tcp data is not transmitted yet.");
@@ -128,7 +130,7 @@ static int __inm_check_congestion_status(int *status)
        else
                retrans_rate = (tcp_retrans_data/tcp_trans_data) * 100;
 
-       if(buffer)
+       if (buffer)
                free(buffer);
        *status = retrans_rate;
        return 0;
index 990bbe14d8ecba156b688cedc1795202da348b3b..8e2720c5142736315bd2c77466c1fdc00ab02913 100644 (file)
@@ -1731,7 +1731,6 @@ static void __service_property_changed(const gchar *sender_name,
        GVariant *value = NULL;
        connman_service_s *service = NULL;
 
-       __INM_FUNC_ENTER__;
        service = g_hash_table_lookup(service_tbl, object_path);
        if (!service) {
                __INM_FUNC_EXIT__;
@@ -1747,7 +1746,6 @@ static void __service_property_changed(const gchar *sender_name,
        inm_connman_service_write(object_path, TRUE);
 
        g_variant_unref(value);
-       __INM_FUNC_EXIT__;
 }
 
 static inline void __add_wifi_priv_info(connman_service_s *service, GVariantIter *iter)
@@ -1755,23 +1753,18 @@ static inline void __add_wifi_priv_info(connman_service_s *service, GVariantIter
        const gchar *key = NULL;
        GVariant *value = NULL;
 
-       __INM_FUNC_ENTER__;
-       if (!service || !iter) {
-               __INM_FUNC_EXIT__;
+       if (!service || !iter)
                return;
-       }
 
        while (g_variant_iter_loop(iter, "{sv}", &key, &value))
                __fill_sec_info(key, value, service);
 
-       __INM_FUNC_EXIT__;
        return;
 }
 
 static inline void __add_cell_priv_info(connman_service_s *service)
 {
        int ret = 0;
-       __INM_FUNC_ENTER__;
 
        if (!service)
                return;
@@ -1781,7 +1774,6 @@ static inline void __add_cell_priv_info(connman_service_s *service)
        if (ret < 0)
                INM_LOGI("get pdp profile failed");
 
-       __INM_FUNC_EXIT__;
        return;
 }
 
@@ -1870,8 +1862,6 @@ void inm_connman_service_add(gchar *path, GVariantIter *iter, GVariantBuilder *a
        connman_service_s *service = NULL;
        gchar *key = NULL;
 
-       __INM_FUNC_ENTER__;
-
        if (!path || ! iter) {
                INM_LOGW("NULL path or iter");
                return;
@@ -1895,7 +1885,6 @@ void inm_connman_service_add(gchar *path, GVariantIter *iter, GVariantBuilder *a
                PRINT_LOG("<Connman service %s:Property changed>", path);
 
        inm_connman_service_write(path, TRUE);
-       __INM_FUNC_EXIT__;
        return;
 }
 
index 013e62949d4f4737f4a27050455774cce12c41a2..194b99dddbef43af3501da435ff5a358b0ddf8ba 100644 (file)
@@ -334,8 +334,11 @@ static gboolean __inm_netlink_event(GIOChannel *channel, GIOCondition cond, gpoi
 
        fd = g_io_channel_unix_get_fd(channel);
 
+       INM_LOGI("Net link event");
        length = recvfrom(fd, buf, sizeof(buf), 0,
                        (struct sockaddr *)&nladdr, &addr_len);
+
+       INM_LOGI("%d received", length);
        if (length < 0) {
                strerror_r(errno, error_buf, MAX_SIZE_ERROR_BUFFER);
                INM_LOGE("Failed to get netlink message [error: %s]", error_buf);
@@ -891,8 +894,6 @@ fail:
 
 static gboolean __inmmanager_send_netlink_cmd(gpointer user_data)
 {
-       __INM_FUNC_ENTER__;
-
        int err;
        struct nl_msg *msg;
        inmmanager_mon_data_s *data = (inmmanager_mon_data_s*)user_data;
@@ -900,7 +901,6 @@ static gboolean __inmmanager_send_netlink_cmd(gpointer user_data)
 
        if (data->timer_source_id == 0) {
                INM_LOGI("monitoring stopped, timer_source_id: %d.", data->timer_source_id);
-               __INM_FUNC_EXIT__;
                return FALSE;
        }
 
@@ -908,7 +908,6 @@ static gboolean __inmmanager_send_netlink_cmd(gpointer user_data)
        msg = nlmsg_alloc();
        if (msg == NULL) {
                INM_LOGE("Failed to allocate netlink message");
-               __INM_FUNC_EXIT__;
                return FALSE;
        }
 
@@ -953,9 +952,9 @@ static gboolean __inmmanager_send_netlink_cmd(gpointer user_data)
        while (err > 0)
                nl_recvmsgs(global->socket, global->cb);
 
+       INM_LOGI("Kernel message received");
 out:
        nlmsg_free(msg);
-       __INM_FUNC_EXIT__;
        return TRUE;
 }
 
index 0c2d0ff0da3ec421996e9d7714f1535aaca82910..6d08f7881ed0e4ccd9f8464536847580b8d832b6 100644 (file)
@@ -297,7 +297,6 @@ static inline void __link_add(inm_rtnl_link_s *p_link)
        GList *p_list;
        inm_rtnl_link_s *tmp = NULL;
 
-       __INM_FUNC_ENTER__;
        p_list = g_list_find_custom(g_list_links,
                        p_link,
                        __link_compare);
@@ -309,13 +308,11 @@ static inline void __link_add(inm_rtnl_link_s *p_link)
                tmp = (inm_rtnl_link_s *)g_try_malloc0(sizeof(inm_rtnl_link_s));
                if (!tmp) {
                        INM_LOGE("link allocation failed");
-                       __INM_FUNC_EXIT__;
                        return;
                }
                __link_copy(p_link, tmp);
                g_list_links = g_list_prepend(g_list_links, tmp);
        }
-       __INM_FUNC_EXIT__;
 }
 
 static inline void __link_remove(inm_rtnl_link_s *p_link)
@@ -323,7 +320,6 @@ static inline void __link_remove(inm_rtnl_link_s *p_link)
        GList *p_list;
        inm_rtnl_link_s *tmp = NULL;
 
-       __INM_FUNC_ENTER__;
        p_list = g_list_find_custom(g_list_links,
                        p_link,
                        __link_compare);
@@ -333,7 +329,6 @@ static inline void __link_remove(inm_rtnl_link_s *p_link)
                g_list_links = g_list_remove(g_list_links, p_list->data);
                __link_destroy(tmp);
        }
-       __INM_FUNC_EXIT__;
 }
 
 static void __link_recv_cb(int action,
@@ -341,17 +336,13 @@ static void __link_recv_cb(int action,
                void *user_data)
 {
        inm_rtnl_link_s *p_link = NULL;
-       __INM_FUNC_ENTER__;
 
-       if (!obj) {
-               __INM_FUNC_EXIT__;
+       if (!obj)
                return;
-       }
 
        p_link = (inm_rtnl_link_s *)g_try_malloc0(sizeof(inm_rtnl_link_s));
        if (!p_link) {
                INM_LOGE("link mem alloc failed");
-               __INM_FUNC_EXIT__;
                return;
        }
 
@@ -363,28 +354,22 @@ static void __link_recv_cb(int action,
 
        __link_destroy(p_link);
 
+       INM_LOGI("Link cache received");
        util_foreach_nl_data(&(nl_data_arr[INM_UTIL_RTNL_TYPE_LINK]),
                        rtnl_obj_cbs[INM_UTIL_RTNL_TYPE_LINK].foreach_cb,
                        rtnl_obj_cbs[INM_UTIL_RTNL_TYPE_LINK].user_data);
-
-       __INM_FUNC_EXIT__;
 }
 
 static void __link_foreach_cb(struct nl_object *obj, void *user_data)
 {
        inm_rtnl_link_s *p_link;
 
-       __INM_FUNC_ENTER__;
-
-       if (!obj) {
-               __INM_FUNC_EXIT__;
+       if (!obj)
                return;
-       }
 
        p_link = (inm_rtnl_link_s *)g_try_malloc0(sizeof(inm_rtnl_link_s));
        if (!p_link) {
                INM_LOGE("link mem alloc failed");
-               __INM_FUNC_EXIT__;
                return;
        }
 
@@ -393,8 +378,6 @@ static void __link_foreach_cb(struct nl_object *obj, void *user_data)
        __link_destroy(p_link);
 
        __rtnl_link_log((struct rtnl_link *)obj);
-
-       __INM_FUNC_EXIT__;
 }
 
 static inline void __rtnl_addr_log(struct rtnl_addr *p_rtnl_addr)
@@ -553,18 +536,14 @@ static void __addr_recv_cb(int action,
                struct nl_object *obj,
                void *user_data)
 {
-       __INM_FUNC_ENTER__;
        inm_rtnl_addr_s *p_addr = NULL;
 
-       if (!obj) {
-               __INM_FUNC_EXIT__;
+       if (!obj)
                return;
-       }
 
        p_addr = (inm_rtnl_addr_s *)g_try_malloc0(sizeof(inm_rtnl_addr_s));
        if (!p_addr) {
                INM_LOGE("addr mem alloc failed");
-               __INM_FUNC_EXIT__;
                return;
        }
 
@@ -576,27 +555,22 @@ static void __addr_recv_cb(int action,
 
        __addr_destroy(p_addr);
 
+       INM_LOGI("Addr cache received");
        util_foreach_nl_data(&(nl_data_arr[INM_UTIL_RTNL_TYPE_ADDR]),
                        rtnl_obj_cbs[INM_UTIL_RTNL_TYPE_ADDR].foreach_cb,
                        rtnl_obj_cbs[INM_UTIL_RTNL_TYPE_ADDR].user_data);
-
-       __INM_FUNC_EXIT__;
 }
 
 static void __addr_foreach_cb(struct nl_object *obj, void *user_data)
 {
-       __INM_FUNC_ENTER__;
 
        inm_rtnl_addr_s *p_addr = NULL;
-       if (!obj) {
-               __INM_FUNC_EXIT__;
+       if (!obj)
                return;
-       }
 
        p_addr = (inm_rtnl_addr_s *)g_try_malloc0(sizeof(inm_rtnl_addr_s));
        if (!p_addr) {
                INM_LOGE("addr mem alloc failed");
-               __INM_FUNC_EXIT__;
                return;
        }
 
@@ -605,8 +579,6 @@ static void __addr_foreach_cb(struct nl_object *obj, void *user_data)
        __addr_destroy(p_addr);
 
        __rtnl_addr_log((struct rtnl_addr *)obj);
-
-       __INM_FUNC_EXIT__;
 }
 
 static inline void __rtnl_neigh_log(struct rtnl_neigh *p_rtnl_neigh)
@@ -764,16 +736,12 @@ static void __neigh_recv_cb(int action,
 {
        inm_rtnl_neigh_s *p_neigh = NULL;
 
-       __INM_FUNC_ENTER__;
-       if (!obj) {
-               __INM_FUNC_EXIT__;
+       if (!obj)
                return;
-       }
 
        p_neigh = (inm_rtnl_neigh_s *)g_try_malloc0(sizeof(inm_rtnl_neigh_s));
        if (!p_neigh) {
                INM_LOGE("neigh mem alloc failed");
-               __INM_FUNC_EXIT__;
                return;
        }
 
@@ -785,27 +753,22 @@ static void __neigh_recv_cb(int action,
 
        __neigh_destroy(p_neigh);
 
+       INM_LOGI("Neigh cache received");
        util_foreach_nl_data(&(nl_data_arr[INM_UTIL_RTNL_TYPE_NEIGH]),
                        rtnl_obj_cbs[INM_UTIL_RTNL_TYPE_NEIGH].foreach_cb,
                        rtnl_obj_cbs[INM_UTIL_RTNL_TYPE_NEIGH].user_data);
-
-       __INM_FUNC_EXIT__;
 }
 
 static void __neigh_foreach_cb(struct nl_object *obj, void *user_data)
 {
        inm_rtnl_neigh_s *p_neigh = NULL;
 
-       __INM_FUNC_ENTER__;
-       if (!obj) {
-               __INM_FUNC_EXIT__;
+       if (!obj)
                return;
-       }
 
        p_neigh = (inm_rtnl_neigh_s *)g_try_malloc0(sizeof(inm_rtnl_neigh_s));
        if (!p_neigh) {
                INM_LOGE("neigh mem alloc failed");
-               __INM_FUNC_EXIT__;
                return;
        }
 
@@ -814,8 +777,6 @@ static void __neigh_foreach_cb(struct nl_object *obj, void *user_data)
        __neigh_destroy(p_neigh);
 
        __rtnl_neigh_log((struct rtnl_neigh *)obj);
-
-       __INM_FUNC_EXIT__;
 }
 
 static void __next_hop_log_cb(struct rtnl_nexthop *nh, void *data)
@@ -1020,16 +981,12 @@ static void __route_recv_cb(int action,
 {
        inm_rtnl_route_s *p_route = NULL;
 
-       __INM_FUNC_ENTER__;
-       if (!obj) {
-               __INM_FUNC_EXIT__;
+       if (!obj)
                return;
-       }
 
        p_route = (inm_rtnl_route_s *)g_try_malloc0(sizeof(inm_rtnl_route_s));
        if (!p_route) {
                INM_LOGE("route mem alloc failed");
-               __INM_FUNC_EXIT__;
                return;
        }
 
@@ -1041,27 +998,22 @@ static void __route_recv_cb(int action,
 
        __route_destroy(p_route);
 
+       INM_LOGI("Route cache received");
        util_foreach_nl_data(&(nl_data_arr[INM_UTIL_RTNL_TYPE_ROUTE]),
                        rtnl_obj_cbs[INM_UTIL_RTNL_TYPE_ROUTE].foreach_cb,
                        rtnl_obj_cbs[INM_UTIL_RTNL_TYPE_ROUTE].user_data);
-
-       __INM_FUNC_EXIT__;
 }
 
 static void __route_foreach_cb(struct nl_object *obj, void *user_data)
 {
        inm_rtnl_route_s *p_route = NULL;
 
-       __INM_FUNC_ENTER__;
-       if (!obj) {
-               __INM_FUNC_EXIT__;
+       if (!obj)
                return;
-       }
 
        p_route = (inm_rtnl_route_s *)g_try_malloc0(sizeof(inm_rtnl_route_s));
        if (!p_route) {
                INM_LOGE("route mem alloc failed");
-               __INM_FUNC_EXIT__;
                return;
        }
 
@@ -1070,8 +1022,6 @@ static void __route_foreach_cb(struct nl_object *obj, void *user_data)
        __route_destroy(p_route);
 
        __rtnl_route_log((struct rtnl_route *)obj);
-
-       __INM_FUNC_EXIT__;
 }
 
 static void __clear_all_nl_data()
index e129516b9789ab5b39715efcca0dcc8592bd1313..a71395a919eba18ac5028f23258217621c9acd8b 100644 (file)
@@ -59,7 +59,6 @@ static void __get_modem_properties(GVariant *reply, gpointer user_data)
        GVariantIter *modem_properties = NULL;
        GSList **modem_path_list;
        const char *modem_path;
-       __INM_FUNC_ENTER__;
 
        if (!reply || !user_data)
                return;
@@ -74,7 +73,6 @@ static void __get_modem_properties(GVariant *reply, gpointer user_data)
 
        g_variant_iter_free(iter);
 
-       __INM_FUNC_EXIT__;
        return;
 }
 
@@ -82,7 +80,6 @@ static int __get_modem_object_path(GSList **modem_path_list)
 {
 
        int ret = 0;
-       __INM_FUNC_ENTER__;
        method_param_s tel_method_params = {
                .bus_name = TELEPHONY_SERVICE,
                .object_path = TELEPHONY_MASTER_PATH,
@@ -97,11 +94,9 @@ static int __get_modem_object_path(GSList **modem_path_list)
                        (gpointer)modem_path_list);
        if (ret != INM_GDBUS_ERROR_NONE) {
                INM_LOGE("Failed to get modem paths");
-               __INM_FUNC_EXIT__;
                return -1;
        }
 
-       __INM_FUNC_EXIT__;
        return 0;
 }
 
@@ -181,7 +176,6 @@ static int __get_profile_names(inm_profile_name_s **profile_names,
 
        profile_list = __get_profile_list();
        count = g_slist_length(profile_list);
-       INM_LOGI("[%d] profile found", count);
        if (count > 0) {
                p_profile_name = (inm_profile_name_s*)g_try_malloc0(sizeof(inm_profile_name_s) * count);
                ret = 0;
@@ -207,7 +201,6 @@ static int __get_profile_names(inm_profile_name_s **profile_names,
 out:
        g_slist_free_full(profile_list, g_free);
 
-       __INM_FUNC_EXIT__;
        return ret;
 }
 
@@ -218,21 +211,13 @@ static int __find_matching_profile(char *profile_name, inm_profile_name_s *profi
        gchar *str_ptr = NULL;
        int i = 0;
 
-       INM_LOGI("search connman profile name[%s] from %d list",
-                       profile_name, profile_cnt);
        connman_profile_name = strrchr(profile_name, '/') + 1;
        for (i = 0; i < profile_cnt; i++) {
                telephony_profile_name = strrchr(profile_list[i].profile_name, '/') + 1;
                str_ptr = strstr(connman_profile_name, telephony_profile_name);
 
-               if (str_ptr != NULL && g_strcmp0(str_ptr, telephony_profile_name) == 0) {
-
-                       INM_LOGI("PDP profile name found in cellular profile: %s, %d",
-                                       telephony_profile_name, i);
+               if (str_ptr != NULL && g_strcmp0(str_ptr, telephony_profile_name) == 0)
                        break;
-               } else {
-                       INM_LOGI("[%s] not matched", telephony_profile_name);
-               }
        }
 
        return i;
@@ -246,20 +231,16 @@ static int __search_pdp_profile(char* profile_name, inm_telephony_profile_s *pro
        int profile_cnt = 0;
        int idx = 0;
 
-       __INM_FUNC_ENTER__;
-
        /* Get pdp profile list from telephony service */
        ret = __get_profile_names(&profile_list, &profile_cnt);
        if (ret < 0) {
                INM_LOGW("Failed to get profile list from telephony service");
-               __INM_FUNC_EXIT__;
                return -1;
        }
 
        if (profile_list == NULL || profile_cnt <= 0) {
                INM_LOGW("There is no PDP profiles");
                g_free(profile_list);
-               __INM_FUNC_EXIT__;
                return -1;
        }
 
@@ -274,7 +255,6 @@ static int __search_pdp_profile(char* profile_name, inm_telephony_profile_s *pro
 
        g_free(profile_list);
 
-       __INM_FUNC_EXIT__;
        return ret;
 }
 
@@ -454,11 +434,9 @@ static void __get_profile_properties(GVariant *reply, gpointer user_data)
 static int __get_profile_info(inm_telephony_profile_s *profile_info)
 {
        int ret = 0;
-       __INM_FUNC_ENTER__;
 
        if (profile_info == NULL) {
                INM_LOGW("Invalid parameter!");
-               __INM_FUNC_EXIT__;
                return -1;
        }
 
@@ -478,11 +456,9 @@ static int __get_profile_info(inm_telephony_profile_s *profile_info)
                        (gpointer)profile_info);
        if (ret != INM_GDBUS_ERROR_NONE) {
                INM_LOGE("Failed to get profile");
-               __INM_FUNC_EXIT__;
                return -1;
        }
 
-       __INM_FUNC_EXIT__;
        return 0;
 }
 
index 573cb3d1ae277f9e9350455390c9a4d638ce795b..4270492dd47efce38d84a47e5028e0ebaa61faeb 100644 (file)
@@ -862,22 +862,23 @@ static  void __rtnl_cache_change_cb(struct nl_cache *cache,
 {
        inm_util_nl_data_s *nl_data = NULL;
 
-       __INM_FUNC_ENTER__;
        if (!obj)
                return;
 
-       if (action == NL_ACT_NEW)
+       if (action == NL_ACT_NEW) {
+               INM_LOGI("Added");
                PRINT_LOG("<Netlink cache object action:Add>");
-       else if (action == NL_ACT_DEL)
+       } else if (action == NL_ACT_DEL) {
+               INM_LOGI("Deleted");
                PRINT_LOG("<Netlink cache object action:Delete>");
-       else if (action == NL_ACT_CHANGE)
+       } else if (action == NL_ACT_CHANGE) {
+               INM_LOGI("Changed");
                PRINT_LOG("<Netlink cache object action:Change>");
+       }
 
        nl_data = (inm_util_nl_data_s *)data;
        if (nl_data->obj_recv_func)
                nl_data->obj_recv_func(action, obj, nl_data->user_data);
-
-       __INM_FUNC_EXIT__;
 }
 
 static gboolean __nl_cache_cb(GIOChannel *source,
@@ -885,18 +886,15 @@ static gboolean __nl_cache_cb(GIOChannel *source,
 {
        struct nl_cache_mngr * p_nl_cm = NULL;
        int res = 0;
-       __INM_FUNC_ENTER__;
 
        if (!data) {
-               __INM_FUNC_EXIT__;
+               INM_LOGE("Data lost");
                return TRUE;
        }
 
        p_nl_cm = (struct nl_cache_mngr *)data;
        res = nl_cache_mngr_data_ready(p_nl_cm);
-       INM_LOGI("%d res nl_cache_mngr_data_ready", res);
-
-       __INM_FUNC_EXIT__;
+       INM_LOGI("%d message processed", res);
 
        return TRUE;
 }
@@ -1099,10 +1097,8 @@ void util_foreach_nl_data(inm_util_nl_data_s *nl_data,
        int nl_cache_cnt;
        int i;
 
-       __INM_FUNC_ENTER__;
        if (!cb || !nl_data || !nl_data->p_nl_mgr_cache || !nl_data->p_nl_mgr) {
                INM_LOGW("Null data");
-               __INM_FUNC_EXIT__;
                return;
        }
 
@@ -1117,7 +1113,6 @@ void util_foreach_nl_data(inm_util_nl_data_s *nl_data,
                cb(p_nl_obj, user_data);
        }
 
-       __INM_FUNC_EXIT__;
        return;
 }