...: Apply Tizen coding rule 79/70079/2
authorsunm.lee <sunm.lee@samsung.com>
Wed, 18 May 2016 04:30:06 +0000 (13:30 +0900)
committersunm.lee <sunm.lee@samsung.com>
Wed, 18 May 2016 04:45:20 +0000 (13:45 +0900)
Apply Tizen coding rule to:
 block, cpu, heart, mem-stress, memory, network,
 proc-stat, resourced, sluggish, swap, timer-slack,
 vip-agent

Change-Id: I58945a9b433744824b576d0cab2a4027867bf6da
Signed-off-by: sunm.lee <sunm.lee@samsung.com>
38 files changed:
src/block/block-monitor.c
src/cpu/cpu.c
src/heart/heart-abnormal.c
src/heart/heart-appopt.c
src/heart/heart-battery.c
src/heart/heart-cpu.c
src/mem-stress/mem-stress.c
src/memory/vmpressure-lowmem-handler.c
src/network/counter-process.c
src/network/datausage-common.c
src/network/datausage-quota-processing.c
src/network/datausage-quota.c
src/network/foreach.c
src/network/generic-netlink.c
src/network/iface.c
src/network/iptables-rule.c
src/network/net-activity.c
src/network/nfacct-rule.c
src/network/notification-mobile.c
src/network/notification-wearable.c
src/network/reset.c
src/network/restriction-handler.c
src/network/restriction-local.c
src/network/specific-trace.c
src/network/telephony.c
src/proc-stat/proc-appusage.c
src/proc-stat/proc-main.c
src/proc-stat/proc-monitor.c
src/proc-stat/proc-noti.c
src/proc-stat/proc-process.c
src/proc-stat/proc-stat.c
src/resourced/init.c
src/sluggish/sluggish.c
src/swap/swap-common.c
src/swap/swap.c
src/timer-slack/timer-slack.c
src/vip-agent/vip-process.c
src/vip-agent/vip-release-agent.c

index 1b05481..8a9e91b 100644 (file)
@@ -218,7 +218,7 @@ static Eina_Bool block_monitor_cb(void *user_data, Ecore_Fd_Handler *fd_handler)
 
                hash = bmi->block_exclude_path
                     ? g_hash_table_find(bmi->block_exclude_path,
-                       find_hash, (gpointer)buf)
+                       find_hash, (gpointer)buf)
                     : NULL;
 
                if (hash) {
@@ -271,7 +271,7 @@ int register_fanotify(struct block_monitor_info *bmi)
 
        bmi->mfd = fanotify_init(FAN_CLOEXEC|FAN_NONBLOCK | FAN_CLASS_CONTENT,
                            O_RDONLY | O_LARGEFILE | O_CLOEXEC | O_NOATIME);
-       if (bmi->mfd< 0) {
+       if (bmi->mfd < 0) {
                _E("Failed to create fanotify fd");
                goto error;
        }
index a2993d2..c614818 100644 (file)
@@ -227,7 +227,7 @@ static int load_cpu_config(struct parse_result *result, void *user_data)
                                    CPU_CONTROL_BANDWIDTH, value);
                }
        }
-       return RESOURCED_ERROR_NONE;
+       return RESOURCED_ERROR_NONE;
 }
 
 static int cpu_service_state(void *data)
index fc79dc2..329c76f 100644 (file)
@@ -339,7 +339,7 @@ static DBusMessage *edbus_heart_get_abnormal_data(E_DBus_Object *obj, DBusMessag
 }
 
 static struct edbus_method edbus_methods[] = {
-       { "GetAbnormalData",      "ii",   "a(si)",     edbus_heart_get_abnormal_data },
+       { "GetAbnormalData",      "ii",   "a(si)",     edbus_heart_get_abnormal_data },
 };
 
 static int heart_abnormal_init(void *data)
index 5ce7ce1..3c19421 100644 (file)
@@ -348,7 +348,7 @@ static void heart_appopt_execute_db_cmd(struct appopt_cmd *cmd)
 
        switch (cmd->type) {
        case APPOPT_CMD_INSERT:
-               if (heart_appopt_db_insert_entry(appopt_db, &cmd->data) != RESOURCED_ERROR_NONE) {
+               if (heart_appopt_db_insert_entry(appopt_db, &cmd->data) != RESOURCED_ERROR_NONE) {
                        _E("Appopt data insertion failed");
                } else {
                        /* invalidate cache on db update success */
@@ -357,7 +357,7 @@ static void heart_appopt_execute_db_cmd(struct appopt_cmd *cmd)
                }
                break;
        case APPOPT_CMD_REMOVE:
-               if (heart_appopt_db_remove_entry(appopt_db, &cmd->data) != RESOURCED_ERROR_NONE) {
+               if (heart_appopt_db_remove_entry(appopt_db, &cmd->data) != RESOURCED_ERROR_NONE) {
                        _E("Query execution failed");
                } else {
                        /* invalidate cache on db remove success */
index e79a02a..3ad9ff2 100644 (file)
@@ -870,7 +870,7 @@ static int heart_battery_get_batt_reset_usage_index(void)
 {
        int i;
 
-       for(i = 0; i < BATTERY_HISTORY_RESET_MAX; i++) {
+       for (i = 0; i < BATTERY_HISTORY_RESET_MAX; i++) {
                if (heart_battery_get_usage_reset_count(i, DISCHARGING) < BATTERY_HISTORY_COUNT_MAX
                        && heart_battery_get_usage_reset_count(i, CHARGING) < BATTERY_HISTORY_COUNT_MAX)
                        return i;
@@ -934,7 +934,7 @@ static int heart_battery_reset(void *data)
        batt_used.used_time_sec = 0;
        batt_used.last_update_time = logging_get_time(CLOCK_BOOTTIME);
 
-        return RESOURCED_ERROR_NONE;
+       return RESOURCED_ERROR_NONE;
 }
 
 static long heart_battery_compute_remaining_time_in_min(int capacity_count, long sec_per_cap)
@@ -2085,7 +2085,7 @@ static int heart_battery_exit(void *data)
        GSList *iter, *next;
        struct heart_battery_capacity *lbc;
 
-        heart_battery_save_to_file(true);
+       heart_battery_save_to_file(true);
        ret = pthread_mutex_lock(&heart_battery_mutex);
        if (ret) {
                _E("pthread_mutex_lock() failed, %d", ret);
index be01242..eb6fbfd 100644 (file)
@@ -561,7 +561,7 @@ void heart_cpu_update(struct logging_table_form *data, void *user_data)
        time_t curr_time = logging_get_time(CLOCK_BOOTTIME);
        struct heart_cpu_table *table;
        struct heart_cpu_info *ci = NULL;
-        GHashTable *cpu_usage_list = NULL;
+       GHashTable *cpu_usage_list = NULL;
 
        if (user_data)
                cpu_usage_list = (GHashTable *)user_data;
@@ -1166,7 +1166,7 @@ static DBusMessage *edbus_heart_get_cpu_data_list(E_DBus_Object *obj, DBusMessag
 
        heart_cpu_update_app_list(NULL);
 
-        logging_save_to_storage(true);
+       logging_save_to_storage(true);
        /* update data list from db */
        logging_update(true);
 
index 0feb70f..3e2b925 100644 (file)
@@ -60,7 +60,7 @@ static int mem_stress_allocate_memory(void **addr, size_t len)
        do {
                fprintf(stdout, "Try to allocate memory %zu", len);
                p = new0(void, len);
-       } while(!p);
+       } while (!p);
 
        r = mlock(p, len);
        if (r < 0) {
@@ -103,7 +103,7 @@ static int mem_stress_run_loop(void)
                return r;
        }
 
-       while(!quite)
+       while (!quite)
                sleep(10);
 
        r = mem_stress_free_memory(mem, arg_size);
index 6d4c3c7..92baa7d 100644 (file)
@@ -424,7 +424,7 @@ int compare_func(const struct dirent **a, const struct dirent **b)
 
 static int memps_file_select(const struct dirent *entry)
 {
-   return strstr(entry->d_name, "memps") ? 1 : 0;
+       return strstr(entry->d_name, "memps") ? 1 : 0;
 }
 
 static void clear_logs(char *dir)
@@ -691,7 +691,7 @@ static int compare_victims(const struct task_info *ta, const struct task_info *t
 
 static int compare_victims_point(const struct task_info *ta, const struct task_info *tb)
 {
-        unsigned int pa, pb;
+       unsigned int pa, pb;
        assert(ta != NULL);
        assert(tb != NULL);
 
@@ -1133,7 +1133,7 @@ static void lowmem_swap_memory(enum memcg_type type, struct memcg_info *mi)
 
        if (!swap) {
                swap = find_module("swap");
-               if(!swap)
+               if (!swap)
                        return;
        }
 
@@ -1472,37 +1472,37 @@ static int set_memory_config(const char *section_name, const struct parse_result
 
 static int memory_load_64_config(struct parse_result *result, void *user_data)
 {
-       return set_memory_config("Memory64", result);
+       return set_memory_config("Memory64", result);
 }
 
 static int memory_load_256_config(struct parse_result *result, void *user_data)
 {
-       return set_memory_config("Memory256", result);
+       return set_memory_config("Memory256", result);
 }
 
 static int memory_load_448_config(struct parse_result *result, void *user_data)
 {
-       return set_memory_config("Memory448", result);
+       return set_memory_config("Memory448", result);
 }
 
 static int memory_load_512_config(struct parse_result *result, void *user_data)
 {
-       return set_memory_config("Memory512", result);
+       return set_memory_config("Memory512", result);
 }
 
 static int memory_load_768_config(struct parse_result *result, void *user_data)
 {
-       return set_memory_config("Memory768", result);
+       return set_memory_config("Memory768", result);
 }
 
 static int memory_load_1024_config(struct parse_result *result, void *user_data)
 {
-       return set_memory_config("Memory1024", result);
+       return set_memory_config("Memory1024", result);
 }
 
 static int memory_load_2048_config(struct parse_result *result, void *user_data)
 {
-       return set_memory_config("Memory2048", result);
+       return set_memory_config("Memory2048", result);
 }
 
 /* setup memcg parameters depending on total ram size. */
@@ -2049,7 +2049,7 @@ static int lowmem_press_setup_eventfd(void)
 static int allocate_vip_app_list(void)
 {
        vip_apps = g_ptr_array_new();
-       if(!vip_apps) {
+       if (!vip_apps) {
                _E("g_ptr_array_new : out of memory");
                return RESOURCED_ERROR_OUT_OF_MEMORY;
        }
@@ -2102,7 +2102,7 @@ static int set_vip_list(void)
 
 static void free_vip_app_list(void)
 {
-       if(vip_apps) {
+       if (vip_apps) {
                g_ptr_array_foreach(vip_apps, (GFunc)g_free, NULL);
                g_ptr_array_free(vip_apps, true);
                vip_apps = NULL;
@@ -2119,13 +2119,13 @@ int lowmem_init(void)
        init_memcg_params();
        setup_memcg_params();
 
-       if(allocate_vip_app_list() != RESOURCED_ERROR_NONE)
+       if (allocate_vip_app_list() != RESOURCED_ERROR_NONE)
                _E("allocate_vip_app_list FAIL");
 
-       if(config_parse(MEM_CONF_FILE, load_vip_config, NULL))
+       if (config_parse(MEM_CONF_FILE, load_vip_config, NULL))
                _E("(%s) parse Fail", MEM_CONF_FILE);
 
-       if(set_vip_list() != RESOURCED_ERROR_NONE)
+       if (set_vip_list() != RESOURCED_ERROR_NONE)
                _E("set_vip_list FAIL");
 
        /* vip_list is only needed at the set_vip_list */
@@ -2243,12 +2243,12 @@ int lowmem_proactive_oom_killer(int flags, char *appid)
                 * above threshold_leave
                 */
                 if (after >= memcg_root->threshold[LOWMEM_MEDIUM])
-                       return RESOURCED_ERROR_FAIL;
+                        return RESOURCED_ERROR_FAIL;
 
                 should_be_freed = memcg_root->threshold_leave +
                         THRESHOLD_MARGIN - after;
                 _D("run history based proactive killer, should_be_freed = %u MB",
-                       should_be_freed);
+                        should_be_freed);
                lowmem_force_oom_killer(OOM_FORCE, should_be_freed, num_max_victims);
 
                return RESOURCED_ERROR_NONE;
index e938a0b..0e53551 100644 (file)
@@ -362,7 +362,7 @@ static inline int _evaluate_warning_threshold(const int64_t quota,
 
        threshold_part = _get_threshold_part(time_period);
 
-       return (get_quota_ceiling(quota) / 100 ) * threshold_part;
+       return (get_quota_ceiling(quota) / 100) * threshold_part;
 }
 
 static dbus_bool_t deserialize_quota(
@@ -404,7 +404,7 @@ static dbus_bool_t deserialize_quota(
                goto release;
        }
 
-       if(quota->iftype <= RESOURCED_IFACE_UNKNOWN ||
+       if (quota->iftype <= RESOURCED_IFACE_UNKNOWN ||
           quota->iftype >= RESOURCED_IFACE_LAST_ELEM) {
                _E("Unknown network interface is inacceptable!");
                ret = FALSE;
@@ -414,8 +414,7 @@ static dbus_bool_t deserialize_quota(
        if (quota->roaming_type < RESOURCED_ROAMING_UNKNOWN ||
            quota->roaming_type >= RESOURCED_ROAMING_LAST_ELEM ||
            (quota->roaming_type == RESOURCED_ROAMING_UNKNOWN &&
-            quota->iftype == RESOURCED_IFACE_DATACALL))
-       {
+            quota->iftype == RESOURCED_IFACE_DATACALL)) {
                _E("Bad roaming!");
                ret = FALSE;
                goto release;
index 7c3d9de..32a33ac 100644 (file)
@@ -118,7 +118,7 @@ struct nfacct_value {
        resourced_state_t ground; /* background/foreground state */
 };
 
-struct ground_state_info{
+struct ground_state_info {
        struct counter_arg *carg;
        u_int32_t classid;
        resourced_state_t state;
@@ -169,7 +169,7 @@ static resourced_ret_c del_iptables_out(struct nfacct_rule *counter)
 #endif /* CONFIG_DATAUSAGE_NFACCT */
 
 static gboolean bg_restriction(gpointer key, gpointer value,
-        gpointer data)
+               gpointer data)
 {
        bool *bg_restriction = (bool *)data;
 
@@ -263,7 +263,7 @@ static int remove_each_counter(
 
        nf_value = lookup_counter(counter);
 
-       ret_value_msg_if (!nf_value, FALSE, "Can't remove counter, due it's not in tree");
+       ret_value_msg_if(!nf_value, FALSE, "Can't remove counter, due it's not in tree");
        SET_BIT(nf_value->fini, NFACCT_FINAL_REMOVE);
 
        /* move it into _answer_func_cb */
@@ -297,8 +297,7 @@ static void remove_nfacct_counters_for_all_iface(u_int32_t classid, struct count
        for_each_ifnames((ifnames_iterator)remove_each_counter, NULL, &counter);
 }
 
-struct match_nftree_context
-{
+struct match_nftree_context {
        u_int32_t classid;
        pid_t pid;
 };
@@ -420,7 +419,7 @@ static gboolean move_proc_background_cgroup(gpointer key, gpointer value,
 {
        struct nfacct_value *nf_value = (struct nfacct_value *)value;
        struct nfacct_key *nf_key = (struct nfacct_key *)key;
-       resourced_state_t state = (resourced_state_t )data;
+       resourced_state_t state = (resourced_state_t)data;
        struct proc_app_info *pai = NULL;
        resourced_restriction_info rst_info = {0};
        char *app_id;
@@ -790,8 +789,8 @@ static int add_one_tizen_os_counter(
        return FALSE;
 }
 
-static void add_tizen_os_counters(struct counter_arg *carg) {
-
+static void add_tizen_os_counters(struct counter_arg *carg)
+{
        for_each_ifnames((ifnames_iterator)add_one_tizen_os_counter, NULL, carg);
 }
 
@@ -1127,7 +1126,7 @@ static int resourced_datausage_init(void *data)
                                                sizeof(struct net_counter_opts));
        struct shared_modules_data *m_data = NULL;
 
-       ret_value_msg_if (net_opts == NULL, RESOURCED_ERROR_OUT_OF_MEMORY,
+       ret_value_msg_if(net_opts == NULL, RESOURCED_ERROR_OUT_OF_MEMORY,
                          "Not enough memory");
 
        m_data = get_shared_modules_data();
@@ -1213,7 +1212,7 @@ static int resourced_datausage_finalize(void *data)
 #ifdef CONFIG_DATAUSAGE_NFACCT
 
 static int compare_nfcntr(gconstpointer a, gconstpointer b,
-                     gpointer UNUSED user_data)
+               gpointer UNUSED user_data)
 {
        struct nfacct_key *key_a = (struct nfacct_key *)a;
        struct nfacct_key *key_b = (struct nfacct_key *)b;
@@ -1354,7 +1353,7 @@ void finalize_counter(struct nfacct_rule *counter)
        ret_msg_if(!value->iptables_rule, "There is no iptables_rule handler");
 
        ret = value->iptables_rule(counter);
-       ret_msg_if (ret != RESOURCED_ERROR_NONE, "Failed to execute iptables rule");
+       ret_msg_if(ret != RESOURCED_ERROR_NONE, "Failed to execute iptables rule");
        UNSET_BIT(value->fini, NFACCT_FINAL_REMOVE);
        value->state = NFACCT_STATE_DEACTIVATED;
 #ifdef NETWORK_DEBUG_ENABLED
@@ -1454,7 +1453,7 @@ static gboolean fill_restriction_list(gpointer key, gpointer value,
 
        if (nf_key->iotype == NFACCT_COUNTER_IN)
                info->rcv_limit = nf_value->quota;
-       else if(nf_key->iotype == NFACCT_COUNTER_OUT)
+       else if (nf_key->iotype == NFACCT_COUNTER_OUT)
                info->send_limit = nf_value->quota;
        else
                _D("Unknown iotype");
@@ -1504,7 +1503,7 @@ static int create_each_iptable_rule(gpointer key, gpointer value, void *data)
            (counter->state != NFACCT_STATE_ACTIVE)) {
                ret = ctx->counter->iptables_rule(ctx->counter);
                ret_value_msg_if(ret != RESOURCED_ERROR_NONE, RESOURCED_ERROR_FAIL,
-                                "Can't add iptables ingress rule");
+                                "Can't add iptables ingress rule");
        }
 
        return RESOURCED_ERROR_NONE;
@@ -1570,7 +1569,7 @@ static void trace_nf_key_value(struct nfacct_key *nfacct_key, struct nfacct_valu
 }
 
 static bool is_incomplete_counter(struct nfacct_key *nfacct_key,
-                                 struct nfacct_value *nfacct_value)
+                                 struct nfacct_value *nfacct_value)
 {
        return nfacct_key->iftype == RESOURCED_IFACE_UNKNOWN &&
                nfacct_value->state == NFACCT_STATE_ACTIVE;
@@ -1585,7 +1584,7 @@ static bool is_incomplete_counter(struct nfacct_key *nfacct_key,
  * 3. counting is not allowed, e.g. by security reason
  */
 static bool check_skip_activating(struct nfacct_key *nfacct_key,
-                                 struct nfacct_value *nfacct_value,
+                                 struct nfacct_value *nfacct_value,
                                  struct iftype_context *ctx)
 {
        /**
@@ -1746,8 +1745,7 @@ static void handle_change_allowance(resourced_iface_type iftype, bool enabled)
                turn_off_counters(iftype, m_data->carg);
 }
 
-struct del_counter_context
-{
+struct del_counter_context {
        struct nfacct_value *nfacct_value;
        struct nfacct_key *nfacct_key;
        struct counter_arg *carg;
@@ -1797,7 +1795,7 @@ static Eina_Bool del_counter_delayed(void *data)
 
        ret = resourced_ipt_remove(&counter, del_ctx->iptc_holder->iptc);
 
-       if(ret != RESOURCED_ERROR_NONE) {
+       if (ret != RESOURCED_ERROR_NONE) {
                _E("Can't delete counter %s",
                   counter.name);
                goto finalize_iptc;
index 3ed5486..d72a980 100644 (file)
@@ -290,7 +290,7 @@ void clear_effective_quota(const char *app_id,
 }
 
 static inline int _is_period_devisible(const int time_period,
-                                    data_usage_quota_period_t quota_period)
+               data_usage_quota_period_t quota_period)
 {
        return time_period > quota_period &&
                time_period % RESOURCED_PERIOD_MONTH == 0;
@@ -397,7 +397,7 @@ static resourced_cb_ret data_usage_details_cb(const data_usage_info *info,
 }
 
 static void _record_quota(const struct quota_key *key,
-                         const struct quota *app_quota)
+                         const struct quota *app_quota)
 {
        if (!key || !app_quota) {
                _E("Please, provide valid argument.");
@@ -501,7 +501,7 @@ static void set_effective_quota(const char *app_id,
        const time_t cur_time = time(0);
        char buf[30];
 
-       app_id = !strncmp(app_id, RESOURCED_ALL_APP, strlen(RESOURCED_ALL_APP)+1) ? 0: app_id;
+       app_id = !strncmp(app_id, RESOURCED_ALL_APP, strlen(RESOURCED_ALL_APP) + 1) ? 0 : app_id;
 
        if (cur_time < start_time) {
                _D("No need to update effective quota!");
@@ -520,7 +520,7 @@ static void set_effective_quota(const char *app_id,
        rule.iftype = iftype;
 
        if (data_usage_details_foreach(app_id, &rule, data_usage_details_cb,
-                                      &out_context) != RESOURCED_ERROR_NONE) {
+                                      &out_context) != RESOURCED_ERROR_NONE) {
                _E("Cant obtain sent_used_quota/rcv_used_quota");
                return;
        }
@@ -579,7 +579,7 @@ void update_quota_state(const char *app_id, const int quota_id,
 
        tree_value = find_quota_in_tree(app_id, ser_quota->iftype,
                                        ser_quota->roaming_type,
-                                       ser_quota->imsi_hash, ser_quota->quota_type);
+                                       ser_quota->imsi_hash, ser_quota->quota_type);
        if (!check_event_in_current_modem(ser_quota->imsi_hash,
                                ser_quota->iftype))
                check_and_clear_all_noti();
@@ -599,7 +599,7 @@ void update_quota_state(const char *app_id, const int quota_id,
                                ser_quota->roaming_type, ser_quota->imsi_hash);
        } else if (!tree_value) {
                insert_key = malloc(sizeof(struct quota_key));
-               ret_msg_if (!insert_key, "not enough memory");
+               ret_msg_if(!insert_key, "not enough memory");
                memset(insert_key, 0, sizeof(struct quota_key));
                tree_value = (struct quota *)malloc(sizeof(struct quota));
                if (!tree_value) {
@@ -667,7 +667,7 @@ void remove_quota_from_counting(const char *app_id, const resourced_iface_type i
        const char *imsi_hash)
 {
        struct quota_key key;
-       ret_msg_if(!app_id,"app_id must be not NULL");
+       ret_msg_if(!app_id, "app_id must be not NULL");
 
        key.app_id = app_id;
        key.iftype = iftype;
@@ -690,25 +690,25 @@ static resourced_ret_c _init_quotas(void)
                return RESOURCED_ERROR_NONE;
 
        if (sqlite3_prepare_v2(resourced_get_database(),
-                              select_query, -1, &select_stmt,
-                              NULL) != SQLITE_OK) {
+                              select_query, -1, &select_stmt,
+                              NULL) != SQLITE_OK) {
                _E("Error preparing query: %s, \
                   %s\n", select_query, sqlite3_errmsg(resourced_get_database()));
                goto handle_error;
        }
 
        if (sqlite3_prepare_v2(resourced_get_database(),
-                              insert_query, -1, &insert_stmt,
-                              NULL) != SQLITE_OK) {
+                              insert_query, -1, &insert_stmt,
+                              NULL) != SQLITE_OK) {
                _E("Error preparing query: %s, \
                   %s\n", insert_query, sqlite3_errmsg(resourced_get_database()));
                goto handle_error;
        }
 
        if (sqlite3_prepare_v2(resourced_get_database(),
-                              clear_effective_quota_query,
-                              -1, &clear_effective_stmt,
-                              NULL) != SQLITE_OK) {
+                              clear_effective_quota_query,
+                              -1, &clear_effective_stmt,
+                              NULL) != SQLITE_OK) {
                _E("Error preparing query: %s, \
                   %s\n", clear_effective_quota_query,
                        sqlite3_errmsg(resourced_get_database()));
@@ -731,7 +731,7 @@ handle_error:
 static resourced_ret_c load_quotas(void)
 {
        const resourced_ret_c ret = _init_quotas();
-       ret_value_msg_if (ret != RESOURCED_ERROR_NONE, ret, "Failed to init quotas");
+       ret_value_msg_if(ret != RESOURCED_ERROR_NONE, ret, "Failed to init quotas");
        return obtain_and_keep_quotas(select_stmt);
 }
 
@@ -877,7 +877,7 @@ static gboolean check_and_apply_node(gpointer key,
                opts->update_period) ||
            app_quota->rcv_warning_threshold < app_quota->rcv_used_quota) &&
            (key_quota->roaming == RESOURCED_ROAMING_UNKNOWN ||
-            key_quota->roaming == get_current_roaming())){
+            key_quota->roaming == get_current_roaming())) {
                data_usage_quota du_quota = {0}; /* use both for
                                                    warning/restriction noti */
 
@@ -912,7 +912,7 @@ static gboolean check_and_apply_node(gpointer key,
                 * is it current imsi or not,
                 * just do not skip kernel op */
                if (proc_keep_restriction(key_quota->app_id,
-                                         app_quota->quota_id, &rst,
+                                         app_quota->quota_id, &rst,
                                          RST_SET, false, RESOURCED_RESTRICTION_ACTIVATED) != RESOURCED_ERROR_NONE) {
                        _E("Failed to keep restriction!");
                        return FALSE;
@@ -944,8 +944,7 @@ static void check_and_apply_quota(struct counter_arg *carg)
        g_tree_foreach(quotas, check_and_apply_node, (void *)carg);
 }
 
-struct update_all_arg
-{
+struct update_all_arg {
        resourced_iface_type iftype;
        char *imsi_hash;
        struct application_stat *app_stat;
@@ -998,8 +997,7 @@ static gboolean update_pseudo_app_entry(gpointer key,
             (qkey->roaming == RESOURCED_ROAMING_UNKNOWN ||
              qkey->roaming == arg->app_stat->is_roaming) &&
              check_ground_state(qkey, arg->app_stat)) ||
-           !strncmp(qkey->app_id, TETHERING_APP_NAME, strlen(TETHERING_APP_NAME)+1))
-       {
+           !strncmp(qkey->app_id, TETHERING_APP_NAME, strlen(TETHERING_APP_NAME)+1)) {
                /* update it */
                total_quota->sent_used_quota += arg->app_stat->delta_snd;
                total_quota->rcv_used_quota += arg->app_stat->delta_rcv;
@@ -1075,7 +1073,7 @@ static gboolean update_each_quota(gpointer key, gpointer value,
        /* TODO ground is not handled for quota per application,
         * due GUI is not set quota per application, yet,
         * no such requirements */
-       qkey.imsi_hash = app_key->iftype == RESOURCED_IFACE_DATACALL ? get_imsi_hash(app_key->imsi): "";
+       qkey.imsi_hash = app_key->iftype == RESOURCED_IFACE_DATACALL ? get_imsi_hash(app_key->imsi) : "";
        update_traffic_quota(&qkey, &app_stat->delta_snd,
                             &app_stat->delta_rcv);
        return FALSE;
@@ -1257,7 +1255,7 @@ resourced_ret_c get_quota_by_id(const int quota_id, data_usage_quota *du_quota)
 
 resourced_ret_c get_quota_by_appid(const char* app_id, const char *imsi_hash,
                const resourced_iface_type iftype, resourced_roaming_type roaming,
-               data_usage_quota *du_quota, int *quota_id, resourced_state_t ground)
+               data_usage_quota *du_quota, int *quota_id, resourced_state_t ground)
 {
        struct quota *qt;
        execute_once {
index e979eb0..88319a4 100644 (file)
@@ -126,7 +126,7 @@ API resourced_ret_c remove_datausage_quota(
                return RESOURCED_ERROR_INVALID_PARAMETER;
 
        return send_remove_quota_message(rule->app_id, rule->iftype,
-                rule->roaming, rule->imsi ? rule->imsi : "", rule->quota_type);
+               rule->roaming, rule->imsi ? rule->imsi : "", rule->quota_type);
 }
 
 API resourced_ret_c remove_datausage_quota_by_iftype(
index 1f5a64b..f1b9a6f 100644 (file)
@@ -218,7 +218,7 @@ API resourced_ret_c data_usage_foreach(const data_usage_selection_rule *rule,
        resourced_tm_interval interval;
 
        libresourced_db_initialize_once();
-       if (init_datausage_foreach(resourced_get_database())!= SQLITE_OK) {
+       if (init_datausage_foreach(resourced_get_database()) != SQLITE_OK) {
                _D("Failed to initialize data usage statements: %s\n",
                   sqlite3_errmsg(resourced_get_database()));
                return RESOURCED_ERROR_DB_FAILED;
@@ -332,7 +332,7 @@ API resourced_ret_c data_usage_details_foreach(const char *app_id,
        resourced_tm_interval interval;
 
        libresourced_db_initialize_once();
-       if (init_datausage_foreach(resourced_get_database())!= SQLITE_OK) {
+       if (init_datausage_foreach(resourced_get_database()) != SQLITE_OK) {
                _D("Failed to initialize data usage statements: %s\n",
                   sqlite3_errmsg(resourced_get_database()));
                return RESOURCED_ERROR_DB_FAILED;
index 6f238bc..9230f3f 100644 (file)
@@ -153,7 +153,7 @@ static uint32_t get_mcast_group_id(struct rtattr *mc_na, const char *group_name)
        struct rtattr *multicast_general_family[NESTED_MCAST_MAX + 1] = {0};
 
        fill_attribute_list(multicast_general_family, NESTED_MCAST_MAX,
-                           rt_na, rt_len);
+                           rt_na, rt_len);
 
        /* for each group */
        for (i = 0; i < NESTED_MCAST_MAX; ++i) {
@@ -171,7 +171,7 @@ static uint32_t get_mcast_group_id(struct rtattr *mc_na, const char *group_name)
 }
 
 uint32_t get_family_group_id(int sock, pid_t pid,
-                       char *family_name, char *group_name,
+                       char *family_name, char *group_name,
                        uint32_t *family_id)
 {
        struct genl family_req;
@@ -246,7 +246,7 @@ static void show_result(const struct genl *ans)
        char *result = NULL;
 
        if (!ans) {
-               _D ("Please provide valid argument!");
+               _D("Please provide valid argument!");
                return;
        }
 
index 51badf9..cd86b40 100644 (file)
@@ -110,7 +110,7 @@ static void keep_ifname(GSList **ifnames_list, char *ifname, int iftype)
        GSList *iter;
        bool found = false;
        struct iface_status *value;
-       ret_msg_if (!ifnames_list || !ifname, "Please provide valid argument!");
+       ret_msg_if(!ifnames_list || !ifname, "Please provide valid argument!");
 
        gslist_for_each_item(iter, *ifnames_list) {
                struct iface_status *cur = (struct iface_status *)iter->data;
@@ -127,7 +127,7 @@ static void keep_ifname(GSList **ifnames_list, char *ifname, int iftype)
        value = (struct iface_status *)malloc(
                        sizeof(struct iface_status));
 
-       ret_msg_if (!value, "Can't allocate memory for iface_status\n");
+       ret_msg_if(!value, "Can't allocate memory for iface_status\n");
        value->active = true; /* we're putting it => it's active now */
        value->iftype = iftype;
        STRING_SAVE_COPY(value->ifname, ifname);
index 9bfe497..458669e 100644 (file)
@@ -577,12 +577,12 @@ static resourced_cb_ret populate_entry(struct resourced_ipt_entry_info *info,
 
 typedef resourced_cb_ret (*iterate_entries_cb)(struct resourced_ipt_entry_info *info, void *user_data);
 
-static int find_nfacct_name (const struct xt_entry_match *match,
+static int find_nfacct_name(const struct xt_entry_match *match,
                        char **found_name)
 {
        if (match && !strncmp(match->u.user.name, NFACCT_MATCH_NAME, strlen(NFACCT_MATCH_NAME)+1)) {
                struct xt_nfacct_match_info *info = (struct xt_nfacct_match_info *)match->data;
-               *found_name = info ? info->name: NULL;
+               *found_name = info ? info->name : NULL;
                return  1; /* means stop */
        }
        return 0; /* means continue */
@@ -618,7 +618,7 @@ static resourced_ret_c ipt_foreach(struct ipt_context *iptc, iterate_entries_cb
                info.rule_type = RESOURCED_OLD_IPT_RULE; /* TODO use enum */
                info.entry = (void *)entries + info.offset;
 
-               for (;hook < NF_IP_NUMHOOKS; ++hook) {
+               for (; hook < NF_IP_NUMHOOKS; ++hook) {
                        if (hook_entry[hook] <= info.offset &&
                            underflow[hook] > info.offset) {
                                info.hook = hook;
@@ -665,7 +665,7 @@ API resourced_ret_c resourced_ipt_begin(struct ipt_context *iptc)
        ret = getsockopt(iptc->sock, IPPROTO_IP, IPT_SO_GET_INFO,
                         iptc->info, &s);
 
-       if(ret < 0) {
+       if (ret < 0) {
                _E("iptables support missing error %d (%s)", errno,
                        strerror_r(errno, error_buf, sizeof(error_buf)));
                goto release_info;
@@ -780,8 +780,8 @@ static struct ipt_replace *prepare_replace(struct ipt_context *iptc)
 
        r->size = replace_size;
        /* xt_counters from linux/netfilter/x_ipts.h */
-       r->counters = (struct xt_counters *)malloc(sizeof(struct xt_counters)
-                               iptc->old_entries);
+       r->counters = (struct xt_counters *)malloc(sizeof(struct xt_counters) *
+                               iptc->old_entries);
        if (!r->counters) {
                free(r);
                _E("Not enough memory");
@@ -971,8 +971,7 @@ static void fill_ipt_entry(struct nfacct_rule *rule, struct ipt_entry *entry)
                dest_ifname = entry->ip.iniface;
                dest_ifmask = entry->ip.iniface_mask;
        /*         iface_flag = IPT_INV_VIA_IN;*/
-       }
-       else if (rule->iotype == NFACCT_COUNTER_OUT) {
+       } else if (rule->iotype == NFACCT_COUNTER_OUT) {
                dest_ifname = entry->ip.outiface;
                dest_ifmask = entry->ip.outiface_mask;
        /*         iface_flag = IPT_INV_VIA_OUT;*/
@@ -1005,7 +1004,7 @@ static int get_hook_by_iotype(struct nfacct_rule *rule)
 {
        if (rule->iotype == NFACCT_COUNTER_IN)
                return NF_IP_LOCAL_IN;
-       else if(rule->iotype == NFACCT_COUNTER_OUT)
+       else if (rule->iotype == NFACCT_COUNTER_OUT)
                return NF_IP_LOCAL_OUT;
 
        return NF_IP_NUMHOOKS;
index be1cacb..f3876d0 100644 (file)
@@ -63,11 +63,11 @@ static void set_socket_option(int sock)
  */
 static uint32_t convert_mcast_group_id(uint32_t group_id)
 {
-        if (group_id > 31) {
-                _E("Netlink: Use setsockopt for this group: %u\n", group_id);
-                return 0;
-        }
-        return group_id ? (1 << (group_id - 1)) : 0;
+       if (group_id > 31) {
+               _E("Netlink: Use setsockopt for this group: %u\n", group_id);
+               return 0;
+       }
+       return group_id ? (1 << (group_id - 1)) : 0;
 }
 
 static void *net_activity_func(void *user_data)
@@ -106,7 +106,7 @@ static void *net_activity_func(void *user_data)
                else if (ret == RESOURCED_NET_ACTIVITY_CONTINUE)
                        continue;
 
-               if (context->cb(&activity_info) == RESOURCED_CANCEL)
+               if (context->cb(&activity_info) == RESOURCED_CANCEL)
                        goto stop_net_activity;
        }
 
index 4725ab7..fbfb926 100644 (file)
@@ -106,9 +106,9 @@ static struct nlattr *start_nest_attr(struct genl *req, uint16_t type)
        struct nlattr *start = (struct nlattr *)(
                 (char *)req + NLMSG_ALIGN(req->n.nlmsg_len));
 
-        start->nla_type = NLA_F_NESTED | type;
-        req->n.nlmsg_len += NLMSG_ALIGN(sizeof(struct nlattr));
-        return start;
+       start->nla_type = NLA_F_NESTED | type;
+       req->n.nlmsg_len += NLMSG_ALIGN(sizeof(struct nlattr));
+       return start;
 }
 
 static void end_nest_attr(struct genl *req, struct nlattr *start)
@@ -290,7 +290,7 @@ bool recreate_counter_by_name(char *cnt_name, struct nfacct_rule *cnt)
                /* tbnep+:seth_w0; means comes by bt go away by mobile interface,
                 * it's outgoing traffic, due all tethering is mobile databased */
                iftype_part = strchr(name, ':');
-               ret_value_msg_if (iftype_part == NULL,
+               ret_value_msg_if(iftype_part == NULL,
                        false, "Invalid format of the tethering counter %s", name);
                ifname_len = iftype_part - name - 1;
                strncpy(ifname_buf, name + 1, ifname_len); /* skip first t */
@@ -367,7 +367,7 @@ static void _process_answer(struct netlink_serialization_params *params)
        /* parse reply message */
        na = (struct rtattr *)GENLMSG_DATA(ans);
 
-       while (NLMSG_OK(nlhdr, ans_len )) {
+       while (NLMSG_OK(nlhdr, ans_len)) {
 
                fill_attribute_list(attr_list, NFACCT_MAX,
                        na, len);
@@ -543,7 +543,7 @@ static char *get_iptables_cmd(const nfacct_rule_action action)
 {
        if (action == NFACCT_ACTION_APPEND)
                return APPEND;
-       else if(action == NFACCT_ACTION_DELETE)
+       else if (action == NFACCT_ACTION_DELETE)
                return DELETE;
        else if (action == NFACCT_ACTION_INSERT)
                return INSERT;
@@ -555,7 +555,7 @@ static char *get_iptables_chain(const nfacct_rule_direction iotype)
 {
        if (iotype == NFACCT_COUNTER_IN)
                return IN_RULE;
-       else if(iotype == NFACCT_COUNTER_OUT)
+       else if (iotype == NFACCT_COUNTER_OUT)
                return OUT_RULE;
 
        return "";
@@ -784,7 +784,7 @@ resourced_ret_c produce_net_rule(struct nfacct_rule *rule,
 
        if (rule->classid != RESOURCED_ALL_APP_CLASSID)
                ret = produce_app_rule(rule, send_limit,
-                                      rcv_limit, action, jump,
+                                      rcv_limit, action, jump,
                                       iotype);
        else
                ret = produce_iface_rule(rule, send_limit, rcv_limit,
index bfcb335..24c0aec 100644 (file)
@@ -91,13 +91,13 @@ static int clear_datausage_noti(int *id, const char *method_name)
        char *pa[1];
        int ret;
 
-       ret_value_msg_if (!id || !method_name, -EINVAL, "Invalid param");
+       ret_value_msg_if(!id || !method_name, -EINVAL, "Invalid param");
 
        snprintf(buf, sizeof(buf), "%d", *id);
 
        pa[0] = buf;
        ret = call_datausage_noti(method_name, "i", pa);
-       if(ret != 0) {
+       if (ret != 0) {
                _E("clear noti id : %d", *id);
                *id = 0;
                return ret;
@@ -127,7 +127,7 @@ void check_and_clear_all_noti(void)
 
 static int show_restriction_noti(const char *method_name)
 {
-       ret_value_msg_if (!method_name, -EINVAL, "Invalid param");
+       ret_value_msg_if(!method_name, -EINVAL, "Invalid param");
 
        return call_datausage_noti(method_name, NULL, NULL);
 }
@@ -170,10 +170,10 @@ static int show_restriction_popup(const char *value, data_usage_quota *du_quota)
 void send_restriction_notification(const char *appid, data_usage_quota *du_quota)
 {
        if (broadcast_edbus_signal(RESOURCED_PATH_NETWORK,
-                                  RESOURCED_INTERFACE_NETWORK,
-                                  RESTRICTION_ACTIVE,
-                                  DBUS_TYPE_STRING,
-                                  (void *)(&appid)) != RESOURCED_ERROR_NONE) {
+                                  RESOURCED_INTERFACE_NETWORK,
+                                  RESTRICTION_ACTIVE,
+                                  DBUS_TYPE_STRING,
+                                  (void *)(&appid)) != RESOURCED_ERROR_NONE) {
                _E("Failed to send DBUS message.");
        }
 
@@ -191,10 +191,10 @@ void send_restriction_notification(const char *appid, data_usage_quota *du_quota
 void send_restriction_warn_notification(const char *appid, data_usage_quota *du_quota)
 {
        if (broadcast_edbus_signal(RESOURCED_PATH_NETWORK,
-                                  RESOURCED_INTERFACE_NETWORK,
-                                  RESTRICTION_WARNING,
-                                  DBUS_TYPE_STRING,
-                                  (void *)(&appid)) != RESOURCED_ERROR_NONE) {
+                                  RESOURCED_INTERFACE_NETWORK,
+                                  RESTRICTION_WARNING,
+                                  DBUS_TYPE_STRING,
+                                  (void *)(&appid)) != RESOURCED_ERROR_NONE) {
                _E("Failed to send DBUS message.");
        }
 
index 23df966..9946d39 100644 (file)
@@ -90,10 +90,10 @@ static int show_restriction_popup(const char *value, data_usage_quota *du_quota)
 void send_restriction_notification(const char *appid, data_usage_quota *du_quota)
 {
        if (broadcast_edbus_signal(RESOURCED_PATH_NETWORK,
-                                  RESOURCED_INTERFACE_NETWORK,
-                                  RESTRICTION_ACTIVE,
-                                  DBUS_TYPE_STRING,
-                                  (void *)(&appid)) != RESOURCED_ERROR_NONE) {
+                                  RESOURCED_INTERFACE_NETWORK,
+                                  RESTRICTION_ACTIVE,
+                                  DBUS_TYPE_STRING,
+                                  (void *)(&appid)) != RESOURCED_ERROR_NONE) {
                _E("Failed to send DBUS message.");
        }
 
@@ -106,10 +106,10 @@ void send_restriction_notification(const char *appid, data_usage_quota *du_quota
 void send_restriction_warn_notification(const char *appid, data_usage_quota *du_quota)
 {
        if (broadcast_edbus_signal(RESOURCED_PATH_NETWORK,
-                                  RESOURCED_INTERFACE_NETWORK,
-                                  RESTRICTION_WARNING,
-                                  DBUS_TYPE_STRING,
-                                  (void *)(&appid)) != RESOURCED_ERROR_NONE) {
+                                  RESOURCED_INTERFACE_NETWORK,
+                                  RESTRICTION_WARNING,
+                                  DBUS_TYPE_STRING,
+                                  (void *)(&appid)) != RESOURCED_ERROR_NONE) {
                _E("Failed to send DBUS message.");
        }
 
index c2ec0be..3ce9474 100644 (file)
@@ -45,7 +45,7 @@
        "iftype=? and time_stamp between ? and ?"
 
 #define RESET_FIRST_BY_NUMBER "delete from statistics where time_stamp in " \
-       "(select time_stamp from statistics desc limit ?)"
+       "(select time_stamp from statistics desc limit ?)"
 
 /* the following array is strictly ordered
  * to find required statement the following code will be used:
@@ -101,7 +101,7 @@ API resourced_ret_c reset_data_usage_first_n_entries(int num)
 {
        resourced_ret_c result = RESOURCED_ERROR_NONE;
 
-       ret_value_msg_if (!num, RESOURCED_ERROR_INVALID_PARAMETER,
+       ret_value_msg_if(!num, RESOURCED_ERROR_INVALID_PARAMETER,
                        "Invalid number of entries");
        libresourced_db_initialize_once();
 
index 37b359b..23b1eef 100644 (file)
@@ -107,14 +107,12 @@ static resourced_cb_ret _restriction_iter(
        return RESOURCED_CONTINUE;
 }
 
-enum restriction_apply_type
-{
+enum restriction_apply_type {
        KEEP_AS_IS,
        UNSET,
 };
 
-struct apply_param
-{
+struct apply_param {
        enum restriction_apply_type apply_type;
 };
 
@@ -183,7 +181,7 @@ static void _reset_restrictions_iter(gpointer data, gpointer user_data)
                        _D("quota rcv: % " PRId64 ", send: % " PRId64 " ", du_quota.rcv_quota, du_quota.snd_quota);
 
                        send_restriction_notification(arg->app_id, &du_quota);
-               } else if(arg->quota_id && rst.rcv_warning_limit) {
+               } else if (arg->quota_id && rst.rcv_warning_limit) {
                        get_quota_by_id(arg->quota_id, &du_quota);
                        _D("quota rcv: % " PRId64 ", send: % " PRId64 " ", du_quota.rcv_quota, du_quota.snd_quota);
 
index 456dcc2..ac8f187 100644 (file)
@@ -87,7 +87,7 @@ static resourced_ret_c reset_restriction_db(const char *app_id,
 
        ret_value_if(error_code != RESOURCED_ERROR_NONE, error_code);
 #ifdef DEBUG_ENABLED
-       _D("app_id %s",app_id);
+       _D("app_id %s", app_id);
        _D("iftype %d", iftype);
        _D("imsi %s", imsi);
        _D("quota_id %d", quota_id);
@@ -456,7 +456,7 @@ resourced_ret_c remove_restriction_local(const char *app_id,
        }
 
 release_ifname:
-       if(rst_info.ifname)
+       if (rst_info.ifname)
                free((char *)rst_info.ifname);
        return ret;
 }
index 1fd2c0e..e17ae91 100644 (file)
@@ -46,8 +46,8 @@ gboolean print_appstat(gpointer key, gpointer value,
                return TRUE; /*stop printing*/
        }
 
-       _SD("appid %s, rcv %u, snd %u, classid %u, iftype %d, ifname %s," \
-               " is_roaming %d, ground %d",
+       _SD("appid %s, rcv %u, snd %u, classid %u, iftype %d, ifname %s," \
+               " is_roaming %d, ground %d",
                appstat->application_id, appstat->rcv_count,
                appstat->snd_count, (u_int32_t)composite_key->classid,
                composite_key->iftype, composite_key->ifname,
index 5758acc..897959f 100644 (file)
@@ -143,7 +143,7 @@ static int get_current_sim(void)
                         VCONFKEY_TELEPHONY_SIM_SLOT_COUNT, &sim_slot_count) != 0, -1,
                         "failed to get sim slot count");
 
-       if(sim_slot_count == SIM_SLOT_SINGLE) {
+       if (sim_slot_count == SIM_SLOT_SINGLE) {
               _D("It's single sim model");
               return current_sim;
        }
@@ -180,11 +180,11 @@ static void init_available_modems(void)
 
        dbus_error_init(&err);
 
-       dbus_message_iter_init (msg, &iter);
-       dbus_message_iter_recurse (&iter, &iter_array);
+       dbus_message_iter_init(msg, &iter);
+       dbus_message_iter_recurse(&iter, &iter_array);
        current_sim = get_current_sim();
 
-       while (dbus_message_iter_get_arg_type (&iter_array) != DBUS_TYPE_INVALID) {
+       while (dbus_message_iter_get_arg_type(&iter_array) != DBUS_TYPE_INVALID) {
                const char *name;
                struct modem_state *state = (struct modem_state *)malloc(
                                              sizeof(struct modem_state));
@@ -193,9 +193,9 @@ static void init_available_modems(void)
                        return;
                }
                memset(state, 0, sizeof(struct modem_state));
-               dbus_message_iter_get_basic (&iter_array, &name);
+               dbus_message_iter_get_basic(&iter_array, &name);
                _D("modem name %s", name);
-               dbus_message_iter_next (&iter_array);
+               dbus_message_iter_next(&iter_array);
                state->name = strndup(name, strlen(name));
                state->roaming = false;
                modems = g_slist_prepend(modems, state);
@@ -258,16 +258,16 @@ static void fill_modem_imsi(struct modem_state *modem)
 
        dbus_error_init(&err);
 
-       dbus_message_iter_init (msg, &iter);
+       dbus_message_iter_init(msg, &iter);
        _D_DBUS("dbus message type %d", dbus_message_iter_get_arg_type(&iter));
-       ret_msg_if (dbus_message_iter_get_arg_type(&iter) != DBUS_TYPE_STRING,
+       ret_msg_if(dbus_message_iter_get_arg_type(&iter) != DBUS_TYPE_STRING,
                "Return for %s isn't variant type as expected",
                DBUS_FREEDESKTOP_PROPERTIES);
-       dbus_message_iter_get_basic (&iter, &plmn);
+       dbus_message_iter_get_basic(&iter, &plmn);
        _D_DBUS("plmn value %d", plmn);
        plmn_len = strlen(plmn);
        dbus_message_iter_next(&iter);
-       dbus_message_iter_get_basic (&iter, &msin);
+       dbus_message_iter_get_basic(&iter, &msin);
        dbus_message_unref(msg);
        dbus_error_free(&err);
        _D_DBUS("msin value %d", msin);
@@ -322,16 +322,16 @@ static void fill_modem_state(struct modem_state *modem)
 
        dbus_error_init(&err);
 
-       dbus_message_iter_init (msg, &iter);
+       dbus_message_iter_init(msg, &iter);
        _D_DBUS("dbus message type %d", dbus_message_iter_get_arg_type(&iter));
-       ret_msg_if (dbus_message_iter_get_arg_type(&iter) != DBUS_TYPE_VARIANT,
+       ret_msg_if(dbus_message_iter_get_arg_type(&iter) != DBUS_TYPE_VARIANT,
                "Return for %s isn't variant type as expected", DBUS_FREEDESKTOP_PROPERTIES);
        dbus_message_iter_recurse(&iter, &var);
        _D_DBUS("dbus message variant type %d", dbus_message_iter_get_arg_type(&var));
-       ret_msg_if (dbus_message_iter_get_arg_type(&var) != DBUS_TYPE_BOOLEAN,
+       ret_msg_if(dbus_message_iter_get_arg_type(&var) != DBUS_TYPE_BOOLEAN,
                "Return for %s isn't boolean type as expected", DBUS_FREEDESKTOP_PROPERTIES);
 
-       dbus_message_iter_get_basic (&var, &modem->roaming);
+       dbus_message_iter_get_basic(&var, &modem->roaming);
        dbus_message_unref(msg);
        dbus_error_free(&err);
        _D("modem roaming value %d", modem->roaming);
@@ -366,16 +366,16 @@ static void fill_protocol(struct modem_state *modem)
 
        dbus_error_init(&err);
 
-       dbus_message_iter_init (msg, &iter);
+       dbus_message_iter_init(msg, &iter);
        _D_DBUS("dbus message type %d", dbus_message_iter_get_arg_type(&iter));
-       ret_msg_if (dbus_message_iter_get_arg_type(&iter) != DBUS_TYPE_VARIANT,
+       ret_msg_if(dbus_message_iter_get_arg_type(&iter) != DBUS_TYPE_VARIANT,
                "Return for %s isn't variant type as expected", DBUS_FREEDESKTOP_PROPERTIES);
        dbus_message_iter_recurse(&iter, &var);
        _D_DBUS("dbus message variant type %d", dbus_message_iter_get_arg_type(&var));
-       ret_msg_if (dbus_message_iter_get_arg_type(&var) != DBUS_TYPE_INT32,
+       ret_msg_if(dbus_message_iter_get_arg_type(&var) != DBUS_TYPE_INT32,
                "Return for %s isn't int type as expected", DBUS_FREEDESKTOP_PROPERTIES);
 
-       dbus_message_iter_get_basic (&var, &modem->protocol);
+       dbus_message_iter_get_basic(&var, &modem->protocol);
        dbus_message_unref(msg);
        dbus_error_free(&err);
        _D("modem roaming value %d", modem->protocol);
@@ -433,7 +433,7 @@ static void edbus_telephony_changed(void *data, DBusMessage *msg)
        DBusMessageIter iter, dict, prop, bool_iter;
 
        _D_DBUS("it's signal by %s path", dbus_message_get_path(msg));
-       dbus_message_iter_init (msg, &iter);
+       dbus_message_iter_init(msg, &iter);
        dbus_message_iter_next(&iter);
        /* call dbus_message_iter_next(&iter) */
        _D_DBUS("dbus message type %d", dbus_message_iter_get_arg_type(&iter));
@@ -441,34 +441,34 @@ static void edbus_telephony_changed(void *data, DBusMessage *msg)
        while (dbus_message_iter_get_arg_type(&iter) == DBUS_TYPE_ARRAY) {
                dbus_message_iter_recurse(&iter, &dict);
                _D_DBUS("dbus message variant type %d", dbus_message_iter_get_arg_type(&dict));
-               ret_msg_if (dbus_message_iter_get_arg_type(&dict) != DBUS_TYPE_DICT_ENTRY,
+               ret_msg_if(dbus_message_iter_get_arg_type(&dict) != DBUS_TYPE_DICT_ENTRY,
                        "Return for %s isn't variant type as expected",
                         modem->path);
 
                dbus_message_iter_recurse(&dict, &prop);
                _D_DBUS("dbus message roaming type %d", dbus_message_iter_get_arg_type(&prop));
-               ret_msg_if (dbus_message_iter_get_arg_type(&prop) != DBUS_TYPE_STRING,
+               ret_msg_if(dbus_message_iter_get_arg_type(&prop) != DBUS_TYPE_STRING,
                        "Return for %s isn't boolean type as expected",
                         modem->path);
 
-               dbus_message_iter_get_basic (&prop, &property);
+               dbus_message_iter_get_basic(&prop, &property);
 
                if (strncmp(property, DBUS_TELEPHONY_ROAMING_STATUS, strlen(DBUS_TELEPHONY_ROAMING_STATUS)+1) == 0) {
                        dbus_message_iter_next(&prop); /* it's variant here, expand it */
                        dbus_message_iter_recurse(&prop, &bool_iter);
-                       ret_msg_if (dbus_message_iter_get_arg_type(&bool_iter) != DBUS_TYPE_BOOLEAN,
+                       ret_msg_if(dbus_message_iter_get_arg_type(&bool_iter) != DBUS_TYPE_BOOLEAN,
                        "Return for %s isn't variant type as expected", DBUS_FREEDESKTOP_PROPERTIES);
 
-                       dbus_message_iter_get_basic (&bool_iter, &modem->roaming);
+                       dbus_message_iter_get_basic(&bool_iter, &modem->roaming);
                        _D("Roaming state for modem %s has changed", modem->name);
                        _D("roaming state now is %d", modem->roaming);
                } else if (strncmp(property, DBUS_TELEPHONY_SERVICE_TYPE, strlen(DBUS_TELEPHONY_SERVICE_TYPE)+1) == 0) {
                        dbus_message_iter_next(&prop); /* it's variant here, expand it */
                        dbus_message_iter_recurse(&prop, &bool_iter);
-                       ret_msg_if (dbus_message_iter_get_arg_type(&bool_iter) != DBUS_TYPE_INT32,
+                       ret_msg_if(dbus_message_iter_get_arg_type(&bool_iter) != DBUS_TYPE_INT32,
                        "Return for %s isn't variant type as expected", DBUS_FREEDESKTOP_PROPERTIES);
 
-                       dbus_message_iter_get_basic (&bool_iter, &modem->protocol);
+                       dbus_message_iter_get_basic(&bool_iter, &modem->protocol);
                        _D("Protocol for modem %s has changed", modem->name);
                        _D("protocol now is %d", modem->protocol);
                } else {
@@ -515,7 +515,7 @@ static void edbus_sim_status_changed(void *data, DBusMessage *msg)
        DBusMessageIter iter;
 
        _D("it's signal by %s path", dbus_message_get_path(msg));
-       dbus_message_iter_init (msg, &iter);
+       dbus_message_iter_init(msg, &iter);
        arg_type = dbus_message_iter_get_arg_type(&iter);
        dbus_message_iter_get_basic(&iter, &sim_status);
 
@@ -603,7 +603,7 @@ char *get_imsi_hash(char *imsi)
                struct modem_state *modem = (struct modem_state *)iter->data;
                if (modem->imsi == NULL)
                        continue;
-               if(!strncmp(imsi, modem->imsi, strlen(modem->imsi)+1))
+               if (!strncmp(imsi, modem->imsi, strlen(modem->imsi)+1))
                        return modem->imsi_hash;
        }
        return NULL;
index 81b4460..da2b10c 100644 (file)
@@ -62,7 +62,7 @@ static gboolean find_hash(gpointer key, gpointer value, gpointer user_data)
        if (!user_data || !key)
                return FALSE;
 
-       return (strstr((char *)user_data, (char *)key) ? TRUE: FALSE);
+       return (strstr((char *)user_data, (char *)key) ? TRUE : FALSE);
 }
 
 static void print_favorite_list(gpointer key, gpointer value, gpointer user_data)
@@ -91,7 +91,7 @@ static Eina_Bool appusage_update_cb(void *data)
 
 static int load_appusage_config(struct parse_result *result, void *user_data)
 {
-       if(!result)
+       if (!result)
                return -EINVAL;
 
        if (strncmp(result->section, APPUSAGE_CONF_SECTION, strlen(APPUSAGE_CONF_SECTION)+1))
@@ -117,7 +117,7 @@ static int proc_appusage_table_init(void)
        int ret;
 
        ret = config_parse(APPUSAGE_CONF_FILE, load_appusage_config, NULL);
-       if(ret || !appusage_favorite_htab)
+       if (ret || !appusage_favorite_htab)
                return RESOURCED_ERROR_NO_DATA;
 
        favorite_count = g_hash_table_size(appusage_favorite_htab);
index 077a2ef..1f29e34 100644 (file)
@@ -118,7 +118,7 @@ void proc_set_process_memory_state(struct proc_app_info *pai,
        if (!pai)
                return;
 
-       pai->memory.memcg_idx= memcg_idx;
+       pai->memory.memcg_idx = memcg_idx;
        pai->memory.memcg_info = memcg_info;
        pai->memory.oom_score_adj = oom_score_adj;
 }
@@ -146,7 +146,7 @@ struct proc_app_info *find_app_info_by_appid(const char *appid)
 struct proc_app_info *find_app_info(const pid_t pid)
 {
        GSList *iter = NULL;
-       struct proc_app_info *pai= NULL;
+       struct proc_app_info *pai = NULL;
 
        gslist_for_each_item(iter, proc_app_list) {
                pai = (struct proc_app_info *)iter->data;
@@ -716,7 +716,7 @@ void proc_set_group(pid_t ownerpid, pid_t childpid, char *pkgname)
        struct proc_app_info *pai, *owner;
        struct proc_status ps = {0};
 
-       if (ownerpid <= 0 || childpid <=0)
+       if (ownerpid <= 0 || childpid <= 0)
                return;
 
        ret = proc_get_oom_score_adj(ownerpid, &owner_oom);
@@ -741,7 +741,7 @@ void proc_set_group(pid_t ownerpid, pid_t childpid, char *pkgname)
                                ppi->app_list = g_slist_remove(ppi->app_list, pai);
 
                        ret = proc_get_oom_score_adj(childpid, &child_oom);
-                       if(ret < 0) {
+                       if (ret < 0) {
                                _D("can't get oom score for pid (%d)", childpid);
                                child_oom = 0;
                        }
index 103c96d..71f875a 100644 (file)
@@ -502,7 +502,7 @@ static void proc_dbus_exclude_signal_handler(void *data, DBusMessage *msg)
                ps.pid = pid;
                resourced_notify(RESOURCED_NOTIFIER_APP_WAKEUP, &ps);
        } else if (len == 7) {
-               if(!strncmp(str, "ex", 2)) {
+               if (!strncmp(str, "ex", 2)) {
                        pe.pid = pid;
                        pe.type = PROC_EXCLUDE;
                        resourced_notify(RESOURCED_NOTIFIER_CONTROL_EXCLUDE, &pe);
@@ -561,7 +561,7 @@ static void proc_dbus_exclude_appid_signal_handler(void *data, DBusMessage *msg)
        if (len == 6 && !strncmp(str, "wa", 2)) {
                resourced_notify(RESOURCED_NOTIFIER_APP_WAKEUP, &ps);
        } else if (len == 7) {
-               if(!strncmp(str, "ex", 2)) {
+               if (!strncmp(str, "ex", 2)) {
                        pe.pid = ps.pid;
                        pe.type = PROC_EXCLUDE;
                        resourced_notify(RESOURCED_NOTIFIER_CONTROL_EXCLUDE, &pe);
index cf36652..63a192f 100644 (file)
@@ -305,7 +305,7 @@ static int proc_noti_socket_init(void)
        if (n > 1) {
                _E("Error: Too many file descriptors received: %d", n);
                return -1;
-       } else if (n==1) {
+       } else if (n == 1) {
                fd = SD_LISTEN_FDS_START + 0;
        } else {
                if (access(RESOURCED_SOCKET_PATH, F_OK) == 0)
index 87e3a69..3572e79 100644 (file)
@@ -73,7 +73,7 @@ static void proc_set_oom_score_childs(GSList *childs, int oom_score_adj)
 }
 
 static void proc_set_oom_score_services(int state, GSList *svcs,
-    int oom_score_adj)
+               int oom_score_adj)
 {
        GSList *iter;
 
@@ -176,7 +176,7 @@ static int proc_backgrd_manage(int currentpid, int active, int oom_score_adj)
 
                        if (spi->lru_state >= PROC_BACKGROUND) {
                                spi->lru_state++;
-                               if (spi->lru_state > PROC_LRU_MAX )
+                               if (spi->lru_state > PROC_LRU_MAX)
                                        spi->lru_state = PROC_LRU_MAX;
                                _D("BACKGRD : process %d increase lru %d", pid, spi->lru_state);
                        }
index ad20f33..ca009bc 100644 (file)
@@ -737,7 +737,7 @@ error:
 }
 
 static int send_socket_with_repy(struct resourced_noti *msg,
-    char*buf, char* len_buf)
+               char *buf, char *len_buf)
 {
        int client_len;
        int client_sockfd;
@@ -828,7 +828,7 @@ static resourced_ret_c proc_cgroup_send_status(const int type, int num, ...)
 }
 
 static resourced_ret_c proc_send_get_status(const int type, char* pid_buf,
-    char*buf, char* len_buf)
+               char *buf, char *len_buf)
 {
        struct resourced_noti *msg;
        resourced_ret_c ret = RESOURCED_ERROR_NONE;
@@ -909,7 +909,7 @@ API resourced_ret_c proc_cgroup_launch(int type, pid_t pid, char *app_id, char *
 }
 
 API resourced_ret_c proc_stat_get_pid_entry(int type, pid_t pid,
-    char* buf, int len)
+               char *buf, int len)
 {
        char pid_buf[MAX_DEC_SIZE(int)];
        char len_buf[MAX_DEC_SIZE(int)];
index 809a300..957419c 100644 (file)
@@ -136,7 +136,7 @@ void set_daemon_net_block_state(const enum traffic_restriction_type rst_type,
        if (rst_type == RST_SET)
                carg->opts->state |= RESOURCED_NET_BLOCKED_STATE; /* set bit */
        else {
-               carg->opts->state &=(~RESOURCED_NET_BLOCKED_STATE); /* nulify bit */
+               carg->opts->state &= (~RESOURCED_NET_BLOCKED_STATE); /* nulify bit */
                ecore_timer_thaw(carg->ecore_timer);
        }
 }
index 3acf6b5..fadba93 100755 (executable)
@@ -268,7 +268,7 @@ static void sluggish_get_summary(char *timestamp, int slug_vertical, int pid, do
 
        /* Get internal memory status */
        memset(&s, 0x00, sizeof(struct storage_size));
-       if (storage_get_size(INTERNAL, &s) < 0 ) {
+       if (storage_get_size(INTERNAL, &s) < 0) {
                _E("Fail to get internal memory size");
        } else {
                int_tot = s.total_size;
@@ -278,7 +278,7 @@ static void sluggish_get_summary(char *timestamp, int slug_vertical, int pid, do
 
        /* Get external memory status */
        memset(&s, 0x00, sizeof(struct storage_size));
-       if (storage_get_size(EXTERNAL, &s) < 0 ) {
+       if (storage_get_size(EXTERNAL, &s) < 0) {
                _E("Fail to get external memory size");
        } else {
                ext_tot = s.total_size;
@@ -319,7 +319,7 @@ static void sluggish_get_summary(char *timestamp, int slug_vertical, int pid, do
                fputs("Sluggishness type: MULTIMEDIA\n", fptr);
 
        /* 4. Write sluggish PID and process name */
-       fprintf(fptr,"Sluggish PID:%d\n", pid);
+       fprintf(fptr, "Sluggish PID:%d\n", pid);
 
        /* Get process name */
        snprintf(proc, sizeof(proc), "/proc/%d/cmdline", pid);
@@ -336,7 +336,7 @@ static void sluggish_get_summary(char *timestamp, int slug_vertical, int pid, do
        }
 
        /* 5. Write CPU usage */
-       fprintf(fptr,"CPU used:%3.2lf%%, idle:%3.2lf%%\n", cpu_usage, (100 - cpu_usage));
+       fprintf(fptr, "CPU used:%3.2lf%%, idle:%3.2lf%%\n", cpu_usage, (100 - cpu_usage));
        fclose(fptr);
 }
 
index 2213c84..d329368 100644 (file)
 
 enum swap_state swap_get_state(void)
 {
-        struct shared_modules_data *modules_data = get_shared_modules_data();
+       struct shared_modules_data *modules_data = get_shared_modules_data();
 
-        ret_value_msg_if(modules_data == NULL, RESOURCED_ERROR_FAIL,
-                         "Invalid shared modules data\n");
+       ret_value_msg_if(modules_data == NULL, RESOURCED_ERROR_FAIL,
+                        "Invalid shared modules data\n");
 
-        return modules_data->swap_data.swap_state;
+       return modules_data->swap_data.swap_state;
 }
index 39dba9e..f4849db 100644 (file)
@@ -239,7 +239,7 @@ static int swap_move_to_cgroup_by_pid(enum memcg_type type, pid_t pid)
                struct child_pid *child;
 
                child = (struct child_pid *)(iter_child->data);
-               ret= place_pid_to_cgroup_by_fullpath(mi->name, child->pid);
+               ret = place_pid_to_cgroup_by_fullpath(mi->name, child->pid);
        }
        pai->memory.memcg_idx = MEMCG_SWAP;
        pai->memory.memcg_info = mi;
@@ -273,7 +273,7 @@ static int swap_move_to_cgroup(struct memcg_info *info, GArray *candidates)
 }
 
 static int swap_sort_by_oom(const struct swap_task *ta,
-    const struct swap_task *tb)
+               const struct swap_task *tb)
 {
        /* sort by oom score adj */
        assert(ta != NULL);
@@ -284,7 +284,7 @@ static int swap_sort_by_oom(const struct swap_task *ta,
 }
 
 static int swap_sort_by_vmrss(const struct swap_task *ta,
-    const struct swap_task *tb)
+               const struct swap_task *tb)
 {
        /* sort by task memory usage */
        assert(ta != NULL);
index 124a9eb..ed57127 100644 (file)
 #include <sys/types.h>
 #include <dirent.h>
 
-#define TIMER_EXCLUDE_CGROUP   "exclude"
-#define TIMER_SERVICE_CGROUP   "service"
-#define TIMER_BACKGRD_CGROUP   "background"
-#define TIMER_STATUS_LCDOFF    "LCDOFF"
+#define TIMER_EXCLUDE_CGROUP   "exclude"
+#define TIMER_SERVICE_CGROUP   "service"
+#define TIMER_BACKGRD_CGROUP   "background"
+#define TIMER_STATUS_LCDOFF    "LCDOFF"
 #define TIMER_SLACK_ROOT               NULL
-#define TIMER_STATUS_POWERSAVING       "POWERSAVING"
+#define TIMER_STATUS_POWERSAVING       "POWERSAVING"
 
 #define TIMER_CONF_FILE     RD_CONFIG_FILE(timer-slack)
-#define EXCLUDE_CONF_SECTION           "EXCLUDE_TIMER_SLACK"
-#define EXCLUDE_CONF_NAME      "EXCLUDE_PROC_NAME"
+#define EXCLUDE_CONF_SECTION   "EXCLUDE_TIMER_SLACK"
+#define EXCLUDE_CONF_NAME      "EXCLUDE_PROC_NAME"
 
 #define TIMER_SLACK_MODE       "/timer_slack.timer_mode"
 #define TIMER_SLACK_VALUE      "/timer_slack.min_slack_ns"
@@ -206,7 +206,7 @@ static int load_timer_config(struct parse_result *result, void *user_data)
                                timer_slack[i].slack_value = atoi(result->value);
                }
        }
-       return RESOURCED_ERROR_NONE;
+       return RESOURCED_ERROR_NONE;
 }
 
 static void timer_slack_cgroup_init(void)
index 4dc8a4a..77636c4 100644 (file)
@@ -46,7 +46,7 @@
 #include "module-data.h"
 #include "vip-process.h"
 
-#define VIP_CONF_FILE          RD_CONFIG_FILE(vip-process)
+#define VIP_CONF_FILE          RD_CONFIG_FILE(vip-process)
 
 static char **arg_vip_proc_names = NULL;
 static char **arg_vip_systemd_services = NULL;
index 02f53e9..017172d 100644 (file)
@@ -53,7 +53,7 @@ static int run_exec(char **argv)
                if (wpid == 0) {
                        if (times < MAX_TIMES) {
                                sleep(WAIT_TIMEOUT);
-                               times ++;
+                               times++;
                        } else {
                                _D("timeout!!, kill child process(%s)\n",
                                    argv[0]);