From: Jiwan Kim Date: Tue, 13 Jun 2017 07:22:11 +0000 (+0900) Subject: Fix to follow coding style X-Git-Tag: accepted/tizen/unified/20170829.053204~29 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=80f0a188a6691fd155759f152ab7bcced9daca6a;p=platform%2Fcore%2Fconnectivity%2Fwifi-mesh-manager.git Fix to follow coding style --- diff --git a/src/mesh-bridge.c b/src/mesh-bridge.c index 12c368a..45999cb 100644 --- a/src/mesh-bridge.c +++ b/src/mesh-bridge.c @@ -239,8 +239,9 @@ int mesh_bridge_set_stp(const char* bridge_name, bool state) char str_error[ERROR_MESSAGE_LENGTH]; int stp_state = (state) ? 1 : 0; struct ifreq ifr; - unsigned long arg[4] = - { BRCTL_SET_BRIDGE_STP_STATE, stp_state, 0, 0 }; + unsigned long arg[4] = { + BRCTL_SET_BRIDGE_STP_STATE, + stp_state, 0, 0 }; if (NULL == bridge_name || strlen(bridge_name) > IFNAMSIZ) { MESH_LOGE("Invalid parameter [%p]", bridge_name); diff --git a/src/mesh-gdbus.c b/src/mesh-gdbus.c index 19c7683..209e0ff 100644 --- a/src/mesh-gdbus.c +++ b/src/mesh-gdbus.c @@ -471,8 +471,7 @@ int mesh_gdbus_mesh_scan(mesh_service *service) return MESHD_ERROR_NONE; } -int mesh_gdbus_mesh_specific_scan(mesh_service *service, gchar *mesh_id, - gint channel) +int mesh_gdbus_mesh_specific_scan(mesh_service *service, gchar *mesh_id, gint channel) { GVariant *variant = NULL; GError *error = NULL; @@ -591,15 +590,13 @@ static void _get_joined_network(mesh_service *service, GVariant *variant) } while (g_variant_iter_loop(property, "{sv}", &key, &val)) { - if (strcasecmp(key, "Name") == 0) { + if (strcasecmp(key, "Name") == 0) { buf = g_variant_get_string(val, &len); joined_info->mesh_id = g_strdup(buf); - } - else if (strcasecmp(key, "BSSID") == 0) { + } else if (strcasecmp(key, "BSSID") == 0) { buf = g_variant_get_string(val, &len); joined_info->bssid = g_strdup(buf); - } - else if (strcasecmp(key, "State") == 0) { + } else if (strcasecmp(key, "State") == 0) { buf = g_variant_get_string(val, &len); MESH_LOGD(" State : %s", buf); @@ -616,15 +613,13 @@ static void _get_joined_network(mesh_service *service, GVariant *variant) } else if (g_strcmp0(buf, "ready") == 0 || g_strcmp0(buf, "online") == 0) { joined_info->state = MESHD_CONNECTION_STATE_CONNECTED; } - } - else if (strcasecmp(key, "Security") == 0) { + } else if (strcasecmp(key, "Security") == 0) { buf = g_variant_get_string(val, &len); if (g_strcmp0("sae", buf) == 0) joined_info->security = MESHD_SECURITY_SAE; else joined_info->security = MESHD_SECURITY_NONE; - } - else if (strcasecmp(key, "Frequency") == 0) { + } else if (strcasecmp(key, "Frequency") == 0) { joined_info->channel = __frequency_to_channel(g_variant_get_uint16(val)); } } @@ -681,17 +676,15 @@ static void _get_mesh_peers(mesh_service *service, GVariant *variant) scan_info->object_path = g_strdup(obj_path); while (g_variant_iter_loop(property, "{sv}", &key, &val)) { - if (strcasecmp(key, "Name") == 0) { + if (strcasecmp(key, "Name") == 0) { const char *buf = g_variant_get_string(val, &len); scan_info->mesh_id = g_strdup(buf); MESH_LOGD(" Mesh ID : %s", scan_info->mesh_id); - } - else if (strcasecmp(key, "BSSID") == 0) { + } else if (strcasecmp(key, "BSSID") == 0) { const char *buf = g_variant_get_string(val, &len); scan_info->bssid = g_strdup(buf); MESH_LOGD(" BSSID : %s", scan_info->bssid); - } - else if (strcasecmp(key, "State") == 0) { + } else if (strcasecmp(key, "State") == 0) { const char *buf = g_variant_get_string(val, &len); MESH_LOGD(" State : %s", buf); @@ -706,24 +699,20 @@ static void _get_mesh_peers(mesh_service *service, GVariant *variant) } else if (g_strcmp0(buf, "ready") == 0 || g_strcmp0(buf, "online") == 0) { scan_info->state = MESHD_CONNECTION_STATE_CONNECTED; } - } - else if (strcasecmp(key, "Security") == 0) { + } else if (strcasecmp(key, "Security") == 0) { const char *buf = g_variant_get_string(val, &len); MESH_LOGD(" Security : %s", buf); if (g_strcmp0("sae", buf) == 0) scan_info->security = MESHD_SECURITY_SAE; else scan_info->security = MESHD_SECURITY_NONE; - } - else if (strcasecmp(key, "Frequency") == 0) { + } else if (strcasecmp(key, "Frequency") == 0) { scan_info->channel = __frequency_to_channel(g_variant_get_uint16(val)); MESH_LOGD(" Channel : %d", scan_info->channel); - } - else if (strcasecmp(key, "Favorite") == 0) { + } else if (strcasecmp(key, "Favorite") == 0) { const char *buf = g_variant_get_string(val, &len); MESH_LOGD(" Favorite : %s", buf); - } - else if (strcasecmp(key, "Strength") == 0) { + } else if (strcasecmp(key, "Strength") == 0) { scan_info->rssi = (gint)g_variant_get_byte(val); MESH_LOGD(" RSSI : %d", scan_info->rssi); } @@ -896,17 +885,15 @@ static void _get_mesh_property(GVariant *variant, mesh_network_info_s *result) g_variant_get(variant, "(a{sv})", &property); while (g_variant_iter_loop(property, "{sv}", &key, &val)) { - if (strcasecmp(key, "Name") == 0) { + if (strcasecmp(key, "Name") == 0) { const char *buf = g_variant_get_string(val, &len); result->mesh_id = g_strdup(buf); MESH_LOGD(" Mesh ID : %s", result->mesh_id); - } - else if (strcasecmp(key, "BSSID") == 0) { + } else if (strcasecmp(key, "BSSID") == 0) { const char *buf = g_variant_get_string(val, &len); result->bssid = g_strdup(buf); MESH_LOGD(" BSSID : %s", result->bssid); - } - else if (strcasecmp(key, "State") == 0) { + } else if (strcasecmp(key, "State") == 0) { const char *buf = g_variant_get_string(val, &len); MESH_LOGD(" State : %s", buf); @@ -921,24 +908,20 @@ static void _get_mesh_property(GVariant *variant, mesh_network_info_s *result) } else if (g_strcmp0(buf, "ready") == 0 || g_strcmp0(buf, "online") == 0) { result->state = MESHD_CONNECTION_STATE_CONNECTED; } - } - else if (strcasecmp(key, "Security") == 0) { + } else if (strcasecmp(key, "Security") == 0) { const char *buf = g_variant_get_string(val, &len); MESH_LOGD(" Security : %s", buf); if (g_strcmp0("sae", buf) == 0) result->security = MESHD_SECURITY_SAE; else result->security = MESHD_SECURITY_NONE; - } - else if (strcasecmp(key, "Frequency") == 0) { + } else if (strcasecmp(key, "Frequency") == 0) { result->channel = __frequency_to_channel(g_variant_get_uint16(val)); MESH_LOGD(" Channel : %d", result->channel); - } - else if (strcasecmp(key, "Favorite") == 0) { + } else if (strcasecmp(key, "Favorite") == 0) { const char *buf = g_variant_get_string(val, &len); MESH_LOGD(" Favorite : %s", buf); - } - else if (strcasecmp(key, "Strength") == 0) { + } else if (strcasecmp(key, "Strength") == 0) { gint rssi = (gint)g_variant_get_byte(val); MESH_LOGD(" RSSI : %d", rssi); } @@ -1034,8 +1017,7 @@ int mesh_gdbus_create_network(mesh_service *service, gchar *mesh_id, return MESHD_ERROR_NONE; } -int mesh_gdbus_set_passphrase(mesh_service *service, mesh_scan_result_s *info, - gchar *passphrase) +int mesh_gdbus_set_passphrase(mesh_service *service, mesh_scan_result_s *info, gchar *passphrase) { GVariant *variant = NULL; GError *error = NULL; diff --git a/src/mesh-interface.c b/src/mesh-interface.c index bb63b17..0a9f4b7 100644 --- a/src/mesh-interface.c +++ b/src/mesh-interface.c @@ -316,9 +316,8 @@ int mesh_interface_check_external_exists(const char* external_interface, bool *s int ret = MESHD_ERROR_NONE; cable_state_e cable_state = ETHERNET_CABLE_DETACHED; - if (NULL == external_interface || NULL == state) { + if (NULL == external_interface || NULL == state) return MESHD_ERROR_INVALID_PARAMETER; - } bool ex = _check_interface_exists(external_interface); if (FALSE == ex) { @@ -336,9 +335,8 @@ int mesh_interface_check_external_exists(const char* external_interface, bool *s } *state = FALSE; - if (ETHERNET_CABLE_ATTACHED == cable_state) { + if (ETHERNET_CABLE_ATTACHED == cable_state) *state = TRUE; - } return MESHD_ERROR_NONE; -} \ No newline at end of file +} diff --git a/src/mesh-monitor.c b/src/mesh-monitor.c index abe15dc..da7a688 100644 --- a/src/mesh-monitor.c +++ b/src/mesh-monitor.c @@ -183,7 +183,7 @@ static gboolean _get_mpath_info(void *pdata) mpath_data = g_variant_builder_end(&builder); g_object_unref(mpath_data); - }else + } else MESH_LOGE("Failed to mesh_request_get_mpath_info"); return ret; diff --git a/src/mesh-netlink.c b/src/mesh-netlink.c index 110b0ac..9e2f82f 100644 --- a/src/mesh-netlink.c +++ b/src/mesh-netlink.c @@ -216,9 +216,8 @@ static int family_handler(struct nl_msg *msg, void *arg) nla_parse(tb, CTRL_ATTR_MAX, genlmsg_attrdata(gnlh, 0), genlmsg_attrlen(gnlh, 0), NULL); - if (!tb[CTRL_ATTR_MCAST_GROUPS]) { + if (!tb[CTRL_ATTR_MCAST_GROUPS]) return NL_SKIP; - } nla_for_each_nested(mcast_group, tb[CTRL_ATTR_MCAST_GROUPS], rem_mcast_group) { struct nlattr *tb_mcast_group[CTRL_ATTR_MCAST_GRP_MAX + 1]; @@ -408,7 +407,8 @@ static int valid_handler(struct nl_msg *msg, void *arg) return NL_SKIP; } -static int no_seq_check(struct nl_msg *msg, void *arg) { +static int no_seq_check(struct nl_msg *msg, void *arg) +{ NOTUSED(msg); NOTUSED(arg); @@ -489,9 +489,8 @@ static gboolean _on_socket_event_io_received(GIOChannel *source, MESH_LOGD("[Event] I/O received"); - while (nl_recvmsgs_report(state->nl_socket, state->cb) > 0) { + while (nl_recvmsgs_report(state->nl_socket, state->cb) > 0) MESH_LOGD(" count [%02d]", ++test); - } /* Do not remove I/O source */ return TRUE; @@ -499,7 +498,7 @@ static gboolean _on_socket_event_io_received(GIOChannel *source, static void _on_remove_event_io_handler() { - if(event_state) { + if (event_state) { g_source_remove(event_state->event_source); __clean_netlink_message(event_state); @@ -603,9 +602,8 @@ static void parse_bss_param(struct nlattr *bss_param_attr, mesh_station_info_s * [NL80211_STA_BSS_PARAM_BEACON_INTERVAL] = { .type = NLA_U16 }, }; - if (nla_parse_nested(bss_param_info, NL80211_STA_BSS_PARAM_MAX, bss_param_attr, bss_poilcy)) { + if (nla_parse_nested(bss_param_info, NL80211_STA_BSS_PARAM_MAX, bss_param_attr, bss_poilcy)) MESH_LOGE("failed to parse nested bss param attributes!"); - } info = bss_param_info[NL80211_STA_BSS_PARAM_DTIM_PERIOD]; if (info) { @@ -698,8 +696,7 @@ static int _on_receive_station_info(struct nl_msg *msg, void *arg) [NL80211_STA_INFO_TX_FAILED] = { .type = NLA_U32 }, [NL80211_STA_INFO_BEACON_LOSS] = { .type = NLA_U32}, [NL80211_STA_INFO_RX_DROP_MISC] = { .type = NLA_U64}, - [NL80211_STA_INFO_STA_FLAGS] = - { .minlen = sizeof(struct nl80211_sta_flag_update) }, + [NL80211_STA_INFO_STA_FLAGS] = { .minlen = sizeof(struct nl80211_sta_flag_update) }, [NL80211_STA_INFO_LOCAL_PM] = { .type = NLA_U32}, [NL80211_STA_INFO_PEER_PM] = { .type = NLA_U32}, [NL80211_STA_INFO_NONPEER_PM] = { .type = NLA_U32}, @@ -755,8 +752,7 @@ static int _on_receive_station_info(struct nl_msg *msg, void *arg) station_info->rx_bytes = (unsigned long long)nla_get_u64(sinfo[NL80211_STA_INFO_RX_BYTES64]); MESH_LOGE(" rx bytes:\t%llu", station_info->rx_bytes); - } - else if (sinfo[NL80211_STA_INFO_RX_BYTES]) { + } else if (sinfo[NL80211_STA_INFO_RX_BYTES]) { station_info->rx_bytes = nla_get_u32(sinfo[NL80211_STA_INFO_RX_BYTES]); MESH_LOGD(" rx bytes:\t%u", station_info->rx_bytes); @@ -771,8 +767,7 @@ static int _on_receive_station_info(struct nl_msg *msg, void *arg) station_info->tx_bytes = (unsigned long long)nla_get_u64(sinfo[NL80211_STA_INFO_TX_BYTES64]); MESH_LOGD(" tx bytes:\t%llu", station_info->rx_packets); - } - else if (sinfo[NL80211_STA_INFO_TX_BYTES]) { + } else if (sinfo[NL80211_STA_INFO_TX_BYTES]) { station_info->tx_bytes = nla_get_u32(sinfo[NL80211_STA_INFO_TX_BYTES]); MESH_LOGD(" tx bytes:\t%u", station_info->tx_bytes); @@ -1503,16 +1498,15 @@ static int _send_nl_register_event_handler() /* Set callbacks for event handler */ nl_cb_set(event_state->cb, NL_CB_VALID, NL_CB_CUSTOM, _on_receive_mesh_event, event_state); - // No sequence checking for multicast messages. + /* No sequence checking for multicast messages. */ nl_cb_set(event_state->cb, NL_CB_SEQ_CHECK, NL_CB_CUSTOM, no_seq_check, NULL); MESH_LOGD("Register event handler"); /* Change socket type to non-blocking */ ret = nl_socket_set_nonblocking(event_state->nl_socket); - if (ret < 0) { + if (ret < 0) MESH_LOGE("Failed to non-blocking socket [%s](%d)", nl_geterror(ret), ret); - } /* Register I/O callback to wait asynchronously */ if (FALSE == event_state->error_occured) { diff --git a/src/mesh-request.c b/src/mesh-request.c index 103235c..1acfc3b 100644 --- a/src/mesh-request.c +++ b/src/mesh-request.c @@ -49,7 +49,7 @@ int mesh_request_set_mesh_gate(const char* bridge_interface, if (state) { /* Turn STP on */ ret = mesh_bridge_set_stp(bridge_interface, TRUE); - if(MESHD_ERROR_NONE != ret) { + if (MESHD_ERROR_NONE != ret) { MESH_LOGE("Failed to turn STP on !"); return ret; } @@ -57,15 +57,13 @@ int mesh_request_set_mesh_gate(const char* bridge_interface, /* Set mesh parameters */ ret = mesh_netlink_set_mesh_parameter(mesh_interface, "mesh_hwmp_rootmode", 4); - if (MESHD_ERROR_NONE != ret) { + if (MESHD_ERROR_NONE != ret) MESH_LOGE("Failed to set [mesh_hwmp_rootmode] : 4"); - } ret = mesh_netlink_set_mesh_parameter(mesh_interface, "mesh_gate_announcements", 1); - if (MESHD_ERROR_NONE != ret) { + if (MESHD_ERROR_NONE != ret) MESH_LOGE("Failed to set [mesh_gate_announcements] : 1"); - } } else { MESH_LOGE("External interface is not available !"); return MESHD_ERROR_OPERATION_FAILED; @@ -84,19 +82,17 @@ int mesh_request_unset_mesh_gate(const char* bridge_interface, /* Set mesh parameters */ ret = mesh_netlink_set_mesh_parameter(mesh_interface, "mesh_hwmp_rootmode", 0); - if (MESHD_ERROR_NONE != ret) { + if (MESHD_ERROR_NONE != ret) MESH_LOGE("Failed to set [mesh_hwmp_rootmode] : 0"); - } ret = mesh_netlink_set_mesh_parameter(mesh_interface, "mesh_gate_announcements", 0); - if (MESHD_ERROR_NONE != ret) { + if (MESHD_ERROR_NONE != ret) MESH_LOGE("Failed to set [mesh_gate_announcements] : 0"); - } /* Turn STP off */ ret = mesh_bridge_set_stp(bridge_interface, FALSE); - if(MESHD_ERROR_NONE != ret) { + if (MESHD_ERROR_NONE != ret) { MESH_LOGE("Failed to turn STP off!"); return ret; } @@ -118,21 +114,21 @@ int mesh_request_add_bridge_interface(const char* bridge_interface, /* Add external interface into bridge */ ret = mesh_bridge_add_interface(bridge_interface, interface); - if(MESHD_ERROR_NONE != ret) { + if (MESHD_ERROR_NONE != ret) { MESH_LOGE("Failed to add interface !"); return ret; } /* Make external interface down */ ret = mesh_interface_set(interface, NULL, MESH_INTERFACE_DOWN); - if(MESHD_ERROR_NONE != ret) { + if (MESHD_ERROR_NONE != ret) { MESH_LOGE("Failed to change external interface state"); return ret; } /* Make external interface up with cleared IP */ ret = mesh_interface_set(interface, "0.0.0.0", MESH_INTERFACE_UP); - if(MESHD_ERROR_NONE != ret) { + if (MESHD_ERROR_NONE != ret) { MESH_LOGE("Failed to change external interface state"); return ret; } @@ -154,7 +150,7 @@ int mesh_request_remove_bridge_interface(const char* bridge_interface, /* Remove external interface into bridge */ ret = mesh_bridge_del_interface(bridge_interface, interface); - if(MESHD_ERROR_NONE != ret) { + if (MESHD_ERROR_NONE != ret) { MESH_LOGE("Failed to remove interface !"); return ret; } @@ -172,7 +168,7 @@ int mesh_request_set_softap_config(const char* softap_interface, ret = mesh_softap_set_configuration(softap_interface, ssid, mode, channel, visibility, max_sta, security, passphrase); - if(MESHD_ERROR_NONE != ret) { + if (MESHD_ERROR_NONE != ret) { MESH_LOGE("Failed to set Configuration for SoftAP"); return ret; } @@ -194,9 +190,8 @@ int mesh_request_enable_softap( /* Add softAP interface into bridge */ ret = mesh_request_add_bridge_interface(bridge_interface, softap_interface); - if (MESHD_ERROR_NONE != ret) { + if (MESHD_ERROR_NONE != ret) return ret; - } return ret; } @@ -211,9 +206,8 @@ int mesh_request_disable_softap( /* Remove softAP interface from bridge */ ret = mesh_request_remove_bridge_interface(bridge_interface, softap_interface); - if (MESHD_ERROR_NONE != ret) { + if (MESHD_ERROR_NONE != ret) return ret; - } return ret; } @@ -226,9 +220,8 @@ int mesh_request_get_station_info(const char* mesh_interface, GList **station_li /* Get station info */ ret = mesh_netlink_get_station_info(mesh_interface, station_list); - if (MESHD_ERROR_NONE != ret) { + if (MESHD_ERROR_NONE != ret) return ret; - } return MESHD_ERROR_NONE; } @@ -241,9 +234,8 @@ int mesh_request_get_mpath_info(const char* mesh_interface, GList **mpath_list) /* Get MPath info */ ret = mesh_netlink_get_mpath_info(mesh_interface, mpath_list); - if (MESHD_ERROR_NONE != ret) { + if (MESHD_ERROR_NONE != ret) return ret; - } return MESHD_ERROR_NONE; } @@ -256,9 +248,8 @@ int mesh_request_register_event_handler() /* Get MPath info */ ret = mesh_netlink_register_event_handler(); - if (MESHD_ERROR_NONE != ret) { + if (MESHD_ERROR_NONE != ret) return ret; - } return MESHD_ERROR_NONE; } @@ -271,9 +262,8 @@ int mesh_request_unregister_event_handler() /* Get MPath info */ ret = mesh_netlink_unregister_event_handler(); - if (MESHD_ERROR_NONE != ret) { + if (MESHD_ERROR_NONE != ret) return ret; - } return MESHD_ERROR_NONE; } @@ -289,7 +279,7 @@ int mesh_request_enable_network(mesh_service *service) MESH_LOGD("[IPC] Enable mesh network"); ret = mesh_gdbus_create_mesh_interface(service); - if(MESHD_ERROR_NONE != ret) { + if (MESHD_ERROR_NONE != ret) { MESH_LOGE("Failed to create mesh network"); return ret; } @@ -308,7 +298,7 @@ int mesh_request_disable_network(mesh_service *service) MESH_LOGD("[IPC] Disable mesh network"); ret = mesh_gdbus_remove_mesh_interface(service); - if(MESHD_ERROR_NONE != ret) { + if (MESHD_ERROR_NONE != ret) { MESH_LOGE("Failed to create mesh network"); return ret; } @@ -327,7 +317,7 @@ int mesh_request_scan(mesh_service *service) MESH_LOGD("[IPC] Request scan for mesh network"); ret = mesh_gdbus_mesh_scan(service); - if(MESHD_ERROR_NONE != ret) { + if (MESHD_ERROR_NONE != ret) { MESH_LOGE("Failed to request scan for mesh network"); return ret; } @@ -335,8 +325,7 @@ int mesh_request_scan(mesh_service *service) return MESHD_ERROR_NONE; } -int mesh_request_specific_scan(mesh_service *service, gchar *mesh_id, - gint channel) +int mesh_request_specific_scan(mesh_service *service, gchar *mesh_id, gint channel) { int ret; if (NULL == service) { @@ -347,7 +336,7 @@ int mesh_request_specific_scan(mesh_service *service, gchar *mesh_id, MESH_LOGD("[IPC] Request specific scan for mesh network"); ret = mesh_gdbus_mesh_specific_scan(service, mesh_id, channel); - if(MESHD_ERROR_NONE != ret) { + if (MESHD_ERROR_NONE != ret) { MESH_LOGE("Failed to request specific scan for mesh network"); return ret; } @@ -366,7 +355,7 @@ int mesh_request_cancel_scan(mesh_service *service) MESH_LOGD("[IPC] Cancel scan for mesh network"); ret = mesh_gdbus_mesh_cancel_scan(service); - if(MESHD_ERROR_NONE != ret) { + if (MESHD_ERROR_NONE != ret) { MESH_LOGE("Failed to cancel scan for mesh network"); return ret; } @@ -385,7 +374,7 @@ int mesh_request_get_networks(mesh_service *service) MESH_LOGD("[IPC] Get mesh networks"); ret = mesh_gdbus_get_mesh_networks(service); - if(MESHD_ERROR_NONE != ret) { + if (MESHD_ERROR_NONE != ret) { MESH_LOGE("Failed to get mesh networks !"); return ret; } @@ -410,8 +399,7 @@ static int _select_matched_network(GList *scanned_network, item = (mesh_scan_result_s*)iter->data; if (g_strcmp0(mesh_id, item->mesh_id) == 0) { - if (item->channel == mesh_channel && item->security == sec) - { + if (item->channel == mesh_channel && item->security == sec) { *info = item; found = TRUE; break; @@ -438,7 +426,7 @@ int mesh_request_get_joined_network(mesh_service *service) MESH_LOGD("[IPC] Get joined mesh network"); ret = mesh_gdbus_get_joined_mesh_network(service); - if(MESHD_ERROR_NONE != ret) { + if (MESHD_ERROR_NONE != ret) { MESH_LOGE("Failed to get joined mesh network"); return ret; } @@ -458,7 +446,7 @@ int mesh_request_get_connected_peers(mesh_service *service) MESH_LOGD("[IPC] Get connected mesh peers"); ret = mesh_gdbus_get_connected_peers(service); - if(MESHD_ERROR_NONE != ret) { + if (MESHD_ERROR_NONE != ret) { MESH_LOGE("Failed to get connected mesh peers"); return ret; } @@ -479,7 +467,7 @@ int mesh_request_create_mesh_network(mesh_service *service, gchar *mesh_id, MESH_LOGD("[IPC] Create a new mesh network"); ret = mesh_gdbus_create_network(service, mesh_id, channel, sec); - if(MESHD_ERROR_NONE != ret) { + if (MESHD_ERROR_NONE != ret) { MESH_LOGE("Failed to create mesh network"); return ret; } @@ -503,7 +491,7 @@ int mesh_request_connect_mesh_network(mesh_service *service, gchar *mesh_id, /* Get mesh_id and channel from saved network */ ret = _select_matched_network(service->scanned_mesh_network, mesh_id, channel, sec, &info); - if(MESHD_ERROR_NONE != ret) { + if (MESHD_ERROR_NONE != ret) { MESH_LOGE("Failed to mesh_network_get_first_mesh_network"); return ret; } @@ -512,7 +500,7 @@ int mesh_request_connect_mesh_network(mesh_service *service, gchar *mesh_id, if (MESHD_SECURITY_NONE != sec) { if (NULL != passphrase) { ret = mesh_gdbus_set_passphrase(service, info, passphrase); - if(MESHD_ERROR_NONE != ret) { + if (MESHD_ERROR_NONE != ret) { MESH_LOGE("Failed to set passphrase for mesh network"); return ret; } @@ -523,7 +511,7 @@ int mesh_request_connect_mesh_network(mesh_service *service, gchar *mesh_id, } ret = mesh_gdbus_connect_network(service, info); - if(MESHD_ERROR_NONE != ret) { + if (MESHD_ERROR_NONE != ret) { MESH_LOGE("Failed to connect mesh network"); return ret; } @@ -547,13 +535,13 @@ int mesh_request_disconnect_mesh_network(mesh_service *service, /* Get mesh_id and channel from saved network */ ret = _select_matched_network(service->scanned_mesh_network, mesh_id, channel, sec, &info); - if(MESHD_ERROR_NONE != ret) { + if (MESHD_ERROR_NONE != ret) { MESH_LOGE("Failed to _select_matched_network"); return ret; } ret = mesh_gdbus_disconnect_network(service, info); - if(MESHD_ERROR_NONE != ret) { + if (MESHD_ERROR_NONE != ret) { MESH_LOGE("Failed to disconnect mesh network"); return ret; } @@ -577,13 +565,13 @@ int mesh_request_remove_mesh_network(mesh_service *service, /* Get mesh_id and channel from saved network */ ret = _select_matched_network(service->scanned_mesh_network, mesh_id, channel, sec, &info); - if(MESHD_ERROR_NONE != ret) { + if (MESHD_ERROR_NONE != ret) { MESH_LOGE("Failed to _select_matched_network"); return ret; } ret = mesh_gdbus_remove_network(service, info); - if(MESHD_ERROR_NONE != ret) { + if (MESHD_ERROR_NONE != ret) { MESH_LOGE("Failed to remove mesh network"); return ret; } diff --git a/src/mesh-service-interface.c b/src/mesh-service-interface.c index aa7e7a9..7550e93 100644 --- a/src/mesh-service-interface.c +++ b/src/mesh-service-interface.c @@ -167,9 +167,8 @@ static gboolean _meshd_dbus_handle_enable(Manager *object, /* Register event handler first */ ret = mesh_request_register_event_handler(); - if (MESHD_ERROR_NONE != ret) { + if (MESHD_ERROR_NONE != ret) MESH_LOGE("Failed to register mesh event handler !! [%d]", ret); - } ret = mesh_interface_initialize(service->interface_info); if (MESHD_ERROR_NONE != ret) { @@ -203,9 +202,8 @@ static gboolean _meshd_dbus_handle_disable(Manager *object, manager_complete_disable(object, invocation, ret); ret = mesh_request_unregister_event_handler(); - if (MESHD_ERROR_NONE != ret) { + if (MESHD_ERROR_NONE != ret) MESH_LOGE("Failed to unregister mesh event handler !! [%d]", ret); - } /* Terminate daemon */ meshd_service_exit(service); @@ -261,9 +259,8 @@ static gboolean _meshd_dbus_handle_cancel_scan(NetMesh *object, mesh_service *service = (mesh_service *)user_data; ret = mesh_request_cancel_scan(service); - if (MESHD_ERROR_NONE != ret) { + if (MESHD_ERROR_NONE != ret) MESH_LOGE("Failed to mesh_request_cancel_scan"); - } net_mesh_complete_cancel_scan(object, invocation, ret); @@ -379,9 +376,8 @@ static gboolean _meshd_dbus_handle_enable_mesh(NetMesh *object, and decide to make gate enabled */ ret = mesh_request_set_mesh_gate(info->bridge_interface, info->mesh_interface, info->external_interface); - if (MESHD_ERROR_NONE != ret) { + if (MESHD_ERROR_NONE != ret) MESH_LOGE("Failed to mesh_request_set_mesh_gate [%d]", ret); - } #endif net_mesh_complete_enable_mesh(object, invocation, ret); @@ -407,9 +403,8 @@ static gboolean _meshd_dbus_handle_disable_mesh(NetMesh *object, } ret = mesh_request_disable_network(service); - if (MESHD_ERROR_NONE != ret) { + if (MESHD_ERROR_NONE != ret) MESH_LOGE("Failed to disable mesh network !"); - } /* Make response */ net_mesh_complete_disable_mesh(object, invocation, ret); @@ -497,9 +492,8 @@ static gboolean _meshd_dbus_handle_set_gate(NetMesh *object, /* Set STP and gate_announce */ ret = mesh_request_set_mesh_gate(info->bridge_interface, info->mesh_interface, info->external_interface); - if (MESHD_ERROR_NONE != ret) { + if (MESHD_ERROR_NONE != ret) MESH_LOGE("Failed to mesh_request_set_mesh_gate [%d]", ret); - } net_mesh_complete_set_gate(object, invocation, ret); @@ -516,9 +510,9 @@ static gboolean _meshd_dbus_handle_unset_gate(NetMesh *object, ret = mesh_request_unset_mesh_gate(info->bridge_interface, info->mesh_interface, info->external_interface); - if (MESHD_ERROR_NONE != ret) { + if (MESHD_ERROR_NONE != ret) MESH_LOGE("Failed to mesh_request_unset_mesh_gate [%d]", ret); - } + net_mesh_complete_unset_gate(object, invocation, ret); return TRUE; @@ -545,9 +539,8 @@ static gboolean _meshd_dbus_handle_set_softap(NetMesh *object, ret = mesh_request_set_softap_config(info->softap_interface, ssid, mode, channel, visibility, max_sta, security, passphrase); - if (MESHD_ERROR_NONE != ret) { + if (MESHD_ERROR_NONE != ret) MESH_LOGE("Failed to mesh_request_set_softap_config [%d]", ret); - } net_mesh_complete_set_softap(object, invocation, ret); @@ -563,9 +556,8 @@ static gboolean _meshd_dbus_handle_enable_softap(NetMesh *object, /* Check softAP interface and execute it */ ret = mesh_request_enable_softap(info->bridge_interface, info->softap_interface); - if (MESHD_ERROR_NONE != ret) { + if (MESHD_ERROR_NONE != ret) MESH_LOGE("Failed to mesh_request_enable_softap [%d]", ret); - } net_mesh_complete_enable_softap(object, invocation, ret); @@ -581,9 +573,8 @@ static gboolean _meshd_dbus_handle_disable_softap(NetMesh *object, /* Destroy softAP */ ret = mesh_request_disable_softap(info->bridge_interface, info->softap_interface); - if (MESHD_ERROR_NONE != ret) { + if (MESHD_ERROR_NONE != ret) MESH_LOGE("Failed to mesh_request_disable_softap [%d]", ret); - } net_mesh_complete_disable_softap(object, invocation, ret); @@ -719,7 +710,7 @@ static gboolean _meshd_dbus_handle_get_station_info(NetMesh *object, * tx retries: 0 * tx failed: 0 * beacon loss: 0 - * signal: -64 dBm + * signal: -64 dBm * signal avg: -63 dBm * tx bitrate: 54.0 MBit/s * rx bitrate: 5.5 MBit/s @@ -856,7 +847,7 @@ static gboolean _meshd_dbus_handle_get_mpath_info(NetMesh *object, */ /* Get mesh path information and make variant data */ g_variant_builder_init(&builder, G_VARIANT_TYPE("aa{sv}")); - + iter = service->mpath_list; while (iter != NULL) { mesh_mpath_info_s *item = (mesh_mpath_info_s*)iter->data; diff --git a/src/mesh-service.c b/src/mesh-service.c index 5a7abbc..fc74c75 100644 --- a/src/mesh-service.c +++ b/src/mesh-service.c @@ -74,4 +74,4 @@ gboolean meshd_service_exit(mesh_service *service) g_main_loop_quit(service->main_loop); return TRUE; -} \ No newline at end of file +} diff --git a/src/mesh-softap.c b/src/mesh-softap.c index 2259cf5..f52eb19 100644 --- a/src/mesh-softap.c +++ b/src/mesh-softap.c @@ -263,9 +263,8 @@ static int __terminate_hostapd() } ret = __close_hostapd_intf(&hostapd_ctrl_fd); - if (ret != MESHD_ERROR_NONE) { + if (ret != MESHD_ERROR_NONE) MESH_LOGE("__close_hostapd_intf is failed"); - } kill(hostapd_pid, SIGTERM); waitpid(hostapd_pid, NULL, 0); @@ -355,5 +354,5 @@ int mesh_softap_disable_softap() return MESHD_ERROR_OPERATION_FAILED; } - return ret; + return ret; }