From 78ef038cfa5f11e1353099e387b642dfdbb396c0 Mon Sep 17 00:00:00 2001 From: Morris Jette <jette@schedmd.com> Date: Mon, 28 Jan 2013 11:36:02 -0800 Subject: [PATCH] No change in logic. Change formatting to match standard --- src/api/allocate.c | 2 +- src/api/block_info.c | 4 +- src/api/config_info.c | 20 +- src/api/job_info.c | 34 +- src/api/job_step_info.c | 26 +- src/api/partition_info.c | 12 +- src/api/reconfigure.c | 2 +- src/api/slurm_pmi.c | 2 +- src/api/step_launch.c | 2 +- src/common/bitstring.c | 6 +- src/common/daemonize.c | 2 +- src/common/env.c | 22 +- src/common/forward.c | 50 +- src/common/hostlist.c | 78 +- src/common/list.c | 6 +- src/common/log.c | 12 +- src/common/node_select.c | 20 +- src/common/pack.c | 2 +- src/common/parse_config.c | 2 +- src/common/parse_time.c | 2 +- src/common/plugin.c | 8 +- src/common/print_fields.c | 130 +-- src/common/proc_args.c | 8 +- src/common/read_config.c | 52 +- src/common/safeopen.c | 2 +- src/common/slurm_jobacct_gather.c | 8 +- src/common/slurm_protocol_defs.c | 38 +- src/common/slurm_resource_info.c | 6 +- src/common/slurm_step_layout.c | 26 +- src/common/slurmdb_defs.c | 532 ++++++------ src/common/slurmdb_pack.c | 1110 ++++++++++++------------- src/common/slurmdbd_defs.c | 392 ++++----- src/common/stepd_api.c | 2 +- src/common/xstring.c | 10 +- src/common/xtree.c | 2 +- src/db_api/cluster_report_functions.c | 62 +- src/db_api/job_report_functions.c | 80 +- src/db_api/user_report_functions.c | 48 +- src/sacct/options.c | 178 ++-- src/sacct/print.c | 82 +- src/sacct/process.c | 4 +- src/sacct/sacct.c | 4 +- src/sacctmgr/account_functions.c | 210 ++--- src/sacctmgr/archive_functions.c | 86 +- src/sacctmgr/association_functions.c | 16 +- src/sacctmgr/cluster_functions.c | 144 ++-- src/sacctmgr/common.c | 14 +- src/sacctmgr/event_functions.c | 150 ++-- src/sacctmgr/file_functions.c | 4 +- src/sacctmgr/job_functions.c | 8 +- src/sacctmgr/problem_functions.c | 28 +- src/sacctmgr/qos_functions.c | 180 ++-- src/sacctmgr/sacctmgr.c | 44 +- src/sacctmgr/txn_functions.c | 44 +- src/sacctmgr/user_functions.c | 314 +++---- src/sacctmgr/wckey_functions.c | 48 +- src/salloc/opt.c | 24 +- src/salloc/salloc.c | 2 +- src/sbatch/mult_cluster.c | 4 +- src/sbatch/opt.c | 84 +- src/sbcast/agent.c | 4 +- src/scontrol/info_job.c | 4 +- src/scontrol/scontrol.c | 26 +- src/scontrol/update_job.c | 2 +- src/sinfo/print.c | 10 +- src/sinfo/sinfo.c | 20 +- src/slurmctld/acct_policy.c | 10 +- src/slurmctld/agent.c | 18 +- src/slurmctld/controller.c | 20 +- src/slurmctld/job_mgr.c | 32 +- src/slurmctld/node_mgr.c | 14 +- src/slurmctld/partition_mgr.c | 6 +- src/slurmctld/proc_req.c | 6 +- src/slurmctld/step_mgr.c | 2 +- src/smap/configure_functions.c | 4 +- src/smap/opts.c | 6 +- src/sprio/opts.c | 4 +- src/squeue/print.c | 14 +- src/sreport/cluster_reports.c | 212 ++--- src/sreport/common.c | 66 +- src/sreport/job_reports.c | 192 ++--- src/sreport/resv_reports.c | 86 +- src/sreport/sreport.c | 4 +- src/sreport/user_reports.c | 60 +- src/srun/srun.c | 2 +- src/sshare/sshare.c | 56 +- src/sstat/print.c | 4 +- 87 files changed, 2689 insertions(+), 2689 deletions(-) diff --git a/src/api/allocate.c b/src/api/allocate.c index 2f8cb0bde9d..fb3a661bb41 100644 --- a/src/api/allocate.c +++ b/src/api/allocate.c @@ -745,7 +745,7 @@ _accept_msg_connection(int listen_fd, msg = xmalloc(sizeof(slurm_msg_t)); slurm_msg_t_init(msg); - if((rc = slurm_receive_msg(conn_fd, msg, 0)) != 0) { + if ((rc = slurm_receive_msg(conn_fd, msg, 0)) != 0) { slurm_free_msg(msg); if (errno == EINTR) { diff --git a/src/api/block_info.c b/src/api/block_info.c index ccbc6271483..4c4323bab7b 100644 --- a/src/api/block_info.c +++ b/src/api/block_info.c @@ -155,14 +155,14 @@ char *slurm_sprint_block_info( tmp_char = conn_type_string_full(block_ptr->conn_type); xstrfmtcat(out, "ConnType=%s", tmp_char); xfree(tmp_char); - if(cluster_flags & CLUSTER_FLAG_BGL) + if (cluster_flags & CLUSTER_FLAG_BGL) xstrfmtcat(out, " NodeUse=%s", node_use_string(block_ptr->node_use)); xstrcat(out, line_end); /****** Line 3 ******/ - if(block_ptr->ionode_str) + if (block_ptr->ionode_str) xstrfmtcat(out, "MidPlanes=%s[%s] MPIndices=", block_ptr->mp_str, block_ptr->ionode_str); else diff --git a/src/api/config_info.c b/src/api/config_info.c index 1672636c581..fac1f8855aa 100644 --- a/src/api/config_info.c +++ b/src/api/config_info.c @@ -105,11 +105,11 @@ void slurm_print_ctl_conf ( FILE* out, char *select_title = ""; uint32_t cluster_flags = slurmdb_setup_cluster_flags(); - if(cluster_flags & CLUSTER_FLAG_BGL) + if (cluster_flags & CLUSTER_FLAG_BGL) select_title = "\nBluegene/L configuration\n"; - else if(cluster_flags & CLUSTER_FLAG_BGP) + else if (cluster_flags & CLUSTER_FLAG_BGP) select_title = "\nBluegene/P configuration\n"; - else if(cluster_flags & CLUSTER_FLAG_BGQ) + else if (cluster_flags & CLUSTER_FLAG_BGQ) select_title = "\nBluegene/Q configuration\n"; if ( slurm_ctl_conf_ptr == NULL ) @@ -121,7 +121,7 @@ void slurm_print_ctl_conf ( FILE* out, time_str); ret_list = slurm_ctl_conf_2_key_pairs(slurm_ctl_conf_ptr); - if(ret_list) { + if (ret_list) { slurm_print_key_pairs(out, ret_list, tmp_str); list_destroy((List)ret_list); @@ -299,7 +299,7 @@ extern void *slurm_ctl_conf_2_key_pairs (slurm_ctl_conf_t* slurm_ctl_conf_ptr) key_pair = xmalloc(sizeof(config_key_pair_t)); list_append(ret_list, key_pair); key_pair->name = xstrdup("DisableRootJobs"); - if(slurm_ctl_conf_ptr->disable_root_jobs) + if (slurm_ctl_conf_ptr->disable_root_jobs) key_pair->value = xstrdup("YES"); else key_pair->value = xstrdup("NO"); @@ -307,7 +307,7 @@ extern void *slurm_ctl_conf_2_key_pairs (slurm_ctl_conf_t* slurm_ctl_conf_ptr) key_pair = xmalloc(sizeof(config_key_pair_t)); list_append(ret_list, key_pair); key_pair->name = xstrdup("EnforcePartLimits"); - if(slurm_ctl_conf_ptr->enforce_part_limits) + if (slurm_ctl_conf_ptr->enforce_part_limits) key_pair->value = xstrdup("YES"); else key_pair->value = xstrdup("NO"); @@ -404,7 +404,7 @@ extern void *slurm_ctl_conf_2_key_pairs (slurm_ctl_conf_t* slurm_ctl_conf_ptr) key_pair->value = xstrdup(slurm_ctl_conf_ptr->health_check_program); list_append(ret_list, key_pair); - if(cluster_flags & CLUSTER_FLAG_XCPU) { + if (cluster_flags & CLUSTER_FLAG_XCPU) { key_pair = xmalloc(sizeof(config_key_pair_t)); key_pair->name = xstrdup("HAVE_XCPU"); key_pair->value = xstrdup("1"); @@ -615,7 +615,7 @@ extern void *slurm_ctl_conf_2_key_pairs (slurm_ctl_conf_t* slurm_ctl_conf_ptr) key_pair->value = xstrdup(slurm_ctl_conf_ptr->mpi_params); list_append(ret_list, key_pair); - if(cluster_flags & CLUSTER_FLAG_MULTSD) { + if (cluster_flags & CLUSTER_FLAG_MULTSD) { key_pair = xmalloc(sizeof(config_key_pair_t)); key_pair->name = xstrdup("MULTIPLE_SLURMD"); key_pair->value = xstrdup("1"); @@ -1214,8 +1214,8 @@ slurm_load_slurmd_status(slurmd_status_t **slurmd_status_ptr) slurm_msg_t_init(&req_msg); slurm_msg_t_init(&resp_msg); - if(cluster_flags & CLUSTER_FLAG_MULTSD) { - if((this_addr = getenv("SLURMD_NODENAME"))) { + if (cluster_flags & CLUSTER_FLAG_MULTSD) { + if ((this_addr = getenv("SLURMD_NODENAME"))) { slurm_conf_get_addr(this_addr, &req_msg.address); } else { this_addr = "localhost"; diff --git a/src/api/job_info.c b/src/api/job_info.c index d152042d905..8278dc3f11c 100644 --- a/src/api/job_info.c +++ b/src/api/job_info.c @@ -130,14 +130,14 @@ static void _sprint_range(char *str, uint32_t str_size, char tmp[128]; uint32_t cluster_flags = slurmdb_setup_cluster_flags(); - if(cluster_flags & CLUSTER_FLAG_BG) { + if (cluster_flags & CLUSTER_FLAG_BG) { convert_num_unit((float)lower, tmp, sizeof(tmp), UNIT_NONE); } else { snprintf(tmp, sizeof(tmp), "%u", lower); } if (upper > 0) { char tmp2[128]; - if(cluster_flags & CLUSTER_FLAG_BG) { + if (cluster_flags & CLUSTER_FLAG_BG) { convert_num_unit((float)upper, tmp2, sizeof(tmp2), UNIT_NONE); } else { @@ -240,7 +240,7 @@ slurm_sprint_job_info ( job_info_t * job_ptr, int one_liner ) "Priority=%u Account=%s QOS=%s", job_ptr->priority, job_ptr->account, job_ptr->qos); xstrcat(out, tmp_line); - if(slurm_get_track_wckey()) { + if (slurm_get_track_wckey()) { snprintf(tmp_line, sizeof(tmp_line), " WCKey=%s", job_ptr->wckey); xstrcat(out, tmp_line); @@ -447,7 +447,7 @@ line6: /****** Line 13 ******/ xstrfmtcat(out, "%s=", nodelist); xstrcat(out, job_ptr->nodes); - if(job_ptr->nodes && ionodes) { + if (job_ptr->nodes && ionodes) { snprintf(tmp_line, sizeof(tmp_line), "[%s]", ionodes); xstrcat(out, tmp_line); xfree(ionodes); @@ -476,7 +476,7 @@ line6: if ((min_nodes == 0) || (min_nodes == NO_VAL)) { min_nodes = job_ptr->num_nodes; max_nodes = job_ptr->max_nodes; - } else if(job_ptr->max_nodes) + } else if (job_ptr->max_nodes) max_nodes = min_nodes; } else { min_nodes = job_ptr->num_nodes; @@ -509,7 +509,7 @@ line6: if (!job_resrcs) goto line15; - if(cluster_flags & CLUSTER_FLAG_BG) { + if (cluster_flags & CLUSTER_FLAG_BG) { if ((job_resrcs->cpu_array_cnt > 0) && (job_resrcs->cpu_array_value) && (job_resrcs->cpu_array_reps)) { @@ -673,7 +673,7 @@ line15: } else tmp6_ptr = "Node"; - if(cluster_flags & CLUSTER_FLAG_BG) { + if (cluster_flags & CLUSTER_FLAG_BG) { convert_num_unit((float)job_ptr->pn_min_cpus, tmp1, sizeof(tmp1), UNIT_NONE); snprintf(tmp_line, sizeof(tmp_line), "MinCPUsNode=%s", tmp1); @@ -732,7 +732,7 @@ line15: job_ptr->work_dir); xstrcat(out, tmp_line); - if(cluster_flags & CLUSTER_FLAG_BG) { + if (cluster_flags & CLUSTER_FLAG_BG) { /****** Line 20 (optional) ******/ select_g_select_jobinfo_sprint(job_ptr->select_jobinfo, select_buf, sizeof(select_buf), @@ -759,7 +759,7 @@ line15: xstrcat(out, select_buf); } - if(cluster_flags & CLUSTER_FLAG_BGL) { + if (cluster_flags & CLUSTER_FLAG_BGL) { /****** Line 22 (optional) ******/ select_g_select_jobinfo_sprint( job_ptr->select_jobinfo, @@ -784,7 +784,7 @@ line15: xstrcat(out, " "); else xstrcat(out, "\n "); - if(cluster_flags & CLUSTER_FLAG_BGL) + if (cluster_flags & CLUSTER_FLAG_BGL) snprintf(tmp_line, sizeof(tmp_line), "LinuxImage=%s", select_buf); else @@ -815,7 +815,7 @@ line15: xstrcat(out, " "); else xstrcat(out, "\n "); - if(cluster_flags & CLUSTER_FLAG_BGL) + if (cluster_flags & CLUSTER_FLAG_BGL) snprintf(tmp_line, sizeof(tmp_line), "RamDiskImage=%s", select_buf); else @@ -1029,8 +1029,8 @@ slurm_pid2jobid (pid_t job_pid, uint32_t *jobid) slurm_msg_t_init(&req_msg); slurm_msg_t_init(&resp_msg); - if(cluster_flags & CLUSTER_FLAG_MULTSD) { - if((this_addr = getenv("SLURMD_NODENAME"))) { + if (cluster_flags & CLUSTER_FLAG_MULTSD) { + if ((this_addr = getenv("SLURMD_NODENAME"))) { slurm_conf_get_addr(this_addr, &req_msg.address); } else { this_addr = "localhost"; @@ -1059,13 +1059,13 @@ slurm_pid2jobid (pid_t job_pid, uint32_t *jobid) rc = slurm_send_recv_node_msg(&req_msg, &resp_msg, 0); - if(rc != 0 || !resp_msg.auth_cred) { + if (rc != 0 || !resp_msg.auth_cred) { error("slurm_pid2jobid: %m"); - if(resp_msg.auth_cred) + if (resp_msg.auth_cred) g_slurm_auth_destroy(resp_msg.auth_cred); return SLURM_ERROR; } - if(resp_msg.auth_cred) + if (resp_msg.auth_cred) g_slurm_auth_destroy(resp_msg.auth_cred); switch (resp_msg.msg_type) { case RESPONSE_JOB_ID: @@ -1271,7 +1271,7 @@ extern int slurm_job_cpus_allocated_on_node_id( for (i = 0; i < job_resrcs_ptr->cpu_array_cnt; i++) { start_node += job_resrcs_ptr->cpu_array_reps[i]; - if(start_node >= node_id) + if (start_node >= node_id) break; } diff --git a/src/api/job_step_info.c b/src/api/job_step_info.c index 686f23bfbb3..7f9a2623415 100644 --- a/src/api/job_step_info.c +++ b/src/api/job_step_info.c @@ -66,7 +66,7 @@ static int _sort_pids_by_name(job_step_pids_t *rec_a, job_step_pids_t *rec_b) { int diff = 0; - if(!rec_a->node_name || !rec_b->node_name) + if (!rec_a->node_name || !rec_b->node_name) return 0; diff = strcmp(rec_a->node_name, rec_b->node_name); @@ -80,7 +80,7 @@ static int _sort_pids_by_name(job_step_pids_t *rec_a, job_step_pids_t *rec_b) static int _sort_stats_by_name(job_step_stat_t *rec_a, job_step_stat_t *rec_b) { - if(!rec_a->step_pids || !rec_b->step_pids) + if (!rec_a->step_pids || !rec_b->step_pids) return 0; return _sort_pids_by_name(rec_a->step_pids, rec_b->step_pids); @@ -499,8 +499,8 @@ extern int slurm_job_step_get_pids(uint32_t job_id, uint32_t step_id, xassert(resp); - if(!node_list) { - if(!(step_layout = + if (!node_list) { + if (!(step_layout = slurm_job_step_layout_get(job_id, step_id))) { rc = errno; error("slurm_job_step_get_pids: " @@ -511,7 +511,7 @@ extern int slurm_job_step_get_pids(uint32_t job_id, uint32_t step_id, node_list = step_layout->node_list; } - if(!*resp) { + if (!*resp) { resp_out = xmalloc(sizeof(job_step_pids_response_msg_t)); *resp = resp_out; created = 1; @@ -531,11 +531,11 @@ extern int slurm_job_step_get_pids(uint32_t job_id, uint32_t step_id, req_msg.msg_type = REQUEST_JOB_STEP_PIDS; req_msg.data = &req; - if(!(ret_list = slurm_send_recv_msgs(node_list, + if (!(ret_list = slurm_send_recv_msgs(node_list, &req_msg, 0, false))) { error("slurm_job_step_get_pids: got an error no list returned"); rc = SLURM_ERROR; - if(created) { + if (created) { slurm_job_step_pids_response_msg_free(resp_out); *resp = NULL; } @@ -546,7 +546,7 @@ extern int slurm_job_step_get_pids(uint32_t job_id, uint32_t step_id, while((ret_data_info = list_next(itr))) { switch (ret_data_info->type) { case RESPONSE_JOB_STEP_PIDS: - if(!resp_out->pid_list) + if (!resp_out->pid_list) resp_out->pid_list = list_create( slurm_free_job_step_pids); list_push(resp_out->pid_list, @@ -573,7 +573,7 @@ extern int slurm_job_step_get_pids(uint32_t job_id, uint32_t step_id, list_iterator_destroy(itr); list_destroy(ret_list); - if(resp_out->pid_list) + if (resp_out->pid_list) list_sort(resp_out->pid_list, (ListCmpF)_sort_pids_by_name); cleanup: slurm_step_layout_destroy(step_layout); @@ -595,8 +595,8 @@ extern void slurm_job_step_pids_response_msg_free(void *object) { job_step_pids_response_msg_t *step_pids_msg = (job_step_pids_response_msg_t *) object; - if(step_pids_msg) { - if(step_pids_msg->pid_list) + if (step_pids_msg) { + if (step_pids_msg->pid_list) list_destroy(step_pids_msg->pid_list); xfree(step_pids_msg); } @@ -611,8 +611,8 @@ extern void slurm_job_step_stat_response_msg_free(void *object) { job_step_stat_response_msg_t *step_stat_msg = (job_step_stat_response_msg_t *) object; - if(step_stat_msg) { - if(step_stat_msg->stats_list) + if (step_stat_msg) { + if (step_stat_msg->stats_list) list_destroy(step_stat_msg->stats_list); xfree(step_stat_msg); } diff --git a/src/api/partition_info.c b/src/api/partition_info.c index c1a920caea0..b9db37ee68f 100644 --- a/src/api/partition_info.c +++ b/src/api/partition_info.c @@ -157,7 +157,7 @@ char *slurm_sprint_partition_info ( partition_info_t * part_ptr, /****** Line added here for BG partitions to keep with alphabetized output******/ - if(cluster_flags & CLUSTER_FLAG_BG) { + if (cluster_flags & CLUSTER_FLAG_BG) { snprintf(tmp_line, sizeof(tmp_line), "BasePartitions=%s", part_ptr->nodes); xstrcat(out, tmp_line); @@ -202,7 +202,7 @@ char *slurm_sprint_partition_info ( partition_info_t * part_ptr, if (part_ptr->max_nodes == INFINITE) sprintf(tmp_line, "MaxNodes=UNLIMITED"); else { - if(cluster_flags & CLUSTER_FLAG_BG) + if (cluster_flags & CLUSTER_FLAG_BG) convert_num_unit((float)part_ptr->max_nodes, tmp1, sizeof(tmp1), UNIT_NONE); else @@ -220,7 +220,7 @@ char *slurm_sprint_partition_info ( partition_info_t * part_ptr, sprintf(tmp_line, " MaxTime=%s", time_line); } xstrcat(out, tmp_line); - if(cluster_flags & CLUSTER_FLAG_BG) + if (cluster_flags & CLUSTER_FLAG_BG) convert_num_unit((float)part_ptr->min_nodes, tmp1, sizeof(tmp1), UNIT_NONE); else @@ -237,7 +237,7 @@ char *slurm_sprint_partition_info ( partition_info_t * part_ptr, /****** Line added here for non BG nodes to keep with alphabetized output******/ - if(!(cluster_flags & CLUSTER_FLAG_BG)) { + if (!(cluster_flags & CLUSTER_FLAG_BG)) { snprintf(tmp_line, sizeof(tmp_line), "Nodes=%s", part_ptr->nodes); xstrcat(out, tmp_line); @@ -301,7 +301,7 @@ char *slurm_sprint_partition_info ( partition_info_t * part_ptr, xstrcat(out, tmp_line); - if(cluster_flags & CLUSTER_FLAG_BG) + if (cluster_flags & CLUSTER_FLAG_BG) convert_num_unit((float)part_ptr->total_cpus, tmp1, sizeof(tmp1), UNIT_NONE); else @@ -309,7 +309,7 @@ char *slurm_sprint_partition_info ( partition_info_t * part_ptr, sprintf(tmp_line, " TotalCPUs=%s", tmp1); xstrcat(out, tmp_line); - if(cluster_flags & CLUSTER_FLAG_BG) + if (cluster_flags & CLUSTER_FLAG_BG) convert_num_unit((float)part_ptr->total_nodes, tmp2, sizeof(tmp2), UNIT_NONE); else diff --git a/src/api/reconfigure.c b/src/api/reconfigure.c index 2fd0e027c4e..99fa6a64266 100644 --- a/src/api/reconfigure.c +++ b/src/api/reconfigure.c @@ -170,7 +170,7 @@ _send_message_controller (enum controller_id dest, slurm_msg_t *req) resp_msg = xmalloc(sizeof(slurm_msg_t)); slurm_msg_t_init(resp_msg); - if((rc = slurm_receive_msg(fd, resp_msg, 0)) != 0) { + if ((rc = slurm_receive_msg(fd, resp_msg, 0)) != 0) { slurm_shutdown_msg_conn(fd); return SLURMCTLD_COMMUNICATIONS_RECEIVE_ERROR; } diff --git a/src/api/slurm_pmi.c b/src/api/slurm_pmi.c index 6dab963710b..8afc82553bc 100644 --- a/src/api/slurm_pmi.c +++ b/src/api/slurm_pmi.c @@ -307,7 +307,7 @@ int slurm_get_kvs_comm_set(struct kvs_comm_set **kvs_set_ptr, slurm_close_accepted_conn(srun_fd); return errno; } - if(msg_rcv.auth_cred) + if (msg_rcv.auth_cred) (void)g_slurm_auth_destroy(msg_rcv.auth_cred); if (msg_rcv.msg_type != PMI_KVS_GET_RESP) { diff --git a/src/api/step_launch.c b/src/api/step_launch.c index 8d49b60d66b..5e7b7d5bcb5 100644 --- a/src/api/step_launch.c +++ b/src/api/step_launch.c @@ -1006,7 +1006,7 @@ static int _msg_thr_create(struct step_launch_state *sls, int num_nodes) /* multiple jobs (easily induced via no_alloc) and highly * parallel jobs using PMI sometimes result in slow message * responses and timeouts. Raise the default timeout for srun. */ - if(!message_socket_ops.timeout) + if (!message_socket_ops.timeout) message_socket_ops.timeout = slurm_get_msg_timeout() * 8000; for (i = 0; i < sls->num_resp_port; i++) { diff --git a/src/common/bitstring.c b/src/common/bitstring.c index 97b6716d1c7..2de03265ec7 100644 --- a/src/common/bitstring.c +++ b/src/common/bitstring.c @@ -1038,7 +1038,7 @@ inx2bitfmt (int *inx) return NULL; while (inx[j] >= 0) { - if(bit_char_ptr) + if (bit_char_ptr) xstrfmtcat(bit_char_ptr, ",%d-%d", inx[j], inx[j+1]); else xstrfmtcat(bit_char_ptr, "%d-%d", inx[j], inx[j+1]); @@ -1244,13 +1244,13 @@ bit_get_bit_num(bitstr_t *b, int pos) for (bit = 0; bit < bit_cnt; bit++) { if (bit_test(b, bit)) { /* we got one */ - if(cnt == pos) + if (cnt == pos) break; cnt++; } } - if(bit >= bit_cnt) + if (bit >= bit_cnt) bit = -1; return bit; diff --git a/src/common/daemonize.c b/src/common/daemonize.c index 09ab391e293..445047291c6 100644 --- a/src/common/daemonize.c +++ b/src/common/daemonize.c @@ -75,7 +75,7 @@ daemon(int nochdir, int noclose) default: _exit(0); /* exit parent */ } - if(!nochdir && chdir("/") < 0) { + if (!nochdir && chdir("/") < 0) { error("chdir(/): %m"); return -1; } diff --git a/src/common/env.c b/src/common/env.c index ccf5123c19b..0af419555b0 100644 --- a/src/common/env.c +++ b/src/common/env.c @@ -389,12 +389,12 @@ int setup_env(env_t *env, bool preserve_env) } if (!preserve_env && env->ntasks) { - if(setenvf(&env->env, "SLURM_NTASKS", "%d", env->ntasks)) { + if (setenvf(&env->env, "SLURM_NTASKS", "%d", env->ntasks)) { error("Unable to set SLURM_NTASKS " "environment variable"); rc = SLURM_FAILURE; } - if(setenvf(&env->env, "SLURM_NPROCS", "%d", env->ntasks)) { + if (setenvf(&env->env, "SLURM_NPROCS", "%d", env->ntasks)) { error("Unable to set SLURM_NPROCS " "environment variable"); rc = SLURM_FAILURE; @@ -437,13 +437,13 @@ int setup_env(env_t *env, bool preserve_env) } _set_distribution(env->distribution, &dist, &lllp_dist); - if(dist) + if (dist) if (setenvf(&env->env, "SLURM_DISTRIBUTION", "%s", dist)) { error("Can't set SLURM_DISTRIBUTION env variable"); rc = SLURM_FAILURE; } - if(env->distribution == SLURM_DIST_PLANE) + if (env->distribution == SLURM_DIST_PLANE) if (setenvf(&env->env, "SLURM_DIST_PLANESIZE", "%u", env->plane_size)) { error("Can't set SLURM_DIST_PLANESIZE " @@ -451,7 +451,7 @@ int setup_env(env_t *env, bool preserve_env) rc = SLURM_FAILURE; } - if(lllp_dist) + if (lllp_dist) if (setenvf(&env->env, "SLURM_DIST_LLLP", "%s", lllp_dist)) { error("Can't set SLURM_DIST_LLLP env variable"); rc = SLURM_FAILURE; @@ -799,7 +799,7 @@ int setup_env(env_t *env, bool preserve_env) rc = SLURM_FAILURE; } - if(cluster_flags & CLUSTER_FLAG_AIX) { + if (cluster_flags & CLUSTER_FLAG_AIX) { char res_env[128]; char *debug_env = (char *)getenv("SLURM_LL_API_DEBUG"); int debug_num = 0; @@ -875,7 +875,7 @@ static char *_uint16_array_to_str(int array_len, const uint16_t *array) char *sep = ","; /* seperator */ char *str = xstrdup(""); - if(array == NULL) + if (array == NULL) return str; for (i = 0; i < array_len; i++) { @@ -1041,7 +1041,7 @@ env_array_for_job(char ***dest, const resource_allocation_response_msg_t *alloc, env_array_overwrite_fmt(dest, "SLURM_NNODES", "%u", node_cnt); env_array_overwrite_fmt(dest, "SLURM_NODELIST", "%s", alloc->node_list); - if(num_tasks == NO_VAL) { + if (num_tasks == NO_VAL) { /* If we know how many tasks we are going to do then we set SLURM_TASKS_PER_NODE */ int i=0; @@ -1054,20 +1054,20 @@ env_array_for_job(char ***dest, const resource_allocation_response_msg_t *alloc, num_tasks += alloc->cpu_count_reps[i] * alloc->cpus_per_node[i]; } - if((int)desc->cpus_per_task > 1 + if ((int)desc->cpus_per_task > 1 && desc->cpus_per_task != (uint16_t)NO_VAL) num_tasks /= desc->cpus_per_task; //num_tasks = desc->min_cpus; } - if(desc->task_dist == SLURM_DIST_ARBITRARY) { + if (desc->task_dist == SLURM_DIST_ARBITRARY) { tmp = desc->req_nodes; env_array_overwrite_fmt(dest, "SLURM_ARBITRARY_NODELIST", "%s", tmp); } else tmp = alloc->node_list; - if(!(step_layout = slurm_step_layout_create(tmp, + if (!(step_layout = slurm_step_layout_create(tmp, alloc->cpus_per_node, alloc->cpu_count_reps, node_cnt, diff --git a/src/common/forward.c b/src/common/forward.c index de9c9544f2b..fbef832dfa4 100644 --- a/src/common/forward.c +++ b/src/common/forward.c @@ -73,8 +73,8 @@ typedef struct { void _destroy_tree_fwd(fwd_tree_t *fwd_tree) { - if(fwd_tree) { - if(fwd_tree->tree_hl) + if (fwd_tree) { + if (fwd_tree->tree_hl) hostlist_destroy(fwd_tree->tree_hl); xfree(fwd_tree); } @@ -96,7 +96,7 @@ void *_forward_thread(void *arg) /* repeat until we are sure the message was sent */ while((name = hostlist_shift(hl))) { - if(slurm_conf_get_addr(name, &addr) == SLURM_ERROR) { + if (slurm_conf_get_addr(name, &addr) == SLURM_ERROR) { error("forward_thread: can't find address for host " "%s, check slurm.conf", name); slurm_mutex_lock(fwd_msg->forward_mutex); @@ -153,7 +153,7 @@ void *_forward_thread(void *arg) /* * forward message */ - if(_slurm_msg_sendto(fd, + if (_slurm_msg_sendto(fd, get_buf_data(buffer), get_buf_offset(buffer), SLURM_PROTOCOL_NO_SEND_RECV_FLAGS ) < 0) { @@ -163,7 +163,7 @@ void *_forward_thread(void *arg) mark_as_failed_forward(&fwd_msg->ret_list, name, errno); free(name); - if(hostlist_count(hl) > 0) { + if (hostlist_count(hl) > 0) { free_buf(buffer); buffer = init_buf(fwd_msg->buf_len); slurm_mutex_unlock(fwd_msg->forward_mutex); @@ -192,7 +192,7 @@ void *_forward_thread(void *arg) goto cleanup; } - if(fwd_msg->header.forward.cnt > 0) { + if (fwd_msg->header.forward.cnt > 0) { static int message_timeout = -1; if (message_timeout < 0) message_timeout = @@ -210,13 +210,13 @@ void *_forward_thread(void *arg) /* info("sent %d forwards got %d back", */ /* fwd_msg->header.forward.cnt, list_count(ret_list)); */ - if(!ret_list || (fwd_msg->header.forward.cnt != 0 + if (!ret_list || (fwd_msg->header.forward.cnt != 0 && list_count(ret_list) <= 1)) { slurm_mutex_lock(fwd_msg->forward_mutex); mark_as_failed_forward(&fwd_msg->ret_list, name, errno); free(name); - if(ret_list) + if (ret_list) list_destroy(ret_list); if (hostlist_count(hl) > 0) { free_buf(buffer); @@ -227,7 +227,7 @@ void *_forward_thread(void *arg) continue; } goto cleanup; - } else if((fwd_msg->header.forward.cnt+1) + } else if ((fwd_msg->header.forward.cnt+1) != list_count(ret_list)) { /* this should never be called since the above should catch the failed forwards and pipe @@ -247,19 +247,19 @@ void *_forward_thread(void *arg) int node_found = 0; itr = list_iterator_create(ret_list); while((ret_data_info = list_next(itr))) { - if(!ret_data_info->node_name) { + if (!ret_data_info->node_name) { first_node_found = 1; ret_data_info->node_name = xstrdup(name); } - if(!strcmp(tmp, + if (!strcmp(tmp, ret_data_info->node_name)) { node_found = 1; break; } } list_iterator_destroy(itr); - if(!node_found) { + if (!node_found) { mark_as_failed_forward( &fwd_msg->ret_list, tmp, @@ -268,7 +268,7 @@ void *_forward_thread(void *arg) free(tmp); } hostlist_iterator_destroy(host_itr); - if(!first_node_found) { + if (!first_node_found) { mark_as_failed_forward(&fwd_msg->ret_list, name, SLURM_COMMUNICATIONS_CONNECTION_ERROR); @@ -277,9 +277,9 @@ void *_forward_thread(void *arg) break; } slurm_mutex_lock(fwd_msg->forward_mutex); - if(ret_list) { + if (ret_list) { while((ret_data_info = list_pop(ret_list)) != NULL) { - if(!ret_data_info->node_name) { + if (!ret_data_info->node_name) { ret_data_info->node_name = xstrdup(name); } list_push(fwd_msg->ret_list, ret_data_info); @@ -375,7 +375,7 @@ void *_fwd_tree_thread(void *arg) free(name); /* check for error and try again */ - if(errno == SLURM_COMMUNICATIONS_CONNECTION_ERROR) + if (errno == SLURM_COMMUNICATIONS_CONNECTION_ERROR) continue; break; @@ -395,7 +395,7 @@ void *_fwd_tree_thread(void *arg) */ extern void forward_init(forward_t *forward, forward_t *from) { - if(from && from->init == FORWARD_INIT) { + if (from && from->init == FORWARD_INIT) { forward->cnt = from->cnt; forward->timeout = from->timeout; forward->nodelist = from->nodelist; @@ -432,7 +432,7 @@ extern int forward_msg(forward_struct_t *forward_struct, hostlist_t forward_hl = NULL; char *name = NULL; - if(!forward_struct->ret_list) { + if (!forward_struct->ret_list) { error("didn't get a ret_list from forward_struct"); xfree(span); return SLURM_ERROR; @@ -455,7 +455,7 @@ extern int forward_msg(forward_struct_t *forward_struct, forward_msg->timeout = forward_struct->timeout; - if(forward_msg->timeout <= 0) { + if (forward_msg->timeout <= 0) { /* convert secs to msec */ forward_msg->timeout = slurm_get_msg_timeout() * 1000; } @@ -480,7 +480,7 @@ extern int forward_msg(forward_struct_t *forward_struct, free(name); for(j = 0; j < span[thr_count]; j++) { name = hostlist_shift(hl); - if(!name) + if (!name) break; hostlist_push(forward_hl, name); free(name); @@ -618,7 +618,7 @@ extern void mark_as_failed_forward(List *ret_list, char *node_name, int err) ret_data_info_t *ret_data_info = NULL; debug3("problems with %s", node_name); - if(!*ret_list) + if (!*ret_list) *ret_list = list_create(destroy_data_info); ret_data_info = xmalloc(sizeof(ret_data_info_t)); @@ -635,7 +635,7 @@ extern void forward_wait(slurm_msg_t * msg) int count = 0; /* wait for all the other messages on the tree under us */ - if(msg->forward_struct) { + if (msg->forward_struct) { debug2("looking for %d", msg->forward_struct->fwd_cnt); slurm_mutex_lock(&msg->forward_struct->forward_mutex); count = 0; @@ -663,7 +663,7 @@ extern void forward_wait(slurm_msg_t * msg) void destroy_data_info(void *object) { ret_data_info_t *ret_data_info = (ret_data_info_t *)object; - if(ret_data_info) { + if (ret_data_info) { slurm_free_msg_data(ret_data_info->type, ret_data_info->data); xfree(ret_data_info->node_name); @@ -673,7 +673,7 @@ void destroy_data_info(void *object) void destroy_forward(forward_t *forward) { - if(forward->init == FORWARD_INIT) { + if (forward->init == FORWARD_INIT) { xfree(forward->nodelist); forward->init = 0; } else { @@ -683,7 +683,7 @@ void destroy_forward(forward_t *forward) void destroy_forward_struct(forward_struct_t *forward_struct) { - if(forward_struct) { + if (forward_struct) { xfree(forward_struct->buf); xfree(forward_struct->forward_msg); slurm_mutex_destroy(&forward_struct->forward_mutex); diff --git a/src/common/hostlist.c b/src/common/hostlist.c index 98a41455cf1..212ddf95b74 100644 --- a/src/common/hostlist.c +++ b/src/common/hostlist.c @@ -667,7 +667,7 @@ static hostname_t hostname_create_dims(const char *hostname, int dims) hn->suffix = hn->hostname + idx + 1; - if((dims > 1) && (strlen(hn->suffix) != dims)) + if ((dims > 1) && (strlen(hn->suffix) != dims)) hostlist_base = 10; hn->num = strtoul(hn->suffix, &p, hostlist_base); @@ -1656,7 +1656,7 @@ hostlist_t _hostlist_create(const char *hostlist, char *sep, char *r_op, } done: - if(orig) + if (orig) free(orig); return new; @@ -1683,7 +1683,7 @@ static int _parse_box_range(char *str, struct _range *ranges, char coord2[dims+1]; int i, a; - if(dims <= 1) + if (dims <= 1) fatal("Unsupported dimensions count %d", dims); if ((str[dims] != 'x') || @@ -1743,12 +1743,12 @@ static int _parse_single_range(const char *str, struct _range *range, int dims) range->width = strlen(str); - if(dims > 1) { + if (dims > 1) { /* If we get something here where the width is not SYSTEM_DIMENSIONS we need to treat it as a regular number since that is how it will be treated in the future. */ - if(range->width != dims) + if (range->width != dims) hostlist_base = 10; } range->lo = strtoul(str, &q, hostlist_base); @@ -1920,7 +1920,7 @@ _hostlist_create_bracketed(const char *hostlist, char *sep, * wanted. We will just tack one on * the end. */ strcat(cur_tok, "]"); - if(prefix && prefix[0]) + if (prefix && prefix[0]) hostlist_push_host_dims( new, cur_tok, dims); else @@ -2101,7 +2101,7 @@ static void hostlist_shift_iterators(hostlist_t hl, int idx, int depth, int n) { hostlist_iterator_t i; - if(!hl) { + if (!hl) { error("hostlist_shift_iterators: no hostlist given"); return; } @@ -2124,7 +2124,7 @@ char *hostlist_shift(hostlist_t hl) { char *host = NULL; - if(!hl){ + if (!hl){ error("hostlist_shift: no hostlist given"); return NULL; } @@ -2156,7 +2156,7 @@ char *hostlist_pop_range(hostlist_t hl) hostlist_t hltmp; hostrange_t tail; - if(!hl) + if (!hl) return NULL; LOCK_HOSTLIST(hl); if (hl->nranges < 1 || !(hltmp = hostlist_new())) { @@ -2231,7 +2231,7 @@ int hostlist_delete(hostlist_t hl, const char *hosts) int n = 0; char *hostname = NULL; hostlist_t hltmp; - if(!hl) + if (!hl) return -1; if (!(hltmp = hostlist_create(hosts))) @@ -2252,7 +2252,7 @@ int hostlist_delete_host(hostlist_t hl, const char *hostname) { int n; - if(!hl) + if (!hl) return -1; n = hostlist_find(hl, hostname); @@ -2299,7 +2299,7 @@ char * hostlist_nth(hostlist_t hl, int n) char *host = NULL; int i, count; - if(!hl) + if (!hl) return NULL; LOCK_HOSTLIST(hl); count = 0; @@ -2323,7 +2323,7 @@ int hostlist_delete_nth(hostlist_t hl, int n) { int i, count; - if(!hl) + if (!hl) return -1; LOCK_HOSTLIST(hl); assert(n >= 0 && n <= hl->nhosts); @@ -2361,7 +2361,7 @@ done: int hostlist_count(hostlist_t hl) { int retval; - if(!hl) + if (!hl) return -1; LOCK_HOSTLIST(hl); @@ -2710,15 +2710,15 @@ static int _tell_if_used(int dim, int curr, for (last[dim]=start[dim]; last[dim]<=grid_end[dim]; last[dim]++) { curr = start_curr + (last[dim] * offset[dim]); - if(dim == (dims-1)) { + if (dim == (dims-1)) { if (!bit_test(bit_grid, curr)) { /* for(i = 0; i<dims; i++) { */ /* coord[i] = alpha_num[last[i]]; */ /* } */ /* info("%s not used", coord); */ - if((*found) == -1) + if ((*found) == -1) continue; - else if(end[dim] < grid_end[dim]) { + else if (end[dim] < grid_end[dim]) { /* try to get a box out of this slice. */ grid_end[dim] = end[dim]; @@ -2730,7 +2730,7 @@ static int _tell_if_used(int dim, int curr, /* coord[i] = alpha_num[last[i]]; */ /* } */ /* info("%s used", coord); */ - if((*found) == -1) { + if ((*found) == -1) { /* for(i = 0; i<dims; i++) { */ /* coord[i] = alpha_num[last[i]]; */ /* } */ @@ -2738,7 +2738,7 @@ static int _tell_if_used(int dim, int curr, memcpy(start, last, dim_grid_size); memcpy(end, last, dim_grid_size); (*found) = dims; - } else if((*found) >= dim) { + } else if ((*found) >= dim) { /* for(i = 0; i<dims; i++) { */ /* coord[i] = alpha_num[last[i]]; */ /* } */ @@ -2747,19 +2747,19 @@ static int _tell_if_used(int dim, int curr, (*found) = dim; } } else { - if((rc = _tell_if_used(dim+1, curr, + if ((rc = _tell_if_used(dim+1, curr, start, end, last, found, dims)) != 1) { return rc; } - if((*found) >= dim) { + if ((*found) >= dim) { /* for(i = 0; i<dims; i++) { */ /* coord[i] = alpha_num[last[i]]; */ /* } */ /* info("%d here %s", dim, coord); */ memcpy(end, last, dim_grid_size); (*found) = dim; - } else if((*found) == -1) + } else if ((*found) == -1) start[dim] = grid_start[dim]; } } @@ -2787,7 +2787,7 @@ static int _get_next_box(int *start, int *end, int dims) /* memset(coord2, 0, sizeof(coord2)); */ again: - if(start[0] == -1) { + if (start[0] == -1) { memcpy(start, grid_start, dim_grid_size); /* We need to keep track of this to make sure we get all the nodes marked since this could change based @@ -2824,7 +2824,7 @@ again: _set_min_max_of_grid(0, 0, grid_start, orig_grid_end, new_min, new_max, pos, dims); - if(new_max[0] != -1) { + if (new_max[0] != -1) { /* for(i = 0; i<dims; i++) { */ /* coord[i] = alpha_num[new_min[i]]; */ /* coord2[i] = alpha_num[new_max[i]]; */ @@ -2837,7 +2837,7 @@ again: /* for(i = 0; i<dims; i++) */ /* coord[i] = alpha_num[last[i]]; */ /* info("next start %s", coord); */ - if(found == -1) { + if (found == -1) { /* There are still nodes set in the grid, so we need to go through them again to make sure we got all the nodes that weren't included in the boxes of @@ -2846,7 +2846,7 @@ again: } } - if(found != -1) + if (found != -1) rc = 1; return rc; @@ -2875,7 +2875,7 @@ _get_boxes(char *buf, int max_len, int dims, int brackets) curr_min[0] = -1; /* for(i=0; i<HOSTLIST_BASE*HOSTLIST_BASE*HOSTLIST_BASE*HOSTLIST_BASE; i++) { */ -/* if(grid[i]) */ +/* if (grid[i]) */ /* info("got one at %d", i); */ /* } */ @@ -2885,30 +2885,30 @@ _get_boxes(char *buf, int max_len, int dims, int brackets) /* coord2[i] = alpha_num[curr_max[i]]; */ /* } */ /* info("%sx%s is a box", coord, coord2); */ - if(!memcmp(curr_min, curr_max, dim_grid_size)) { + if (!memcmp(curr_min, curr_max, dim_grid_size)) { for(i = 0; i<dims; i++) { - if(len >= max_len) + if (len >= max_len) goto end_it; buf[len++] = alpha_num[curr_min[i]]; } - if(len >= max_len) + if (len >= max_len) goto end_it; buf[len++] = ','; } else { for(i = 0; i<dims; i++) { - if(len >= max_len) + if (len >= max_len) goto end_it; buf[len++] = alpha_num[curr_min[i]]; } - if(len >= max_len) + if (len >= max_len) goto end_it; buf[len++] = 'x'; for(i = 0; i<dims; i++) { - if(len >= max_len) + if (len >= max_len) goto end_it; buf[len++] = alpha_num[curr_max[i]]; } - if(len >= max_len) + if (len >= max_len) goto end_it; buf[len++] = ','; } @@ -2957,7 +2957,7 @@ static int _add_box_ranges(int dim, int curr, for (pos[dim]=start[dim]; pos[dim]<=end[dim]; pos[dim]++) { curr = start_curr + (pos[dim] * offset[dim]); - if(dim == (dims-2)) { + if (dim == (dims-2)) { char new_str[(dims*2)+2]; memset(new_str, 0, sizeof(new_str)); @@ -2983,7 +2983,7 @@ static int _add_box_ranges(int dim, int curr, return 0; (*count)++; } else - if(!_add_box_ranges(dim+1, curr, start, end, pos, + if (!_add_box_ranges(dim+1, curr, start, end, pos, ranges, len, count, dims)) return 0; } @@ -3003,7 +3003,7 @@ static void _set_min_max_of_grid(int dim, int curr, for (pos[dim]=start[dim]; pos[dim]<=end[dim]; pos[dim]++) { curr = start_curr + (pos[dim] * offset[dim]); - if(dim == (dims-1)) { + if (dim == (dims-1)) { if (!bit_test(bit_grid, curr)) continue; for(i = 0; i<dims; i++) { @@ -3049,11 +3049,11 @@ _test_box_in_grid(int dim, int curr, for (i=start[dim]; i<=end[dim]; i++) { curr = start_curr + (i * offset[dim]); - if(dim == (dims-1)) { + if (dim == (dims-1)) { if (!bit_test(bit_grid, curr)) return false; } else { - if(!_test_box_in_grid(dim+1, curr, start, end, dims)) + if (!_test_box_in_grid(dim+1, curr, start, end, dims)) return false; } } diff --git a/src/common/list.c b/src/common/list.c index 30b0fb0a180..b759ac1b6c3 100644 --- a/src/common/list.c +++ b/src/common/list.c @@ -390,7 +390,7 @@ list_append_list (List l, List sub) assert(sub != NULL); itr = list_iterator_create(sub); while((v = list_next(itr))) { - if(list_append(l, v)) + if (list_append(l, v)) n++; else break; @@ -410,10 +410,10 @@ list_transfer (List l, List sub) assert(sub != NULL); assert(l->fDel == sub->fDel); while((v = list_pop(sub))) { - if(list_append(l, v)) + if (list_append(l, v)) n++; else { - if(l->fDel) + if (l->fDel) l->fDel(v); break; } diff --git a/src/common/log.c b/src/common/log.c index e8fe7a8f0de..24843368695 100644 --- a/src/common/log.c +++ b/src/common/log.c @@ -696,13 +696,13 @@ static char *vxstrfmt(const char *fmt, va_list ap) xstrcat(buf, "%u"); break; case 'l': - if((unprocessed == 0) && (*(p+1) == 'l')) { + if ((unprocessed == 0) && (*(p+1) == 'l')) { long_long = 1; p++; } if ((unprocessed == 0) && (*(p+1) == 'u')) { - if(long_long) { + if (long_long) { snprintf(tmp, sizeof(tmp), "%llu", va_arg(ap, @@ -716,7 +716,7 @@ static char *vxstrfmt(const char *fmt, va_list ap) xstrcat(buf, tmp); p++; } else if ((unprocessed==0) && (*(p+1)=='d')) { - if(long_long) { + if (long_long) { snprintf(tmp, sizeof(tmp), "%lld", va_arg(ap, @@ -729,7 +729,7 @@ static char *vxstrfmt(const char *fmt, va_list ap) xstrcat(buf, tmp); p++; } else if ((unprocessed==0) && (*(p+1)=='f')) { - if(long_long) { + if (long_long) { xstrcat(buf, "%llf"); long_long = 0; } else @@ -739,7 +739,7 @@ static char *vxstrfmt(const char *fmt, va_list ap) xstrcat(buf, tmp); p++; } else if ((unprocessed==0) && (*(p+1)=='x')) { - if(long_long) { + if (long_long) { snprintf(tmp, sizeof(tmp), "%llx", va_arg(ap, @@ -751,7 +751,7 @@ static char *vxstrfmt(const char *fmt, va_list ap) va_arg(ap, long int)); xstrcat(buf, tmp); p++; - } else if(long_long) { + } else if (long_long) { xstrcat(buf, "%ll"); long_long = 0; } else diff --git a/src/common/node_select.c b/src/common/node_select.c index 6869b6dede3..c6cdf4d0dda 100644 --- a/src/common/node_select.c +++ b/src/common/node_select.c @@ -276,11 +276,11 @@ extern int slurm_select_init(bool only_default) if (dir_array[i] == ':') { dir_array[i] = '\0'; got_colon = 1; - } else if(dir_array[i] != '\0') + } else if (dir_array[i] != '\0') continue; /* Open the directory. */ - if(!(dirp = opendir(head))) { + if (!(dirp = opendir(head))) { error("cannot open plugin directory %s", head); goto done; } @@ -288,7 +288,7 @@ extern int slurm_select_init(bool only_default) while (1) { char full_name[128]; - if(!(e = readdir( dirp ))) + if (!(e = readdir( dirp ))) break; /* Check only files with select_ in them. */ if (strncmp(e->d_name, "select_", 7)) @@ -832,8 +832,8 @@ extern int select_g_select_nodeinfo_free(dynamic_plugin_data_t *nodeinfo) if (slurm_select_init(0) < 0) return SLURM_ERROR; - if(nodeinfo) { - if(nodeinfo->data) + if (nodeinfo) { + if (nodeinfo->data) rc = (*(ops[nodeinfo->plugin_id]. nodeinfo_free))(nodeinfo->data); xfree(nodeinfo); @@ -927,7 +927,7 @@ extern int select_g_select_jobinfo_set(dynamic_plugin_data_t *jobinfo, if (slurm_select_init(0) < 0) return SLURM_ERROR; - if(jobinfo) { + if (jobinfo) { jobdata = jobinfo->data; plugin_id = jobinfo->plugin_id; } else @@ -952,7 +952,7 @@ extern int select_g_select_jobinfo_get(dynamic_plugin_data_t *jobinfo, if (slurm_select_init(0) < 0) return SLURM_ERROR; - if(jobinfo) { + if (jobinfo) { jobdata = jobinfo->data; plugin_id = jobinfo->plugin_id; } else @@ -975,7 +975,7 @@ extern dynamic_plugin_data_t *select_g_select_jobinfo_copy( return NULL; jobinfo_ptr = xmalloc(sizeof(dynamic_plugin_data_t)); - if(jobinfo) { + if (jobinfo) { jobinfo_ptr->plugin_id = jobinfo->plugin_id; jobinfo_ptr->data = (*(ops[jobinfo->plugin_id]. jobinfo_copy))(jobinfo->data); @@ -1083,7 +1083,7 @@ extern char *select_g_select_jobinfo_sprint(dynamic_plugin_data_t *jobinfo, if (slurm_select_init(0) < 0) return NULL; - if(jobinfo) { + if (jobinfo) { data = jobinfo->data; plugin_id = jobinfo->plugin_id; } else @@ -1107,7 +1107,7 @@ extern char *select_g_select_jobinfo_xstrdup( if (slurm_select_init(0) < 0) return NULL; - if(jobinfo) { + if (jobinfo) { data = jobinfo->data; plugin_id = jobinfo->plugin_id; } else diff --git a/src/common/pack.c b/src/common/pack.c index 6320d20977b..6d0f84d2f54 100644 --- a/src/common/pack.c +++ b/src/common/pack.c @@ -150,7 +150,7 @@ Buf init_buf(int size) error("init_buf: buffer size too large"); return NULL; } - if(size <= 0) + if (size <= 0) size = BUF_SIZE; my_buf = xmalloc(sizeof(struct slurm_buf)); my_buf->magic = BUF_MAGIC; diff --git a/src/common/parse_config.c b/src/common/parse_config.c index 27f756e31db..683035d781d 100644 --- a/src/common/parse_config.c +++ b/src/common/parse_config.c @@ -372,7 +372,7 @@ static void _compute_hash_val(uint32_t *hash_val, char *line) { int idx, i, len; - if(!hash_val) + if (!hash_val) return; len = strlen(line); diff --git a/src/common/parse_time.c b/src/common/parse_time.c index 77c39476b68..e498959794a 100644 --- a/src/common/parse_time.c +++ b/src/common/parse_time.c @@ -224,7 +224,7 @@ static int _get_date(char *time_str, int *pos, int *month, int *mday, int *year) int mon, day, yr; int offset = *pos; - if(time_str[offset+4] && (time_str[offset+4] == '-') + if (time_str[offset+4] && (time_str[offset+4] == '-') && time_str[offset+7] && (time_str[offset+7] == '-')) { /* get year */ if ((time_str[offset] < '0') || (time_str[offset] > '9')) diff --git a/src/common/plugin.c b/src/common/plugin.c index 6bb5faf0d05..18970748bda 100644 --- a/src/common/plugin.c +++ b/src/common/plugin.c @@ -228,11 +228,11 @@ plugin_load_and_link(const char *type_name, int n_syms, so_name = xstrdup_printf("%s.so", type_name); #endif while(so_name[i]) { - if(so_name[i] == '/') + if (so_name[i] == '/') so_name[i] = '_'; i++; } - if(!(dir_array = slurm_get_plugin_dir())) { + if (!(dir_array = slurm_get_plugin_dir())) { error("plugin_load_and_link: No plugin dir given"); xfree(so_name); return plug; @@ -244,7 +244,7 @@ plugin_load_and_link(const char *type_name, int n_syms, if (dir_array[i] == ':') { dir_array[i] = '\0'; got_colon = 1; - } else if(dir_array[i] != '\0') + } else if (dir_array[i] != '\0') continue; file_name = xstrdup_printf("%s/%s", head, so_name); @@ -255,7 +255,7 @@ plugin_load_and_link(const char *type_name, int n_syms, xfree(file_name); err = EPLUGIN_NOTFOUND; } else { - if((err = plugin_load_from_file(&plug, file_name)) + if ((err = plugin_load_from_file(&plug, file_name)) == EPLUGIN_SUCCESS) { if (plugin_get_syms(plug, n_syms, names, ptrs) >= diff --git a/src/common/print_fields.c b/src/common/print_fields.c index c4ef4de86e0..667e247a499 100644 --- a/src/common/print_fields.c +++ b/src/common/print_fields.c @@ -58,7 +58,7 @@ extern void destroy_print_field(void *object) { print_field_t *field = (print_field_t *)object; - if(field) { + if (field) { xfree(field->name); xfree(field); } @@ -71,18 +71,18 @@ extern void print_fields_header(List print_fields_list) int curr_inx = 1; int field_count = 0; - if(!print_fields_list || !print_fields_have_header) + if (!print_fields_list || !print_fields_have_header) return; field_count = list_count(print_fields_list); itr = list_iterator_create(print_fields_list); while((field = list_next(itr))) { - if(print_fields_parsable_print + if (print_fields_parsable_print == PRINT_FIELDS_PARSABLE_NO_ENDING && (curr_inx == field_count)) printf("%s", field->name); - else if(print_fields_parsable_print) + else if (print_fields_parsable_print) printf("%s|", field->name); else { int abs_len = abs(field->len); @@ -92,7 +92,7 @@ extern void print_fields_header(List print_fields_list) } list_iterator_reset(itr); printf("\n"); - if(print_fields_parsable_print) + if (print_fields_parsable_print) return; while((field = list_next(itr))) { int abs_len = abs(field->len); @@ -109,15 +109,15 @@ extern void print_fields_date(print_field_t *field, time_t value, int last) char temp_char[abs_len+1]; time_t now = value; - if(!now) + if (!now) now = time(NULL); slurm_make_time_str(&value, (char *)temp_char, sizeof(temp_char)); - if(print_fields_parsable_print == PRINT_FIELDS_PARSABLE_NO_ENDING + if (print_fields_parsable_print == PRINT_FIELDS_PARSABLE_NO_ENDING && last) printf("%s", temp_char); - else if(print_fields_parsable_print) + else if (print_fields_parsable_print) printf("%s|", temp_char); - else if(field->len == abs_len) + else if (field->len == abs_len) printf("%*.*s ", abs_len, abs_len, temp_char); else printf("%-*.*s ", abs_len, abs_len, temp_char); @@ -128,29 +128,29 @@ extern void print_fields_str(print_field_t *field, char *value, int last) int abs_len = abs(field->len); char temp_char[abs_len+1]; char *print_this = NULL; - if(!value) { - if(print_fields_parsable_print) + if (!value) { + if (print_fields_parsable_print) print_this = ""; else print_this = " "; } else print_this = value; - if(print_fields_parsable_print == PRINT_FIELDS_PARSABLE_NO_ENDING + if (print_fields_parsable_print == PRINT_FIELDS_PARSABLE_NO_ENDING && last) printf("%s", print_this); - else if(print_fields_parsable_print) + else if (print_fields_parsable_print) printf("%s|", print_this); else { - if(value) { + if (value) { memcpy(&temp_char, value, abs_len); - if(strlen(value) > abs_len) + if (strlen(value) > abs_len) temp_char[abs_len-1] = '+'; print_this = temp_char; } - if(field->len == abs_len) + if (field->len == abs_len) printf("%*.*s ", abs_len, abs_len, print_this); else printf("%-*.*s ", abs_len, abs_len, print_this); @@ -161,23 +161,23 @@ extern void print_fields_int(print_field_t *field, int value, int last) { int abs_len = abs(field->len); /* (value == unset) || (value == cleared) */ - if((value == NO_VAL) || (value == INFINITE)) { - if(print_fields_parsable_print + if ((value == NO_VAL) || (value == INFINITE)) { + if (print_fields_parsable_print == PRINT_FIELDS_PARSABLE_NO_ENDING && last) ; - else if(print_fields_parsable_print) + else if (print_fields_parsable_print) printf("|"); else printf("%*s ", abs_len, " "); } else { - if(print_fields_parsable_print + if (print_fields_parsable_print == PRINT_FIELDS_PARSABLE_NO_ENDING && last) printf("%d", value); - else if(print_fields_parsable_print) + else if (print_fields_parsable_print) printf("%d|", value); - else if(field->len == abs_len) + else if (field->len == abs_len) printf("%*d ", abs_len, value); else printf("%-*d ", abs_len, value); @@ -188,23 +188,23 @@ extern void print_fields_uint32(print_field_t *field, uint32_t value, int last) { int abs_len = abs(field->len); /* (value == unset) || (value == cleared) */ - if((value == NO_VAL) || (value == INFINITE)) { - if(print_fields_parsable_print + if ((value == NO_VAL) || (value == INFINITE)) { + if (print_fields_parsable_print == PRINT_FIELDS_PARSABLE_NO_ENDING && last) ; - else if(print_fields_parsable_print) + else if (print_fields_parsable_print) printf("|"); else printf("%*s ", field->len, " "); } else { - if(print_fields_parsable_print + if (print_fields_parsable_print == PRINT_FIELDS_PARSABLE_NO_ENDING && last) printf("%u", value); - else if(print_fields_parsable_print) + else if (print_fields_parsable_print) printf("%u|", value); - else if(field->len == abs_len) + else if (field->len == abs_len) printf("%*u ", abs_len, value); else printf("%-*u ", abs_len, value); @@ -216,23 +216,23 @@ extern void print_fields_uint64(print_field_t *field, uint64_t value, int last) int abs_len = abs(field->len); /* (value == unset) || (value == cleared) */ - if((value == (uint64_t)NO_VAL) || (value == (uint64_t)INFINITE)) { - if(print_fields_parsable_print + if ((value == (uint64_t)NO_VAL) || (value == (uint64_t)INFINITE)) { + if (print_fields_parsable_print == PRINT_FIELDS_PARSABLE_NO_ENDING && last) ; - else if(print_fields_parsable_print) + else if (print_fields_parsable_print) printf("|"); else printf("%*s ", field->len, " "); } else { - if(print_fields_parsable_print + if (print_fields_parsable_print == PRINT_FIELDS_PARSABLE_NO_ENDING && last) printf("%llu", (long long unsigned) value); - else if(print_fields_parsable_print) + else if (print_fields_parsable_print) printf("%llu|", (long long unsigned) value); - else if(field->len == abs_len) + else if (field->len == abs_len) printf("%*llu ", abs_len, (long long unsigned) value); else printf("%-*llu ", abs_len, (long long unsigned) value); @@ -243,23 +243,23 @@ extern void print_fields_double(print_field_t *field, double value, int last) { int abs_len = abs(field->len); /* (value == unset) || (value == cleared) */ - if((value == NO_VAL) || (value == INFINITE)) { - if(print_fields_parsable_print + if ((value == NO_VAL) || (value == INFINITE)) { + if (print_fields_parsable_print == PRINT_FIELDS_PARSABLE_NO_ENDING && last) ; - else if(print_fields_parsable_print) + else if (print_fields_parsable_print) printf("|"); else printf("%*s ", field->len, " "); } else { - if(print_fields_parsable_print + if (print_fields_parsable_print == PRINT_FIELDS_PARSABLE_NO_ENDING && last) printf("%f", value); - else if(print_fields_parsable_print) + else if (print_fields_parsable_print) printf("%f|", value); - else if(field->len == abs_len) + else if (field->len == abs_len) printf("%*f ", abs_len, value); else printf("%-*f ", abs_len, value); @@ -271,23 +271,23 @@ extern void print_fields_long_double( { int abs_len = abs(field->len); /* (value == unset) || (value == cleared) */ - if((value == NO_VAL) || (value == INFINITE)) { - if(print_fields_parsable_print + if ((value == NO_VAL) || (value == INFINITE)) { + if (print_fields_parsable_print == PRINT_FIELDS_PARSABLE_NO_ENDING && last) ; - else if(print_fields_parsable_print) + else if (print_fields_parsable_print) printf("|"); else printf("%*s ", field->len, " "); } else { - if(print_fields_parsable_print + if (print_fields_parsable_print == PRINT_FIELDS_PARSABLE_NO_ENDING && last) printf("%Lf", value); - else if(print_fields_parsable_print) + else if (print_fields_parsable_print) printf("%Lf|", value); - else if(field->len == abs_len) + else if (field->len == abs_len) printf("%*Lf ", abs_len, value); else printf("%-*Lf ", abs_len, value); @@ -299,25 +299,25 @@ extern void print_fields_time(print_field_t *field, uint64_t value, int last) { int abs_len = abs(field->len); /* (value == unset) || (value == cleared) */ - if((value == (uint64_t)NO_VAL) || (value == (uint64_t)INFINITE)) { - if(print_fields_parsable_print + if ((value == (uint64_t)NO_VAL) || (value == (uint64_t)INFINITE)) { + if (print_fields_parsable_print == PRINT_FIELDS_PARSABLE_NO_ENDING && last) ; - else if(print_fields_parsable_print) + else if (print_fields_parsable_print) printf("|"); else printf("%*s ", field->len, " "); } else { char time_buf[32]; mins2time_str((time_t) value, time_buf, sizeof(time_buf)); - if(print_fields_parsable_print + if (print_fields_parsable_print == PRINT_FIELDS_PARSABLE_NO_ENDING && last) printf("%s", time_buf); - else if(print_fields_parsable_print) + else if (print_fields_parsable_print) printf("%s|", time_buf); - else if(field->len == abs_len) + else if (field->len == abs_len) printf("%*s ", abs_len, time_buf); else printf("%-*s ", abs_len, time_buf); @@ -329,25 +329,25 @@ extern void print_fields_time_from_secs(print_field_t *field, { int abs_len = abs(field->len); /* (value == unset) || (value == cleared) */ - if((value == (uint64_t)NO_VAL) || (value == (uint64_t)INFINITE)) { - if(print_fields_parsable_print + if ((value == (uint64_t)NO_VAL) || (value == (uint64_t)INFINITE)) { + if (print_fields_parsable_print == PRINT_FIELDS_PARSABLE_NO_ENDING && last) ; - else if(print_fields_parsable_print) + else if (print_fields_parsable_print) printf("|"); else printf("%*s ", field->len, " "); } else { char time_buf[32]; secs2time_str((time_t) value, time_buf, sizeof(time_buf)); - if(print_fields_parsable_print + if (print_fields_parsable_print == PRINT_FIELDS_PARSABLE_NO_ENDING && last) printf("%s", time_buf); - else if(print_fields_parsable_print) + else if (print_fields_parsable_print) printf("%s|", time_buf); - else if(field->len == abs_len) + else if (field->len == abs_len) printf("%*s ", abs_len, time_buf); else printf("%-*s ", abs_len, time_buf); @@ -361,8 +361,8 @@ extern void print_fields_char_list(print_field_t *field, List value, int last) char *print_this = NULL; char *object = NULL; - if(!value || !list_count(value)) { - if(print_fields_parsable_print) + if (!value || !list_count(value)) { + if (print_fields_parsable_print) print_this = xstrdup(""); else print_this = xstrdup(" "); @@ -370,7 +370,7 @@ extern void print_fields_char_list(print_field_t *field, List value, int last) list_sort(value, (ListCmpF)_sort_char_list); itr = list_iterator_create(value); while((object = list_next(itr))) { - if(print_this) + if (print_this) xstrfmtcat(print_this, ",%s", object); else print_this = xstrdup(object); @@ -378,16 +378,16 @@ extern void print_fields_char_list(print_field_t *field, List value, int last) list_iterator_destroy(itr); } - if(print_fields_parsable_print == PRINT_FIELDS_PARSABLE_NO_ENDING + if (print_fields_parsable_print == PRINT_FIELDS_PARSABLE_NO_ENDING && last) printf("%s", print_this); - else if(print_fields_parsable_print) + else if (print_fields_parsable_print) printf("%s|", print_this); else { - if(strlen(print_this) > abs_len) + if (strlen(print_this) > abs_len) print_this[abs_len-1] = '+'; - if(field->len == abs_len) + if (field->len == abs_len) printf("%*.*s ", abs_len, abs_len, print_this); else printf("%-*.*s ", abs_len, abs_len, print_this); diff --git a/src/common/proc_args.c b/src/common/proc_args.c index 9213fffd362..e0598f84b6c 100644 --- a/src/common/proc_args.c +++ b/src/common/proc_args.c @@ -118,7 +118,7 @@ task_dist_states_t verify_dist_type(const char *arg, uint32_t *plane_size) } else { /* -m plane=<plane_size> */ dist_str = strchr(arg,'='); - if(dist_str != NULL) { + if (dist_str != NULL) { *plane_size=atoi(dist_str+1); len = dist_str-arg; plane_dist = true; @@ -426,7 +426,7 @@ bool verify_node_list(char **node_list_pptr, enum task_dist_states dist, /* If we are using Arbitrary grab count out of the hostfile using them exactly the way we read it in since we are saying, lay it out this way! */ - if(dist == SLURM_DIST_ARBITRARY) + if (dist == SLURM_DIST_ARBITRARY) nodelist = slurm_read_hostfile(*node_list_pptr, task_count); else nodelist = slurm_read_hostfile(*node_list_pptr, NO_VAL); @@ -470,7 +470,7 @@ bool get_resource_arg_range(const char *arg, const char *what, int* min, if (*p == 'k' || *p == 'K') { result *= 1024; p++; - } else if(*p == 'm' || *p == 'M') { + } else if (*p == 'm' || *p == 'M') { result *= 1048576; p++; } @@ -498,7 +498,7 @@ bool get_resource_arg_range(const char *arg, const char *what, int* min, if ((*p == 'k') || (*p == 'K')) { result *= 1024; p++; - } else if(*p == 'm' || *p == 'M') { + } else if (*p == 'm' || *p == 'M') { result *= 1048576; p++; } diff --git a/src/common/read_config.c b/src/common/read_config.c index aaf03722625..5f20de49012 100644 --- a/src/common/read_config.c +++ b/src/common/read_config.c @@ -394,20 +394,20 @@ static void _set_node_prefix(const char *nodenames) xassert(nodenames != NULL); for (i = 1; nodenames[i] != '\0'; i++) { - if((nodenames[i-1] == '[') + if ((nodenames[i-1] == '[') || (nodenames[i-1] <= '9' && nodenames[i-1] >= '0')) break; } - if(i == 1) { + if (i == 1) { error("In your Node definition in your slurm.conf you " "gave a nodelist '%s' without a prefix. " "Please try something like bg%s.", nodenames, nodenames); } xfree(conf_ptr->node_prefix); - if(nodenames[i] == '\0') + if (nodenames[i] == '\0') conf_ptr->node_prefix = xstrdup(nodenames); else { tmp = xmalloc(sizeof(char)*i+1); @@ -2715,7 +2715,7 @@ _validate_and_set_defaults(slurm_ctl_conf_t *conf, s_p_hashtbl_t *hashtbl) "JobAcctGatherFrequency", hashtbl)) conf->job_acct_gather_freq = DEFAULT_JOB_ACCT_GATHER_FREQ; - if(!s_p_get_string(&conf->job_acct_gather_type, + if (!s_p_get_string(&conf->job_acct_gather_type, "JobAcctGatherType", hashtbl)) conf->job_acct_gather_type = xstrdup(DEFAULT_JOB_ACCT_GATHER_TYPE); @@ -2724,8 +2724,8 @@ _validate_and_set_defaults(slurm_ctl_conf_t *conf, s_p_hashtbl_t *hashtbl) conf->job_ckpt_dir = xstrdup(DEFAULT_JOB_CKPT_DIR); if (!s_p_get_string(&conf->job_comp_type, "JobCompType", hashtbl)) { - if(default_storage_type) { - if(!strcasecmp("slurmdbd", default_storage_type)) { + if (default_storage_type) { + if (!strcasecmp("slurmdbd", default_storage_type)) { error("Can not use the default storage type " "specified for jobcomp since there is " "not slurmdbd type. We are using %s " @@ -2742,9 +2742,9 @@ _validate_and_set_defaults(slurm_ctl_conf_t *conf, s_p_hashtbl_t *hashtbl) conf->job_comp_type = xstrdup(DEFAULT_JOB_COMP_TYPE); } if (!s_p_get_string(&conf->job_comp_loc, "JobCompLoc", hashtbl)) { - if(default_storage_loc) + if (default_storage_loc) conf->job_comp_loc = xstrdup(default_storage_loc); - else if(!strcmp(conf->job_comp_type, "job_comp/mysql") + else if (!strcmp(conf->job_comp_type, "job_comp/mysql") || !strcmp(conf->job_comp_type, "job_comp/pgsql")) conf->job_comp_loc = xstrdup(DEFAULT_JOB_COMP_DB); else @@ -2753,30 +2753,30 @@ _validate_and_set_defaults(slurm_ctl_conf_t *conf, s_p_hashtbl_t *hashtbl) if (!s_p_get_string(&conf->job_comp_host, "JobCompHost", hashtbl)) { - if(default_storage_host) + if (default_storage_host) conf->job_comp_host = xstrdup(default_storage_host); else conf->job_comp_host = xstrdup(DEFAULT_STORAGE_HOST); } if (!s_p_get_string(&conf->job_comp_user, "JobCompUser", hashtbl)) { - if(default_storage_user) + if (default_storage_user) conf->job_comp_user = xstrdup(default_storage_user); else conf->job_comp_user = xstrdup(DEFAULT_STORAGE_USER); } if (!s_p_get_string(&conf->job_comp_pass, "JobCompPass", hashtbl)) { - if(default_storage_pass) + if (default_storage_pass) conf->job_comp_pass = xstrdup(default_storage_pass); } if (!s_p_get_uint32(&conf->job_comp_port, "JobCompPort", hashtbl)) { - if(default_storage_port) + if (default_storage_port) conf->job_comp_port = default_storage_port; - else if(!strcmp(conf->job_comp_type, "job_comp/mysql")) + else if (!strcmp(conf->job_comp_type, "job_comp/mysql")) conf->job_comp_port = DEFAULT_MYSQL_PORT; - else if(!strcmp(conf->job_comp_type, "job_comp/pgsql")) + else if (!strcmp(conf->job_comp_type, "job_comp/pgsql")) conf->job_comp_port = DEFAULT_PGSQL_PORT; else conf->job_comp_port = DEFAULT_STORAGE_PORT; @@ -2865,13 +2865,13 @@ _validate_and_set_defaults(slurm_ctl_conf_t *conf, s_p_hashtbl_t *hashtbl) s_p_get_string(&conf->mpi_params, "MpiParams", hashtbl); - if(!s_p_get_boolean((bool *)&conf->track_wckey, + if (!s_p_get_boolean((bool *)&conf->track_wckey, "TrackWCKey", hashtbl)) conf->track_wckey = false; if (!s_p_get_string(&conf->accounting_storage_type, "AccountingStorageType", hashtbl)) { - if(default_storage_type) + if (default_storage_type) conf->accounting_storage_type = xstrdup_printf("accounting_storage/%s", default_storage_type); @@ -2944,7 +2944,7 @@ _validate_and_set_defaults(slurm_ctl_conf_t *conf, s_p_hashtbl_t *hashtbl) if (!s_p_get_string(&conf->accounting_storage_host, "AccountingStorageHost", hashtbl)) { - if(default_storage_host) + if (default_storage_host) conf->accounting_storage_host = xstrdup(default_storage_host); else @@ -2969,7 +2969,7 @@ _validate_and_set_defaults(slurm_ctl_conf_t *conf, s_p_hashtbl_t *hashtbl) } if (!s_p_get_string(&conf->accounting_storage_user, "AccountingStorageUser", hashtbl)) { - if(default_storage_user) + if (default_storage_user) conf->accounting_storage_user = xstrdup(default_storage_user); else @@ -2978,7 +2978,7 @@ _validate_and_set_defaults(slurm_ctl_conf_t *conf, s_p_hashtbl_t *hashtbl) } if (!s_p_get_string(&conf->accounting_storage_pass, "AccountingStoragePass", hashtbl)) { - if(default_storage_pass) + if (default_storage_pass) conf->accounting_storage_pass = xstrdup(default_storage_pass); } @@ -2990,15 +2990,15 @@ _validate_and_set_defaults(slurm_ctl_conf_t *conf, s_p_hashtbl_t *hashtbl) if (!s_p_get_uint32(&conf->accounting_storage_port, "AccountingStoragePort", hashtbl)) { - if(default_storage_port) + if (default_storage_port) conf->accounting_storage_port = default_storage_port; - else if(!strcmp(conf->accounting_storage_type, + else if (!strcmp(conf->accounting_storage_type, "accounting_storage/slurmdbd")) conf->accounting_storage_port = SLURMDBD_PORT; - else if(!strcmp(conf->accounting_storage_type, + else if (!strcmp(conf->accounting_storage_type, "accounting_storage/mysql")) conf->accounting_storage_port = DEFAULT_MYSQL_PORT; - else if(!strcmp(conf->accounting_storage_type, + else if (!strcmp(conf->accounting_storage_type, "accounting_storage/pgsql")) conf->accounting_storage_port = DEFAULT_PGSQL_PORT; else @@ -3006,7 +3006,7 @@ _validate_and_set_defaults(slurm_ctl_conf_t *conf, s_p_hashtbl_t *hashtbl) } /* remove the user and loc if using slurmdbd */ - if(!strcmp(conf->accounting_storage_type, + if (!strcmp(conf->accounting_storage_type, "accounting_storage/slurmdbd")) { xfree(conf->accounting_storage_loc); conf->accounting_storage_loc = xstrdup("N/A"); @@ -3129,7 +3129,7 @@ _validate_and_set_defaults(slurm_ctl_conf_t *conf, s_p_hashtbl_t *hashtbl) xfree(temp_str); } else { conf->priority_reset_period = PRIORITY_RESET_NONE; - if(!conf->priority_decay_hl) { + if (!conf->priority_decay_hl) { fatal("You have to either have " "PriorityDecayHalfLife != 0 or " "PriorityUsageResetPeriod set to something " @@ -3825,7 +3825,7 @@ extern void destroy_config_key_pair(void *object) { config_key_pair_t *key_pair_ptr = (config_key_pair_t *)object; - if(key_pair_ptr) { + if (key_pair_ptr) { xfree(key_pair_ptr->name); xfree(key_pair_ptr->value); xfree(key_pair_ptr); diff --git a/src/common/safeopen.c b/src/common/safeopen.c index 8a18c350485..da4683e2449 100644 --- a/src/common/safeopen.c +++ b/src/common/safeopen.c @@ -62,7 +62,7 @@ FILE * safeopen(const char *path, const char *mode, int flags) int oflags; struct stat fb1, fb2; - if(mode[0] == 'w') { + if (mode[0] == 'w') { oflags = O_WRONLY; } else if (mode[0] == 'a') { oflags = O_CREAT | O_WRONLY | O_APPEND; diff --git a/src/common/slurm_jobacct_gather.c b/src/common/slurm_jobacct_gather.c index 0d631dcf299..ea9729be2d9 100644 --- a/src/common/slurm_jobacct_gather.c +++ b/src/common/slurm_jobacct_gather.c @@ -327,7 +327,7 @@ extern int jobacct_gather_endpoll(void) jobacct_shutdown = true; slurm_mutex_lock(&task_list_lock); - if(task_list) + if (task_list) list_destroy(task_list); task_list = NULL; slurm_mutex_unlock(&task_list_lock); @@ -443,7 +443,7 @@ extern jobacctinfo_t *jobacct_gather_stat_task(pid_t pid) itr = list_iterator_create(task_list); while ((jobacct = list_next(itr))) { - if(jobacct->pid == pid) + if (jobacct->pid == pid) break; } list_iterator_destroy(itr); @@ -491,13 +491,13 @@ extern jobacctinfo_t *jobacct_gather_remove_task(pid_t pid) itr = list_iterator_create(task_list); while((jobacct = list_next(itr))) { - if(jobacct->pid == pid) { + if (jobacct->pid == pid) { list_remove(itr); break; } } list_iterator_destroy(itr); - if(jobacct) { + if (jobacct) { debug2("removing task %u pid %d from jobacct", jobacct->max_vsize_id.taskid, jobacct->pid); } else { diff --git a/src/common/slurm_protocol_defs.c b/src/common/slurm_protocol_defs.c index e7971d332d3..45ed46c716f 100644 --- a/src/common/slurm_protocol_defs.c +++ b/src/common/slurm_protocol_defs.c @@ -149,7 +149,7 @@ extern char *slurm_add_slash_to_quotes(char *str) { char *dup, *copy = NULL; int len = 0; - if(!str || !(len = strlen(str))) + if (!str || !(len = strlen(str))) return NULL; /* make a buffer 2 times the size just to be safe */ @@ -710,7 +710,7 @@ extern void slurm_free_launch_tasks_request_msg(launch_tasks_request_msg_t * msg xfree(msg->spank_job_env[i]); } xfree(msg->spank_job_env); - if(msg->nnodes && msg->global_task_ids) + if (msg->nnodes && msg->global_task_ids) for(i=0; i<msg->nnodes; i++) { xfree(msg->global_task_ids[i]); } @@ -2337,7 +2337,7 @@ extern void slurm_free_job_step_stat(void *object) extern void slurm_free_job_step_pids(void *object) { job_step_pids_t *msg = (job_step_pids_t *)object; - if(msg) { + if (msg) { xfree(msg->node_name); xfree(msg->pid); xfree(msg); @@ -2358,7 +2358,7 @@ extern void slurm_free_block_job_info(void *object) extern void slurm_free_block_info_members(block_info_t *block_info) { - if(block_info) { + if (block_info) { xfree(block_info->bg_block_id); xfree(block_info->blrtsimage); xfree(block_info->ionode_inx); @@ -2374,7 +2374,7 @@ extern void slurm_free_block_info_members(block_info_t *block_info) extern void slurm_free_block_info(block_info_t *block_info) { - if(block_info) { + if (block_info) { slurm_free_block_info_members(block_info); xfree(block_info); } @@ -2382,7 +2382,7 @@ extern void slurm_free_block_info(block_info_t *block_info) extern void slurm_free_block_info_msg(block_info_msg_t *block_info_msg) { - if(block_info_msg) { + if (block_info_msg) { if (block_info_msg->block_array) { int i; for(i=0; i<block_info_msg->record_count; i++) @@ -2427,7 +2427,7 @@ extern void slurm_destroy_association_shares_object(void *object) association_shares_object_t *obj_ptr = (association_shares_object_t *)object; - if(obj_ptr) { + if (obj_ptr) { xfree(obj_ptr->cluster); xfree(obj_ptr->name); xfree(obj_ptr->parent); @@ -2437,10 +2437,10 @@ extern void slurm_destroy_association_shares_object(void *object) extern void slurm_free_shares_request_msg(shares_request_msg_t *msg) { - if(msg) { - if(msg->acct_list) + if (msg) { + if (msg->acct_list) list_destroy(msg->acct_list); - if(msg->user_list) + if (msg->user_list) list_destroy(msg->user_list); xfree(msg); } @@ -2448,8 +2448,8 @@ extern void slurm_free_shares_request_msg(shares_request_msg_t *msg) extern void slurm_free_shares_response_msg(shares_response_msg_t *msg) { - if(msg) { - if(msg->assoc_shares_list) + if (msg) { + if (msg->assoc_shares_list) list_destroy(msg->assoc_shares_list); xfree(msg); } @@ -2472,10 +2472,10 @@ extern void slurm_destroy_priority_factors_object(void *object) extern void slurm_free_priority_factors_request_msg( priority_factors_request_msg_t *msg) { - if(msg) { - if(msg->job_id_list) + if (msg) { + if (msg->job_id_list) list_destroy(msg->job_id_list); - if(msg->uid_list) + if (msg->uid_list) list_destroy(msg->uid_list); xfree(msg); } @@ -2484,8 +2484,8 @@ extern void slurm_free_priority_factors_request_msg( extern void slurm_free_priority_factors_response_msg( priority_factors_response_msg_t *msg) { - if(msg) { - if(msg->priority_factors_list) + if (msg) { + if (msg->priority_factors_list) list_destroy(msg->priority_factors_list); xfree(msg); } @@ -2494,8 +2494,8 @@ extern void slurm_free_priority_factors_response_msg( extern void slurm_free_accounting_update_msg(accounting_update_msg_t *msg) { - if(msg) { - if(msg->update_list) + if (msg) { + if (msg->update_list) list_destroy(msg->update_list); xfree(msg); } diff --git a/src/common/slurm_resource_info.c b/src/common/slurm_resource_info.c index 0c74c66ea4f..32d82cad5b7 100644 --- a/src/common/slurm_resource_info.c +++ b/src/common/slurm_resource_info.c @@ -54,7 +54,7 @@ #include "src/common/xmalloc.h" #include "src/common/xstring.h" -#if(0) +#if (0) #define DEBUG 1 #endif @@ -163,7 +163,7 @@ int slurm_get_avail_procs(const uint16_t socket_cnt, if (alloc_cores[i]) allocated_sockets++; } -#if(DEBUG) +#if (DEBUG) info("get_avail_procs %u %s User_ sockets %u cores %u threads %u", job_id, name, socket_cnt, core_cnt, thread_cnt); info("get_avail_procs %u %s HW_ sockets %u cores %u threads %u", @@ -298,7 +298,7 @@ int slurm_get_avail_procs(const uint16_t socket_cnt, avail_cpus = (*cpus / cpus_per_task) * cpus_per_task; avail_cpus = MIN(avail_cpus, max_cpus); -#if(DEBUG) +#if (DEBUG) info("get_avail_procs %u %s return cpus %u sockets %u cores %u threads %u", job_id, name, *cpus, *sockets, *cores, *threads); info("get_avail_procs %d %s avail_cpus %u", job_id, name, avail_cpus); diff --git a/src/common/slurm_step_layout.c b/src/common/slurm_step_layout.c index a9f28ed0fdb..f186fb67ec5 100644 --- a/src/common/slurm_step_layout.c +++ b/src/common/slurm_step_layout.c @@ -353,7 +353,7 @@ int slurm_step_layout_host_id (slurm_step_layout_t *s, int taskid) return SLURM_ERROR; for (i=0; i < s->node_cnt; i++) for (j=0; j<s->tasks[i]; j++) - if(s->tids[i][j] == taskid) + if (s->tids[i][j] == taskid) return i; return SLURM_ERROR; @@ -441,10 +441,10 @@ static int _init_task_layout(slurm_step_layout_t *step_layout, (task_dist == SLURM_DIST_CYCLIC_CYCLIC) || (task_dist == SLURM_DIST_CYCLIC_BLOCK)) return _task_layout_cyclic(step_layout, cpus); - else if(task_dist == SLURM_DIST_ARBITRARY + else if (task_dist == SLURM_DIST_ARBITRARY && !(cluster_flags & CLUSTER_FLAG_FE)) return _task_layout_hostfile(step_layout, arbitrary_nodes); - else if(task_dist == SLURM_DIST_PLANE) + else if (task_dist == SLURM_DIST_PLANE) return _task_layout_plane(step_layout, cpus); else return _task_layout_block(step_layout, cpus); @@ -466,14 +466,14 @@ static int _task_layout_hostfile(slurm_step_layout_t *step_layout, debug2("job list is %s", step_layout->node_list); job_alloc_hosts = hostlist_create(step_layout->node_list); itr = hostlist_iterator_create(job_alloc_hosts); - if(!arbitrary_nodes) { + if (!arbitrary_nodes) { error("no hostlist given for arbitrary dist"); return SLURM_ERROR; } debug2("list is %s", arbitrary_nodes); step_alloc_hosts = hostlist_create(arbitrary_nodes); - if(hostlist_count(step_alloc_hosts) != step_layout->task_cnt) { + if (hostlist_count(step_alloc_hosts) != step_layout->task_cnt) { error("Asked for %u tasks have %d in the nodelist. " "Check your nodelist, or set the -n option to be %d", step_layout->task_cnt, @@ -485,16 +485,16 @@ static int _task_layout_hostfile(slurm_step_layout_t *step_layout, while((host = hostlist_next(itr))) { step_layout->tasks[i] = 0; while((host_task = hostlist_next(itr_task))) { - if(!strcmp(host, host_task)) { + if (!strcmp(host, host_task)) { step_layout->tasks[i]++; task_cnt++; } free(host_task); - if(task_cnt >= step_layout->task_cnt) + if (task_cnt >= step_layout->task_cnt) break; } debug3("%s got %u tasks", host, step_layout->tasks[i]); - if(step_layout->tasks[i] == 0) + if (step_layout->tasks[i] == 0) goto reset_hosts; step_layout->tids[i] = xmalloc(sizeof(uint32_t) * step_layout->tasks[i]); @@ -502,27 +502,27 @@ static int _task_layout_hostfile(slurm_step_layout_t *step_layout, j = 0; hostlist_iterator_reset(itr_task); while((host_task = hostlist_next(itr_task))) { - if(!strcmp(host, host_task)) { + if (!strcmp(host, host_task)) { step_layout->tids[i][j] = taskid; j++; } taskid++; free(host_task); - if(j >= step_layout->tasks[i]) + if (j >= step_layout->tasks[i]) break; } i++; reset_hosts: hostlist_iterator_reset(itr_task); free(host); - if(i > step_layout->task_cnt) + if (i > step_layout->task_cnt) break; } hostlist_iterator_destroy(itr); hostlist_iterator_destroy(itr_task); hostlist_destroy(job_alloc_hosts); hostlist_destroy(step_alloc_hosts); - if(task_cnt != step_layout->task_cnt) { + if (task_cnt != step_layout->task_cnt) { error("Asked for %u tasks but placed %d. Check your nodelist", step_layout->task_cnt, task_cnt); return SLURM_ERROR; @@ -687,7 +687,7 @@ static int _task_layout_plane(slurm_step_layout_t *step_layout, return SLURM_ERROR; } -#if(0) +#if (0) /* debugging only */ for (i=0; i < step_layout->node_cnt; i++) { info("tasks[%d]: %u", i, step_layout->tasks[i]); diff --git a/src/common/slurmdb_defs.c b/src/common/slurmdb_defs.c index 86fabab1aa7..60f7fb6e1d4 100644 --- a/src/common/slurmdb_defs.c +++ b/src/common/slurmdb_defs.c @@ -54,13 +54,13 @@ slurmdb_cluster_rec_t *working_cluster_rec = NULL; static void _free_assoc_rec_members(slurmdb_association_rec_t *assoc) { if (assoc) { - if(assoc->accounting_list) + if (assoc->accounting_list) list_destroy(assoc->accounting_list); xfree(assoc->acct); xfree(assoc->cluster); xfree(assoc->parent_acct); xfree(assoc->partition); - if(assoc->qos_list) + if (assoc->qos_list) list_destroy(assoc->qos_list); xfree(assoc->user); @@ -71,7 +71,7 @@ static void _free_assoc_rec_members(slurmdb_association_rec_t *assoc) static void _free_cluster_rec_members(slurmdb_cluster_rec_t *cluster) { if (cluster) { - if(cluster->accounting_list) + if (cluster->accounting_list) list_destroy(cluster->accounting_list); xfree(cluster->control_host); xfree(cluster->dim_size); @@ -87,7 +87,7 @@ static void _free_qos_rec_members(slurmdb_qos_rec_t *qos) xfree(qos->description); xfree(qos->name); FREE_NULL_BITMAP(qos->preempt_bitstr); - if(qos->preempt_list) + if (qos->preempt_list) list_destroy(qos->preempt_list); destroy_assoc_mgr_qos_usage(qos->usage); } @@ -96,7 +96,7 @@ static void _free_qos_rec_members(slurmdb_qos_rec_t *qos) static void _free_wckey_rec_members(slurmdb_wckey_rec_t *wckey) { if (wckey) { - if(wckey->accounting_list) + if (wckey->accounting_list) list_destroy(wckey->accounting_list); xfree(wckey->cluster); xfree(wckey->name); @@ -131,9 +131,9 @@ static int _sort_childern_list(slurmdb_hierarchical_rec_t *assoc_a, /* check to see if this is a user association or an account. * We want the accounts at the bottom */ - if(assoc_a->assoc->user && !assoc_b->assoc->user) + if (assoc_a->assoc->user && !assoc_b->assoc->user) return -1; - else if(!assoc_a->assoc->user && assoc_b->assoc->user) + else if (!assoc_a->assoc->user && assoc_b->assoc->user) return 1; /* Sort by alpha */ @@ -158,7 +158,7 @@ static int _sort_childern_list(slurmdb_hierarchical_rec_t *assoc_a, static int _sort_assoc_by_lft_dec(slurmdb_association_rec_t *assoc_a, slurmdb_association_rec_t *assoc_b) { - if(assoc_a->lft > assoc_b->lft) + if (assoc_a->lft > assoc_b->lft) return 1; return -1; } @@ -169,14 +169,14 @@ static int _sort_slurmdb_hierarchical_rec_list( slurmdb_hierarchical_rec_t *slurmdb_hierarchical_rec = NULL; ListIterator itr; - if(!list_count(slurmdb_hierarchical_rec_list)) + if (!list_count(slurmdb_hierarchical_rec_list)) return SLURM_SUCCESS; list_sort(slurmdb_hierarchical_rec_list, (ListCmpF)_sort_childern_list); itr = list_iterator_create(slurmdb_hierarchical_rec_list); while((slurmdb_hierarchical_rec = list_next(itr))) { - if(list_count(slurmdb_hierarchical_rec->childern)) + if (list_count(slurmdb_hierarchical_rec->childern)) _sort_slurmdb_hierarchical_rec_list( slurmdb_hierarchical_rec->childern); } @@ -191,17 +191,17 @@ static int _append_hierarchical_childern_ret_list( slurmdb_hierarchical_rec_t *slurmdb_hierarchical_rec = NULL; ListIterator itr; - if(!ret_list) + if (!ret_list) return SLURM_ERROR; - if(!list_count(slurmdb_hierarchical_rec_list)) + if (!list_count(slurmdb_hierarchical_rec_list)) return SLURM_SUCCESS; itr = list_iterator_create(slurmdb_hierarchical_rec_list); while((slurmdb_hierarchical_rec = list_next(itr))) { list_append(ret_list, slurmdb_hierarchical_rec->assoc); - if(list_count(slurmdb_hierarchical_rec->childern)) + if (list_count(slurmdb_hierarchical_rec->childern)) _append_hierarchical_childern_ret_list( ret_list, slurmdb_hierarchical_rec->childern); } @@ -216,12 +216,12 @@ static char *_get_qos_list_str(List qos_list) ListIterator itr = NULL; slurmdb_qos_rec_t *qos = NULL; - if(!qos_list) + if (!qos_list) return NULL; itr = list_iterator_create(qos_list); while((qos = list_next(itr))) { - if(qos_char) + if (qos_char) xstrfmtcat(qos_char, ",%s", qos->name); else xstrcat(qos_char, qos->name); @@ -361,16 +361,16 @@ extern void slurmdb_destroy_user_rec(void *object) { slurmdb_user_rec_t *slurmdb_user = (slurmdb_user_rec_t *)object; - if(slurmdb_user) { - if(slurmdb_user->assoc_list) + if (slurmdb_user) { + if (slurmdb_user->assoc_list) list_destroy(slurmdb_user->assoc_list); - if(slurmdb_user->coord_accts) + if (slurmdb_user->coord_accts) list_destroy(slurmdb_user->coord_accts); xfree(slurmdb_user->default_acct); xfree(slurmdb_user->default_wckey); xfree(slurmdb_user->name); xfree(slurmdb_user->old_name); - if(slurmdb_user->wckey_list) + if (slurmdb_user->wckey_list) list_destroy(slurmdb_user->wckey_list); xfree(slurmdb_user); } @@ -381,10 +381,10 @@ extern void slurmdb_destroy_account_rec(void *object) slurmdb_account_rec_t *slurmdb_account = (slurmdb_account_rec_t *)object; - if(slurmdb_account) { - if(slurmdb_account->assoc_list) + if (slurmdb_account) { + if (slurmdb_account->assoc_list) list_destroy(slurmdb_account->assoc_list); - if(slurmdb_account->coordinators) + if (slurmdb_account->coordinators) list_destroy(slurmdb_account->coordinators); xfree(slurmdb_account->description); xfree(slurmdb_account->name); @@ -398,7 +398,7 @@ extern void slurmdb_destroy_coord_rec(void *object) slurmdb_coord_rec_t *slurmdb_coord = (slurmdb_coord_rec_t *)object; - if(slurmdb_coord) { + if (slurmdb_coord) { xfree(slurmdb_coord->name); xfree(slurmdb_coord); } @@ -409,7 +409,7 @@ extern void slurmdb_destroy_cluster_accounting_rec(void *object) slurmdb_cluster_accounting_rec_t *clusteracct_rec = (slurmdb_cluster_accounting_rec_t *)object; - if(clusteracct_rec) { + if (clusteracct_rec) { xfree(clusteracct_rec); } } @@ -419,7 +419,7 @@ extern void slurmdb_destroy_cluster_rec(void *object) slurmdb_cluster_rec_t *slurmdb_cluster = (slurmdb_cluster_rec_t *)object; - if(slurmdb_cluster) { + if (slurmdb_cluster) { _free_cluster_rec_members(slurmdb_cluster); xfree(slurmdb_cluster); } @@ -430,7 +430,7 @@ extern void slurmdb_destroy_accounting_rec(void *object) slurmdb_accounting_rec_t *slurmdb_accounting = (slurmdb_accounting_rec_t *)object; - if(slurmdb_accounting) { + if (slurmdb_accounting) { xfree(slurmdb_accounting); } } @@ -440,7 +440,7 @@ extern void slurmdb_destroy_association_rec(void *object) slurmdb_association_rec_t *slurmdb_association = (slurmdb_association_rec_t *)object; - if(slurmdb_association) { + if (slurmdb_association) { _free_assoc_rec_members(slurmdb_association); xfree(slurmdb_association); } @@ -451,7 +451,7 @@ extern void slurmdb_destroy_event_rec(void *object) slurmdb_event_rec_t *slurmdb_event = (slurmdb_event_rec_t *)object; - if(slurmdb_event) { + if (slurmdb_event) { xfree(slurmdb_event->cluster); xfree(slurmdb_event->cluster_nodes); xfree(slurmdb_event->node_name); @@ -472,7 +472,7 @@ extern void slurmdb_destroy_job_rec(void *object) xfree(job->jobname); xfree(job->partition); xfree(job->nodes); - if(job->steps) { + if (job->steps) { list_destroy(job->steps); job->steps = NULL; } @@ -485,7 +485,7 @@ extern void slurmdb_destroy_job_rec(void *object) extern void slurmdb_destroy_qos_rec(void *object) { slurmdb_qos_rec_t *slurmdb_qos = (slurmdb_qos_rec_t *)object; - if(slurmdb_qos) { + if (slurmdb_qos) { _free_qos_rec_members(slurmdb_qos); xfree(slurmdb_qos); } @@ -495,7 +495,7 @@ extern void slurmdb_destroy_reservation_rec(void *object) { slurmdb_reservation_rec_t *slurmdb_resv = (slurmdb_reservation_rec_t *)object; - if(slurmdb_resv) { + if (slurmdb_resv) { xfree(slurmdb_resv->assocs); xfree(slurmdb_resv->cluster); xfree(slurmdb_resv->name); @@ -519,7 +519,7 @@ extern void slurmdb_destroy_step_rec(void *object) extern void slurmdb_destroy_txn_rec(void *object) { slurmdb_txn_rec_t *slurmdb_txn = (slurmdb_txn_rec_t *)object; - if(slurmdb_txn) { + if (slurmdb_txn) { xfree(slurmdb_txn->accts); xfree(slurmdb_txn->actor_name); xfree(slurmdb_txn->clusters); @@ -534,7 +534,7 @@ extern void slurmdb_destroy_wckey_rec(void *object) { slurmdb_wckey_rec_t *wckey = (slurmdb_wckey_rec_t *)object; - if(wckey) { + if (wckey) { _free_wckey_rec_members(wckey); xfree(wckey); } @@ -544,7 +544,7 @@ extern void slurmdb_destroy_archive_rec(void *object) { slurmdb_archive_rec_t *arch_rec = (slurmdb_archive_rec_t *)object; - if(arch_rec) { + if (arch_rec) { xfree(arch_rec->archive_file); xfree(arch_rec->insert); xfree(arch_rec); @@ -555,7 +555,7 @@ extern void slurmdb_destroy_report_assoc_rec(void *object) { slurmdb_report_assoc_rec_t *slurmdb_report_assoc = (slurmdb_report_assoc_rec_t *)object; - if(slurmdb_report_assoc) { + if (slurmdb_report_assoc) { xfree(slurmdb_report_assoc->acct); xfree(slurmdb_report_assoc->cluster); xfree(slurmdb_report_assoc->parent_acct); @@ -568,11 +568,11 @@ extern void slurmdb_destroy_report_user_rec(void *object) { slurmdb_report_user_rec_t *slurmdb_report_user = (slurmdb_report_user_rec_t *)object; - if(slurmdb_report_user) { + if (slurmdb_report_user) { xfree(slurmdb_report_user->acct); - if(slurmdb_report_user->acct_list) + if (slurmdb_report_user->acct_list) list_destroy(slurmdb_report_user->acct_list); - if(slurmdb_report_user->assoc_list) + if (slurmdb_report_user->assoc_list) list_destroy(slurmdb_report_user->assoc_list); xfree(slurmdb_report_user->name); xfree(slurmdb_report_user); @@ -583,11 +583,11 @@ extern void slurmdb_destroy_report_cluster_rec(void *object) { slurmdb_report_cluster_rec_t *slurmdb_report_cluster = (slurmdb_report_cluster_rec_t *)object; - if(slurmdb_report_cluster) { - if(slurmdb_report_cluster->assoc_list) + if (slurmdb_report_cluster) { + if (slurmdb_report_cluster->assoc_list) list_destroy(slurmdb_report_cluster->assoc_list); xfree(slurmdb_report_cluster->name); - if(slurmdb_report_cluster->user_list) + if (slurmdb_report_cluster->user_list) list_destroy(slurmdb_report_cluster->user_list); xfree(slurmdb_report_cluster); } @@ -597,11 +597,11 @@ extern void slurmdb_destroy_user_cond(void *object) { slurmdb_user_cond_t *slurmdb_user = (slurmdb_user_cond_t *)object; - if(slurmdb_user) { + if (slurmdb_user) { slurmdb_destroy_association_cond(slurmdb_user->assoc_cond); - if(slurmdb_user->def_acct_list) + if (slurmdb_user->def_acct_list) list_destroy(slurmdb_user->def_acct_list); - if(slurmdb_user->def_wckey_list) + if (slurmdb_user->def_wckey_list) list_destroy(slurmdb_user->def_wckey_list); xfree(slurmdb_user); } @@ -612,11 +612,11 @@ extern void slurmdb_destroy_account_cond(void *object) slurmdb_account_cond_t *slurmdb_account = (slurmdb_account_cond_t *)object; - if(slurmdb_account) { + if (slurmdb_account) { slurmdb_destroy_association_cond(slurmdb_account->assoc_cond); - if(slurmdb_account->description_list) + if (slurmdb_account->description_list) list_destroy(slurmdb_account->description_list); - if(slurmdb_account->organization_list) + if (slurmdb_account->organization_list) list_destroy(slurmdb_account->organization_list); xfree(slurmdb_account); } @@ -627,7 +627,7 @@ extern void slurmdb_destroy_cluster_cond(void *object) slurmdb_cluster_cond_t *slurmdb_cluster = (slurmdb_cluster_cond_t *)object; - if(slurmdb_cluster) { + if (slurmdb_cluster) { _free_cluster_cond_members(slurmdb_cluster); xfree(slurmdb_cluster); } @@ -638,63 +638,63 @@ extern void slurmdb_destroy_association_cond(void *object) slurmdb_association_cond_t *slurmdb_association = (slurmdb_association_cond_t *)object; - if(slurmdb_association) { - if(slurmdb_association->acct_list) + if (slurmdb_association) { + if (slurmdb_association->acct_list) list_destroy(slurmdb_association->acct_list); - if(slurmdb_association->cluster_list) + if (slurmdb_association->cluster_list) list_destroy(slurmdb_association->cluster_list); - if(slurmdb_association->def_qos_id_list) + if (slurmdb_association->def_qos_id_list) list_destroy(slurmdb_association->def_qos_id_list); - if(slurmdb_association->fairshare_list) + if (slurmdb_association->fairshare_list) list_destroy(slurmdb_association->fairshare_list); - if(slurmdb_association->grp_cpu_mins_list) + if (slurmdb_association->grp_cpu_mins_list) list_destroy(slurmdb_association->grp_cpu_mins_list); - if(slurmdb_association->grp_cpu_run_mins_list) + if (slurmdb_association->grp_cpu_run_mins_list) list_destroy(slurmdb_association-> grp_cpu_run_mins_list); - if(slurmdb_association->grp_cpus_list) + if (slurmdb_association->grp_cpus_list) list_destroy(slurmdb_association->grp_cpus_list); - if(slurmdb_association->grp_jobs_list) + if (slurmdb_association->grp_jobs_list) list_destroy(slurmdb_association->grp_jobs_list); - if(slurmdb_association->grp_mem_list) + if (slurmdb_association->grp_mem_list) list_destroy(slurmdb_association->grp_mem_list); - if(slurmdb_association->grp_nodes_list) + if (slurmdb_association->grp_nodes_list) list_destroy(slurmdb_association->grp_nodes_list); - if(slurmdb_association->grp_submit_jobs_list) + if (slurmdb_association->grp_submit_jobs_list) list_destroy(slurmdb_association->grp_submit_jobs_list); - if(slurmdb_association->grp_wall_list) + if (slurmdb_association->grp_wall_list) list_destroy(slurmdb_association->grp_wall_list); - if(slurmdb_association->id_list) + if (slurmdb_association->id_list) list_destroy(slurmdb_association->id_list); - if(slurmdb_association->max_cpu_mins_pj_list) + if (slurmdb_association->max_cpu_mins_pj_list) list_destroy(slurmdb_association->max_cpu_mins_pj_list); - if(slurmdb_association->max_cpu_run_mins_list) + if (slurmdb_association->max_cpu_run_mins_list) list_destroy(slurmdb_association-> max_cpu_run_mins_list); - if(slurmdb_association->max_cpus_pj_list) + if (slurmdb_association->max_cpus_pj_list) list_destroy(slurmdb_association->max_cpus_pj_list); - if(slurmdb_association->max_jobs_list) + if (slurmdb_association->max_jobs_list) list_destroy(slurmdb_association->max_jobs_list); - if(slurmdb_association->max_nodes_pj_list) + if (slurmdb_association->max_nodes_pj_list) list_destroy(slurmdb_association->max_nodes_pj_list); - if(slurmdb_association->max_submit_jobs_list) + if (slurmdb_association->max_submit_jobs_list) list_destroy(slurmdb_association->max_submit_jobs_list); - if(slurmdb_association->max_wall_pj_list) + if (slurmdb_association->max_wall_pj_list) list_destroy(slurmdb_association->max_wall_pj_list); - if(slurmdb_association->partition_list) + if (slurmdb_association->partition_list) list_destroy(slurmdb_association->partition_list); - if(slurmdb_association->parent_acct_list) + if (slurmdb_association->parent_acct_list) list_destroy(slurmdb_association->parent_acct_list); - if(slurmdb_association->qos_list) + if (slurmdb_association->qos_list) list_destroy(slurmdb_association->qos_list); - if(slurmdb_association->user_list) + if (slurmdb_association->user_list) list_destroy(slurmdb_association->user_list); xfree(slurmdb_association); } @@ -705,16 +705,16 @@ extern void slurmdb_destroy_event_cond(void *object) slurmdb_event_cond_t *slurmdb_event = (slurmdb_event_cond_t *)object; - if(slurmdb_event) { - if(slurmdb_event->cluster_list) + if (slurmdb_event) { + if (slurmdb_event->cluster_list) list_destroy(slurmdb_event->cluster_list); - if(slurmdb_event->node_list) + if (slurmdb_event->node_list) list_destroy(slurmdb_event->node_list); - if(slurmdb_event->reason_list) + if (slurmdb_event->reason_list) list_destroy(slurmdb_event->reason_list); - if(slurmdb_event->reason_uid_list) + if (slurmdb_event->reason_uid_list) list_destroy(slurmdb_event->reason_uid_list); - if(slurmdb_event->state_list) + if (slurmdb_event->state_list) list_destroy(slurmdb_event->state_list); xfree(slurmdb_event); } @@ -725,33 +725,33 @@ extern void slurmdb_destroy_job_cond(void *object) slurmdb_job_cond_t *job_cond = (slurmdb_job_cond_t *)object; - if(job_cond) { - if(job_cond->acct_list) + if (job_cond) { + if (job_cond->acct_list) list_destroy(job_cond->acct_list); - if(job_cond->associd_list) + if (job_cond->associd_list) list_destroy(job_cond->associd_list); - if(job_cond->cluster_list) + if (job_cond->cluster_list) list_destroy(job_cond->cluster_list); - if(job_cond->groupid_list) + if (job_cond->groupid_list) list_destroy(job_cond->groupid_list); - if(job_cond->jobname_list) + if (job_cond->jobname_list) list_destroy(job_cond->jobname_list); - if(job_cond->partition_list) + if (job_cond->partition_list) list_destroy(job_cond->partition_list); - if(job_cond->qos_list) + if (job_cond->qos_list) list_destroy(job_cond->qos_list); - if(job_cond->resv_list) + if (job_cond->resv_list) list_destroy(job_cond->resv_list); - if(job_cond->resvid_list) + if (job_cond->resvid_list) list_destroy(job_cond->resvid_list); - if(job_cond->step_list) + if (job_cond->step_list) list_destroy(job_cond->step_list); - if(job_cond->state_list) + if (job_cond->state_list) list_destroy(job_cond->state_list); xfree(job_cond->used_nodes); - if(job_cond->userid_list) + if (job_cond->userid_list) list_destroy(job_cond->userid_list); - if(job_cond->wckey_list) + if (job_cond->wckey_list) list_destroy(job_cond->wckey_list); xfree(job_cond); } @@ -762,7 +762,7 @@ extern void slurmdb_destroy_job_modify_cond(void *object) slurmdb_job_modify_cond_t *job_cond = (slurmdb_job_modify_cond_t *)object; - if(job_cond) { + if (job_cond) { xfree(job_cond->cluster); xfree(job_cond); } @@ -771,10 +771,10 @@ extern void slurmdb_destroy_job_modify_cond(void *object) extern void slurmdb_destroy_qos_cond(void *object) { slurmdb_qos_cond_t *slurmdb_qos = (slurmdb_qos_cond_t *)object; - if(slurmdb_qos) { - if(slurmdb_qos->id_list) + if (slurmdb_qos) { + if (slurmdb_qos->id_list) list_destroy(slurmdb_qos->id_list); - if(slurmdb_qos->name_list) + if (slurmdb_qos->name_list) list_destroy(slurmdb_qos->name_list); xfree(slurmdb_qos); } @@ -784,12 +784,12 @@ extern void slurmdb_destroy_reservation_cond(void *object) { slurmdb_reservation_cond_t *slurmdb_resv = (slurmdb_reservation_cond_t *)object; - if(slurmdb_resv) { - if(slurmdb_resv->cluster_list) + if (slurmdb_resv) { + if (slurmdb_resv->cluster_list) list_destroy(slurmdb_resv->cluster_list); - if(slurmdb_resv->id_list) + if (slurmdb_resv->id_list) list_destroy(slurmdb_resv->id_list); - if(slurmdb_resv->name_list) + if (slurmdb_resv->name_list) list_destroy(slurmdb_resv->name_list); xfree(slurmdb_resv->nodes); xfree(slurmdb_resv); @@ -799,22 +799,22 @@ extern void slurmdb_destroy_reservation_cond(void *object) extern void slurmdb_destroy_txn_cond(void *object) { slurmdb_txn_cond_t *slurmdb_txn = (slurmdb_txn_cond_t *)object; - if(slurmdb_txn) { - if(slurmdb_txn->acct_list) + if (slurmdb_txn) { + if (slurmdb_txn->acct_list) list_destroy(slurmdb_txn->acct_list); - if(slurmdb_txn->action_list) + if (slurmdb_txn->action_list) list_destroy(slurmdb_txn->action_list); - if(slurmdb_txn->actor_list) + if (slurmdb_txn->actor_list) list_destroy(slurmdb_txn->actor_list); - if(slurmdb_txn->cluster_list) + if (slurmdb_txn->cluster_list) list_destroy(slurmdb_txn->cluster_list); - if(slurmdb_txn->id_list) + if (slurmdb_txn->id_list) list_destroy(slurmdb_txn->id_list); - if(slurmdb_txn->info_list) + if (slurmdb_txn->info_list) list_destroy(slurmdb_txn->info_list); - if(slurmdb_txn->name_list) + if (slurmdb_txn->name_list) list_destroy(slurmdb_txn->name_list); - if(slurmdb_txn->user_list) + if (slurmdb_txn->user_list) list_destroy(slurmdb_txn->user_list); xfree(slurmdb_txn); } @@ -824,14 +824,14 @@ extern void slurmdb_destroy_wckey_cond(void *object) { slurmdb_wckey_cond_t *wckey = (slurmdb_wckey_cond_t *)object; - if(wckey) { - if(wckey->cluster_list) + if (wckey) { + if (wckey->cluster_list) list_destroy(wckey->cluster_list); - if(wckey->id_list) + if (wckey->id_list) list_destroy(wckey->id_list); - if(wckey->name_list) + if (wckey->name_list) list_destroy(wckey->name_list); - if(wckey->user_list) + if (wckey->user_list) list_destroy(wckey->user_list); xfree(wckey); } @@ -841,7 +841,7 @@ extern void slurmdb_destroy_archive_cond(void *object) { slurmdb_archive_cond_t *arch_cond = (slurmdb_archive_cond_t *)object; - if(arch_cond) { + if (arch_cond) { xfree(arch_cond->archive_dir); xfree(arch_cond->archive_script); slurmdb_destroy_job_cond(arch_cond->job_cond); @@ -855,8 +855,8 @@ extern void slurmdb_destroy_update_object(void *object) slurmdb_update_object_t *slurmdb_update = (slurmdb_update_object_t *) object; - if(slurmdb_update) { - if(slurmdb_update->objects) + if (slurmdb_update) { + if (slurmdb_update->objects) list_destroy(slurmdb_update->objects); xfree(slurmdb_update); @@ -868,7 +868,7 @@ extern void slurmdb_destroy_used_limits(void *object) slurmdb_used_limits_t *slurmdb_used_limits = (slurmdb_used_limits_t *)object; - if(slurmdb_used_limits) { + if (slurmdb_used_limits) { xfree(slurmdb_used_limits); } } @@ -883,7 +883,7 @@ extern void slurmdb_destroy_print_tree(void *object) slurmdb_print_tree_t *slurmdb_print_tree = (slurmdb_print_tree_t *)object; - if(slurmdb_print_tree) { + if (slurmdb_print_tree) { xfree(slurmdb_print_tree->name); xfree(slurmdb_print_tree->print_name); xfree(slurmdb_print_tree->spaces); @@ -898,8 +898,8 @@ extern void slurmdb_destroy_hierarchical_rec(void *object) */ slurmdb_hierarchical_rec_t *slurmdb_hierarchical_rec = (slurmdb_hierarchical_rec_t *)object; - if(slurmdb_hierarchical_rec) { - if(slurmdb_hierarchical_rec->childern) { + if (slurmdb_hierarchical_rec) { + if (slurmdb_hierarchical_rec->childern) { list_destroy(slurmdb_hierarchical_rec->childern); } xfree(slurmdb_hierarchical_rec); @@ -918,8 +918,8 @@ extern void slurmdb_destroy_report_job_grouping(void *object) { slurmdb_report_job_grouping_t *job_grouping = (slurmdb_report_job_grouping_t *)object; - if(job_grouping) { - if(job_grouping->jobs) + if (job_grouping) { + if (job_grouping->jobs) list_destroy(job_grouping->jobs); xfree(job_grouping); } @@ -929,9 +929,9 @@ extern void slurmdb_destroy_report_acct_grouping(void *object) { slurmdb_report_acct_grouping_t *acct_grouping = (slurmdb_report_acct_grouping_t *)object; - if(acct_grouping) { + if (acct_grouping) { xfree(acct_grouping->acct); - if(acct_grouping->groups) + if (acct_grouping->groups) list_destroy(acct_grouping->groups); xfree(acct_grouping); } @@ -941,9 +941,9 @@ extern void slurmdb_destroy_report_cluster_grouping(void *object) { slurmdb_report_cluster_grouping_t *cluster_grouping = (slurmdb_report_cluster_grouping_t *)object; - if(cluster_grouping) { + if (cluster_grouping) { xfree(cluster_grouping->cluster); - if(cluster_grouping->acct_list) + if (cluster_grouping->acct_list) list_destroy(cluster_grouping->acct_list); xfree(cluster_grouping); } @@ -1127,7 +1127,7 @@ extern void slurmdb_init_wckey_rec(slurmdb_wckey_rec_t *wckey, bool free_it) extern void slurmdb_init_cluster_cond(slurmdb_cluster_cond_t *cluster, bool free_it) { - if(!cluster) + if (!cluster) return; if (free_it) @@ -1141,21 +1141,21 @@ extern char *slurmdb_qos_str(List qos_list, uint32_t level) ListIterator itr = NULL; slurmdb_qos_rec_t *qos = NULL; - if(!qos_list) { + if (!qos_list) { error("We need a qos list to translate"); return NULL; - } else if(!level) { + } else if (!level) { debug2("no level"); return ""; } itr = list_iterator_create(qos_list); while((qos = list_next(itr))) { - if(level == qos->id) + if (level == qos->id) break; } list_iterator_destroy(itr); - if(qos) + if (qos) return qos->name; else return NULL; @@ -1167,14 +1167,14 @@ extern uint32_t str_2_slurmdb_qos(List qos_list, char *level) slurmdb_qos_rec_t *qos = NULL; char *working_level = NULL; - if(!qos_list) { + if (!qos_list) { error("We need a qos list to translate"); return NO_VAL; - } else if(!level) { + } else if (!level) { debug2("no level"); return 0; } - if(level[0] == '+' || level[0] == '-') + if (level[0] == '+' || level[0] == '-') working_level = level+1; else working_level = level; @@ -1185,7 +1185,7 @@ extern uint32_t str_2_slurmdb_qos(List qos_list, char *level) break; } list_iterator_destroy(itr); - if(qos) + if (qos) return qos->id; else return NO_VAL; @@ -1282,13 +1282,13 @@ extern char *slurmdb_admin_level_str(slurmdb_admin_level_t level) extern slurmdb_admin_level_t str_2_slurmdb_admin_level(char *level) { - if(!level) { + if (!level) { return SLURMDB_ADMIN_NOTSET; - } else if(!strncasecmp(level, "None", 1)) { + } else if (!strncasecmp(level, "None", 1)) { return SLURMDB_ADMIN_NONE; - } else if(!strncasecmp(level, "Operator", 1)) { + } else if (!strncasecmp(level, "Operator", 1)) { return SLURMDB_ADMIN_OPERATOR; - } else if(!strncasecmp(level, "SuperUser", 1) + } else if (!strncasecmp(level, "SuperUser", 1) || !strncasecmp(level, "Admin", 1)) { return SLURMDB_ADMIN_SUPER_USER; } else { @@ -1359,7 +1359,7 @@ extern List slurmdb_get_acct_hierarchical_rec_list(List assoc_list) will look for it in the list. If it isn't there we will just add it to the parent and call it good */ - if(!assoc->parent_id) { + if (!assoc->parent_id) { arch_rec->sort_name = assoc->cluster; list_append(arch_rec_list, arch_rec); @@ -1368,15 +1368,15 @@ extern List slurmdb_get_acct_hierarchical_rec_list(List assoc_list) continue; } - if(assoc->user) + if (assoc->user) arch_rec->sort_name = assoc->user; else arch_rec->sort_name = assoc->acct; - if(last_parent && assoc->parent_id == last_parent->assoc->id + if (last_parent && assoc->parent_id == last_parent->assoc->id && !strcmp(assoc->cluster, last_parent->assoc->cluster)) { par_arch_rec = last_parent; - } else if(last_acct_parent + } else if (last_acct_parent && (assoc->parent_id == last_acct_parent->assoc->id) && !strcmp(assoc->cluster, last_acct_parent->assoc->cluster)) { @@ -1384,10 +1384,10 @@ extern List slurmdb_get_acct_hierarchical_rec_list(List assoc_list) } else { list_iterator_reset(itr2); while((par_arch_rec = list_next(itr2))) { - if(assoc->parent_id == par_arch_rec->assoc->id + if (assoc->parent_id == par_arch_rec->assoc->id && !strcmp(assoc->cluster, par_arch_rec->assoc->cluster)) { - if(assoc->user) + if (assoc->user) last_parent = par_arch_rec; else last_parent @@ -1398,7 +1398,7 @@ extern List slurmdb_get_acct_hierarchical_rec_list(List assoc_list) } } - if(!par_arch_rec) { + if (!par_arch_rec) { list_append(arch_rec_list, arch_rec); last_parent = last_acct_parent = arch_rec; } else @@ -1423,37 +1423,37 @@ extern char *slurmdb_tree_name_get(char *name, char *parent, List tree_list) slurmdb_print_tree_t *slurmdb_print_tree = NULL; slurmdb_print_tree_t *par_slurmdb_print_tree = NULL; - if(!tree_list) + if (!tree_list) return NULL; itr = list_iterator_create(tree_list); while((slurmdb_print_tree = list_next(itr))) { /* we don't care about users in this list. They are only there so we don't leak memory */ - if(slurmdb_print_tree->user) + if (slurmdb_print_tree->user) continue; - if(!strcmp(name, slurmdb_print_tree->name)) + if (!strcmp(name, slurmdb_print_tree->name)) break; - else if(parent && !strcmp(parent, slurmdb_print_tree->name)) + else if (parent && !strcmp(parent, slurmdb_print_tree->name)) par_slurmdb_print_tree = slurmdb_print_tree; } list_iterator_destroy(itr); - if(parent && slurmdb_print_tree) + if (parent && slurmdb_print_tree) return slurmdb_print_tree->print_name; slurmdb_print_tree = xmalloc(sizeof(slurmdb_print_tree_t)); slurmdb_print_tree->name = xstrdup(name); - if(par_slurmdb_print_tree) + if (par_slurmdb_print_tree) slurmdb_print_tree->spaces = xstrdup_printf(" %s", par_slurmdb_print_tree->spaces); else slurmdb_print_tree->spaces = xstrdup(""); /* user account */ - if(name[0] == '|') { + if (name[0] == '|') { slurmdb_print_tree->print_name = xstrdup_printf( "%s%s", slurmdb_print_tree->spaces, parent); slurmdb_print_tree->user = 1; @@ -1476,21 +1476,21 @@ extern int set_qos_bitstr_from_list(bitstr_t *valid_qos, List qos_list) xassert(valid_qos); - if(!qos_list) + if (!qos_list) return SLURM_ERROR; itr = list_iterator_create(qos_list); while((temp_char = list_next(itr))) { - if(temp_char[0] == '-') { + if (temp_char[0] == '-') { temp_char++; my_function = bit_clear; - } else if(temp_char[0] == '+') { + } else if (temp_char[0] == '+') { temp_char++; my_function = bit_set; } else my_function = bit_set; bit = atoi(temp_char); - if(bit >= bit_size(valid_qos)) { + if (bit >= bit_size(valid_qos)) { rc = SLURM_ERROR; break; } @@ -1509,22 +1509,22 @@ extern char *get_qos_complete_str_bitstr(List qos_list, bitstr_t *valid_qos) ListIterator itr = NULL; int i = 0; - if(!qos_list || !list_count(qos_list) + if (!qos_list || !list_count(qos_list) || !valid_qos || (bit_ffs(valid_qos) == -1)) return xstrdup(""); temp_list = list_create(NULL); for(i=0; i<bit_size(valid_qos); i++) { - if(!bit_test(valid_qos, i)) + if (!bit_test(valid_qos, i)) continue; - if((temp_char = slurmdb_qos_str(qos_list, i))) + if ((temp_char = slurmdb_qos_str(qos_list, i))) list_append(temp_list, temp_char); } list_sort(temp_list, (ListCmpF)slurm_sort_char_list_asc); itr = list_iterator_create(temp_list); while((temp_char = list_next(itr))) { - if(print_this) + if (print_this) xstrfmtcat(print_this, ",%s", temp_char); else print_this = xstrdup(temp_char); @@ -1532,7 +1532,7 @@ extern char *get_qos_complete_str_bitstr(List qos_list, bitstr_t *valid_qos) list_iterator_destroy(itr); list_destroy(temp_list); - if(!print_this) + if (!print_this) return xstrdup(""); return print_this; @@ -1546,7 +1546,7 @@ extern char *get_qos_complete_str(List qos_list, List num_qos_list) ListIterator itr = NULL; int option = 0; - if(!qos_list || !list_count(qos_list) + if (!qos_list || !list_count(qos_list) || !num_qos_list || !list_count(num_qos_list)) return xstrdup(""); @@ -1555,13 +1555,13 @@ extern char *get_qos_complete_str(List qos_list, List num_qos_list) itr = list_iterator_create(num_qos_list); while((temp_char = list_next(itr))) { option = 0; - if(temp_char[0] == '+' || temp_char[0] == '-') { + if (temp_char[0] == '+' || temp_char[0] == '-') { option = temp_char[0]; temp_char++; } temp_char = slurmdb_qos_str(qos_list, atoi(temp_char)); - if(temp_char) { - if(option) + if (temp_char) { + if (option) list_append(temp_list, xstrdup_printf( "%c%s", option, temp_char)); else @@ -1572,7 +1572,7 @@ extern char *get_qos_complete_str(List qos_list, List num_qos_list) list_sort(temp_list, (ListCmpF)slurm_sort_char_list_asc); itr = list_iterator_create(temp_list); while((temp_char = list_next(itr))) { - if(print_this) + if (print_this) xstrfmtcat(print_this, ",%s", temp_char); else print_this = xstrdup(temp_char); @@ -1580,7 +1580,7 @@ extern char *get_qos_complete_str(List qos_list, List num_qos_list) list_iterator_destroy(itr); list_destroy(temp_list); - if(!print_this) + if (!print_this) return xstrdup(""); return print_this; @@ -1596,25 +1596,25 @@ extern char *get_classification_str(uint16_t class) return NULL; break; case SLURMDB_CLASS_CAPACITY: - if(classified) + if (classified) return "*Capacity"; else return "Capacity"; break; case SLURMDB_CLASS_CAPABILITY: - if(classified) + if (classified) return "*Capability"; else return "Capability"; break; case SLURMDB_CLASS_CAPAPACITY: - if(classified) + if (classified) return "*Capapacity"; else return "Capapacity"; break; default: - if(classified) + if (classified) return "*Unknown"; else return "Unknown"; @@ -1625,19 +1625,19 @@ extern char *get_classification_str(uint16_t class) extern uint16_t str_2_classification(char *class) { uint16_t type = 0; - if(!class) + if (!class) return type; - if(slurm_strcasestr(class, "capac")) + if (slurm_strcasestr(class, "capac")) type = SLURMDB_CLASS_CAPACITY; - else if(slurm_strcasestr(class, "capab")) + else if (slurm_strcasestr(class, "capab")) type = SLURMDB_CLASS_CAPABILITY; - else if(slurm_strcasestr(class, "capap")) + else if (slurm_strcasestr(class, "capap")) type = SLURMDB_CLASS_CAPAPACITY; - if(slurm_strcasestr(class, "*")) + if (slurm_strcasestr(class, "*")) type |= SLURMDB_CLASSIFIED_FLAG; - else if(slurm_strcasestr(class, "class")) + else if (slurm_strcasestr(class, "class")) type |= SLURMDB_CLASSIFIED_FLAG; return type; @@ -1673,16 +1673,16 @@ extern uint16_t str_2_slurmdb_problem(char *problem) { uint16_t type = 0; - if(!problem) + if (!problem) return type; - if(slurm_strcasestr(problem, "account no associations")) + if (slurm_strcasestr(problem, "account no associations")) type = SLURMDB_PROBLEM_USER_NO_ASSOC; - else if(slurm_strcasestr(problem, "account no users")) + else if (slurm_strcasestr(problem, "account no users")) type = SLURMDB_PROBLEM_ACCT_NO_USERS; - else if(slurm_strcasestr(problem, "user no associations")) + else if (slurm_strcasestr(problem, "user no associations")) type = SLURMDB_PROBLEM_USER_NO_ASSOC; - else if(slurm_strcasestr(problem, "user no uid")) + else if (slurm_strcasestr(problem, "user no uid")) type = SLURMDB_PROBLEM_USER_NO_UID; return type; @@ -1697,111 +1697,111 @@ extern void log_assoc_rec(slurmdb_association_rec_t *assoc_ptr, debug2(" acct : %s", assoc_ptr->acct); debug2(" cluster : %s", assoc_ptr->cluster); - if(assoc_ptr->shares_raw == INFINITE) + if (assoc_ptr->shares_raw == INFINITE) debug2(" RawShares : NONE"); - else if(assoc_ptr->shares_raw != NO_VAL) + else if (assoc_ptr->shares_raw != NO_VAL) debug2(" RawShares : %u", assoc_ptr->shares_raw); - if(assoc_ptr->def_qos_id) + if (assoc_ptr->def_qos_id) debug2(" Default QOS : %s", slurmdb_qos_str(qos_list, assoc_ptr->def_qos_id)); else debug2(" Default QOS : NONE"); - if(assoc_ptr->grp_cpu_mins == INFINITE) + if (assoc_ptr->grp_cpu_mins == INFINITE) debug2(" GrpCPUMins : NONE"); - else if(assoc_ptr->grp_cpu_mins != NO_VAL) + else if (assoc_ptr->grp_cpu_mins != NO_VAL) debug2(" GrpCPUMins : %"PRIu64"", assoc_ptr->grp_cpu_mins); - if(assoc_ptr->grp_cpu_run_mins == INFINITE) + if (assoc_ptr->grp_cpu_run_mins == INFINITE) debug2(" GrpCPURunMins : NONE"); - else if(assoc_ptr->grp_cpu_run_mins != NO_VAL) + else if (assoc_ptr->grp_cpu_run_mins != NO_VAL) debug2(" GrpCPURunMins : %"PRIu64"", assoc_ptr->grp_cpu_run_mins); - if(assoc_ptr->grp_cpus == INFINITE) + if (assoc_ptr->grp_cpus == INFINITE) debug2(" GrpCPUs : NONE"); - else if(assoc_ptr->grp_cpus != NO_VAL) + else if (assoc_ptr->grp_cpus != NO_VAL) debug2(" GrpCPUs : %u", assoc_ptr->grp_cpus); - if(assoc_ptr->grp_jobs == INFINITE) + if (assoc_ptr->grp_jobs == INFINITE) debug2(" GrpJobs : NONE"); - else if(assoc_ptr->grp_jobs != NO_VAL) + else if (assoc_ptr->grp_jobs != NO_VAL) debug2(" GrpJobs : %u", assoc_ptr->grp_jobs); - if(assoc_ptr->grp_mem == INFINITE) + if (assoc_ptr->grp_mem == INFINITE) debug2(" GrpMemory : NONE"); - else if(assoc_ptr->grp_mem != NO_VAL) + else if (assoc_ptr->grp_mem != NO_VAL) debug2(" GrpMemory : %u", assoc_ptr->grp_mem); - if(assoc_ptr->grp_nodes == INFINITE) + if (assoc_ptr->grp_nodes == INFINITE) debug2(" GrpNodes : NONE"); - else if(assoc_ptr->grp_nodes != NO_VAL) + else if (assoc_ptr->grp_nodes != NO_VAL) debug2(" GrpNodes : %u", assoc_ptr->grp_nodes); - if(assoc_ptr->grp_submit_jobs == INFINITE) + if (assoc_ptr->grp_submit_jobs == INFINITE) debug2(" GrpSubmitJobs : NONE"); - else if(assoc_ptr->grp_submit_jobs != NO_VAL) + else if (assoc_ptr->grp_submit_jobs != NO_VAL) debug2(" GrpSubmitJobs : %u", assoc_ptr->grp_submit_jobs); - if(assoc_ptr->grp_wall == INFINITE) + if (assoc_ptr->grp_wall == INFINITE) debug2(" GrpWall : NONE"); - else if(assoc_ptr->grp_wall != NO_VAL) { + else if (assoc_ptr->grp_wall != NO_VAL) { char time_buf[32]; mins2time_str((time_t) assoc_ptr->grp_wall, time_buf, sizeof(time_buf)); debug2(" GrpWall : %s", time_buf); } - if(assoc_ptr->max_cpu_mins_pj == INFINITE) + if (assoc_ptr->max_cpu_mins_pj == INFINITE) debug2(" MaxCPUMins : NONE"); - else if(assoc_ptr->max_cpu_mins_pj != NO_VAL) + else if (assoc_ptr->max_cpu_mins_pj != NO_VAL) debug2(" MaxCPUMins : %"PRIu64"", assoc_ptr->max_cpu_mins_pj); - if(assoc_ptr->max_cpu_run_mins == INFINITE) + if (assoc_ptr->max_cpu_run_mins == INFINITE) debug2(" MaxCPURunMins : NONE"); - else if(assoc_ptr->max_cpu_run_mins != NO_VAL) + else if (assoc_ptr->max_cpu_run_mins != NO_VAL) debug2(" MaxCPURunMins : %"PRIu64"", assoc_ptr->max_cpu_run_mins); - if(assoc_ptr->max_cpus_pj == INFINITE) + if (assoc_ptr->max_cpus_pj == INFINITE) debug2(" MaxCPUs : NONE"); - else if(assoc_ptr->max_cpus_pj != NO_VAL) + else if (assoc_ptr->max_cpus_pj != NO_VAL) debug2(" MaxCPUs : %u", assoc_ptr->max_cpus_pj); - if(assoc_ptr->max_jobs == INFINITE) + if (assoc_ptr->max_jobs == INFINITE) debug2(" MaxJobs : NONE"); - else if(assoc_ptr->max_jobs != NO_VAL) + else if (assoc_ptr->max_jobs != NO_VAL) debug2(" MaxJobs : %u", assoc_ptr->max_jobs); - if(assoc_ptr->max_nodes_pj == INFINITE) + if (assoc_ptr->max_nodes_pj == INFINITE) debug2(" MaxNodes : NONE"); - else if(assoc_ptr->max_nodes_pj != NO_VAL) + else if (assoc_ptr->max_nodes_pj != NO_VAL) debug2(" MaxNodes : %u", assoc_ptr->max_nodes_pj); - if(assoc_ptr->max_submit_jobs == INFINITE) + if (assoc_ptr->max_submit_jobs == INFINITE) debug2(" MaxSubmitJobs : NONE"); - else if(assoc_ptr->max_submit_jobs != NO_VAL) + else if (assoc_ptr->max_submit_jobs != NO_VAL) debug2(" MaxSubmitJobs : %u", assoc_ptr->max_submit_jobs); - if(assoc_ptr->max_wall_pj == INFINITE) + if (assoc_ptr->max_wall_pj == INFINITE) debug2(" MaxWall : NONE"); - else if(assoc_ptr->max_wall_pj != NO_VAL) { + else if (assoc_ptr->max_wall_pj != NO_VAL) { char time_buf[32]; mins2time_str((time_t) assoc_ptr->max_wall_pj, time_buf, sizeof(time_buf)); debug2(" MaxWall : %s", time_buf); } - if(assoc_ptr->qos_list) { + if (assoc_ptr->qos_list) { char *temp_char = get_qos_complete_str(qos_list, assoc_ptr->qos_list); - if(temp_char) { + if (temp_char) { debug2(" Qos : %s", temp_char); xfree(temp_char); - if(assoc_ptr->usage && assoc_ptr->usage->valid_qos) { + if (assoc_ptr->usage && assoc_ptr->usage->valid_qos) { temp_char = get_qos_complete_str_bitstr( qos_list, assoc_ptr->usage->valid_qos); debug3(" Valid Qos : %s", temp_char); @@ -1845,8 +1845,8 @@ extern int slurmdb_report_set_start_end_time(time_t *start, time_t *end) // info("now got %d and %d sent", (*start), (*end)); /* Default is going to be the last day */ - if(!sent_end) { - if(!localtime_r(&my_time, &end_tm)) { + if (!sent_end) { + if (!localtime_r(&my_time, &end_tm)) { error("Couldn't get localtime from end %ld", (long)my_time); return SLURM_ERROR; @@ -1855,14 +1855,14 @@ extern int slurmdb_report_set_start_end_time(time_t *start, time_t *end) //(*end) = mktime(&end_tm); } else { temp_time = sent_end; - if(!localtime_r(&temp_time, &end_tm)) { + if (!localtime_r(&temp_time, &end_tm)) { error("Couldn't get localtime from user end %ld", (long)my_time); return SLURM_ERROR; } - if(end_tm.tm_sec >= 30) + if (end_tm.tm_sec >= 30) end_tm.tm_min++; - if(end_tm.tm_min >= 30) + if (end_tm.tm_min >= 30) end_tm.tm_hour++; } @@ -1871,8 +1871,8 @@ extern int slurmdb_report_set_start_end_time(time_t *start, time_t *end) end_tm.tm_isdst = -1; (*end) = mktime(&end_tm); - if(!sent_start) { - if(!localtime_r(&my_time, &start_tm)) { + if (!sent_start) { + if (!localtime_r(&my_time, &start_tm)) { error("Couldn't get localtime from start %ld", (long)my_time); return SLURM_ERROR; @@ -1882,14 +1882,14 @@ extern int slurmdb_report_set_start_end_time(time_t *start, time_t *end) //(*start) = mktime(&start_tm); } else { temp_time = sent_start; - if(!localtime_r(&temp_time, &start_tm)) { + if (!localtime_r(&temp_time, &start_tm)) { error("Couldn't get localtime from user start %ld", (long)my_time); return SLURM_ERROR; } - if(start_tm.tm_sec >= 30) + if (start_tm.tm_sec >= 30) start_tm.tm_min++; - if(start_tm.tm_min >= 30) + if (start_tm.tm_min >= 30) start_tm.tm_hour++; } start_tm.tm_sec = 0; @@ -1897,7 +1897,7 @@ extern int slurmdb_report_set_start_end_time(time_t *start, time_t *end) start_tm.tm_isdst = -1; (*start) = mktime(&start_tm); - if((*end)-(*start) < 3600) + if ((*end)-(*start) < 3600) (*end) = (*start) + 3600; /* info("now got %d and %d sent", (*start), (*end)); */ /* char start_char[20]; */ @@ -1935,7 +1935,7 @@ extern uint32_t slurmdb_parse_purge(char *string) while(string[i]) { if ((string[i] >= '0') && (string[i] <= '9')) { - if(purge == NO_VAL) + if (purge == NO_VAL) purge = 0; purge = (purge * 10) + (string[i] - '0'); } else @@ -1945,11 +1945,11 @@ extern uint32_t slurmdb_parse_purge(char *string) if (purge != NO_VAL) { int len = strlen(string+i); - if(!len || !strncasecmp("months", string+i, MAX(len, 1))) { + if (!len || !strncasecmp("months", string+i, MAX(len, 1))) { purge |= SLURMDB_PURGE_MONTHS; - } else if(!strncasecmp("hours", string+i, MAX(len, 1))) { + } else if (!strncasecmp("hours", string+i, MAX(len, 1))) { purge |= SLURMDB_PURGE_HOURS; - } else if(!strncasecmp("days", string+i, MAX(len, 1))) { + } else if (!strncasecmp("days", string+i, MAX(len, 1))) { purge |= SLURMDB_PURGE_DAYS; } else { error("Invalid purge unit '%s', valid options " @@ -1967,18 +1967,18 @@ extern char *slurmdb_purge_string(uint32_t purge, char *string, int len, { uint32_t units = SLURMDB_PURGE_GET_UNITS(purge); - if(SLURMDB_PURGE_IN_HOURS(purge)) { - if(with_archive && SLURMDB_PURGE_ARCHIVE_SET(purge)) + if (SLURMDB_PURGE_IN_HOURS(purge)) { + if (with_archive && SLURMDB_PURGE_ARCHIVE_SET(purge)) snprintf(string, len, "%u hours*", units); else snprintf(string, len, "%u hours", units); - } else if(SLURMDB_PURGE_IN_DAYS(purge)) { - if(with_archive && SLURMDB_PURGE_ARCHIVE_SET(purge)) + } else if (SLURMDB_PURGE_IN_DAYS(purge)) { + if (with_archive && SLURMDB_PURGE_ARCHIVE_SET(purge)) snprintf(string, len, "%u days*", units); else snprintf(string, len, "%u days", units); } else { - if(with_archive && SLURMDB_PURGE_ARCHIVE_SET(purge)) + if (with_archive && SLURMDB_PURGE_ARCHIVE_SET(purge)) snprintf(string, len, "%u months*", units); else snprintf(string, len, "%u months", units); @@ -2000,18 +2000,18 @@ extern int slurmdb_addto_qos_char_list(List char_list, List qos_list, int equal_set = 0; int add_set = 0; - if(!char_list) { + if (!char_list) { error("No list was given to fill in"); return 0; } - if(!qos_list || !list_count(qos_list)) { + if (!qos_list || !list_count(qos_list)) { debug2("No real qos_list"); return 0; } itr = list_iterator_create(char_list); - if(names) { + if (names) { if (names[i] == '\"' || names[i] == '\'') { quote_c = names[i]; quote = 1; @@ -2019,14 +2019,14 @@ extern int slurmdb_addto_qos_char_list(List char_list, List qos_list, } start = i; while(names[i]) { - if(quote && names[i] == quote_c) + if (quote && names[i] == quote_c) break; else if (names[i] == '\"' || names[i] == '\'') names[i] = '`'; - else if(names[i] == ',') { - if((i-start) > 0) { + else if (names[i] == ',') { + if ((i-start) > 0) { int tmp_option = option; - if(names[start] == '+' + if (names[start] == '+' || names[start] == '-') { tmp_option = names[start]; start++; @@ -2035,7 +2035,7 @@ extern int slurmdb_addto_qos_char_list(List char_list, List qos_list, memcpy(name, names+start, (i-start)); id = str_2_slurmdb_qos(qos_list, name); - if(id == NO_VAL) { + if (id == NO_VAL) { char *tmp = _get_qos_list_str( qos_list); error("You gave a bad qos " @@ -2048,8 +2048,8 @@ extern int slurmdb_addto_qos_char_list(List char_list, List qos_list, } xfree(name); - if(tmp_option) { - if(equal_set) { + if (tmp_option) { + if (equal_set) { error("You can't set " "qos equal to " "something and " @@ -2063,7 +2063,7 @@ extern int slurmdb_addto_qos_char_list(List char_list, List qos_list, name = xstrdup_printf( "%c%u", tmp_option, id); } else { - if(add_set) { + if (add_set) { error("You can't set " "qos equal to " "something and " @@ -2077,12 +2077,12 @@ extern int slurmdb_addto_qos_char_list(List char_list, List qos_list, name = xstrdup_printf("%u", id); } while((tmp_char = list_next(itr))) { - if(!strcasecmp(tmp_char, name)) + if (!strcasecmp(tmp_char, name)) break; } list_iterator_reset(itr); - if(!tmp_char) { + if (!tmp_char) { list_append(char_list, name); count++; } else @@ -2094,7 +2094,7 @@ extern int slurmdb_addto_qos_char_list(List char_list, List qos_list, i++; start = i; - if(!names[i]) { + if (!names[i]) { error("There is a problem with " "your request. It appears you " "have spaces inside your list."); @@ -2103,9 +2103,9 @@ extern int slurmdb_addto_qos_char_list(List char_list, List qos_list, } i++; } - if((i-start) > 0) { + if ((i-start) > 0) { int tmp_option = option; - if(names[start] == '+' || names[start] == '-') { + if (names[start] == '+' || names[start] == '-') { tmp_option = names[start]; start++; } @@ -2113,7 +2113,7 @@ extern int slurmdb_addto_qos_char_list(List char_list, List qos_list, memcpy(name, names+start, (i-start)); id = str_2_slurmdb_qos(qos_list, name); - if(id == NO_VAL) { + if (id == NO_VAL) { char *tmp = _get_qos_list_str(qos_list); error("You gave a bad qos " "'%s'. Valid QOS's are " @@ -2125,8 +2125,8 @@ extern int slurmdb_addto_qos_char_list(List char_list, List qos_list, } xfree(name); - if(tmp_option) { - if(equal_set) { + if (tmp_option) { + if (equal_set) { error("You can't set " "qos equal to " "something and " @@ -2139,7 +2139,7 @@ extern int slurmdb_addto_qos_char_list(List char_list, List qos_list, name = xstrdup_printf( "%c%u", tmp_option, id); } else { - if(add_set) { + if (add_set) { error("You can't set " "qos equal to " "something and " @@ -2152,11 +2152,11 @@ extern int slurmdb_addto_qos_char_list(List char_list, List qos_list, name = xstrdup_printf("%u", id); } while((tmp_char = list_next(itr))) { - if(!strcasecmp(tmp_char, name)) + if (!strcasecmp(tmp_char, name)) break; } - if(!tmp_char) { + if (!tmp_char) { list_append(char_list, name); count++; } else @@ -2166,7 +2166,7 @@ extern int slurmdb_addto_qos_char_list(List char_list, List qos_list, count++; } } - if(!count) { + if (!count) { error("You gave me an empty qos list"); } @@ -2207,7 +2207,7 @@ extern int slurmdb_send_accounting_update(List update_list, char *cluster, slurm_msg_t_init(&req); slurm_set_addr_char(&req.address, port, host); req.msg_type = ACCOUNTING_UPDATE_MSG; - if(slurmdbd_conf) + if (slurmdbd_conf) req.flags = SLURM_GLOBAL_AUTH_KEY; req.data = &msg; slurm_msg_t_init(&resp); @@ -2227,7 +2227,7 @@ extern int slurmdb_send_accounting_update(List update_list, char *cluster, slurm_free_return_code_msg(resp.data); break; default: - if(rc != SLURM_ERROR) + if (rc != SLURM_ERROR) error("Unknown response message %u", resp.msg_type); rc = SLURM_ERROR; break; diff --git a/src/common/slurmdb_pack.c b/src/common/slurmdb_pack.c index 9761c5c1c35..c4ba0466519 100644 --- a/src/common/slurmdb_pack.c +++ b/src/common/slurmdb_pack.c @@ -84,7 +84,7 @@ static void _pack_slurmdb_stats(slurmdb_stats_t *stats, pack32(stats->cpu_min_nodeid, buffer); pack16(stats->cpu_min_taskid, buffer); } else if (rpc_version >= SLURMDBD_VERSION_MIN) { - if(!stats) { + if (!stats) { for(i=0; i<4; i++) pack32((uint32_t) 0, buffer); @@ -181,8 +181,8 @@ extern void slurmdb_pack_user_rec(void *in, uint16_t rpc_version, Buf buffer) slurmdb_association_rec_t *assoc = NULL; slurmdb_wckey_rec_t *wckey = NULL; - if(rpc_version >= 8) { - if(!object) { + if (rpc_version >= 8) { + if (!object) { pack16(0, buffer); pack32(NO_VAL, buffer); pack32(NO_VAL, buffer); @@ -197,11 +197,11 @@ extern void slurmdb_pack_user_rec(void *in, uint16_t rpc_version, Buf buffer) pack16(object->admin_level, buffer); - if(object->assoc_list) + if (object->assoc_list) count = list_count(object->assoc_list); pack32(count, buffer); - if(count && count != NO_VAL) { + if (count && count != NO_VAL) { itr = list_iterator_create(object->assoc_list); while((assoc = list_next(itr))) { slurmdb_pack_association_rec(assoc, rpc_version, @@ -211,11 +211,11 @@ extern void slurmdb_pack_user_rec(void *in, uint16_t rpc_version, Buf buffer) } count = NO_VAL; - if(object->coord_accts) + if (object->coord_accts) count = list_count(object->coord_accts); pack32(count, buffer); - if(count && count != NO_VAL) { + if (count && count != NO_VAL) { itr = list_iterator_create(object->coord_accts); while((coord = list_next(itr))) { slurmdb_pack_coord_rec(coord, @@ -232,11 +232,11 @@ extern void slurmdb_pack_user_rec(void *in, uint16_t rpc_version, Buf buffer) pack32(object->uid, buffer); - if(object->wckey_list) + if (object->wckey_list) count = list_count(object->wckey_list); pack32(count, buffer); - if(count && count != NO_VAL) { + if (count && count != NO_VAL) { itr = list_iterator_create(object->wckey_list); while((wckey = list_next(itr))) { slurmdb_pack_wckey_rec(wckey, rpc_version, @@ -245,8 +245,8 @@ extern void slurmdb_pack_user_rec(void *in, uint16_t rpc_version, Buf buffer) list_iterator_destroy(itr); } count = NO_VAL; - } else if(rpc_version >= 4) { - if(!object) { + } else if (rpc_version >= 4) { + if (!object) { pack16(0, buffer); pack32(NO_VAL, buffer); pack32(NO_VAL, buffer); @@ -260,11 +260,11 @@ extern void slurmdb_pack_user_rec(void *in, uint16_t rpc_version, Buf buffer) pack16(object->admin_level, buffer); - if(object->assoc_list) + if (object->assoc_list) count = list_count(object->assoc_list); pack32(count, buffer); - if(count && count != NO_VAL) { + if (count && count != NO_VAL) { itr = list_iterator_create(object->assoc_list); while((assoc = list_next(itr))) { slurmdb_pack_association_rec(assoc, rpc_version, @@ -274,11 +274,11 @@ extern void slurmdb_pack_user_rec(void *in, uint16_t rpc_version, Buf buffer) } count = NO_VAL; - if(object->coord_accts) + if (object->coord_accts) count = list_count(object->coord_accts); pack32(count, buffer); - if(count && count != NO_VAL) { + if (count && count != NO_VAL) { itr = list_iterator_create(object->coord_accts); while((coord = list_next(itr))) { slurmdb_pack_coord_rec(coord, @@ -294,11 +294,11 @@ extern void slurmdb_pack_user_rec(void *in, uint16_t rpc_version, Buf buffer) pack32(object->uid, buffer); - if(object->wckey_list) + if (object->wckey_list) count = list_count(object->wckey_list); pack32(count, buffer); - if(count && count != NO_VAL) { + if (count && count != NO_VAL) { itr = list_iterator_create(object->wckey_list); while((wckey = list_next(itr))) { slurmdb_pack_wckey_rec(wckey, rpc_version, @@ -323,14 +323,14 @@ extern int slurmdb_unpack_user_rec(void **object, uint16_t rpc_version, *object = object_ptr; - if(rpc_version >= 8) { + if (rpc_version >= 8) { safe_unpack16(&object_ptr->admin_level, buffer); safe_unpack32(&count, buffer); - if(count != NO_VAL) { + if (count != NO_VAL) { object_ptr->assoc_list = list_create(slurmdb_destroy_association_rec); for(i=0; i<count; i++) { - if(slurmdb_unpack_association_rec( + if (slurmdb_unpack_association_rec( (void *)&assoc, rpc_version, buffer) == SLURM_ERROR) goto unpack_error; @@ -338,11 +338,11 @@ extern int slurmdb_unpack_user_rec(void **object, uint16_t rpc_version, } } safe_unpack32(&count, buffer); - if(count != NO_VAL) { + if (count != NO_VAL) { object_ptr->coord_accts = list_create(slurmdb_destroy_coord_rec); for(i=0; i<count; i++) { - if(slurmdb_unpack_coord_rec((void *)&coord, + if (slurmdb_unpack_coord_rec((void *)&coord, rpc_version, buffer) == SLURM_ERROR) goto unpack_error; @@ -358,11 +358,11 @@ extern int slurmdb_unpack_user_rec(void **object, uint16_t rpc_version, &uint32_tmp, buffer); safe_unpack32(&object_ptr->uid, buffer); safe_unpack32(&count, buffer); - if(count != NO_VAL) { + if (count != NO_VAL) { object_ptr->wckey_list = list_create(slurmdb_destroy_wckey_rec); for(i=0; i<count; i++) { - if(slurmdb_unpack_wckey_rec( + if (slurmdb_unpack_wckey_rec( (void *)&wckey, rpc_version, buffer) == SLURM_ERROR) goto unpack_error; @@ -370,14 +370,14 @@ extern int slurmdb_unpack_user_rec(void **object, uint16_t rpc_version, } } - } else if(rpc_version >= 4) { + } else if (rpc_version >= 4) { safe_unpack16(&object_ptr->admin_level, buffer); safe_unpack32(&count, buffer); - if(count != NO_VAL) { + if (count != NO_VAL) { object_ptr->assoc_list = list_create(slurmdb_destroy_association_rec); for(i=0; i<count; i++) { - if(slurmdb_unpack_association_rec( + if (slurmdb_unpack_association_rec( (void *)&assoc, rpc_version, buffer) == SLURM_ERROR) goto unpack_error; @@ -385,11 +385,11 @@ extern int slurmdb_unpack_user_rec(void **object, uint16_t rpc_version, } } safe_unpack32(&count, buffer); - if(count != NO_VAL) { + if (count != NO_VAL) { object_ptr->coord_accts = list_create(slurmdb_destroy_coord_rec); for(i=0; i<count; i++) { - if(slurmdb_unpack_coord_rec((void *)&coord, + if (slurmdb_unpack_coord_rec((void *)&coord, rpc_version, buffer) == SLURM_ERROR) goto unpack_error; @@ -403,11 +403,11 @@ extern int slurmdb_unpack_user_rec(void **object, uint16_t rpc_version, safe_unpackstr_xmalloc(&object_ptr->name, &uint32_tmp, buffer); safe_unpack32(&object_ptr->uid, buffer); safe_unpack32(&count, buffer); - if(count != NO_VAL) { + if (count != NO_VAL) { object_ptr->wckey_list = list_create(slurmdb_destroy_wckey_rec); for(i=0; i<count; i++) { - if(slurmdb_unpack_wckey_rec( + if (slurmdb_unpack_wckey_rec( (void *)&wckey, rpc_version, buffer) == SLURM_ERROR) goto unpack_error; @@ -429,8 +429,8 @@ extern void slurmdb_pack_used_limits(void *in, uint16_t rpc_version, Buf buffer) { slurmdb_used_limits_t *object = (slurmdb_used_limits_t *)in; - if(rpc_version >= 9) { - if(!object) { + if (rpc_version >= 9) { + if (!object) { pack64(0, buffer); pack32(0, buffer); pack32(0, buffer); @@ -447,7 +447,7 @@ extern void slurmdb_pack_used_limits(void *in, uint16_t rpc_version, Buf buffer) pack32(object->submit_jobs, buffer); pack32(object->uid, buffer); } else if (rpc_version >= 8) { - if(!object) { + if (!object) { pack64(0, buffer); pack32(0, buffer); pack32(0, buffer); @@ -459,8 +459,8 @@ extern void slurmdb_pack_used_limits(void *in, uint16_t rpc_version, Buf buffer) pack32(object->jobs, buffer); pack32(object->submit_jobs, buffer); pack32(object->uid, buffer); - } else if(rpc_version >= 6) { - if(!object) { + } else if (rpc_version >= 6) { + if (!object) { pack32(0, buffer); pack32(0, buffer); pack32(0, buffer); @@ -493,7 +493,7 @@ extern int slurmdb_unpack_used_limits(void **object, safe_unpack32(&object_ptr->jobs, buffer); safe_unpack32(&object_ptr->submit_jobs, buffer); safe_unpack32(&object_ptr->uid, buffer); - } else if(rpc_version >= 6) { + } else if (rpc_version >= 6) { safe_unpack32(&object_ptr->jobs, buffer); safe_unpack32(&object_ptr->submit_jobs, buffer); safe_unpack32(&object_ptr->uid, buffer); @@ -514,8 +514,8 @@ extern void slurmdb_pack_account_rec(void *in, uint16_t rpc_version, Buf buffer) slurmdb_account_rec_t *object = (slurmdb_account_rec_t *)in; slurmdb_association_rec_t *assoc = NULL; - if(rpc_version >= 3) { - if(!object) { + if (rpc_version >= 3) { + if (!object) { pack32(NO_VAL, buffer); pack32(NO_VAL, buffer); packnull(buffer); @@ -524,11 +524,11 @@ extern void slurmdb_pack_account_rec(void *in, uint16_t rpc_version, Buf buffer) return; } - if(object->assoc_list) + if (object->assoc_list) count = list_count(object->assoc_list); pack32(count, buffer); - if(count && count != NO_VAL) { + if (count && count != NO_VAL) { itr = list_iterator_create(object->assoc_list); while((assoc = list_next(itr))) { slurmdb_pack_association_rec(assoc, rpc_version, @@ -538,11 +538,11 @@ extern void slurmdb_pack_account_rec(void *in, uint16_t rpc_version, Buf buffer) } count = NO_VAL; - if(object->coordinators) + if (object->coordinators) count = list_count(object->coordinators); pack32(count, buffer); - if(count && count != NO_VAL) { + if (count && count != NO_VAL) { itr = list_iterator_create(object->coordinators); while((coord = list_next(itr))) { slurmdb_pack_coord_rec(coord, @@ -571,13 +571,13 @@ extern int slurmdb_unpack_account_rec(void **object, uint16_t rpc_version, *object = object_ptr; - if(rpc_version >= 3) { + if (rpc_version >= 3) { safe_unpack32(&count, buffer); - if(count != NO_VAL) { + if (count != NO_VAL) { object_ptr->assoc_list = list_create(slurmdb_destroy_association_rec); for(i=0; i<count; i++) { - if(slurmdb_unpack_association_rec( + if (slurmdb_unpack_association_rec( (void *)&assoc, rpc_version, buffer) == SLURM_ERROR) goto unpack_error; @@ -585,11 +585,11 @@ extern int slurmdb_unpack_account_rec(void **object, uint16_t rpc_version, } } safe_unpack32(&count, buffer); - if(count != NO_VAL) { + if (count != NO_VAL) { object_ptr->coordinators = list_create(slurmdb_destroy_coord_rec); for(i=0; i<count; i++) { - if(slurmdb_unpack_coord_rec((void *)&coord, + if (slurmdb_unpack_coord_rec((void *)&coord, rpc_version, buffer) == SLURM_ERROR) goto unpack_error; @@ -615,7 +615,7 @@ extern void slurmdb_pack_coord_rec(void *in, uint16_t rpc_version, Buf buffer) { slurmdb_coord_rec_t *object = (slurmdb_coord_rec_t *)in; - if(!object) { + if (!object) { packnull(buffer); pack16(0, buffer); return; @@ -648,8 +648,8 @@ extern void slurmdb_pack_cluster_accounting_rec(void *in, uint16_t rpc_version, slurmdb_cluster_accounting_rec_t *object = (slurmdb_cluster_accounting_rec_t *)in; - if(rpc_version >= 5) { - if(!object) { + if (rpc_version >= 5) { + if (!object) { pack64(0, buffer); pack32(0, buffer); pack64(0, buffer); @@ -681,7 +681,7 @@ extern int slurmdb_unpack_cluster_accounting_rec(void **object, *object = object_ptr; - if(rpc_version >= 5) { + if (rpc_version >= 5) { safe_unpack64(&object_ptr->alloc_secs, buffer); safe_unpack32(&object_ptr->cpu_count, buffer); safe_unpack64(&object_ptr->down_secs, buffer); @@ -707,8 +707,8 @@ extern void slurmdb_pack_cluster_rec(void *in, uint16_t rpc_version, Buf buffer) uint32_t count = NO_VAL; slurmdb_cluster_rec_t *object = (slurmdb_cluster_rec_t *)in; - if(rpc_version >= 8) { - if(!object) { + if (rpc_version >= 8) { + if (!object) { pack32(NO_VAL, buffer); pack16(0, buffer); packnull(buffer); @@ -728,12 +728,12 @@ extern void slurmdb_pack_cluster_rec(void *in, uint16_t rpc_version, Buf buffer) return; } - if(object->accounting_list) + if (object->accounting_list) count = list_count(object->accounting_list); pack32(count, buffer); - if(count && count != NO_VAL) { + if (count && count != NO_VAL) { itr = list_iterator_create(object->accounting_list); while((slurmdb_info = list_next(itr))) { slurmdb_pack_cluster_accounting_rec( @@ -759,8 +759,8 @@ extern void slurmdb_pack_cluster_rec(void *in, uint16_t rpc_version, Buf buffer) rpc_version, buffer); pack16(object->rpc_version, buffer); - } else if(rpc_version >= 5) { - if(!object) { + } else if (rpc_version >= 5) { + if (!object) { pack32(NO_VAL, buffer); pack16(0, buffer); packnull(buffer); @@ -776,12 +776,12 @@ extern void slurmdb_pack_cluster_rec(void *in, uint16_t rpc_version, Buf buffer) return; } - if(object->accounting_list) + if (object->accounting_list) count = list_count(object->accounting_list); pack32(count, buffer); - if(count && count != NO_VAL) { + if (count && count != NO_VAL) { itr = list_iterator_create(object->accounting_list); while((slurmdb_info = list_next(itr))) { slurmdb_pack_cluster_accounting_rec( @@ -819,9 +819,9 @@ extern int slurmdb_unpack_cluster_rec(void **object, uint16_t rpc_version, *object = object_ptr; slurmdb_init_cluster_rec(object_ptr, 0); - if(rpc_version >= 8) { + if (rpc_version >= 8) { safe_unpack32(&count, buffer); - if(count != NO_VAL) { + if (count != NO_VAL) { object_ptr->accounting_list = list_create( slurmdb_destroy_cluster_accounting_rec); for(i=0; i<count; i++) { @@ -847,16 +847,16 @@ extern int slurmdb_unpack_cluster_rec(void **object, uint16_t rpc_version, safe_unpack32(&object_ptr->plugin_id_select, buffer); - if(slurmdb_unpack_association_rec( + if (slurmdb_unpack_association_rec( (void **)&object_ptr->root_assoc, rpc_version, buffer) == SLURM_ERROR) goto unpack_error; safe_unpack16(&object_ptr->rpc_version, buffer); - } else if(rpc_version >= 5) { + } else if (rpc_version >= 5) { safe_unpack32(&count, buffer); - if(count != NO_VAL) { + if (count != NO_VAL) { object_ptr->accounting_list = list_create( slurmdb_destroy_cluster_accounting_rec); for(i=0; i<count; i++) { @@ -878,7 +878,7 @@ extern int slurmdb_unpack_cluster_rec(void **object, uint16_t rpc_version, safe_unpackstr_xmalloc(&object_ptr->name, &uint32_tmp, buffer); safe_unpackstr_xmalloc(&object_ptr->nodes, &uint32_tmp, buffer); - if(slurmdb_unpack_association_rec( + if (slurmdb_unpack_association_rec( (void **)&object_ptr->root_assoc, rpc_version, buffer) == SLURM_ERROR) @@ -900,7 +900,7 @@ extern void slurmdb_pack_accounting_rec(void *in, uint16_t rpc_version, { slurmdb_accounting_rec_t *object = (slurmdb_accounting_rec_t *)in; - if(!object) { + if (!object) { pack64(0, buffer); pack32(0, buffer); pack_time(0, buffer); @@ -942,7 +942,7 @@ extern void slurmdb_pack_association_rec(void *in, uint16_t rpc_version, slurmdb_association_rec_t *object = (slurmdb_association_rec_t *)in; if (rpc_version >= 10) { - if(!object) { + if (!object) { pack32(NO_VAL, buffer); packnull(buffer); packnull(buffer); @@ -985,12 +985,12 @@ extern void slurmdb_pack_association_rec(void *in, uint16_t rpc_version, return; } - if(object->accounting_list) + if (object->accounting_list) count = list_count(object->accounting_list); pack32(count, buffer); - if(count && count != NO_VAL) { + if (count && count != NO_VAL) { itr = list_iterator_create(object->accounting_list); while((slurmdb_info = list_next(itr))) { slurmdb_pack_accounting_rec(slurmdb_info, @@ -1036,12 +1036,12 @@ extern void slurmdb_pack_association_rec(void *in, uint16_t rpc_version, pack32(object->parent_id, buffer); packstr(object->partition, buffer); - if(object->qos_list) + if (object->qos_list) count = list_count(object->qos_list); pack32(count, buffer); - if(count && count != NO_VAL) { + if (count && count != NO_VAL) { itr = list_iterator_create(object->qos_list); while((tmp_info = list_next(itr))) { packstr(tmp_info, buffer); @@ -1055,7 +1055,7 @@ extern void slurmdb_pack_association_rec(void *in, uint16_t rpc_version, packstr(object->user, buffer); } else if (rpc_version >= 8) { - if(!object) { + if (!object) { pack32(NO_VAL, buffer); packnull(buffer); packnull(buffer); @@ -1097,12 +1097,12 @@ extern void slurmdb_pack_association_rec(void *in, uint16_t rpc_version, return; } - if(object->accounting_list) + if (object->accounting_list) count = list_count(object->accounting_list); pack32(count, buffer); - if(count && count != NO_VAL) { + if (count && count != NO_VAL) { itr = list_iterator_create(object->accounting_list); while((slurmdb_info = list_next(itr))) { slurmdb_pack_accounting_rec(slurmdb_info, @@ -1147,12 +1147,12 @@ extern void slurmdb_pack_association_rec(void *in, uint16_t rpc_version, pack32(object->parent_id, buffer); packstr(object->partition, buffer); - if(object->qos_list) + if (object->qos_list) count = list_count(object->qos_list); pack32(count, buffer); - if(count && count != NO_VAL) { + if (count && count != NO_VAL) { itr = list_iterator_create(object->qos_list); while((tmp_info = list_next(itr))) { packstr(tmp_info, buffer); @@ -1166,7 +1166,7 @@ extern void slurmdb_pack_association_rec(void *in, uint16_t rpc_version, packstr(object->user, buffer); } else if (rpc_version >= 4) { - if(!object) { + if (!object) { pack32(NO_VAL, buffer); packnull(buffer); packnull(buffer); @@ -1203,12 +1203,12 @@ extern void slurmdb_pack_association_rec(void *in, uint16_t rpc_version, return; } - if(object->accounting_list) + if (object->accounting_list) count = list_count(object->accounting_list); pack32(count, buffer); - if(count && count != NO_VAL) { + if (count && count != NO_VAL) { itr = list_iterator_create(object->accounting_list); while((slurmdb_info = list_next(itr))) { slurmdb_pack_accounting_rec(slurmdb_info, @@ -1248,12 +1248,12 @@ extern void slurmdb_pack_association_rec(void *in, uint16_t rpc_version, pack32(object->parent_id, buffer); packstr(object->partition, buffer); - if(object->qos_list) + if (object->qos_list) count = list_count(object->qos_list); pack32(count, buffer); - if(count && count != NO_VAL) { + if (count && count != NO_VAL) { itr = list_iterator_create(object->qos_list); while((tmp_info = list_next(itr))) { packstr(tmp_info, buffer); @@ -1286,11 +1286,11 @@ extern int slurmdb_unpack_association_rec(void **object, uint16_t rpc_version, if (rpc_version >= 10) { safe_unpack32(&count, buffer); - if(count != NO_VAL) { + if (count != NO_VAL) { object_ptr->accounting_list = list_create(slurmdb_destroy_accounting_rec); for(i=0; i<count; i++) { - if(slurmdb_unpack_accounting_rec( + if (slurmdb_unpack_accounting_rec( (void **)&slurmdb_info, rpc_version, buffer) == SLURM_ERROR) @@ -1338,7 +1338,7 @@ extern int slurmdb_unpack_association_rec(void **object, uint16_t rpc_version, safe_unpack32(&count, buffer); /* This needs to look for zero to tell if something has changed */ - if(count != NO_VAL) { + if (count != NO_VAL) { object_ptr->qos_list = list_create(slurm_destroy_char); for(i=0; i<count; i++) { safe_unpackstr_xmalloc(&tmp_info, &uint32_tmp, @@ -1353,11 +1353,11 @@ extern int slurmdb_unpack_association_rec(void **object, uint16_t rpc_version, safe_unpackstr_xmalloc(&object_ptr->user, &uint32_tmp, buffer); } else if (rpc_version >= 8) { safe_unpack32(&count, buffer); - if(count != NO_VAL) { + if (count != NO_VAL) { object_ptr->accounting_list = list_create(slurmdb_destroy_accounting_rec); for(i=0; i<count; i++) { - if(slurmdb_unpack_accounting_rec( + if (slurmdb_unpack_accounting_rec( (void **)&slurmdb_info, rpc_version, buffer) == SLURM_ERROR) @@ -1404,7 +1404,7 @@ extern int slurmdb_unpack_association_rec(void **object, uint16_t rpc_version, safe_unpack32(&count, buffer); /* This needs to look for zero to tell if something has changed */ - if(count != NO_VAL) { + if (count != NO_VAL) { object_ptr->qos_list = list_create(slurm_destroy_char); for(i=0; i<count; i++) { safe_unpackstr_xmalloc(&tmp_info, &uint32_tmp, @@ -1419,11 +1419,11 @@ extern int slurmdb_unpack_association_rec(void **object, uint16_t rpc_version, safe_unpackstr_xmalloc(&object_ptr->user, &uint32_tmp, buffer); } else if (rpc_version >= 4) { safe_unpack32(&count, buffer); - if(count != NO_VAL) { + if (count != NO_VAL) { object_ptr->accounting_list = list_create(slurmdb_destroy_accounting_rec); for(i=0; i<count; i++) { - if(slurmdb_unpack_accounting_rec( + if (slurmdb_unpack_accounting_rec( (void **)&slurmdb_info, rpc_version, buffer) == SLURM_ERROR) @@ -1465,7 +1465,7 @@ extern int slurmdb_unpack_association_rec(void **object, uint16_t rpc_version, safe_unpack32(&count, buffer); /* This needs to look for zero to tell if something has changed */ - if(count != NO_VAL) { + if (count != NO_VAL) { object_ptr->qos_list = list_create(slurm_destroy_char); for(i=0; i<count; i++) { safe_unpackstr_xmalloc(&tmp_info, &uint32_tmp, @@ -1492,7 +1492,7 @@ extern void slurmdb_pack_event_rec(void *in, uint16_t rpc_version, Buf buffer) { slurmdb_event_rec_t *object = (slurmdb_event_rec_t *)in; - if(!object) { + if (!object) { packnull(buffer); packnull(buffer); pack32(NO_VAL, buffer); @@ -1853,12 +1853,12 @@ extern void slurmdb_pack_qos_rec(void *in, uint16_t rpc_version, Buf buffer) pack_bit_str(object->preempt_bitstr, buffer); - if(object->preempt_list) + if (object->preempt_list) count = list_count(object->preempt_list); pack32(count, buffer); - if(count && count != NO_VAL) { + if (count && count != NO_VAL) { itr = list_iterator_create(object->preempt_list); while((tmp_info = list_next(itr))) { packstr(tmp_info, buffer); @@ -2051,7 +2051,7 @@ extern int slurmdb_unpack_qos_rec(void **object, uint16_t rpc_version, unpack_bit_str(&object_ptr->preempt_bitstr, buffer); safe_unpack32(&count, buffer); - if(count != NO_VAL) { + if (count != NO_VAL) { object_ptr->preempt_list = list_create(slurm_destroy_char); for(i=0; i<count; i++) { @@ -2080,7 +2080,7 @@ extern void slurmdb_pack_reservation_rec(void *in, uint16_t rpc_version, { slurmdb_reservation_rec_t *object = (slurmdb_reservation_rec_t *)in; - if(!object) { + if (!object) { pack64(0, buffer); packnull(buffer); packnull(buffer); @@ -2147,8 +2147,8 @@ extern void slurmdb_pack_txn_rec(void *in, uint16_t rpc_version, Buf buffer) { slurmdb_txn_rec_t *object = (slurmdb_txn_rec_t *)in; - if(rpc_version >= 3) { - if(!object) { + if (rpc_version >= 3) { + if (!object) { packnull(buffer); pack16(0, buffer); packnull(buffer); @@ -2212,8 +2212,8 @@ extern void slurmdb_pack_wckey_rec(void *in, uint16_t rpc_version, Buf buffer) uint32_t count = NO_VAL; slurmdb_wckey_rec_t *object = (slurmdb_wckey_rec_t *)in; - if(rpc_version >= 8) { - if(!object) { + if (rpc_version >= 8) { + if (!object) { pack32(NO_VAL, buffer); packnull(buffer); @@ -2228,12 +2228,12 @@ extern void slurmdb_pack_wckey_rec(void *in, uint16_t rpc_version, Buf buffer) return; } - if(object->accounting_list) + if (object->accounting_list) count = list_count(object->accounting_list); pack32(count, buffer); - if(count && count != NO_VAL) { + if (count && count != NO_VAL) { itr = list_iterator_create(object->accounting_list); while((slurmdb_info = list_next(itr))) { slurmdb_pack_accounting_rec( @@ -2255,7 +2255,7 @@ extern void slurmdb_pack_wckey_rec(void *in, uint16_t rpc_version, Buf buffer) packstr(object->user, buffer); } else { - if(!object) { + if (!object) { pack32(NO_VAL, buffer); packnull(buffer); @@ -2270,12 +2270,12 @@ extern void slurmdb_pack_wckey_rec(void *in, uint16_t rpc_version, Buf buffer) return; } - if(object->accounting_list) + if (object->accounting_list) count = list_count(object->accounting_list); pack32(count, buffer); - if(count && count != NO_VAL) { + if (count && count != NO_VAL) { itr = list_iterator_create(object->accounting_list); while((slurmdb_info = list_next(itr))) { slurmdb_pack_accounting_rec( @@ -2309,13 +2309,13 @@ extern int slurmdb_unpack_wckey_rec(void **object, uint16_t rpc_version, *object = object_ptr; - if(rpc_version >= 8) { + if (rpc_version >= 8) { safe_unpack32(&count, buffer); - if(count != NO_VAL) { + if (count != NO_VAL) { object_ptr->accounting_list = list_create(slurmdb_destroy_accounting_rec); for(i=0; i<count; i++) { - if(slurmdb_unpack_accounting_rec( + if (slurmdb_unpack_accounting_rec( (void **)&slurmdb_info, rpc_version, buffer) == SLURM_ERROR) @@ -2339,11 +2339,11 @@ extern int slurmdb_unpack_wckey_rec(void **object, uint16_t rpc_version, safe_unpackstr_xmalloc(&object_ptr->user, &uint32_tmp, buffer); } else { safe_unpack32(&count, buffer); - if(count != NO_VAL) { + if (count != NO_VAL) { object_ptr->accounting_list = list_create(slurmdb_destroy_accounting_rec); for(i=0; i<count; i++) { - if(slurmdb_unpack_accounting_rec( + if (slurmdb_unpack_accounting_rec( (void **)&slurmdb_info, rpc_version, buffer) == SLURM_ERROR) @@ -2376,7 +2376,7 @@ extern void slurmdb_pack_archive_rec(void *in, uint16_t rpc_version, Buf buffer) { slurmdb_archive_rec_t *object = (slurmdb_archive_rec_t *)in; - if(!object) { + if (!object) { packnull(buffer); packnull(buffer); return; @@ -2447,7 +2447,7 @@ extern void slurmdb_pack_user_cond(void *in, uint16_t rpc_version, Buf buffer) } count = NO_VAL; - if(object->def_wckey_list) + if (object->def_wckey_list) count = list_count(object->def_wckey_list); pack32(count, buffer); @@ -2542,8 +2542,8 @@ extern void slurmdb_pack_account_cond(void *in, uint16_t rpc_version, slurmdb_account_cond_t *object = (slurmdb_account_cond_t *)in; uint32_t count = NO_VAL; - if(rpc_version >= 3) { - if(!object) { + if (rpc_version >= 3) { + if (!object) { slurmdb_pack_association_cond(NULL, rpc_version, buffer); pack32(NO_VAL, buffer); @@ -2557,12 +2557,12 @@ extern void slurmdb_pack_account_cond(void *in, uint16_t rpc_version, rpc_version, buffer); count = NO_VAL; - if(object->description_list) + if (object->description_list) count = list_count(object->description_list); pack32(count, buffer); - if(count && count != NO_VAL) { + if (count && count != NO_VAL) { itr = list_iterator_create(object->description_list); while((tmp_info = list_next(itr))) { packstr(tmp_info, buffer); @@ -2571,12 +2571,12 @@ extern void slurmdb_pack_account_cond(void *in, uint16_t rpc_version, } count = NO_VAL; - if(object->organization_list) + if (object->organization_list) count = list_count(object->organization_list); pack32(count, buffer); - if(count && count != NO_VAL) { + if (count && count != NO_VAL) { itr = list_iterator_create(object->organization_list); while((tmp_info = list_next(itr))) { packstr(tmp_info, buffer); @@ -2604,13 +2604,13 @@ extern int slurmdb_unpack_account_cond(void **object, uint16_t rpc_version, *object = object_ptr; if (rpc_version >= 3) { - if(slurmdb_unpack_association_cond( + if (slurmdb_unpack_association_cond( (void **)&object_ptr->assoc_cond, rpc_version, buffer) == SLURM_ERROR) goto unpack_error; safe_unpack32(&count, buffer); - if(count != NO_VAL) { + if (count != NO_VAL) { object_ptr->description_list = list_create(slurm_destroy_char); for(i=0; i<count; i++) { @@ -2621,7 +2621,7 @@ extern int slurmdb_unpack_account_cond(void **object, uint16_t rpc_version, } } safe_unpack32(&count, buffer); - if(count != NO_VAL) { + if (count != NO_VAL) { object_ptr->organization_list = list_create(slurm_destroy_char); for(i=0; i<count; i++) { @@ -2652,8 +2652,8 @@ extern void slurmdb_pack_cluster_cond(void *in, uint16_t rpc_version, slurmdb_cluster_cond_t *object = (slurmdb_cluster_cond_t *)in; uint32_t count = NO_VAL; - if(rpc_version >= 8) { - if(!object) { + if (rpc_version >= 8) { + if (!object) { pack16(0, buffer); pack32(NO_VAL, buffer); pack32(NO_VAL, buffer); @@ -2668,12 +2668,12 @@ extern void slurmdb_pack_cluster_cond(void *in, uint16_t rpc_version, pack16(object->classification, buffer); - if(object->cluster_list) + if (object->cluster_list) count = list_count(object->cluster_list); pack32(count, buffer); - if(count && count != NO_VAL) { + if (count && count != NO_VAL) { itr = list_iterator_create(object->cluster_list); while((tmp_info = list_next(itr))) { packstr(tmp_info, buffer); @@ -2684,12 +2684,12 @@ extern void slurmdb_pack_cluster_cond(void *in, uint16_t rpc_version, pack32(object->flags, buffer); - if(object->plugin_id_select_list) + if (object->plugin_id_select_list) count = list_count(object->plugin_id_select_list); pack32(count, buffer); - if(count && count != NO_VAL) { + if (count && count != NO_VAL) { itr = list_iterator_create( object->plugin_id_select_list); while((tmp_info = list_next(itr))) { @@ -2699,12 +2699,12 @@ extern void slurmdb_pack_cluster_cond(void *in, uint16_t rpc_version, } count = NO_VAL; - if(object->rpc_version_list) + if (object->rpc_version_list) count = list_count(object->rpc_version_list); pack32(count, buffer); - if(count && count != NO_VAL) { + if (count && count != NO_VAL) { itr = list_iterator_create(object->rpc_version_list); while((tmp_info = list_next(itr))) { packstr(tmp_info, buffer); @@ -2718,8 +2718,8 @@ extern void slurmdb_pack_cluster_cond(void *in, uint16_t rpc_version, pack16(object->with_usage, buffer); pack16(object->with_deleted, buffer); - } else if(rpc_version >= 5) { - if(!object) { + } else if (rpc_version >= 5) { + if (!object) { pack16(0, buffer); pack32(NO_VAL, buffer); pack_time(0, buffer); @@ -2731,12 +2731,12 @@ extern void slurmdb_pack_cluster_cond(void *in, uint16_t rpc_version, pack16(object->classification, buffer); - if(object->cluster_list) + if (object->cluster_list) count = list_count(object->cluster_list); pack32(count, buffer); - if(count && count != NO_VAL) { + if (count && count != NO_VAL) { itr = list_iterator_create(object->cluster_list); while((tmp_info = list_next(itr))) { packstr(tmp_info, buffer); @@ -2766,10 +2766,10 @@ extern int slurmdb_unpack_cluster_cond(void **object, uint16_t rpc_version, *object = object_ptr; slurmdb_init_cluster_cond(object_ptr, 0); - if(rpc_version >= 8) { + if (rpc_version >= 8) { safe_unpack16(&object_ptr->classification, buffer); safe_unpack32(&count, buffer); - if(count && count != NO_VAL) { + if (count && count != NO_VAL) { object_ptr->cluster_list = list_create(slurm_destroy_char); for(i=0; i<count; i++) { @@ -2782,7 +2782,7 @@ extern int slurmdb_unpack_cluster_cond(void **object, uint16_t rpc_version, safe_unpack32(&object_ptr->flags, buffer); safe_unpack32(&count, buffer); - if(count && count != NO_VAL) { + if (count && count != NO_VAL) { object_ptr->plugin_id_select_list = list_create(slurm_destroy_char); for(i=0; i<count; i++) { @@ -2794,7 +2794,7 @@ extern int slurmdb_unpack_cluster_cond(void **object, uint16_t rpc_version, } safe_unpack32(&count, buffer); - if(count && count != NO_VAL) { + if (count && count != NO_VAL) { object_ptr->rpc_version_list = list_create(slurm_destroy_char); for(i=0; i<count; i++) { @@ -2810,10 +2810,10 @@ extern int slurmdb_unpack_cluster_cond(void **object, uint16_t rpc_version, safe_unpack16(&object_ptr->with_usage, buffer); safe_unpack16(&object_ptr->with_deleted, buffer); - } else if(rpc_version >= 5) { + } else if (rpc_version >= 5) { safe_unpack16(&object_ptr->classification, buffer); safe_unpack32(&count, buffer); - if(count && count != NO_VAL) { + if (count && count != NO_VAL) { object_ptr->cluster_list = list_create(slurm_destroy_char); for(i=0; i<count; i++) { @@ -2845,8 +2845,8 @@ extern void slurmdb_pack_association_cond(void *in, uint16_t rpc_version, ListIterator itr = NULL; slurmdb_association_cond_t *object = (slurmdb_association_cond_t *)in; - if(rpc_version >= 10) { - if(!object) { + if (rpc_version >= 10) { + if (!object) { pack32(NO_VAL, buffer); pack32(NO_VAL, buffer); @@ -2894,11 +2894,11 @@ extern void slurmdb_pack_association_cond(void *in, uint16_t rpc_version, return; } - if(object->acct_list) + if (object->acct_list) count = list_count(object->acct_list); pack32(count, buffer); - if(count && count != NO_VAL) { + if (count && count != NO_VAL) { itr = list_iterator_create(object->acct_list); while((tmp_info = list_next(itr))) { packstr(tmp_info, buffer); @@ -2907,11 +2907,11 @@ extern void slurmdb_pack_association_cond(void *in, uint16_t rpc_version, } count = NO_VAL; - if(object->cluster_list) + if (object->cluster_list) count = list_count(object->cluster_list); pack32(count, buffer); - if(count && count != NO_VAL) { + if (count && count != NO_VAL) { itr = list_iterator_create(object->cluster_list); while((tmp_info = list_next(itr))) { packstr(tmp_info, buffer); @@ -2920,11 +2920,11 @@ extern void slurmdb_pack_association_cond(void *in, uint16_t rpc_version, } count = NO_VAL; - if(object->def_qos_id_list) + if (object->def_qos_id_list) count = list_count(object->def_qos_id_list); pack32(count, buffer); - if(count && count != NO_VAL) { + if (count && count != NO_VAL) { itr = list_iterator_create(object->def_qos_id_list); while((tmp_info = list_next(itr))) { packstr(tmp_info, buffer); @@ -2933,11 +2933,11 @@ extern void slurmdb_pack_association_cond(void *in, uint16_t rpc_version, } count = NO_VAL; - if(object->fairshare_list) + if (object->fairshare_list) count = list_count(object->fairshare_list); pack32(count, buffer); - if(count && count != NO_VAL) { + if (count && count != NO_VAL) { itr = list_iterator_create(object->fairshare_list); while((tmp_info = list_next(itr))) { packstr(tmp_info, buffer); @@ -2946,11 +2946,11 @@ extern void slurmdb_pack_association_cond(void *in, uint16_t rpc_version, } count = NO_VAL; - if(object->grp_cpu_mins_list) + if (object->grp_cpu_mins_list) count = list_count(object->grp_cpu_mins_list); pack32(count, buffer); - if(count && count != NO_VAL) { + if (count && count != NO_VAL) { itr = list_iterator_create(object->grp_cpu_mins_list); while((tmp_info = list_next(itr))) { packstr(tmp_info, buffer); @@ -2959,11 +2959,11 @@ extern void slurmdb_pack_association_cond(void *in, uint16_t rpc_version, } count = NO_VAL; - if(object->grp_cpu_run_mins_list) + if (object->grp_cpu_run_mins_list) count = list_count(object->grp_cpu_run_mins_list); pack32(count, buffer); - if(count && count != NO_VAL) { + if (count && count != NO_VAL) { itr = list_iterator_create( object->grp_cpu_run_mins_list); while((tmp_info = list_next(itr))) { @@ -2973,11 +2973,11 @@ extern void slurmdb_pack_association_cond(void *in, uint16_t rpc_version, } count = NO_VAL; - if(object->grp_cpus_list) + if (object->grp_cpus_list) count = list_count(object->grp_cpus_list); pack32(count, buffer); - if(count && count != NO_VAL) { + if (count && count != NO_VAL) { itr = list_iterator_create(object->grp_cpus_list); while((tmp_info = list_next(itr))) { packstr(tmp_info, buffer); @@ -2986,11 +2986,11 @@ extern void slurmdb_pack_association_cond(void *in, uint16_t rpc_version, } count = NO_VAL; - if(object->grp_jobs_list) + if (object->grp_jobs_list) count = list_count(object->grp_jobs_list); pack32(count, buffer); - if(count && count != NO_VAL) { + if (count && count != NO_VAL) { itr = list_iterator_create(object->grp_jobs_list); while((tmp_info = list_next(itr))) { packstr(tmp_info, buffer); @@ -2999,11 +2999,11 @@ extern void slurmdb_pack_association_cond(void *in, uint16_t rpc_version, } count = NO_VAL; - if(object->grp_mem_list) + if (object->grp_mem_list) count = list_count(object->grp_mem_list); pack32(count, buffer); - if(count && count != NO_VAL) { + if (count && count != NO_VAL) { itr = list_iterator_create(object->grp_mem_list); while((tmp_info = list_next(itr))) { packstr(tmp_info, buffer); @@ -3012,11 +3012,11 @@ extern void slurmdb_pack_association_cond(void *in, uint16_t rpc_version, } count = NO_VAL; - if(object->grp_nodes_list) + if (object->grp_nodes_list) count = list_count(object->grp_nodes_list); pack32(count, buffer); - if(count && count != NO_VAL) { + if (count && count != NO_VAL) { itr = list_iterator_create(object->grp_nodes_list); while((tmp_info = list_next(itr))) { packstr(tmp_info, buffer); @@ -3025,11 +3025,11 @@ extern void slurmdb_pack_association_cond(void *in, uint16_t rpc_version, } count = NO_VAL; - if(object->grp_submit_jobs_list) + if (object->grp_submit_jobs_list) count = list_count(object->grp_submit_jobs_list); pack32(count, buffer); - if(count && count != NO_VAL) { + if (count && count != NO_VAL) { itr = list_iterator_create( object->grp_submit_jobs_list); while((tmp_info = list_next(itr))) { @@ -3039,11 +3039,11 @@ extern void slurmdb_pack_association_cond(void *in, uint16_t rpc_version, } count = NO_VAL; - if(object->grp_wall_list) + if (object->grp_wall_list) count = list_count(object->grp_wall_list); pack32(count, buffer); - if(count && count != NO_VAL) { + if (count && count != NO_VAL) { itr = list_iterator_create(object->grp_wall_list); while((tmp_info = list_next(itr))) { packstr(tmp_info, buffer); @@ -3052,11 +3052,11 @@ extern void slurmdb_pack_association_cond(void *in, uint16_t rpc_version, } count = NO_VAL; - if(object->id_list) + if (object->id_list) count = list_count(object->id_list); pack32(count, buffer); - if(count && count != NO_VAL) { + if (count && count != NO_VAL) { itr = list_iterator_create(object->id_list); while((tmp_info = list_next(itr))) { packstr(tmp_info, buffer); @@ -3064,11 +3064,11 @@ extern void slurmdb_pack_association_cond(void *in, uint16_t rpc_version, } count = NO_VAL; - if(object->max_cpu_mins_pj_list) + if (object->max_cpu_mins_pj_list) count = list_count(object->max_cpu_mins_pj_list); pack32(count, buffer); - if(count && count != NO_VAL) { + if (count && count != NO_VAL) { itr = list_iterator_create( object->max_cpu_mins_pj_list); while((tmp_info = list_next(itr))) { @@ -3078,11 +3078,11 @@ extern void slurmdb_pack_association_cond(void *in, uint16_t rpc_version, } count = NO_VAL; - if(object->max_cpu_run_mins_list) + if (object->max_cpu_run_mins_list) count = list_count(object->max_cpu_run_mins_list); pack32(count, buffer); - if(count && count != NO_VAL) { + if (count && count != NO_VAL) { itr = list_iterator_create( object->max_cpu_run_mins_list); while((tmp_info = list_next(itr))) { @@ -3092,11 +3092,11 @@ extern void slurmdb_pack_association_cond(void *in, uint16_t rpc_version, } count = NO_VAL; - if(object->max_cpus_pj_list) + if (object->max_cpus_pj_list) count = list_count(object->max_cpus_pj_list); pack32(count, buffer); - if(count && count != NO_VAL) { + if (count && count != NO_VAL) { itr = list_iterator_create(object->max_cpus_pj_list); while((tmp_info = list_next(itr))) { packstr(tmp_info, buffer); @@ -3104,11 +3104,11 @@ extern void slurmdb_pack_association_cond(void *in, uint16_t rpc_version, list_iterator_destroy(itr); } count = NO_VAL; - if(object->max_jobs_list) + if (object->max_jobs_list) count = list_count(object->max_jobs_list); pack32(count, buffer); - if(count && count != NO_VAL) { + if (count && count != NO_VAL) { itr = list_iterator_create(object->max_jobs_list); while((tmp_info = list_next(itr))) { packstr(tmp_info, buffer); @@ -3116,11 +3116,11 @@ extern void slurmdb_pack_association_cond(void *in, uint16_t rpc_version, list_iterator_destroy(itr); } count = NO_VAL; - if(object->max_nodes_pj_list) + if (object->max_nodes_pj_list) count = list_count(object->max_nodes_pj_list); pack32(count, buffer); - if(count && count != NO_VAL) { + if (count && count != NO_VAL) { itr = list_iterator_create(object->max_nodes_pj_list); while((tmp_info = list_next(itr))) { packstr(tmp_info, buffer); @@ -3128,11 +3128,11 @@ extern void slurmdb_pack_association_cond(void *in, uint16_t rpc_version, list_iterator_destroy(itr); } count = NO_VAL; - if(object->max_submit_jobs_list) + if (object->max_submit_jobs_list) count = list_count(object->max_submit_jobs_list); pack32(count, buffer); - if(count && count != NO_VAL) { + if (count && count != NO_VAL) { itr = list_iterator_create( object->max_submit_jobs_list); while((tmp_info = list_next(itr))) { @@ -3141,11 +3141,11 @@ extern void slurmdb_pack_association_cond(void *in, uint16_t rpc_version, list_iterator_destroy(itr); } count = NO_VAL; - if(object->max_wall_pj_list) + if (object->max_wall_pj_list) count = list_count(object->max_wall_pj_list); pack32(count, buffer); - if(count && count != NO_VAL) { + if (count && count != NO_VAL) { itr = list_iterator_create(object->max_wall_pj_list); while((tmp_info = list_next(itr))) { packstr(tmp_info, buffer); @@ -3156,11 +3156,11 @@ extern void slurmdb_pack_association_cond(void *in, uint16_t rpc_version, pack16(object->only_defs, buffer); - if(object->partition_list) + if (object->partition_list) count = list_count(object->partition_list); pack32(count, buffer); - if(count && count != NO_VAL) { + if (count && count != NO_VAL) { itr = list_iterator_create(object->partition_list); while((tmp_info = list_next(itr))) { packstr(tmp_info, buffer); @@ -3169,11 +3169,11 @@ extern void slurmdb_pack_association_cond(void *in, uint16_t rpc_version, } count = NO_VAL; - if(object->parent_acct_list) + if (object->parent_acct_list) count = list_count(object->parent_acct_list); pack32(count, buffer); - if(count && count != NO_VAL) { + if (count && count != NO_VAL) { itr = list_iterator_create(object->parent_acct_list); while((tmp_info = list_next(itr))) { packstr(tmp_info, buffer); @@ -3182,12 +3182,12 @@ extern void slurmdb_pack_association_cond(void *in, uint16_t rpc_version, } count = NO_VAL; - if(object->qos_list) + if (object->qos_list) count = list_count(object->qos_list); pack32(count, buffer); - if(count && count != NO_VAL) { + if (count && count != NO_VAL) { itr = list_iterator_create(object->qos_list); while((tmp_info = list_next(itr))) { packstr(tmp_info, buffer); @@ -3199,11 +3199,11 @@ extern void slurmdb_pack_association_cond(void *in, uint16_t rpc_version, pack_time(object->usage_end, buffer); pack_time(object->usage_start, buffer); - if(object->user_list) + if (object->user_list) count = list_count(object->user_list); pack32(count, buffer); - if(count && count != NO_VAL) { + if (count && count != NO_VAL) { itr = list_iterator_create(object->user_list); while((tmp_info = list_next(itr))) { packstr(tmp_info, buffer); @@ -3218,8 +3218,8 @@ extern void slurmdb_pack_association_cond(void *in, uint16_t rpc_version, pack16(object->with_sub_accts, buffer); pack16(object->without_parent_info, buffer); pack16(object->without_parent_limits, buffer); - } else if(rpc_version >= 8) { - if(!object) { + } else if (rpc_version >= 8) { + if (!object) { pack32(NO_VAL, buffer); pack32(NO_VAL, buffer); @@ -3266,11 +3266,11 @@ extern void slurmdb_pack_association_cond(void *in, uint16_t rpc_version, return; } - if(object->acct_list) + if (object->acct_list) count = list_count(object->acct_list); pack32(count, buffer); - if(count && count != NO_VAL) { + if (count && count != NO_VAL) { itr = list_iterator_create(object->acct_list); while((tmp_info = list_next(itr))) { packstr(tmp_info, buffer); @@ -3279,11 +3279,11 @@ extern void slurmdb_pack_association_cond(void *in, uint16_t rpc_version, } count = NO_VAL; - if(object->cluster_list) + if (object->cluster_list) count = list_count(object->cluster_list); pack32(count, buffer); - if(count && count != NO_VAL) { + if (count && count != NO_VAL) { itr = list_iterator_create(object->cluster_list); while((tmp_info = list_next(itr))) { packstr(tmp_info, buffer); @@ -3292,11 +3292,11 @@ extern void slurmdb_pack_association_cond(void *in, uint16_t rpc_version, } count = NO_VAL; - if(object->def_qos_id_list) + if (object->def_qos_id_list) count = list_count(object->def_qos_id_list); pack32(count, buffer); - if(count && count != NO_VAL) { + if (count && count != NO_VAL) { itr = list_iterator_create(object->def_qos_id_list); while((tmp_info = list_next(itr))) { packstr(tmp_info, buffer); @@ -3305,11 +3305,11 @@ extern void slurmdb_pack_association_cond(void *in, uint16_t rpc_version, } count = NO_VAL; - if(object->fairshare_list) + if (object->fairshare_list) count = list_count(object->fairshare_list); pack32(count, buffer); - if(count && count != NO_VAL) { + if (count && count != NO_VAL) { itr = list_iterator_create(object->fairshare_list); while((tmp_info = list_next(itr))) { packstr(tmp_info, buffer); @@ -3318,11 +3318,11 @@ extern void slurmdb_pack_association_cond(void *in, uint16_t rpc_version, } count = NO_VAL; - if(object->grp_cpu_mins_list) + if (object->grp_cpu_mins_list) count = list_count(object->grp_cpu_mins_list); pack32(count, buffer); - if(count && count != NO_VAL) { + if (count && count != NO_VAL) { itr = list_iterator_create(object->grp_cpu_mins_list); while((tmp_info = list_next(itr))) { packstr(tmp_info, buffer); @@ -3331,11 +3331,11 @@ extern void slurmdb_pack_association_cond(void *in, uint16_t rpc_version, } count = NO_VAL; - if(object->grp_cpu_run_mins_list) + if (object->grp_cpu_run_mins_list) count = list_count(object->grp_cpu_run_mins_list); pack32(count, buffer); - if(count && count != NO_VAL) { + if (count && count != NO_VAL) { itr = list_iterator_create( object->grp_cpu_run_mins_list); while((tmp_info = list_next(itr))) { @@ -3345,11 +3345,11 @@ extern void slurmdb_pack_association_cond(void *in, uint16_t rpc_version, } count = NO_VAL; - if(object->grp_cpus_list) + if (object->grp_cpus_list) count = list_count(object->grp_cpus_list); pack32(count, buffer); - if(count && count != NO_VAL) { + if (count && count != NO_VAL) { itr = list_iterator_create(object->grp_cpus_list); while((tmp_info = list_next(itr))) { packstr(tmp_info, buffer); @@ -3358,11 +3358,11 @@ extern void slurmdb_pack_association_cond(void *in, uint16_t rpc_version, } count = NO_VAL; - if(object->grp_jobs_list) + if (object->grp_jobs_list) count = list_count(object->grp_jobs_list); pack32(count, buffer); - if(count && count != NO_VAL) { + if (count && count != NO_VAL) { itr = list_iterator_create(object->grp_jobs_list); while((tmp_info = list_next(itr))) { packstr(tmp_info, buffer); @@ -3371,11 +3371,11 @@ extern void slurmdb_pack_association_cond(void *in, uint16_t rpc_version, } count = NO_VAL; - if(object->grp_nodes_list) + if (object->grp_nodes_list) count = list_count(object->grp_nodes_list); pack32(count, buffer); - if(count && count != NO_VAL) { + if (count && count != NO_VAL) { itr = list_iterator_create(object->grp_nodes_list); while((tmp_info = list_next(itr))) { packstr(tmp_info, buffer); @@ -3384,11 +3384,11 @@ extern void slurmdb_pack_association_cond(void *in, uint16_t rpc_version, } count = NO_VAL; - if(object->grp_submit_jobs_list) + if (object->grp_submit_jobs_list) count = list_count(object->grp_submit_jobs_list); pack32(count, buffer); - if(count && count != NO_VAL) { + if (count && count != NO_VAL) { itr = list_iterator_create( object->grp_submit_jobs_list); while((tmp_info = list_next(itr))) { @@ -3398,11 +3398,11 @@ extern void slurmdb_pack_association_cond(void *in, uint16_t rpc_version, } count = NO_VAL; - if(object->grp_wall_list) + if (object->grp_wall_list) count = list_count(object->grp_wall_list); pack32(count, buffer); - if(count && count != NO_VAL) { + if (count && count != NO_VAL) { itr = list_iterator_create(object->grp_wall_list); while((tmp_info = list_next(itr))) { packstr(tmp_info, buffer); @@ -3411,11 +3411,11 @@ extern void slurmdb_pack_association_cond(void *in, uint16_t rpc_version, } count = NO_VAL; - if(object->id_list) + if (object->id_list) count = list_count(object->id_list); pack32(count, buffer); - if(count && count != NO_VAL) { + if (count && count != NO_VAL) { itr = list_iterator_create(object->id_list); while((tmp_info = list_next(itr))) { packstr(tmp_info, buffer); @@ -3423,11 +3423,11 @@ extern void slurmdb_pack_association_cond(void *in, uint16_t rpc_version, } count = NO_VAL; - if(object->max_cpu_mins_pj_list) + if (object->max_cpu_mins_pj_list) count = list_count(object->max_cpu_mins_pj_list); pack32(count, buffer); - if(count && count != NO_VAL) { + if (count && count != NO_VAL) { itr = list_iterator_create( object->max_cpu_mins_pj_list); while((tmp_info = list_next(itr))) { @@ -3437,11 +3437,11 @@ extern void slurmdb_pack_association_cond(void *in, uint16_t rpc_version, } count = NO_VAL; - if(object->max_cpu_run_mins_list) + if (object->max_cpu_run_mins_list) count = list_count(object->max_cpu_run_mins_list); pack32(count, buffer); - if(count && count != NO_VAL) { + if (count && count != NO_VAL) { itr = list_iterator_create( object->max_cpu_run_mins_list); while((tmp_info = list_next(itr))) { @@ -3451,11 +3451,11 @@ extern void slurmdb_pack_association_cond(void *in, uint16_t rpc_version, } count = NO_VAL; - if(object->max_cpus_pj_list) + if (object->max_cpus_pj_list) count = list_count(object->max_cpus_pj_list); pack32(count, buffer); - if(count && count != NO_VAL) { + if (count && count != NO_VAL) { itr = list_iterator_create(object->max_cpus_pj_list); while((tmp_info = list_next(itr))) { packstr(tmp_info, buffer); @@ -3463,11 +3463,11 @@ extern void slurmdb_pack_association_cond(void *in, uint16_t rpc_version, list_iterator_destroy(itr); } count = NO_VAL; - if(object->max_jobs_list) + if (object->max_jobs_list) count = list_count(object->max_jobs_list); pack32(count, buffer); - if(count && count != NO_VAL) { + if (count && count != NO_VAL) { itr = list_iterator_create(object->max_jobs_list); while((tmp_info = list_next(itr))) { packstr(tmp_info, buffer); @@ -3475,11 +3475,11 @@ extern void slurmdb_pack_association_cond(void *in, uint16_t rpc_version, list_iterator_destroy(itr); } count = NO_VAL; - if(object->max_nodes_pj_list) + if (object->max_nodes_pj_list) count = list_count(object->max_nodes_pj_list); pack32(count, buffer); - if(count && count != NO_VAL) { + if (count && count != NO_VAL) { itr = list_iterator_create(object->max_nodes_pj_list); while((tmp_info = list_next(itr))) { packstr(tmp_info, buffer); @@ -3487,11 +3487,11 @@ extern void slurmdb_pack_association_cond(void *in, uint16_t rpc_version, list_iterator_destroy(itr); } count = NO_VAL; - if(object->max_submit_jobs_list) + if (object->max_submit_jobs_list) count = list_count(object->max_submit_jobs_list); pack32(count, buffer); - if(count && count != NO_VAL) { + if (count && count != NO_VAL) { itr = list_iterator_create( object->max_submit_jobs_list); while((tmp_info = list_next(itr))) { @@ -3500,11 +3500,11 @@ extern void slurmdb_pack_association_cond(void *in, uint16_t rpc_version, list_iterator_destroy(itr); } count = NO_VAL; - if(object->max_wall_pj_list) + if (object->max_wall_pj_list) count = list_count(object->max_wall_pj_list); pack32(count, buffer); - if(count && count != NO_VAL) { + if (count && count != NO_VAL) { itr = list_iterator_create(object->max_wall_pj_list); while((tmp_info = list_next(itr))) { packstr(tmp_info, buffer); @@ -3515,11 +3515,11 @@ extern void slurmdb_pack_association_cond(void *in, uint16_t rpc_version, pack16(object->only_defs, buffer); - if(object->partition_list) + if (object->partition_list) count = list_count(object->partition_list); pack32(count, buffer); - if(count && count != NO_VAL) { + if (count && count != NO_VAL) { itr = list_iterator_create(object->partition_list); while((tmp_info = list_next(itr))) { packstr(tmp_info, buffer); @@ -3528,11 +3528,11 @@ extern void slurmdb_pack_association_cond(void *in, uint16_t rpc_version, } count = NO_VAL; - if(object->parent_acct_list) + if (object->parent_acct_list) count = list_count(object->parent_acct_list); pack32(count, buffer); - if(count && count != NO_VAL) { + if (count && count != NO_VAL) { itr = list_iterator_create(object->parent_acct_list); while((tmp_info = list_next(itr))) { packstr(tmp_info, buffer); @@ -3541,12 +3541,12 @@ extern void slurmdb_pack_association_cond(void *in, uint16_t rpc_version, } count = NO_VAL; - if(object->qos_list) + if (object->qos_list) count = list_count(object->qos_list); pack32(count, buffer); - if(count && count != NO_VAL) { + if (count && count != NO_VAL) { itr = list_iterator_create(object->qos_list); while((tmp_info = list_next(itr))) { packstr(tmp_info, buffer); @@ -3558,11 +3558,11 @@ extern void slurmdb_pack_association_cond(void *in, uint16_t rpc_version, pack_time(object->usage_end, buffer); pack_time(object->usage_start, buffer); - if(object->user_list) + if (object->user_list) count = list_count(object->user_list); pack32(count, buffer); - if(count && count != NO_VAL) { + if (count && count != NO_VAL) { itr = list_iterator_create(object->user_list); while((tmp_info = list_next(itr))) { packstr(tmp_info, buffer); @@ -3577,8 +3577,8 @@ extern void slurmdb_pack_association_cond(void *in, uint16_t rpc_version, pack16(object->with_sub_accts, buffer); pack16(object->without_parent_info, buffer); pack16(object->without_parent_limits, buffer); - } else if(rpc_version >= 5) { - if(!object) { + } else if (rpc_version >= 5) { + if (!object) { pack32(NO_VAL, buffer); pack32(NO_VAL, buffer); @@ -3619,11 +3619,11 @@ extern void slurmdb_pack_association_cond(void *in, uint16_t rpc_version, return; } - if(object->acct_list) + if (object->acct_list) count = list_count(object->acct_list); pack32(count, buffer); - if(count && count != NO_VAL) { + if (count && count != NO_VAL) { itr = list_iterator_create(object->acct_list); while((tmp_info = list_next(itr))) { packstr(tmp_info, buffer); @@ -3632,11 +3632,11 @@ extern void slurmdb_pack_association_cond(void *in, uint16_t rpc_version, } count = NO_VAL; - if(object->cluster_list) + if (object->cluster_list) count = list_count(object->cluster_list); pack32(count, buffer); - if(count && count != NO_VAL) { + if (count && count != NO_VAL) { itr = list_iterator_create(object->cluster_list); while((tmp_info = list_next(itr))) { packstr(tmp_info, buffer); @@ -3645,11 +3645,11 @@ extern void slurmdb_pack_association_cond(void *in, uint16_t rpc_version, } count = NO_VAL; - if(object->fairshare_list) + if (object->fairshare_list) count = list_count(object->fairshare_list); pack32(count, buffer); - if(count && count != NO_VAL) { + if (count && count != NO_VAL) { itr = list_iterator_create(object->fairshare_list); while((tmp_info = list_next(itr))) { packstr(tmp_info, buffer); @@ -3658,11 +3658,11 @@ extern void slurmdb_pack_association_cond(void *in, uint16_t rpc_version, } count = NO_VAL; - if(object->grp_cpu_mins_list) + if (object->grp_cpu_mins_list) count = list_count(object->grp_cpu_mins_list); pack32(count, buffer); - if(count && count != NO_VAL) { + if (count && count != NO_VAL) { itr = list_iterator_create(object->grp_cpu_mins_list); while((tmp_info = list_next(itr))) { packstr(tmp_info, buffer); @@ -3671,11 +3671,11 @@ extern void slurmdb_pack_association_cond(void *in, uint16_t rpc_version, } count = NO_VAL; - if(object->grp_cpus_list) + if (object->grp_cpus_list) count = list_count(object->grp_cpus_list); pack32(count, buffer); - if(count && count != NO_VAL) { + if (count && count != NO_VAL) { itr = list_iterator_create(object->grp_cpus_list); while((tmp_info = list_next(itr))) { packstr(tmp_info, buffer); @@ -3684,11 +3684,11 @@ extern void slurmdb_pack_association_cond(void *in, uint16_t rpc_version, } count = NO_VAL; - if(object->grp_jobs_list) + if (object->grp_jobs_list) count = list_count(object->grp_jobs_list); pack32(count, buffer); - if(count && count != NO_VAL) { + if (count && count != NO_VAL) { itr = list_iterator_create(object->grp_jobs_list); while((tmp_info = list_next(itr))) { packstr(tmp_info, buffer); @@ -3697,11 +3697,11 @@ extern void slurmdb_pack_association_cond(void *in, uint16_t rpc_version, } count = NO_VAL; - if(object->grp_nodes_list) + if (object->grp_nodes_list) count = list_count(object->grp_nodes_list); pack32(count, buffer); - if(count && count != NO_VAL) { + if (count && count != NO_VAL) { itr = list_iterator_create(object->grp_nodes_list); while((tmp_info = list_next(itr))) { packstr(tmp_info, buffer); @@ -3710,11 +3710,11 @@ extern void slurmdb_pack_association_cond(void *in, uint16_t rpc_version, } count = NO_VAL; - if(object->grp_submit_jobs_list) + if (object->grp_submit_jobs_list) count = list_count(object->grp_submit_jobs_list); pack32(count, buffer); - if(count && count != NO_VAL) { + if (count && count != NO_VAL) { itr = list_iterator_create( object->grp_submit_jobs_list); while((tmp_info = list_next(itr))) { @@ -3724,11 +3724,11 @@ extern void slurmdb_pack_association_cond(void *in, uint16_t rpc_version, } count = NO_VAL; - if(object->grp_wall_list) + if (object->grp_wall_list) count = list_count(object->grp_wall_list); pack32(count, buffer); - if(count && count != NO_VAL) { + if (count && count != NO_VAL) { itr = list_iterator_create(object->grp_wall_list); while((tmp_info = list_next(itr))) { packstr(tmp_info, buffer); @@ -3737,11 +3737,11 @@ extern void slurmdb_pack_association_cond(void *in, uint16_t rpc_version, } count = NO_VAL; - if(object->id_list) + if (object->id_list) count = list_count(object->id_list); pack32(count, buffer); - if(count && count != NO_VAL) { + if (count && count != NO_VAL) { itr = list_iterator_create(object->id_list); while((tmp_info = list_next(itr))) { packstr(tmp_info, buffer); @@ -3749,11 +3749,11 @@ extern void slurmdb_pack_association_cond(void *in, uint16_t rpc_version, } count = NO_VAL; - if(object->max_cpu_mins_pj_list) + if (object->max_cpu_mins_pj_list) count = list_count(object->max_cpu_mins_pj_list); pack32(count, buffer); - if(count && count != NO_VAL) { + if (count && count != NO_VAL) { itr = list_iterator_create( object->max_cpu_mins_pj_list); while((tmp_info = list_next(itr))) { @@ -3762,11 +3762,11 @@ extern void slurmdb_pack_association_cond(void *in, uint16_t rpc_version, list_iterator_destroy(itr); } count = NO_VAL; - if(object->max_cpus_pj_list) + if (object->max_cpus_pj_list) count = list_count(object->max_cpus_pj_list); pack32(count, buffer); - if(count && count != NO_VAL) { + if (count && count != NO_VAL) { itr = list_iterator_create(object->max_cpus_pj_list); while((tmp_info = list_next(itr))) { packstr(tmp_info, buffer); @@ -3774,11 +3774,11 @@ extern void slurmdb_pack_association_cond(void *in, uint16_t rpc_version, list_iterator_destroy(itr); } count = NO_VAL; - if(object->max_jobs_list) + if (object->max_jobs_list) count = list_count(object->max_jobs_list); pack32(count, buffer); - if(count && count != NO_VAL) { + if (count && count != NO_VAL) { itr = list_iterator_create(object->max_jobs_list); while((tmp_info = list_next(itr))) { packstr(tmp_info, buffer); @@ -3786,11 +3786,11 @@ extern void slurmdb_pack_association_cond(void *in, uint16_t rpc_version, list_iterator_destroy(itr); } count = NO_VAL; - if(object->max_nodes_pj_list) + if (object->max_nodes_pj_list) count = list_count(object->max_nodes_pj_list); pack32(count, buffer); - if(count && count != NO_VAL) { + if (count && count != NO_VAL) { itr = list_iterator_create(object->max_nodes_pj_list); while((tmp_info = list_next(itr))) { packstr(tmp_info, buffer); @@ -3798,11 +3798,11 @@ extern void slurmdb_pack_association_cond(void *in, uint16_t rpc_version, list_iterator_destroy(itr); } count = NO_VAL; - if(object->max_submit_jobs_list) + if (object->max_submit_jobs_list) count = list_count(object->max_submit_jobs_list); pack32(count, buffer); - if(count && count != NO_VAL) { + if (count && count != NO_VAL) { itr = list_iterator_create( object->max_submit_jobs_list); while((tmp_info = list_next(itr))) { @@ -3811,11 +3811,11 @@ extern void slurmdb_pack_association_cond(void *in, uint16_t rpc_version, list_iterator_destroy(itr); } count = NO_VAL; - if(object->max_wall_pj_list) + if (object->max_wall_pj_list) count = list_count(object->max_wall_pj_list); pack32(count, buffer); - if(count && count != NO_VAL) { + if (count && count != NO_VAL) { itr = list_iterator_create(object->max_wall_pj_list); while((tmp_info = list_next(itr))) { packstr(tmp_info, buffer); @@ -3824,11 +3824,11 @@ extern void slurmdb_pack_association_cond(void *in, uint16_t rpc_version, } count = NO_VAL; - if(object->partition_list) + if (object->partition_list) count = list_count(object->partition_list); pack32(count, buffer); - if(count && count != NO_VAL) { + if (count && count != NO_VAL) { itr = list_iterator_create(object->partition_list); while((tmp_info = list_next(itr))) { packstr(tmp_info, buffer); @@ -3837,11 +3837,11 @@ extern void slurmdb_pack_association_cond(void *in, uint16_t rpc_version, } count = NO_VAL; - if(object->parent_acct_list) + if (object->parent_acct_list) count = list_count(object->parent_acct_list); pack32(count, buffer); - if(count && count != NO_VAL) { + if (count && count != NO_VAL) { itr = list_iterator_create(object->parent_acct_list); while((tmp_info = list_next(itr))) { packstr(tmp_info, buffer); @@ -3850,12 +3850,12 @@ extern void slurmdb_pack_association_cond(void *in, uint16_t rpc_version, } count = NO_VAL; - if(object->qos_list) + if (object->qos_list) count = list_count(object->qos_list); pack32(count, buffer); - if(count && count != NO_VAL) { + if (count && count != NO_VAL) { itr = list_iterator_create(object->qos_list); while((tmp_info = list_next(itr))) { packstr(tmp_info, buffer); @@ -3867,11 +3867,11 @@ extern void slurmdb_pack_association_cond(void *in, uint16_t rpc_version, pack_time(object->usage_end, buffer); pack_time(object->usage_start, buffer); - if(object->user_list) + if (object->user_list) count = list_count(object->user_list); pack32(count, buffer); - if(count && count != NO_VAL) { + if (count && count != NO_VAL) { itr = list_iterator_create(object->user_list); while((tmp_info = list_next(itr))) { packstr(tmp_info, buffer); @@ -3902,7 +3902,7 @@ extern int slurmdb_unpack_association_cond(void **object, if (rpc_version >= 10) { safe_unpack32(&count, buffer); - if(count != NO_VAL) { + if (count != NO_VAL) { object_ptr->acct_list = list_create(slurm_destroy_char); for(i=0; i<count; i++) { @@ -3912,7 +3912,7 @@ extern int slurmdb_unpack_association_cond(void **object, } } safe_unpack32(&count, buffer); - if(count != NO_VAL) { + if (count != NO_VAL) { object_ptr->cluster_list = list_create(slurm_destroy_char); for(i=0; i<count; i++) { @@ -3924,7 +3924,7 @@ extern int slurmdb_unpack_association_cond(void **object, } safe_unpack32(&count, buffer); - if(count != NO_VAL) { + if (count != NO_VAL) { object_ptr->def_qos_id_list = list_create(slurm_destroy_char); for(i=0; i<count; i++) { @@ -3936,7 +3936,7 @@ extern int slurmdb_unpack_association_cond(void **object, } safe_unpack32(&count, buffer); - if(count != NO_VAL) { + if (count != NO_VAL) { object_ptr->fairshare_list = list_create(slurm_destroy_char); for(i=0; i<count; i++) { @@ -3948,7 +3948,7 @@ extern int slurmdb_unpack_association_cond(void **object, } safe_unpack32(&count, buffer); - if(count != NO_VAL) { + if (count != NO_VAL) { object_ptr->grp_cpu_mins_list = list_create(slurm_destroy_char); for(i=0; i<count; i++) { @@ -3959,7 +3959,7 @@ extern int slurmdb_unpack_association_cond(void **object, } } safe_unpack32(&count, buffer); - if(count != NO_VAL) { + if (count != NO_VAL) { object_ptr->grp_cpu_run_mins_list = list_create(slurm_destroy_char); for(i=0; i<count; i++) { @@ -3970,7 +3970,7 @@ extern int slurmdb_unpack_association_cond(void **object, } } safe_unpack32(&count, buffer); - if(count != NO_VAL) { + if (count != NO_VAL) { object_ptr->grp_cpus_list = list_create(slurm_destroy_char); for(i=0; i<count; i++) { @@ -3981,7 +3981,7 @@ extern int slurmdb_unpack_association_cond(void **object, } } safe_unpack32(&count, buffer); - if(count != NO_VAL) { + if (count != NO_VAL) { object_ptr->grp_jobs_list = list_create(slurm_destroy_char); for(i=0; i<count; i++) { @@ -3992,7 +3992,7 @@ extern int slurmdb_unpack_association_cond(void **object, } } safe_unpack32(&count, buffer); - if(count != NO_VAL) { + if (count != NO_VAL) { object_ptr->grp_mem_list = list_create(slurm_destroy_char); for(i=0; i<count; i++) { @@ -4003,7 +4003,7 @@ extern int slurmdb_unpack_association_cond(void **object, } } safe_unpack32(&count, buffer); - if(count != NO_VAL) { + if (count != NO_VAL) { object_ptr->grp_nodes_list = list_create(slurm_destroy_char); for(i=0; i<count; i++) { @@ -4014,7 +4014,7 @@ extern int slurmdb_unpack_association_cond(void **object, } } safe_unpack32(&count, buffer); - if(count != NO_VAL) { + if (count != NO_VAL) { object_ptr->grp_submit_jobs_list = list_create(slurm_destroy_char); for(i=0; i<count; i++) { @@ -4025,7 +4025,7 @@ extern int slurmdb_unpack_association_cond(void **object, } } safe_unpack32(&count, buffer); - if(count != NO_VAL) { + if (count != NO_VAL) { object_ptr->grp_wall_list = list_create(slurm_destroy_char); for(i=0; i<count; i++) { @@ -4037,7 +4037,7 @@ extern int slurmdb_unpack_association_cond(void **object, } safe_unpack32(&count, buffer); - if(count != NO_VAL) { + if (count != NO_VAL) { object_ptr->id_list = list_create(slurm_destroy_char); for(i=0; i<count; i++) { safe_unpackstr_xmalloc(&tmp_info, &uint32_tmp, @@ -4047,7 +4047,7 @@ extern int slurmdb_unpack_association_cond(void **object, } safe_unpack32(&count, buffer); - if(count != NO_VAL) { + if (count != NO_VAL) { object_ptr->max_cpu_mins_pj_list = list_create(slurm_destroy_char); for(i=0; i<count; i++) { @@ -4058,7 +4058,7 @@ extern int slurmdb_unpack_association_cond(void **object, } } safe_unpack32(&count, buffer); - if(count != NO_VAL) { + if (count != NO_VAL) { object_ptr->max_cpu_run_mins_list = list_create(slurm_destroy_char); for(i=0; i<count; i++) { @@ -4069,7 +4069,7 @@ extern int slurmdb_unpack_association_cond(void **object, } } safe_unpack32(&count, buffer); - if(count != NO_VAL) { + if (count != NO_VAL) { object_ptr->max_cpus_pj_list = list_create(slurm_destroy_char); for(i=0; i<count; i++) { @@ -4080,7 +4080,7 @@ extern int slurmdb_unpack_association_cond(void **object, } } safe_unpack32(&count, buffer); - if(count != NO_VAL) { + if (count != NO_VAL) { object_ptr->max_jobs_list = list_create(slurm_destroy_char); for(i=0; i<count; i++) { @@ -4091,7 +4091,7 @@ extern int slurmdb_unpack_association_cond(void **object, } } safe_unpack32(&count, buffer); - if(count != NO_VAL) { + if (count != NO_VAL) { object_ptr->max_nodes_pj_list = list_create(slurm_destroy_char); for(i=0; i<count; i++) { @@ -4102,7 +4102,7 @@ extern int slurmdb_unpack_association_cond(void **object, } } safe_unpack32(&count, buffer); - if(count != NO_VAL) { + if (count != NO_VAL) { object_ptr->max_submit_jobs_list = list_create(slurm_destroy_char); for(i=0; i<count; i++) { @@ -4113,7 +4113,7 @@ extern int slurmdb_unpack_association_cond(void **object, } } safe_unpack32(&count, buffer); - if(count != NO_VAL) { + if (count != NO_VAL) { object_ptr->max_wall_pj_list = list_create(slurm_destroy_char); for(i=0; i<count; i++) { @@ -4127,7 +4127,7 @@ extern int slurmdb_unpack_association_cond(void **object, safe_unpack16(&object_ptr->only_defs, buffer); safe_unpack32(&count, buffer); - if(count != NO_VAL) { + if (count != NO_VAL) { object_ptr->partition_list = list_create(slurm_destroy_char); for(i=0; i<count; i++) { @@ -4139,7 +4139,7 @@ extern int slurmdb_unpack_association_cond(void **object, } safe_unpack32(&count, buffer); - if(count != NO_VAL) { + if (count != NO_VAL) { object_ptr->parent_acct_list = list_create(slurm_destroy_char); for(i=0; i<count; i++) { @@ -4151,7 +4151,7 @@ extern int slurmdb_unpack_association_cond(void **object, } safe_unpack32(&count, buffer); - if(count != NO_VAL) { + if (count != NO_VAL) { object_ptr->qos_list = list_create(slurm_destroy_char); for(i=0; i<count; i++) { safe_unpackstr_xmalloc(&tmp_info, &uint32_tmp, @@ -4164,7 +4164,7 @@ extern int slurmdb_unpack_association_cond(void **object, safe_unpack_time(&object_ptr->usage_start, buffer); safe_unpack32(&count, buffer); - if(count != NO_VAL) { + if (count != NO_VAL) { object_ptr->user_list = list_create(slurm_destroy_char); for(i=0; i<count; i++) { @@ -4182,7 +4182,7 @@ extern int slurmdb_unpack_association_cond(void **object, safe_unpack16(&object_ptr->without_parent_limits, buffer); } else if (rpc_version >= 8) { safe_unpack32(&count, buffer); - if(count != NO_VAL) { + if (count != NO_VAL) { object_ptr->acct_list = list_create(slurm_destroy_char); for(i=0; i<count; i++) { @@ -4192,7 +4192,7 @@ extern int slurmdb_unpack_association_cond(void **object, } } safe_unpack32(&count, buffer); - if(count != NO_VAL) { + if (count != NO_VAL) { object_ptr->cluster_list = list_create(slurm_destroy_char); for(i=0; i<count; i++) { @@ -4204,7 +4204,7 @@ extern int slurmdb_unpack_association_cond(void **object, } safe_unpack32(&count, buffer); - if(count != NO_VAL) { + if (count != NO_VAL) { object_ptr->def_qos_id_list = list_create(slurm_destroy_char); for(i=0; i<count; i++) { @@ -4216,7 +4216,7 @@ extern int slurmdb_unpack_association_cond(void **object, } safe_unpack32(&count, buffer); - if(count != NO_VAL) { + if (count != NO_VAL) { object_ptr->fairshare_list = list_create(slurm_destroy_char); for(i=0; i<count; i++) { @@ -4228,7 +4228,7 @@ extern int slurmdb_unpack_association_cond(void **object, } safe_unpack32(&count, buffer); - if(count != NO_VAL) { + if (count != NO_VAL) { object_ptr->grp_cpu_mins_list = list_create(slurm_destroy_char); for(i=0; i<count; i++) { @@ -4239,7 +4239,7 @@ extern int slurmdb_unpack_association_cond(void **object, } } safe_unpack32(&count, buffer); - if(count != NO_VAL) { + if (count != NO_VAL) { object_ptr->grp_cpu_run_mins_list = list_create(slurm_destroy_char); for(i=0; i<count; i++) { @@ -4250,7 +4250,7 @@ extern int slurmdb_unpack_association_cond(void **object, } } safe_unpack32(&count, buffer); - if(count != NO_VAL) { + if (count != NO_VAL) { object_ptr->grp_cpus_list = list_create(slurm_destroy_char); for(i=0; i<count; i++) { @@ -4261,7 +4261,7 @@ extern int slurmdb_unpack_association_cond(void **object, } } safe_unpack32(&count, buffer); - if(count != NO_VAL) { + if (count != NO_VAL) { object_ptr->grp_jobs_list = list_create(slurm_destroy_char); for(i=0; i<count; i++) { @@ -4272,7 +4272,7 @@ extern int slurmdb_unpack_association_cond(void **object, } } safe_unpack32(&count, buffer); - if(count != NO_VAL) { + if (count != NO_VAL) { object_ptr->grp_nodes_list = list_create(slurm_destroy_char); for(i=0; i<count; i++) { @@ -4283,7 +4283,7 @@ extern int slurmdb_unpack_association_cond(void **object, } } safe_unpack32(&count, buffer); - if(count != NO_VAL) { + if (count != NO_VAL) { object_ptr->grp_submit_jobs_list = list_create(slurm_destroy_char); for(i=0; i<count; i++) { @@ -4294,7 +4294,7 @@ extern int slurmdb_unpack_association_cond(void **object, } } safe_unpack32(&count, buffer); - if(count != NO_VAL) { + if (count != NO_VAL) { object_ptr->grp_wall_list = list_create(slurm_destroy_char); for(i=0; i<count; i++) { @@ -4306,7 +4306,7 @@ extern int slurmdb_unpack_association_cond(void **object, } safe_unpack32(&count, buffer); - if(count != NO_VAL) { + if (count != NO_VAL) { object_ptr->id_list = list_create(slurm_destroy_char); for(i=0; i<count; i++) { safe_unpackstr_xmalloc(&tmp_info, &uint32_tmp, @@ -4316,7 +4316,7 @@ extern int slurmdb_unpack_association_cond(void **object, } safe_unpack32(&count, buffer); - if(count != NO_VAL) { + if (count != NO_VAL) { object_ptr->max_cpu_mins_pj_list = list_create(slurm_destroy_char); for(i=0; i<count; i++) { @@ -4327,7 +4327,7 @@ extern int slurmdb_unpack_association_cond(void **object, } } safe_unpack32(&count, buffer); - if(count != NO_VAL) { + if (count != NO_VAL) { object_ptr->max_cpu_run_mins_list = list_create(slurm_destroy_char); for(i=0; i<count; i++) { @@ -4338,7 +4338,7 @@ extern int slurmdb_unpack_association_cond(void **object, } } safe_unpack32(&count, buffer); - if(count != NO_VAL) { + if (count != NO_VAL) { object_ptr->max_cpus_pj_list = list_create(slurm_destroy_char); for(i=0; i<count; i++) { @@ -4349,7 +4349,7 @@ extern int slurmdb_unpack_association_cond(void **object, } } safe_unpack32(&count, buffer); - if(count != NO_VAL) { + if (count != NO_VAL) { object_ptr->max_jobs_list = list_create(slurm_destroy_char); for(i=0; i<count; i++) { @@ -4360,7 +4360,7 @@ extern int slurmdb_unpack_association_cond(void **object, } } safe_unpack32(&count, buffer); - if(count != NO_VAL) { + if (count != NO_VAL) { object_ptr->max_nodes_pj_list = list_create(slurm_destroy_char); for(i=0; i<count; i++) { @@ -4371,7 +4371,7 @@ extern int slurmdb_unpack_association_cond(void **object, } } safe_unpack32(&count, buffer); - if(count != NO_VAL) { + if (count != NO_VAL) { object_ptr->max_submit_jobs_list = list_create(slurm_destroy_char); for(i=0; i<count; i++) { @@ -4382,7 +4382,7 @@ extern int slurmdb_unpack_association_cond(void **object, } } safe_unpack32(&count, buffer); - if(count != NO_VAL) { + if (count != NO_VAL) { object_ptr->max_wall_pj_list = list_create(slurm_destroy_char); for(i=0; i<count; i++) { @@ -4396,7 +4396,7 @@ extern int slurmdb_unpack_association_cond(void **object, safe_unpack16(&object_ptr->only_defs, buffer); safe_unpack32(&count, buffer); - if(count != NO_VAL) { + if (count != NO_VAL) { object_ptr->partition_list = list_create(slurm_destroy_char); for(i=0; i<count; i++) { @@ -4408,7 +4408,7 @@ extern int slurmdb_unpack_association_cond(void **object, } safe_unpack32(&count, buffer); - if(count != NO_VAL) { + if (count != NO_VAL) { object_ptr->parent_acct_list = list_create(slurm_destroy_char); for(i=0; i<count; i++) { @@ -4420,7 +4420,7 @@ extern int slurmdb_unpack_association_cond(void **object, } safe_unpack32(&count, buffer); - if(count != NO_VAL) { + if (count != NO_VAL) { object_ptr->qos_list = list_create(slurm_destroy_char); for(i=0; i<count; i++) { safe_unpackstr_xmalloc(&tmp_info, &uint32_tmp, @@ -4433,7 +4433,7 @@ extern int slurmdb_unpack_association_cond(void **object, safe_unpack_time(&object_ptr->usage_start, buffer); safe_unpack32(&count, buffer); - if(count != NO_VAL) { + if (count != NO_VAL) { object_ptr->user_list = list_create(slurm_destroy_char); for(i=0; i<count; i++) { @@ -4449,9 +4449,9 @@ extern int slurmdb_unpack_association_cond(void **object, safe_unpack16(&object_ptr->with_sub_accts, buffer); safe_unpack16(&object_ptr->without_parent_info, buffer); safe_unpack16(&object_ptr->without_parent_limits, buffer); - } else if(rpc_version >= 5) { + } else if (rpc_version >= 5) { safe_unpack32(&count, buffer); - if(count != NO_VAL) { + if (count != NO_VAL) { object_ptr->acct_list = list_create(slurm_destroy_char); for(i=0; i<count; i++) { @@ -4461,7 +4461,7 @@ extern int slurmdb_unpack_association_cond(void **object, } } safe_unpack32(&count, buffer); - if(count != NO_VAL) { + if (count != NO_VAL) { object_ptr->cluster_list = list_create(slurm_destroy_char); for(i=0; i<count; i++) { @@ -4473,7 +4473,7 @@ extern int slurmdb_unpack_association_cond(void **object, } safe_unpack32(&count, buffer); - if(count != NO_VAL) { + if (count != NO_VAL) { object_ptr->fairshare_list = list_create(slurm_destroy_char); for(i=0; i<count; i++) { @@ -4485,7 +4485,7 @@ extern int slurmdb_unpack_association_cond(void **object, } safe_unpack32(&count, buffer); - if(count != NO_VAL) { + if (count != NO_VAL) { object_ptr->grp_cpu_mins_list = list_create(slurm_destroy_char); for(i=0; i<count; i++) { @@ -4496,7 +4496,7 @@ extern int slurmdb_unpack_association_cond(void **object, } } safe_unpack32(&count, buffer); - if(count != NO_VAL) { + if (count != NO_VAL) { object_ptr->grp_cpus_list = list_create(slurm_destroy_char); for(i=0; i<count; i++) { @@ -4507,7 +4507,7 @@ extern int slurmdb_unpack_association_cond(void **object, } } safe_unpack32(&count, buffer); - if(count != NO_VAL) { + if (count != NO_VAL) { object_ptr->grp_jobs_list = list_create(slurm_destroy_char); for(i=0; i<count; i++) { @@ -4518,7 +4518,7 @@ extern int slurmdb_unpack_association_cond(void **object, } } safe_unpack32(&count, buffer); - if(count != NO_VAL) { + if (count != NO_VAL) { object_ptr->grp_nodes_list = list_create(slurm_destroy_char); for(i=0; i<count; i++) { @@ -4529,7 +4529,7 @@ extern int slurmdb_unpack_association_cond(void **object, } } safe_unpack32(&count, buffer); - if(count != NO_VAL) { + if (count != NO_VAL) { object_ptr->grp_submit_jobs_list = list_create(slurm_destroy_char); for(i=0; i<count; i++) { @@ -4540,7 +4540,7 @@ extern int slurmdb_unpack_association_cond(void **object, } } safe_unpack32(&count, buffer); - if(count != NO_VAL) { + if (count != NO_VAL) { object_ptr->grp_wall_list = list_create(slurm_destroy_char); for(i=0; i<count; i++) { @@ -4552,7 +4552,7 @@ extern int slurmdb_unpack_association_cond(void **object, } safe_unpack32(&count, buffer); - if(count != NO_VAL) { + if (count != NO_VAL) { object_ptr->id_list = list_create(slurm_destroy_char); for(i=0; i<count; i++) { safe_unpackstr_xmalloc(&tmp_info, &uint32_tmp, @@ -4562,7 +4562,7 @@ extern int slurmdb_unpack_association_cond(void **object, } safe_unpack32(&count, buffer); - if(count != NO_VAL) { + if (count != NO_VAL) { object_ptr->max_cpu_mins_pj_list = list_create(slurm_destroy_char); for(i=0; i<count; i++) { @@ -4573,7 +4573,7 @@ extern int slurmdb_unpack_association_cond(void **object, } } safe_unpack32(&count, buffer); - if(count != NO_VAL) { + if (count != NO_VAL) { object_ptr->max_cpus_pj_list = list_create(slurm_destroy_char); for(i=0; i<count; i++) { @@ -4584,7 +4584,7 @@ extern int slurmdb_unpack_association_cond(void **object, } } safe_unpack32(&count, buffer); - if(count != NO_VAL) { + if (count != NO_VAL) { object_ptr->max_jobs_list = list_create(slurm_destroy_char); for(i=0; i<count; i++) { @@ -4595,7 +4595,7 @@ extern int slurmdb_unpack_association_cond(void **object, } } safe_unpack32(&count, buffer); - if(count != NO_VAL) { + if (count != NO_VAL) { object_ptr->max_nodes_pj_list = list_create(slurm_destroy_char); for(i=0; i<count; i++) { @@ -4606,7 +4606,7 @@ extern int slurmdb_unpack_association_cond(void **object, } } safe_unpack32(&count, buffer); - if(count != NO_VAL) { + if (count != NO_VAL) { object_ptr->max_submit_jobs_list = list_create(slurm_destroy_char); for(i=0; i<count; i++) { @@ -4617,7 +4617,7 @@ extern int slurmdb_unpack_association_cond(void **object, } } safe_unpack32(&count, buffer); - if(count != NO_VAL) { + if (count != NO_VAL) { object_ptr->max_wall_pj_list = list_create(slurm_destroy_char); for(i=0; i<count; i++) { @@ -4629,7 +4629,7 @@ extern int slurmdb_unpack_association_cond(void **object, } safe_unpack32(&count, buffer); - if(count != NO_VAL) { + if (count != NO_VAL) { object_ptr->partition_list = list_create(slurm_destroy_char); for(i=0; i<count; i++) { @@ -4641,7 +4641,7 @@ extern int slurmdb_unpack_association_cond(void **object, } safe_unpack32(&count, buffer); - if(count != NO_VAL) { + if (count != NO_VAL) { object_ptr->parent_acct_list = list_create(slurm_destroy_char); for(i=0; i<count; i++) { @@ -4653,7 +4653,7 @@ extern int slurmdb_unpack_association_cond(void **object, } safe_unpack32(&count, buffer); - if(count != NO_VAL) { + if (count != NO_VAL) { object_ptr->qos_list = list_create(slurm_destroy_char); for(i=0; i<count; i++) { safe_unpackstr_xmalloc(&tmp_info, &uint32_tmp, @@ -4666,7 +4666,7 @@ extern int slurmdb_unpack_association_cond(void **object, safe_unpack_time(&object_ptr->usage_start, buffer); safe_unpack32(&count, buffer); - if(count != NO_VAL) { + if (count != NO_VAL) { object_ptr->user_list = list_create(slurm_destroy_char); for(i=0; i<count; i++) { @@ -4700,7 +4700,7 @@ extern void slurmdb_pack_event_cond(void *in, uint16_t rpc_version, Buf buffer) ListIterator itr = NULL; slurmdb_event_cond_t *object = (slurmdb_event_cond_t *)in; - if(!object) { + if (!object) { pack32(NO_VAL, buffer); pack32(NO_VAL, buffer); pack32(NO_VAL, buffer); @@ -4714,11 +4714,11 @@ extern void slurmdb_pack_event_cond(void *in, uint16_t rpc_version, Buf buffer) return; } - if(object->cluster_list) + if (object->cluster_list) count = list_count(object->cluster_list); pack32(count, buffer); - if(count && count != NO_VAL) { + if (count && count != NO_VAL) { itr = list_iterator_create(object->cluster_list); while((tmp_info = list_next(itr))) { packstr(tmp_info, buffer); @@ -4731,11 +4731,11 @@ extern void slurmdb_pack_event_cond(void *in, uint16_t rpc_version, Buf buffer) pack32(object->cpus_min, buffer); pack16(object->event_type, buffer); - if(object->node_list) + if (object->node_list) count = list_count(object->node_list); pack32(count, buffer); - if(count && count != NO_VAL) { + if (count && count != NO_VAL) { itr = list_iterator_create(object->node_list); while((tmp_info = list_next(itr))) { packstr(tmp_info, buffer); @@ -4747,11 +4747,11 @@ extern void slurmdb_pack_event_cond(void *in, uint16_t rpc_version, Buf buffer) pack_time(object->period_end, buffer); pack_time(object->period_start, buffer); - if(object->reason_list) + if (object->reason_list) count = list_count(object->reason_list); pack32(count, buffer); - if(count && count != NO_VAL) { + if (count && count != NO_VAL) { itr = list_iterator_create(object->reason_list); while((tmp_info = list_next(itr))) { packstr(tmp_info, buffer); @@ -4760,11 +4760,11 @@ extern void slurmdb_pack_event_cond(void *in, uint16_t rpc_version, Buf buffer) } count = NO_VAL; - if(object->reason_uid_list) + if (object->reason_uid_list) count = list_count(object->reason_uid_list); pack32(count, buffer); - if(count && count != NO_VAL) { + if (count && count != NO_VAL) { itr = list_iterator_create(object->reason_uid_list); while((tmp_info = list_next(itr))) { packstr(tmp_info, buffer); @@ -4773,11 +4773,11 @@ extern void slurmdb_pack_event_cond(void *in, uint16_t rpc_version, Buf buffer) } count = NO_VAL; - if(object->state_list) + if (object->state_list) count = list_count(object->state_list); pack32(count, buffer); - if(count && count != NO_VAL) { + if (count && count != NO_VAL) { itr = list_iterator_create(object->state_list); while((tmp_info = list_next(itr))) { packstr(tmp_info, buffer); @@ -4800,7 +4800,7 @@ extern int slurmdb_unpack_event_cond(void **object, uint16_t rpc_version, *object = object_ptr; safe_unpack32(&count, buffer); - if(count != NO_VAL) { + if (count != NO_VAL) { object_ptr->cluster_list = list_create(slurm_destroy_char); for(i=0; i<count; i++) { safe_unpackstr_xmalloc(&tmp_info, &uint32_tmp, @@ -4813,7 +4813,7 @@ extern int slurmdb_unpack_event_cond(void **object, uint16_t rpc_version, safe_unpack16(&object_ptr->event_type, buffer); safe_unpack32(&count, buffer); - if(count != NO_VAL) { + if (count != NO_VAL) { object_ptr->node_list = list_create(slurm_destroy_char); for(i=0; i<count; i++) { safe_unpackstr_xmalloc(&tmp_info, &uint32_tmp, @@ -4826,7 +4826,7 @@ extern int slurmdb_unpack_event_cond(void **object, uint16_t rpc_version, safe_unpack_time(&object_ptr->period_start, buffer); safe_unpack32(&count, buffer); - if(count != NO_VAL) { + if (count != NO_VAL) { object_ptr->reason_list = list_create(slurm_destroy_char); for(i=0; i<count; i++) { safe_unpackstr_xmalloc(&tmp_info, &uint32_tmp, @@ -4836,7 +4836,7 @@ extern int slurmdb_unpack_event_cond(void **object, uint16_t rpc_version, } safe_unpack32(&count, buffer); - if(count != NO_VAL) { + if (count != NO_VAL) { object_ptr->reason_uid_list = list_create(slurm_destroy_char); for(i=0; i<count; i++) { safe_unpackstr_xmalloc(&tmp_info, &uint32_tmp, @@ -4846,7 +4846,7 @@ extern int slurmdb_unpack_event_cond(void **object, uint16_t rpc_version, } safe_unpack32(&count, buffer); - if(count != NO_VAL) { + if (count != NO_VAL) { object_ptr->state_list = list_create(slurm_destroy_char); for(i=0; i<count; i++) { safe_unpackstr_xmalloc(&tmp_info, &uint32_tmp, @@ -5090,7 +5090,7 @@ extern void slurmdb_pack_job_cond(void *in, uint16_t rpc_version, Buf buffer) pack16(object->without_steps, buffer); pack16(object->without_usage_truncation, buffer); } else if (rpc_version >= 8) { - if(!object) { + if (!object) { pack32(NO_VAL, buffer); pack32(NO_VAL, buffer); pack32(NO_VAL, buffer); @@ -5119,11 +5119,11 @@ extern void slurmdb_pack_job_cond(void *in, uint16_t rpc_version, Buf buffer) return; } - if(object->acct_list) + if (object->acct_list) count = list_count(object->acct_list); pack32(count, buffer); - if(count && count != NO_VAL) { + if (count && count != NO_VAL) { itr = list_iterator_create(object->acct_list); while((tmp_info = list_next(itr))) { packstr(tmp_info, buffer); @@ -5132,11 +5132,11 @@ extern void slurmdb_pack_job_cond(void *in, uint16_t rpc_version, Buf buffer) } count = NO_VAL; - if(object->associd_list) + if (object->associd_list) count = list_count(object->associd_list); pack32(count, buffer); - if(count && count != NO_VAL) { + if (count && count != NO_VAL) { itr = list_iterator_create(object->associd_list); while((tmp_info = list_next(itr))) { packstr(tmp_info, buffer); @@ -5144,11 +5144,11 @@ extern void slurmdb_pack_job_cond(void *in, uint16_t rpc_version, Buf buffer) } count = NO_VAL; - if(object->cluster_list) + if (object->cluster_list) count = list_count(object->cluster_list); pack32(count, buffer); - if(count && count != NO_VAL) { + if (count && count != NO_VAL) { itr = list_iterator_create(object->cluster_list); while((tmp_info = list_next(itr))) { packstr(tmp_info, buffer); @@ -5162,11 +5162,11 @@ extern void slurmdb_pack_job_cond(void *in, uint16_t rpc_version, Buf buffer) pack16(object->duplicates, buffer); pack32((uint32_t)object->exitcode, buffer); - if(object->groupid_list) + if (object->groupid_list) count = list_count(object->groupid_list); pack32(count, buffer); - if(count && count != NO_VAL) { + if (count && count != NO_VAL) { itr = list_iterator_create(object->groupid_list); while((tmp_info = list_next(itr))) { packstr(tmp_info, buffer); @@ -5177,11 +5177,11 @@ extern void slurmdb_pack_job_cond(void *in, uint16_t rpc_version, Buf buffer) pack32(object->nodes_max, buffer); pack32(object->nodes_min, buffer); - if(object->partition_list) + if (object->partition_list) count = list_count(object->partition_list); pack32(count, buffer); - if(count && count != NO_VAL) { + if (count && count != NO_VAL) { itr = list_iterator_create(object->partition_list); while((tmp_info = list_next(itr))) { packstr(tmp_info, buffer); @@ -5190,11 +5190,11 @@ extern void slurmdb_pack_job_cond(void *in, uint16_t rpc_version, Buf buffer) } count = NO_VAL; - if(object->qos_list) + if (object->qos_list) count = list_count(object->qos_list); pack32(count, buffer); - if(count && count != NO_VAL) { + if (count && count != NO_VAL) { itr = list_iterator_create(object->qos_list); while((tmp_info = list_next(itr))) { packstr(tmp_info, buffer); @@ -5203,11 +5203,11 @@ extern void slurmdb_pack_job_cond(void *in, uint16_t rpc_version, Buf buffer) } count = NO_VAL; - if(object->resv_list) + if (object->resv_list) count = list_count(object->resv_list); pack32(count, buffer); - if(count && count != NO_VAL) { + if (count && count != NO_VAL) { itr = list_iterator_create(object->resv_list); while((tmp_info = list_next(itr))) { packstr(tmp_info, buffer); @@ -5216,11 +5216,11 @@ extern void slurmdb_pack_job_cond(void *in, uint16_t rpc_version, Buf buffer) } count = NO_VAL; - if(object->resvid_list) + if (object->resvid_list) count = list_count(object->resvid_list); pack32(count, buffer); - if(count && count != NO_VAL) { + if (count && count != NO_VAL) { itr = list_iterator_create(object->resvid_list); while((tmp_info = list_next(itr))) { packstr(tmp_info, buffer); @@ -5229,11 +5229,11 @@ extern void slurmdb_pack_job_cond(void *in, uint16_t rpc_version, Buf buffer) } count = NO_VAL; - if(object->step_list) + if (object->step_list) count = list_count(object->step_list); pack32(count, buffer); - if(count && count != NO_VAL) { + if (count && count != NO_VAL) { itr = list_iterator_create(object->step_list); while((job = list_next(itr))) { slurmdb_pack_selected_step(job, rpc_version, @@ -5243,11 +5243,11 @@ extern void slurmdb_pack_job_cond(void *in, uint16_t rpc_version, Buf buffer) } count = NO_VAL; - if(object->state_list) + if (object->state_list) count = list_count(object->state_list); pack32(count, buffer); - if(count && count != NO_VAL) { + if (count && count != NO_VAL) { itr = list_iterator_create(object->state_list); while((tmp_info = list_next(itr))) { packstr(tmp_info, buffer); @@ -5263,11 +5263,11 @@ extern void slurmdb_pack_job_cond(void *in, uint16_t rpc_version, Buf buffer) packstr(object->used_nodes, buffer); - if(object->userid_list) + if (object->userid_list) count = list_count(object->userid_list); pack32(count, buffer); - if(count && count != NO_VAL) { + if (count && count != NO_VAL) { itr = list_iterator_create(object->userid_list); while((tmp_info = list_next(itr))) { packstr(tmp_info, buffer); @@ -5276,10 +5276,10 @@ extern void slurmdb_pack_job_cond(void *in, uint16_t rpc_version, Buf buffer) } count = NO_VAL; - if(object->wckey_list) + if (object->wckey_list) count = list_count(object->wckey_list); pack32(count, buffer); - if(count && count != NO_VAL) { + if (count && count != NO_VAL) { itr = list_iterator_create(object->wckey_list); while((tmp_info = list_next(itr))) { packstr(tmp_info, buffer); @@ -5290,8 +5290,8 @@ extern void slurmdb_pack_job_cond(void *in, uint16_t rpc_version, Buf buffer) pack16(object->without_steps, buffer); pack16(object->without_usage_truncation, buffer); - } else if(rpc_version >= 6) { - if(!object) { + } else if (rpc_version >= 6) { + if (!object) { pack32(NO_VAL, buffer); pack32(NO_VAL, buffer); pack32(NO_VAL, buffer); @@ -5315,11 +5315,11 @@ extern void slurmdb_pack_job_cond(void *in, uint16_t rpc_version, Buf buffer) return; } - if(object->acct_list) + if (object->acct_list) count = list_count(object->acct_list); pack32(count, buffer); - if(count && count != NO_VAL) { + if (count && count != NO_VAL) { itr = list_iterator_create(object->acct_list); while((tmp_info = list_next(itr))) { packstr(tmp_info, buffer); @@ -5328,11 +5328,11 @@ extern void slurmdb_pack_job_cond(void *in, uint16_t rpc_version, Buf buffer) } count = NO_VAL; - if(object->associd_list) + if (object->associd_list) count = list_count(object->associd_list); pack32(count, buffer); - if(count && count != NO_VAL) { + if (count && count != NO_VAL) { itr = list_iterator_create(object->associd_list); while((tmp_info = list_next(itr))) { packstr(tmp_info, buffer); @@ -5340,11 +5340,11 @@ extern void slurmdb_pack_job_cond(void *in, uint16_t rpc_version, Buf buffer) } count = NO_VAL; - if(object->cluster_list) + if (object->cluster_list) count = list_count(object->cluster_list); pack32(count, buffer); - if(count && count != NO_VAL) { + if (count && count != NO_VAL) { itr = list_iterator_create(object->cluster_list); while((tmp_info = list_next(itr))) { packstr(tmp_info, buffer); @@ -5357,11 +5357,11 @@ extern void slurmdb_pack_job_cond(void *in, uint16_t rpc_version, Buf buffer) pack32(object->cpus_min, buffer); pack16(object->duplicates, buffer); - if(object->groupid_list) + if (object->groupid_list) count = list_count(object->groupid_list); pack32(count, buffer); - if(count && count != NO_VAL) { + if (count && count != NO_VAL) { itr = list_iterator_create(object->groupid_list); while((tmp_info = list_next(itr))) { packstr(tmp_info, buffer); @@ -5371,11 +5371,11 @@ extern void slurmdb_pack_job_cond(void *in, uint16_t rpc_version, Buf buffer) pack32(object->nodes_max, buffer); pack32(object->nodes_min, buffer); - if(object->partition_list) + if (object->partition_list) count = list_count(object->partition_list); pack32(count, buffer); - if(count && count != NO_VAL) { + if (count && count != NO_VAL) { itr = list_iterator_create(object->partition_list); while((tmp_info = list_next(itr))) { packstr(tmp_info, buffer); @@ -5384,11 +5384,11 @@ extern void slurmdb_pack_job_cond(void *in, uint16_t rpc_version, Buf buffer) } count = NO_VAL; - if(object->resv_list) + if (object->resv_list) count = list_count(object->resv_list); pack32(count, buffer); - if(count && count != NO_VAL) { + if (count && count != NO_VAL) { itr = list_iterator_create(object->resv_list); while((tmp_info = list_next(itr))) { packstr(tmp_info, buffer); @@ -5397,11 +5397,11 @@ extern void slurmdb_pack_job_cond(void *in, uint16_t rpc_version, Buf buffer) } count = NO_VAL; - if(object->resvid_list) + if (object->resvid_list) count = list_count(object->resvid_list); pack32(count, buffer); - if(count && count != NO_VAL) { + if (count && count != NO_VAL) { itr = list_iterator_create(object->resvid_list); while((tmp_info = list_next(itr))) { packstr(tmp_info, buffer); @@ -5410,11 +5410,11 @@ extern void slurmdb_pack_job_cond(void *in, uint16_t rpc_version, Buf buffer) } count = NO_VAL; - if(object->step_list) + if (object->step_list) count = list_count(object->step_list); pack32(count, buffer); - if(count && count != NO_VAL) { + if (count && count != NO_VAL) { itr = list_iterator_create(object->step_list); while((job = list_next(itr))) { slurmdb_pack_selected_step(job, rpc_version, @@ -5424,11 +5424,11 @@ extern void slurmdb_pack_job_cond(void *in, uint16_t rpc_version, Buf buffer) } count = NO_VAL; - if(object->state_list) + if (object->state_list) count = list_count(object->state_list); pack32(count, buffer); - if(count && count != NO_VAL) { + if (count && count != NO_VAL) { itr = list_iterator_create(object->state_list); while((tmp_info = list_next(itr))) { packstr(tmp_info, buffer); @@ -5442,11 +5442,11 @@ extern void slurmdb_pack_job_cond(void *in, uint16_t rpc_version, Buf buffer) packstr(object->used_nodes, buffer); - if(object->userid_list) + if (object->userid_list) count = list_count(object->userid_list); pack32(count, buffer); - if(count && count != NO_VAL) { + if (count && count != NO_VAL) { itr = list_iterator_create(object->userid_list); while((tmp_info = list_next(itr))) { packstr(tmp_info, buffer); @@ -5455,10 +5455,10 @@ extern void slurmdb_pack_job_cond(void *in, uint16_t rpc_version, Buf buffer) } count = NO_VAL; - if(object->wckey_list) + if (object->wckey_list) count = list_count(object->wckey_list); pack32(count, buffer); - if(count && count != NO_VAL) { + if (count && count != NO_VAL) { itr = list_iterator_create(object->wckey_list); while((tmp_info = list_next(itr))) { packstr(tmp_info, buffer); @@ -5652,7 +5652,7 @@ extern int slurmdb_unpack_job_cond(void **object, uint16_t rpc_version, safe_unpack16(&object_ptr->without_usage_truncation, buffer); } else if (rpc_version >= 8) { safe_unpack32(&count, buffer); - if(count != NO_VAL) { + if (count != NO_VAL) { object_ptr->acct_list = list_create(slurm_destroy_char); for(i=0; i<count; i++) { safe_unpackstr_xmalloc(&tmp_info, &uint32_tmp, @@ -5662,7 +5662,7 @@ extern int slurmdb_unpack_job_cond(void **object, uint16_t rpc_version, } safe_unpack32(&count, buffer); - if(count != NO_VAL) { + if (count != NO_VAL) { object_ptr->associd_list = list_create(slurm_destroy_char); for(i=0; i<count; i++) { @@ -5673,7 +5673,7 @@ extern int slurmdb_unpack_job_cond(void **object, uint16_t rpc_version, } safe_unpack32(&count, buffer); - if(count != NO_VAL) { + if (count != NO_VAL) { object_ptr->cluster_list = list_create(slurm_destroy_char); for(i=0; i<count; i++) { @@ -5690,7 +5690,7 @@ extern int slurmdb_unpack_job_cond(void **object, uint16_t rpc_version, object_ptr->exitcode = (int32_t)uint32_tmp; safe_unpack32(&count, buffer); - if(count != NO_VAL) { + if (count != NO_VAL) { object_ptr->groupid_list = list_create(slurm_destroy_char); for(i=0; i<count; i++) { @@ -5704,7 +5704,7 @@ extern int slurmdb_unpack_job_cond(void **object, uint16_t rpc_version, safe_unpack32(&object_ptr->nodes_min, buffer); safe_unpack32(&count, buffer); - if(count != NO_VAL) { + if (count != NO_VAL) { object_ptr->partition_list = list_create(slurm_destroy_char); for(i=0; i<count; i++) { @@ -5716,7 +5716,7 @@ extern int slurmdb_unpack_job_cond(void **object, uint16_t rpc_version, } safe_unpack32(&count, buffer); - if(count != NO_VAL) { + if (count != NO_VAL) { object_ptr->qos_list = list_create(slurm_destroy_char); for(i=0; i<count; i++) { @@ -5728,7 +5728,7 @@ extern int slurmdb_unpack_job_cond(void **object, uint16_t rpc_version, } safe_unpack32(&count, buffer); - if(count != NO_VAL) { + if (count != NO_VAL) { object_ptr->resv_list = list_create(slurm_destroy_char); for(i=0; i<count; i++) { @@ -5740,7 +5740,7 @@ extern int slurmdb_unpack_job_cond(void **object, uint16_t rpc_version, } safe_unpack32(&count, buffer); - if(count != NO_VAL) { + if (count != NO_VAL) { object_ptr->resvid_list = list_create(slurm_destroy_char); for(i=0; i<count; i++) { @@ -5752,7 +5752,7 @@ extern int slurmdb_unpack_job_cond(void **object, uint16_t rpc_version, } safe_unpack32(&count, buffer); - if(count != NO_VAL) { + if (count != NO_VAL) { object_ptr->step_list = list_create(slurmdb_destroy_selected_step); for(i=0; i<count; i++) { @@ -5763,7 +5763,7 @@ extern int slurmdb_unpack_job_cond(void **object, uint16_t rpc_version, } safe_unpack32(&count, buffer); - if(count != NO_VAL) { + if (count != NO_VAL) { object_ptr->state_list = list_create(slurm_destroy_char); for(i=0; i<count; i++) { @@ -5782,7 +5782,7 @@ extern int slurmdb_unpack_job_cond(void **object, uint16_t rpc_version, &uint32_tmp, buffer); safe_unpack32(&count, buffer); - if(count != NO_VAL) { + if (count != NO_VAL) { object_ptr->userid_list = list_create(slurm_destroy_char); for(i=0; i<count; i++) { @@ -5793,7 +5793,7 @@ extern int slurmdb_unpack_job_cond(void **object, uint16_t rpc_version, } safe_unpack32(&count, buffer); - if(count != NO_VAL) { + if (count != NO_VAL) { object_ptr->wckey_list = list_create(slurm_destroy_char); for(i=0; i<count; i++) { @@ -5805,9 +5805,9 @@ extern int slurmdb_unpack_job_cond(void **object, uint16_t rpc_version, safe_unpack16(&object_ptr->without_steps, buffer); safe_unpack16(&object_ptr->without_usage_truncation, buffer); - } else if(rpc_version >= 6) { + } else if (rpc_version >= 6) { safe_unpack32(&count, buffer); - if(count != NO_VAL) { + if (count != NO_VAL) { object_ptr->acct_list = list_create(slurm_destroy_char); for(i=0; i<count; i++) { safe_unpackstr_xmalloc(&tmp_info, &uint32_tmp, @@ -5817,7 +5817,7 @@ extern int slurmdb_unpack_job_cond(void **object, uint16_t rpc_version, } safe_unpack32(&count, buffer); - if(count != NO_VAL) { + if (count != NO_VAL) { object_ptr->associd_list = list_create(slurm_destroy_char); for(i=0; i<count; i++) { @@ -5828,7 +5828,7 @@ extern int slurmdb_unpack_job_cond(void **object, uint16_t rpc_version, } safe_unpack32(&count, buffer); - if(count != NO_VAL) { + if (count != NO_VAL) { object_ptr->cluster_list = list_create(slurm_destroy_char); for(i=0; i<count; i++) { @@ -5843,7 +5843,7 @@ extern int slurmdb_unpack_job_cond(void **object, uint16_t rpc_version, safe_unpack16(&object_ptr->duplicates, buffer); safe_unpack32(&count, buffer); - if(count != NO_VAL) { + if (count != NO_VAL) { object_ptr->groupid_list = list_create(slurm_destroy_char); for(i=0; i<count; i++) { @@ -5857,7 +5857,7 @@ extern int slurmdb_unpack_job_cond(void **object, uint16_t rpc_version, safe_unpack32(&object_ptr->nodes_min, buffer); safe_unpack32(&count, buffer); - if(count != NO_VAL) { + if (count != NO_VAL) { object_ptr->partition_list = list_create(slurm_destroy_char); for(i=0; i<count; i++) { @@ -5869,7 +5869,7 @@ extern int slurmdb_unpack_job_cond(void **object, uint16_t rpc_version, } safe_unpack32(&count, buffer); - if(count != NO_VAL) { + if (count != NO_VAL) { object_ptr->resv_list = list_create(slurm_destroy_char); for(i=0; i<count; i++) { @@ -5881,7 +5881,7 @@ extern int slurmdb_unpack_job_cond(void **object, uint16_t rpc_version, } safe_unpack32(&count, buffer); - if(count != NO_VAL) { + if (count != NO_VAL) { object_ptr->resvid_list = list_create(slurm_destroy_char); for(i=0; i<count; i++) { @@ -5893,7 +5893,7 @@ extern int slurmdb_unpack_job_cond(void **object, uint16_t rpc_version, } safe_unpack32(&count, buffer); - if(count != NO_VAL) { + if (count != NO_VAL) { object_ptr->step_list = list_create(slurmdb_destroy_selected_step); for(i=0; i<count; i++) { @@ -5906,7 +5906,7 @@ extern int slurmdb_unpack_job_cond(void **object, uint16_t rpc_version, } safe_unpack32(&count, buffer); - if(count != NO_VAL) { + if (count != NO_VAL) { object_ptr->state_list = list_create(slurm_destroy_char); for(i=0; i<count; i++) { @@ -5923,7 +5923,7 @@ extern int slurmdb_unpack_job_cond(void **object, uint16_t rpc_version, &uint32_tmp, buffer); safe_unpack32(&count, buffer); - if(count != NO_VAL) { + if (count != NO_VAL) { object_ptr->userid_list = list_create(slurm_destroy_char); for(i=0; i<count; i++) { @@ -5934,7 +5934,7 @@ extern int slurmdb_unpack_job_cond(void **object, uint16_t rpc_version, } safe_unpack32(&count, buffer); - if(count != NO_VAL) { + if (count != NO_VAL) { object_ptr->wckey_list = list_create(slurm_destroy_char); for(i=0; i<count; i++) { @@ -5961,8 +5961,8 @@ extern void slurmdb_pack_job_modify_cond(void *in, uint16_t rpc_version, { slurmdb_job_modify_cond_t *cond = (slurmdb_job_modify_cond_t *)in; - if(rpc_version >= 8) { - if(!cond) { + if (rpc_version >= 8) { + if (!cond) { packnull(buffer); pack32(NO_VAL, buffer); return; @@ -5981,7 +5981,7 @@ extern int slurmdb_unpack_job_modify_cond(void **object, uint16_t rpc_version, *object = object_ptr; - if(rpc_version >= 8) { + if (rpc_version >= 8) { safe_unpackstr_xmalloc(&object_ptr->cluster, &uint32_tmp, buffer); safe_unpack32(&object_ptr->job_id, buffer); @@ -6001,7 +6001,7 @@ extern void slurmdb_pack_job_rec(void *object, uint16_t rpc_version, Buf buffer) slurmdb_step_rec_t *step = NULL; uint32_t count = 0; - if(rpc_version >= 8) { + if (rpc_version >= 8) { packstr(job->account, buffer); pack32(job->alloc_cpus, buffer); pack32(job->alloc_nodes, buffer); @@ -6032,10 +6032,10 @@ extern void slurmdb_pack_job_rec(void *object, uint16_t rpc_version, Buf buffer) pack_time(job->start, buffer); pack16((uint16_t)job->state, buffer); _pack_slurmdb_stats(&job->stats, rpc_version, buffer); - if(job->steps) + if (job->steps) count = list_count(job->steps); pack32(count, buffer); - if(count) { + if (count) { itr = list_iterator_create(job->steps); while((step = list_next(itr))) { slurmdb_pack_step_rec(step, rpc_version, @@ -6057,7 +6057,7 @@ extern void slurmdb_pack_job_rec(void *object, uint16_t rpc_version, Buf buffer) pack32(job->user_cpu_usec, buffer); packstr(job->wckey, buffer); /* added for rpc_version 4 */ pack32(job->wckeyid, buffer); /* added for rpc_version 4 */ - } else if(rpc_version >= 5) { + } else if (rpc_version >= 5) { pack32(job->alloc_cpus, buffer); pack32(job->alloc_nodes, buffer); pack32(job->associd, buffer); @@ -6086,10 +6086,10 @@ extern void slurmdb_pack_job_rec(void *object, uint16_t rpc_version, Buf buffer) pack32(job->show_full, buffer); pack_time(job->start, buffer); pack16((uint16_t)job->state, buffer); - if(job->steps) + if (job->steps) count = list_count(job->steps); pack32(count, buffer); - if(count) { + if (count) { itr = list_iterator_create(job->steps); while((step = list_next(itr))) { slurmdb_pack_step_rec(step, rpc_version, @@ -6125,7 +6125,7 @@ extern int slurmdb_unpack_job_rec(void **job, uint16_t rpc_version, Buf buffer) *job = job_ptr; - if(rpc_version >= 8) { + if (rpc_version >= 8) { safe_unpackstr_xmalloc(&job_ptr->account, &uint32_tmp, buffer); safe_unpack32(&job_ptr->alloc_cpus, buffer); safe_unpack32(&job_ptr->alloc_nodes, buffer); @@ -6157,7 +6157,7 @@ extern int slurmdb_unpack_job_rec(void **job, uint16_t rpc_version, Buf buffer) safe_unpack_time(&job_ptr->start, buffer); safe_unpack16(&uint16_tmp, buffer); job_ptr->state = uint16_tmp; - if(_unpack_slurmdb_stats(&job_ptr->stats, rpc_version, buffer) + if (_unpack_slurmdb_stats(&job_ptr->stats, rpc_version, buffer) != SLURM_SUCCESS) goto unpack_error; @@ -6169,7 +6169,7 @@ extern int slurmdb_unpack_job_rec(void **job, uint16_t rpc_version, Buf buffer) goto unpack_error; step->job_ptr = job_ptr; - if(!job_ptr->first_step_ptr) + if (!job_ptr->first_step_ptr) job_ptr->first_step_ptr = step; list_append(job_ptr->steps, step); } @@ -6188,7 +6188,7 @@ extern int slurmdb_unpack_job_rec(void **job, uint16_t rpc_version, Buf buffer) safe_unpack32(&job_ptr->user_cpu_usec, buffer); safe_unpackstr_xmalloc(&job_ptr->wckey, &uint32_tmp, buffer); safe_unpack32(&job_ptr->wckeyid, buffer); - } else if(rpc_version >= 5) { + } else if (rpc_version >= 5) { safe_unpack32(&job_ptr->alloc_cpus, buffer); safe_unpack32(&job_ptr->alloc_nodes, buffer); safe_unpack32(&job_ptr->associd, buffer); @@ -6212,7 +6212,7 @@ extern int slurmdb_unpack_job_rec(void **job, uint16_t rpc_version, Buf buffer) safe_unpack32(&job_ptr->resvid, buffer); safe_unpack32(&job_ptr->req_cpus, buffer); safe_unpack32(&job_ptr->requid, buffer); - if(_unpack_slurmdb_stats(&job_ptr->stats, rpc_version, buffer) + if (_unpack_slurmdb_stats(&job_ptr->stats, rpc_version, buffer) != SLURM_SUCCESS) goto unpack_error; safe_unpack32(&job_ptr->show_full, buffer); @@ -6228,7 +6228,7 @@ extern int slurmdb_unpack_job_rec(void **job, uint16_t rpc_version, Buf buffer) goto unpack_error; step->job_ptr = job_ptr; - if(!job_ptr->first_step_ptr) + if (!job_ptr->first_step_ptr) job_ptr->first_step_ptr = step; list_append(job_ptr->steps, step); } @@ -6264,8 +6264,8 @@ extern void slurmdb_pack_qos_cond(void *in, uint16_t rpc_version, Buf buffer) ListIterator itr = NULL; slurmdb_qos_cond_t *object = (slurmdb_qos_cond_t *)in; - if(rpc_version >= 8) { - if(!object) { + if (rpc_version >= 8) { + if (!object) { pack32(NO_VAL, buffer); pack32(NO_VAL, buffer); pack32(NO_VAL, buffer); @@ -6274,11 +6274,11 @@ extern void slurmdb_pack_qos_cond(void *in, uint16_t rpc_version, Buf buffer) return; } - if(object->description_list) + if (object->description_list) count = list_count(object->description_list); pack32(count, buffer); - if(count && count != NO_VAL) { + if (count && count != NO_VAL) { itr = list_iterator_create(object->description_list); while((tmp_info = list_next(itr))) { packstr(tmp_info, buffer); @@ -6287,11 +6287,11 @@ extern void slurmdb_pack_qos_cond(void *in, uint16_t rpc_version, Buf buffer) } count = NO_VAL; - if(object->id_list) + if (object->id_list) count = list_count(object->id_list); pack32(count, buffer); - if(count && count != NO_VAL) { + if (count && count != NO_VAL) { itr = list_iterator_create(object->id_list); while((tmp_info = list_next(itr))) { packstr(tmp_info, buffer); @@ -6300,11 +6300,11 @@ extern void slurmdb_pack_qos_cond(void *in, uint16_t rpc_version, Buf buffer) } count = NO_VAL; - if(object->name_list) + if (object->name_list) count = list_count(object->name_list); pack32(count, buffer); - if(count && count != NO_VAL) { + if (count && count != NO_VAL) { itr = list_iterator_create(object->name_list); while((tmp_info = list_next(itr))) { packstr(tmp_info, buffer); @@ -6316,7 +6316,7 @@ extern void slurmdb_pack_qos_cond(void *in, uint16_t rpc_version, Buf buffer) pack16(object->preempt_mode, buffer); pack16(object->with_deleted, buffer); } else { - if(!object) { + if (!object) { pack32(NO_VAL, buffer); pack32(NO_VAL, buffer); pack32(NO_VAL, buffer); @@ -6324,11 +6324,11 @@ extern void slurmdb_pack_qos_cond(void *in, uint16_t rpc_version, Buf buffer) return; } - if(object->description_list) + if (object->description_list) count = list_count(object->description_list); pack32(count, buffer); - if(count && count != NO_VAL) { + if (count && count != NO_VAL) { itr = list_iterator_create(object->description_list); while((tmp_info = list_next(itr))) { packstr(tmp_info, buffer); @@ -6337,11 +6337,11 @@ extern void slurmdb_pack_qos_cond(void *in, uint16_t rpc_version, Buf buffer) } count = NO_VAL; - if(object->id_list) + if (object->id_list) count = list_count(object->id_list); pack32(count, buffer); - if(count && count != NO_VAL) { + if (count && count != NO_VAL) { itr = list_iterator_create(object->id_list); while((tmp_info = list_next(itr))) { packstr(tmp_info, buffer); @@ -6350,11 +6350,11 @@ extern void slurmdb_pack_qos_cond(void *in, uint16_t rpc_version, Buf buffer) } count = NO_VAL; - if(object->name_list) + if (object->name_list) count = list_count(object->name_list); pack32(count, buffer); - if(count && count != NO_VAL) { + if (count && count != NO_VAL) { itr = list_iterator_create(object->name_list); while((tmp_info = list_next(itr))) { packstr(tmp_info, buffer); @@ -6378,9 +6378,9 @@ extern int slurmdb_unpack_qos_cond(void **object, uint16_t rpc_version, *object = object_ptr; - if(rpc_version >= 8) { + if (rpc_version >= 8) { safe_unpack32(&count, buffer); - if(count != NO_VAL) { + if (count != NO_VAL) { object_ptr->description_list = list_create(slurm_destroy_char); for(i=0; i<count; i++) { @@ -6392,7 +6392,7 @@ extern int slurmdb_unpack_qos_cond(void **object, uint16_t rpc_version, } safe_unpack32(&count, buffer); - if(count != NO_VAL) { + if (count != NO_VAL) { object_ptr->id_list = list_create(slurm_destroy_char); for(i=0; i<count; i++) { safe_unpackstr_xmalloc(&tmp_info, &uint32_tmp, @@ -6402,7 +6402,7 @@ extern int slurmdb_unpack_qos_cond(void **object, uint16_t rpc_version, } safe_unpack32(&count, buffer); - if(count != NO_VAL) { + if (count != NO_VAL) { object_ptr->name_list = list_create(slurm_destroy_char); for(i=0; i<count; i++) { safe_unpackstr_xmalloc(&tmp_info, &uint32_tmp, @@ -6415,7 +6415,7 @@ extern int slurmdb_unpack_qos_cond(void **object, uint16_t rpc_version, safe_unpack16(&object_ptr->with_deleted, buffer); } else { safe_unpack32(&count, buffer); - if(count != NO_VAL) { + if (count != NO_VAL) { object_ptr->description_list = list_create(slurm_destroy_char); for(i=0; i<count; i++) { @@ -6427,7 +6427,7 @@ extern int slurmdb_unpack_qos_cond(void **object, uint16_t rpc_version, } safe_unpack32(&count, buffer); - if(count != NO_VAL) { + if (count != NO_VAL) { object_ptr->id_list = list_create(slurm_destroy_char); for(i=0; i<count; i++) { safe_unpackstr_xmalloc(&tmp_info, &uint32_tmp, @@ -6437,7 +6437,7 @@ extern int slurmdb_unpack_qos_cond(void **object, uint16_t rpc_version, } safe_unpack32(&count, buffer); - if(count != NO_VAL) { + if (count != NO_VAL) { object_ptr->name_list = list_create(slurm_destroy_char); for(i=0; i<count; i++) { safe_unpackstr_xmalloc(&tmp_info, &uint32_tmp, @@ -6465,7 +6465,7 @@ extern void slurmdb_pack_reservation_cond(void *in, uint16_t rpc_version, ListIterator itr = NULL; char *tmp_info = NULL; - if(!object) { + if (!object) { pack32((uint32_t)NO_VAL, buffer); pack16(0, buffer); pack32((uint16_t)NO_VAL, buffer); @@ -6477,11 +6477,11 @@ extern void slurmdb_pack_reservation_cond(void *in, uint16_t rpc_version, return; } - if(object->cluster_list) + if (object->cluster_list) count = list_count(object->cluster_list); pack32(count, buffer); - if(count && count != NO_VAL) { + if (count && count != NO_VAL) { itr = list_iterator_create(object->cluster_list); while((tmp_info = list_next(itr))) { packstr(tmp_info, buffer); @@ -6492,11 +6492,11 @@ extern void slurmdb_pack_reservation_cond(void *in, uint16_t rpc_version, pack16(object->flags, buffer); - if(object->id_list) + if (object->id_list) count = list_count(object->id_list); pack32(count, buffer); - if(count && count != NO_VAL) { + if (count && count != NO_VAL) { itr = list_iterator_create(object->id_list); while((tmp_info = list_next(itr))) { packstr(tmp_info, buffer); @@ -6505,11 +6505,11 @@ extern void slurmdb_pack_reservation_cond(void *in, uint16_t rpc_version, } count = NO_VAL; - if(object->name_list) + if (object->name_list) count = list_count(object->name_list); pack32(count, buffer); - if(count && count != NO_VAL) { + if (count && count != NO_VAL) { itr = list_iterator_create(object->name_list); while((tmp_info = list_next(itr))) { packstr(tmp_info, buffer); @@ -6536,7 +6536,7 @@ extern int slurmdb_unpack_reservation_cond(void **object, uint16_t rpc_version, *object = object_ptr; safe_unpack32(&count, buffer); - if(count != NO_VAL) { + if (count != NO_VAL) { object_ptr->cluster_list = list_create(slurm_destroy_char); for(i=0; i<count; i++) { safe_unpackstr_xmalloc(&tmp_info, &uint32_tmp, buffer); @@ -6547,7 +6547,7 @@ extern int slurmdb_unpack_reservation_cond(void **object, uint16_t rpc_version, safe_unpack16(&object_ptr->flags, buffer); safe_unpack32(&count, buffer); - if(count != NO_VAL) { + if (count != NO_VAL) { object_ptr->id_list = list_create(slurm_destroy_char); for(i=0; i<count; i++) { safe_unpackstr_xmalloc(&tmp_info, &uint32_tmp, buffer); @@ -6556,7 +6556,7 @@ extern int slurmdb_unpack_reservation_cond(void **object, uint16_t rpc_version, } safe_unpack32(&count, buffer); - if(count != NO_VAL) { + if (count != NO_VAL) { object_ptr->name_list = list_create(slurm_destroy_char); for(i=0; i<count; i++) { safe_unpackstr_xmalloc(&tmp_info, &uint32_tmp, buffer); @@ -6705,7 +6705,7 @@ extern int slurmdb_unpack_step_rec(slurmdb_step_rec_t **step, safe_unpackstr_xmalloc(&step_ptr->nodes, &uint32_tmp, buffer); safe_unpack32(&step_ptr->ntasks, buffer); safe_unpack32(&step_ptr->requid, buffer); - if(_unpack_slurmdb_stats(&step_ptr->stats, rpc_version, buffer) + if (_unpack_slurmdb_stats(&step_ptr->stats, rpc_version, buffer) != SLURM_SUCCESS) goto unpack_error; safe_unpack_time(&step_ptr->start, buffer); @@ -6739,8 +6739,8 @@ extern void slurmdb_pack_txn_cond(void *in, uint16_t rpc_version, Buf buffer) ListIterator itr = NULL; slurmdb_txn_cond_t *object = (slurmdb_txn_cond_t *)in; - if(rpc_version >= 5) { - if(!object) { + if (rpc_version >= 5) { + if (!object) { pack32(NO_VAL, buffer); pack32(NO_VAL, buffer); pack32(NO_VAL, buffer); @@ -6753,11 +6753,11 @@ extern void slurmdb_pack_txn_cond(void *in, uint16_t rpc_version, Buf buffer) pack16(0, buffer); return; } - if(object->acct_list) + if (object->acct_list) count = list_count(object->acct_list); pack32(count, buffer); - if(count && count != NO_VAL) { + if (count && count != NO_VAL) { itr = list_iterator_create(object->acct_list); while((tmp_info = list_next(itr))) { packstr(tmp_info, buffer); @@ -6766,11 +6766,11 @@ extern void slurmdb_pack_txn_cond(void *in, uint16_t rpc_version, Buf buffer) } count = NO_VAL; - if(object->action_list) + if (object->action_list) count = list_count(object->action_list); pack32(count, buffer); - if(count && count != NO_VAL) { + if (count && count != NO_VAL) { itr = list_iterator_create(object->action_list); while((tmp_info = list_next(itr))) { packstr(tmp_info, buffer); @@ -6779,11 +6779,11 @@ extern void slurmdb_pack_txn_cond(void *in, uint16_t rpc_version, Buf buffer) } count = NO_VAL; - if(object->actor_list) + if (object->actor_list) count = list_count(object->actor_list); pack32(count, buffer); - if(count && count != NO_VAL) { + if (count && count != NO_VAL) { itr = list_iterator_create(object->actor_list); while((tmp_info = list_next(itr))) { packstr(tmp_info, buffer); @@ -6792,11 +6792,11 @@ extern void slurmdb_pack_txn_cond(void *in, uint16_t rpc_version, Buf buffer) } count = NO_VAL; - if(object->cluster_list) + if (object->cluster_list) count = list_count(object->cluster_list); pack32(count, buffer); - if(count && count != NO_VAL) { + if (count && count != NO_VAL) { itr = list_iterator_create(object->cluster_list); while((tmp_info = list_next(itr))) { packstr(tmp_info, buffer); @@ -6805,11 +6805,11 @@ extern void slurmdb_pack_txn_cond(void *in, uint16_t rpc_version, Buf buffer) } count = NO_VAL; - if(object->id_list) + if (object->id_list) count = list_count(object->id_list); pack32(count, buffer); - if(count && count != NO_VAL) { + if (count && count != NO_VAL) { itr = list_iterator_create(object->id_list); while((tmp_info = list_next(itr))) { packstr(tmp_info, buffer); @@ -6818,11 +6818,11 @@ extern void slurmdb_pack_txn_cond(void *in, uint16_t rpc_version, Buf buffer) } count = NO_VAL; - if(object->info_list) + if (object->info_list) count = list_count(object->info_list); pack32(count, buffer); - if(count && count != NO_VAL) { + if (count && count != NO_VAL) { itr = list_iterator_create(object->info_list); while((tmp_info = list_next(itr))) { packstr(tmp_info, buffer); @@ -6831,11 +6831,11 @@ extern void slurmdb_pack_txn_cond(void *in, uint16_t rpc_version, Buf buffer) } count = NO_VAL; - if(object->name_list) + if (object->name_list) count = list_count(object->name_list); pack32(count, buffer); - if(count && count != NO_VAL) { + if (count && count != NO_VAL) { itr = list_iterator_create(object->name_list); while((tmp_info = list_next(itr))) { packstr(tmp_info, buffer); @@ -6846,11 +6846,11 @@ extern void slurmdb_pack_txn_cond(void *in, uint16_t rpc_version, Buf buffer) pack_time(object->time_end, buffer); pack_time(object->time_start, buffer); - if(object->user_list) + if (object->user_list) count = list_count(object->user_list); pack32(count, buffer); - if(count && count != NO_VAL) { + if (count && count != NO_VAL) { itr = list_iterator_create(object->user_list); while((tmp_info = list_next(itr))) { packstr(tmp_info, buffer); @@ -6875,7 +6875,7 @@ extern int slurmdb_unpack_txn_cond(void **object, uint16_t rpc_version, *object = object_ptr; if (rpc_version >= 5) { safe_unpack32(&count, buffer); - if(count != NO_VAL) { + if (count != NO_VAL) { object_ptr->acct_list = list_create(slurm_destroy_char); for(i=0; i<count; i++) { @@ -6886,7 +6886,7 @@ extern int slurmdb_unpack_txn_cond(void **object, uint16_t rpc_version, } safe_unpack32(&count, buffer); - if(count != NO_VAL) { + if (count != NO_VAL) { object_ptr->action_list = list_create(slurm_destroy_char); for(i=0; i<count; i++) { @@ -6897,7 +6897,7 @@ extern int slurmdb_unpack_txn_cond(void **object, uint16_t rpc_version, } safe_unpack32(&count, buffer); - if(count != NO_VAL) { + if (count != NO_VAL) { object_ptr->actor_list = list_create(slurm_destroy_char); for(i=0; i<count; i++) { @@ -6908,7 +6908,7 @@ extern int slurmdb_unpack_txn_cond(void **object, uint16_t rpc_version, } safe_unpack32(&count, buffer); - if(count != NO_VAL) { + if (count != NO_VAL) { object_ptr->cluster_list = list_create(slurm_destroy_char); for(i=0; i<count; i++) { @@ -6919,7 +6919,7 @@ extern int slurmdb_unpack_txn_cond(void **object, uint16_t rpc_version, } safe_unpack32(&count, buffer); - if(count != NO_VAL) { + if (count != NO_VAL) { object_ptr->id_list = list_create(slurm_destroy_char); for(i=0; i<count; i++) { safe_unpackstr_xmalloc(&tmp_info, @@ -6929,7 +6929,7 @@ extern int slurmdb_unpack_txn_cond(void **object, uint16_t rpc_version, } safe_unpack32(&count, buffer); - if(count != NO_VAL) { + if (count != NO_VAL) { object_ptr->info_list = list_create(slurm_destroy_char); for(i=0; i<count; i++) { @@ -6940,7 +6940,7 @@ extern int slurmdb_unpack_txn_cond(void **object, uint16_t rpc_version, } safe_unpack32(&count, buffer); - if(count != NO_VAL) { + if (count != NO_VAL) { object_ptr->name_list = list_create(slurm_destroy_char); for(i=0; i<count; i++) { @@ -6954,7 +6954,7 @@ extern int slurmdb_unpack_txn_cond(void **object, uint16_t rpc_version, safe_unpack_time(&object_ptr->time_start, buffer); safe_unpack32(&count, buffer); - if(count != NO_VAL) { + if (count != NO_VAL) { object_ptr->user_list = list_create(slurm_destroy_char); for(i=0; i<count; i++) { @@ -6983,8 +6983,8 @@ extern void slurmdb_pack_wckey_cond(void *in, uint16_t rpc_version, Buf buffer) ListIterator itr = NULL; slurmdb_wckey_cond_t *object = (slurmdb_wckey_cond_t *)in; - if(rpc_version >= 8) { - if(!object) { + if (rpc_version >= 8) { + if (!object) { pack32(NO_VAL, buffer); pack32(NO_VAL, buffer); pack32(NO_VAL, buffer); @@ -7001,11 +7001,11 @@ extern void slurmdb_pack_wckey_cond(void *in, uint16_t rpc_version, Buf buffer) return; } - if(object->cluster_list) + if (object->cluster_list) count = list_count(object->cluster_list); pack32(count, buffer); - if(count && count != NO_VAL) { + if (count && count != NO_VAL) { itr = list_iterator_create(object->cluster_list); while((tmp_info = list_next(itr))) { packstr(tmp_info, buffer); @@ -7014,11 +7014,11 @@ extern void slurmdb_pack_wckey_cond(void *in, uint16_t rpc_version, Buf buffer) } count = NO_VAL; - if(object->id_list) + if (object->id_list) count = list_count(object->id_list); pack32(count, buffer); - if(count && count != NO_VAL) { + if (count && count != NO_VAL) { itr = list_iterator_create(object->id_list); while((tmp_info = list_next(itr))) { packstr(tmp_info, buffer); @@ -7026,11 +7026,11 @@ extern void slurmdb_pack_wckey_cond(void *in, uint16_t rpc_version, Buf buffer) } count = NO_VAL; - if(object->name_list) + if (object->name_list) count = list_count(object->name_list); pack32(count, buffer); - if(count && count != NO_VAL) { + if (count && count != NO_VAL) { itr = list_iterator_create(object->name_list); while((tmp_info = list_next(itr))) { packstr(tmp_info, buffer); @@ -7044,11 +7044,11 @@ extern void slurmdb_pack_wckey_cond(void *in, uint16_t rpc_version, Buf buffer) pack_time(object->usage_end, buffer); pack_time(object->usage_start, buffer); - if(object->user_list) + if (object->user_list) count = list_count(object->user_list); pack32(count, buffer); - if(count && count != NO_VAL) { + if (count && count != NO_VAL) { itr = list_iterator_create(object->user_list); while((tmp_info = list_next(itr))) { packstr(tmp_info, buffer); @@ -7060,7 +7060,7 @@ extern void slurmdb_pack_wckey_cond(void *in, uint16_t rpc_version, Buf buffer) pack16(object->with_usage, buffer); pack16(object->with_deleted, buffer); } else if (rpc_version >= 5) { - if(!object) { + if (!object) { pack32(NO_VAL, buffer); pack32(NO_VAL, buffer); pack32(NO_VAL, buffer); @@ -7075,11 +7075,11 @@ extern void slurmdb_pack_wckey_cond(void *in, uint16_t rpc_version, Buf buffer) return; } - if(object->cluster_list) + if (object->cluster_list) count = list_count(object->cluster_list); pack32(count, buffer); - if(count && count != NO_VAL) { + if (count && count != NO_VAL) { itr = list_iterator_create(object->cluster_list); while((tmp_info = list_next(itr))) { packstr(tmp_info, buffer); @@ -7088,11 +7088,11 @@ extern void slurmdb_pack_wckey_cond(void *in, uint16_t rpc_version, Buf buffer) } count = NO_VAL; - if(object->id_list) + if (object->id_list) count = list_count(object->id_list); pack32(count, buffer); - if(count && count != NO_VAL) { + if (count && count != NO_VAL) { itr = list_iterator_create(object->id_list); while((tmp_info = list_next(itr))) { packstr(tmp_info, buffer); @@ -7100,11 +7100,11 @@ extern void slurmdb_pack_wckey_cond(void *in, uint16_t rpc_version, Buf buffer) } count = NO_VAL; - if(object->name_list) + if (object->name_list) count = list_count(object->name_list); pack32(count, buffer); - if(count && count != NO_VAL) { + if (count && count != NO_VAL) { itr = list_iterator_create(object->name_list); while((tmp_info = list_next(itr))) { packstr(tmp_info, buffer); @@ -7116,11 +7116,11 @@ extern void slurmdb_pack_wckey_cond(void *in, uint16_t rpc_version, Buf buffer) pack_time(object->usage_end, buffer); pack_time(object->usage_start, buffer); - if(object->user_list) + if (object->user_list) count = list_count(object->user_list); pack32(count, buffer); - if(count && count != NO_VAL) { + if (count && count != NO_VAL) { itr = list_iterator_create(object->user_list); while((tmp_info = list_next(itr))) { packstr(tmp_info, buffer); @@ -7148,7 +7148,7 @@ extern int slurmdb_unpack_wckey_cond(void **object, uint16_t rpc_version, if (rpc_version >= 8) { safe_unpack32(&count, buffer); - if(count != NO_VAL) { + if (count != NO_VAL) { object_ptr->cluster_list = list_create(slurm_destroy_char); for(i=0; i<count; i++) { @@ -7160,7 +7160,7 @@ extern int slurmdb_unpack_wckey_cond(void **object, uint16_t rpc_version, } safe_unpack32(&count, buffer); - if(count != NO_VAL) { + if (count != NO_VAL) { object_ptr->id_list = list_create(slurm_destroy_char); for(i=0; i<count; i++) { safe_unpackstr_xmalloc(&tmp_info, &uint32_tmp, @@ -7170,7 +7170,7 @@ extern int slurmdb_unpack_wckey_cond(void **object, uint16_t rpc_version, } safe_unpack32(&count, buffer); - if(count != NO_VAL) { + if (count != NO_VAL) { object_ptr->name_list = list_create(slurm_destroy_char); for(i=0; i<count; i++) { @@ -7186,7 +7186,7 @@ extern int slurmdb_unpack_wckey_cond(void **object, uint16_t rpc_version, safe_unpack_time(&object_ptr->usage_start, buffer); safe_unpack32(&count, buffer); - if(count != NO_VAL) { + if (count != NO_VAL) { object_ptr->user_list = list_create(slurm_destroy_char); for(i=0; i<count; i++) { @@ -7200,7 +7200,7 @@ extern int slurmdb_unpack_wckey_cond(void **object, uint16_t rpc_version, safe_unpack16(&object_ptr->with_deleted, buffer); } else if (rpc_version >= 5) { safe_unpack32(&count, buffer); - if(count != NO_VAL) { + if (count != NO_VAL) { object_ptr->cluster_list = list_create(slurm_destroy_char); for(i=0; i<count; i++) { @@ -7212,7 +7212,7 @@ extern int slurmdb_unpack_wckey_cond(void **object, uint16_t rpc_version, } safe_unpack32(&count, buffer); - if(count != NO_VAL) { + if (count != NO_VAL) { object_ptr->id_list = list_create(slurm_destroy_char); for(i=0; i<count; i++) { safe_unpackstr_xmalloc(&tmp_info, &uint32_tmp, @@ -7222,7 +7222,7 @@ extern int slurmdb_unpack_wckey_cond(void **object, uint16_t rpc_version, } safe_unpack32(&count, buffer); - if(count != NO_VAL) { + if (count != NO_VAL) { object_ptr->name_list = list_create(slurm_destroy_char); for(i=0; i<count; i++) { @@ -7236,7 +7236,7 @@ extern int slurmdb_unpack_wckey_cond(void **object, uint16_t rpc_version, safe_unpack_time(&object_ptr->usage_start, buffer); safe_unpack32(&count, buffer); - if(count != NO_VAL) { + if (count != NO_VAL) { object_ptr->user_list = list_create(slurm_destroy_char); for(i=0; i<count; i++) { @@ -7262,8 +7262,8 @@ extern void slurmdb_pack_archive_cond(void *in, uint16_t rpc_version, { slurmdb_archive_cond_t *object = (slurmdb_archive_cond_t *)in; - if(rpc_version >= 8) { - if(!object) { + if (rpc_version >= 8) { + if (!object) { packnull(buffer); packnull(buffer); slurmdb_pack_job_cond(NULL, rpc_version, buffer); @@ -7282,7 +7282,7 @@ extern void slurmdb_pack_archive_cond(void *in, uint16_t rpc_version, pack32(object->purge_step, buffer); pack32(object->purge_suspend, buffer); } else { - if(!object) { + if (!object) { packnull(buffer); pack16((uint16_t)0, buffer); pack16((uint16_t)0, buffer); @@ -7324,12 +7324,12 @@ extern int slurmdb_unpack_archive_cond(void **object, uint16_t rpc_version, *object = object_ptr; - if(rpc_version >= 8) { + if (rpc_version >= 8) { safe_unpackstr_xmalloc(&object_ptr->archive_dir, &uint32_tmp, buffer); safe_unpackstr_xmalloc(&object_ptr->archive_script, &uint32_tmp, buffer); - if(slurmdb_unpack_job_cond((void *)&object_ptr->job_cond, + if (slurmdb_unpack_job_cond((void *)&object_ptr->job_cond, rpc_version, buffer) == SLURM_ERROR) goto unpack_error; safe_unpack32(&object_ptr->purge_event, buffer); @@ -7347,36 +7347,36 @@ extern int slurmdb_unpack_archive_cond(void **object, uint16_t rpc_version, &uint32_tmp, buffer); safe_unpack16(&a_steps, buffer); safe_unpack16(&a_suspend, buffer); - if(slurmdb_unpack_job_cond((void *)&object_ptr->job_cond, + if (slurmdb_unpack_job_cond((void *)&object_ptr->job_cond, rpc_version, buffer) == SLURM_ERROR) goto unpack_error; safe_unpack16(&tmp16, buffer); object_ptr->purge_event = tmp16; - if(tmp16 != (uint16_t)NO_VAL) { + if (tmp16 != (uint16_t)NO_VAL) { object_ptr->purge_event |= SLURMDB_PURGE_MONTHS; - if(a_events) + if (a_events) object_ptr->purge_event |= SLURMDB_PURGE_ARCHIVE; } safe_unpack16(&tmp16, buffer); object_ptr->purge_job = tmp16; - if(tmp16 != (uint16_t)NO_VAL) { + if (tmp16 != (uint16_t)NO_VAL) { object_ptr->purge_job |= SLURMDB_PURGE_MONTHS; - if(a_jobs) + if (a_jobs) object_ptr->purge_job |= SLURMDB_PURGE_ARCHIVE; } safe_unpack16(&tmp16, buffer); object_ptr->purge_step = tmp16; - if(tmp16 != (uint16_t)NO_VAL) { + if (tmp16 != (uint16_t)NO_VAL) { object_ptr->purge_step |= SLURMDB_PURGE_MONTHS; - if(a_steps) + if (a_steps) object_ptr->purge_step |= SLURMDB_PURGE_ARCHIVE; } safe_unpack16(&tmp16, buffer); object_ptr->purge_suspend = tmp16; - if(tmp16 != (uint16_t)NO_VAL) { + if (tmp16 != (uint16_t)NO_VAL) { object_ptr->purge_suspend |= SLURMDB_PURGE_MONTHS; - if(a_suspend) + if (a_suspend) object_ptr->purge_suspend |= SLURMDB_PURGE_ARCHIVE; } @@ -7435,11 +7435,11 @@ extern void slurmdb_pack_update_object(slurmdb_update_object_t *object, } pack16(object->type, buffer); - if(object->objects) + if (object->objects) count = list_count(object->objects); pack32(count, buffer); - if(count && count != NO_VAL) { + if (count && count != NO_VAL) { itr = list_iterator_create(object->objects); while((slurmdb_object = list_next(itr))) { (*(my_function))(slurmdb_object, rpc_version, buffer); @@ -7501,10 +7501,10 @@ extern int slurmdb_unpack_update_object(slurmdb_update_object_t **object, goto unpack_error; } safe_unpack32(&count, buffer); - if(count != NO_VAL) { + if (count != NO_VAL) { object_ptr->objects = list_create((*(my_destroy))); for(i=0; i<count; i++) { - if(((*(my_function))(&slurmdb_object, + if (((*(my_function))(&slurmdb_object, rpc_version, buffer)) == SLURM_ERROR) goto unpack_error; diff --git a/src/common/slurmdbd_defs.c b/src/common/slurmdbd_defs.c index dd96e864475..a7049e5c0c9 100644 --- a/src/common/slurmdbd_defs.c +++ b/src/common/slurmdbd_defs.c @@ -195,11 +195,11 @@ extern int slurm_open_slurmdbd_conn(char *auth_info, if ((callbacks != NULL) && ((agent_tid == 0) || (agent_list == NULL))) _create_agent(); - else if(agent_list) + else if (agent_list) _load_dbd_state(); slurm_mutex_unlock(&agent_lock); - if(tmp_errno) { + if (tmp_errno) { errno = tmp_errno; return tmp_errno; } else if (slurmdbd_fd < 0) @@ -313,7 +313,7 @@ extern int slurm_send_recv_slurmdbd_msg(uint16_t rpc_version, if (slurmdbd_fd < 0) { /* Either slurm_open_slurmdbd_conn() was not executed or * the connection to Slurm DBD has been closed */ - if(req->msg_type == DBD_GET_CONFIG) + if (req->msg_type == DBD_GET_CONFIG) _open_slurmdbd_fd(0); else _open_slurmdbd_fd(1); @@ -323,7 +323,7 @@ extern int slurm_send_recv_slurmdbd_msg(uint16_t rpc_version, } } - if(!(buffer = pack_slurmdbd_msg(req, rpc_version))) { + if (!(buffer = pack_slurmdbd_msg(req, rpc_version))) { rc = SLURM_ERROR; goto end_it; } @@ -453,7 +453,7 @@ again: if (try_backup) { try_backup = false; xfree(slurmdbd_host); - if((slurmdbd_host = + if ((slurmdbd_host = slurm_get_accounting_storage_backup_host())) goto again; } @@ -853,157 +853,157 @@ unpack_error: extern slurmdbd_msg_type_t str_2_slurmdbd_msg_type(char *msg_type) { - if(!msg_type) { + if (!msg_type) { return NO_VAL; - } else if(!strcasecmp(msg_type, "Init")) { + } else if (!strcasecmp(msg_type, "Init")) { return DBD_INIT; - } else if(!strcasecmp(msg_type, "Fini")) { + } else if (!strcasecmp(msg_type, "Fini")) { return DBD_FINI; - } else if(!strcasecmp(msg_type, "Add Accounts")) { + } else if (!strcasecmp(msg_type, "Add Accounts")) { return DBD_ADD_ACCOUNTS; - } else if(!strcasecmp(msg_type, "Add Account Coord")) { + } else if (!strcasecmp(msg_type, "Add Account Coord")) { return DBD_ADD_ACCOUNT_COORDS; - } else if(!strcasecmp(msg_type, "Add Associations")) { + } else if (!strcasecmp(msg_type, "Add Associations")) { return DBD_ADD_ASSOCS; - } else if(!strcasecmp(msg_type, "Add Clusters")) { + } else if (!strcasecmp(msg_type, "Add Clusters")) { return DBD_ADD_CLUSTERS; - } else if(!strcasecmp(msg_type, "Add Users")) { + } else if (!strcasecmp(msg_type, "Add Users")) { return DBD_ADD_USERS; - } else if(!strcasecmp(msg_type, "Cluster Processors")) { + } else if (!strcasecmp(msg_type, "Cluster Processors")) { return DBD_CLUSTER_CPUS; - } else if(!strcasecmp(msg_type, "Flush Jobs")) { + } else if (!strcasecmp(msg_type, "Flush Jobs")) { return DBD_FLUSH_JOBS; - } else if(!strcasecmp(msg_type, "Get Accounts")) { + } else if (!strcasecmp(msg_type, "Get Accounts")) { return DBD_GET_ACCOUNTS; - } else if(!strcasecmp(msg_type, "Get Associations")) { + } else if (!strcasecmp(msg_type, "Get Associations")) { return DBD_GET_ASSOCS; - } else if(!strcasecmp(msg_type, "Get Association Usage")) { + } else if (!strcasecmp(msg_type, "Get Association Usage")) { return DBD_GET_ASSOC_USAGE; - } else if(!strcasecmp(msg_type, "Get Clusters")) { + } else if (!strcasecmp(msg_type, "Get Clusters")) { return DBD_GET_CLUSTERS; - } else if(!strcasecmp(msg_type, "Get Cluster Usage")) { + } else if (!strcasecmp(msg_type, "Get Cluster Usage")) { return DBD_GET_CLUSTER_USAGE; - } else if(!strcasecmp(msg_type, "Get Events")) { + } else if (!strcasecmp(msg_type, "Get Events")) { return DBD_GET_EVENTS; - } else if(!strcasecmp(msg_type, "Get Jobs")) { + } else if (!strcasecmp(msg_type, "Get Jobs")) { return DBD_GET_JOBS; - } else if(!strcasecmp(msg_type, "Get Problems")) { + } else if (!strcasecmp(msg_type, "Get Problems")) { return DBD_GET_PROBS; - } else if(!strcasecmp(msg_type, "Get Users")) { + } else if (!strcasecmp(msg_type, "Get Users")) { return DBD_GET_USERS; - } else if(!strcasecmp(msg_type, "Got Accounts")) { + } else if (!strcasecmp(msg_type, "Got Accounts")) { return DBD_GOT_ACCOUNTS; - } else if(!strcasecmp(msg_type, "Got Associations")) { + } else if (!strcasecmp(msg_type, "Got Associations")) { return DBD_GOT_ASSOCS; - } else if(!strcasecmp(msg_type, "Got Association Usage")) { + } else if (!strcasecmp(msg_type, "Got Association Usage")) { return DBD_GOT_ASSOC_USAGE; - } else if(!strcasecmp(msg_type, "Got Clusters")) { + } else if (!strcasecmp(msg_type, "Got Clusters")) { return DBD_GOT_CLUSTERS; - } else if(!strcasecmp(msg_type, "Got Cluster Usage")) { + } else if (!strcasecmp(msg_type, "Got Cluster Usage")) { return DBD_GOT_CLUSTER_USAGE; - } else if(!strcasecmp(msg_type, "Got Events")) { + } else if (!strcasecmp(msg_type, "Got Events")) { return DBD_GOT_EVENTS; - } else if(!strcasecmp(msg_type, "Got Jobs")) { + } else if (!strcasecmp(msg_type, "Got Jobs")) { return DBD_GOT_JOBS; - } else if(!strcasecmp(msg_type, "Got List")) { + } else if (!strcasecmp(msg_type, "Got List")) { return DBD_GOT_LIST; - } else if(!strcasecmp(msg_type, "Got Problems")) { + } else if (!strcasecmp(msg_type, "Got Problems")) { return DBD_GOT_PROBS; - } else if(!strcasecmp(msg_type, "Got Users")) { + } else if (!strcasecmp(msg_type, "Got Users")) { return DBD_GOT_USERS; - } else if(!strcasecmp(msg_type, "Job Complete")) { + } else if (!strcasecmp(msg_type, "Job Complete")) { return DBD_JOB_COMPLETE; - } else if(!strcasecmp(msg_type, "Job Start")) { + } else if (!strcasecmp(msg_type, "Job Start")) { return DBD_JOB_START; - } else if(!strcasecmp(msg_type, "ID RC")) { + } else if (!strcasecmp(msg_type, "ID RC")) { return DBD_ID_RC; - } else if(!strcasecmp(msg_type, "Job Suspend")) { + } else if (!strcasecmp(msg_type, "Job Suspend")) { return DBD_JOB_SUSPEND; - } else if(!strcasecmp(msg_type, "Modify Accounts")) { + } else if (!strcasecmp(msg_type, "Modify Accounts")) { return DBD_MODIFY_ACCOUNTS; - } else if(!strcasecmp(msg_type, "Modify Associations")) { + } else if (!strcasecmp(msg_type, "Modify Associations")) { return DBD_MODIFY_ASSOCS; - } else if(!strcasecmp(msg_type, "Modify Clusters")) { + } else if (!strcasecmp(msg_type, "Modify Clusters")) { return DBD_MODIFY_CLUSTERS; - } else if(!strcasecmp(msg_type, "Modify Job")) { + } else if (!strcasecmp(msg_type, "Modify Job")) { return DBD_MODIFY_JOB; - } else if(!strcasecmp(msg_type, "Modify QOS")) { + } else if (!strcasecmp(msg_type, "Modify QOS")) { return DBD_MODIFY_QOS; - } else if(!strcasecmp(msg_type, "Modify Users")) { + } else if (!strcasecmp(msg_type, "Modify Users")) { return DBD_MODIFY_USERS; - } else if(!strcasecmp(msg_type, "Node State")) { + } else if (!strcasecmp(msg_type, "Node State")) { return DBD_NODE_STATE; - } else if(!strcasecmp(msg_type, "RC")) { + } else if (!strcasecmp(msg_type, "RC")) { return DBD_RC; - } else if(!strcasecmp(msg_type, "Register Cluster")) { + } else if (!strcasecmp(msg_type, "Register Cluster")) { return DBD_REGISTER_CTLD; - } else if(!strcasecmp(msg_type, "Remove Accounts")) { + } else if (!strcasecmp(msg_type, "Remove Accounts")) { return DBD_REMOVE_ACCOUNTS; - } else if(!strcasecmp(msg_type, "Remove Account Coords")) { + } else if (!strcasecmp(msg_type, "Remove Account Coords")) { return DBD_REMOVE_ACCOUNT_COORDS; - } else if(!strcasecmp(msg_type, "Archive Dump")) { + } else if (!strcasecmp(msg_type, "Archive Dump")) { return DBD_ARCHIVE_DUMP; - } else if(!strcasecmp(msg_type, "Archive Load")) { + } else if (!strcasecmp(msg_type, "Archive Load")) { return DBD_ARCHIVE_LOAD; - } else if(!strcasecmp(msg_type, "Remove Associations")) { + } else if (!strcasecmp(msg_type, "Remove Associations")) { return DBD_REMOVE_ASSOCS; - } else if(!strcasecmp(msg_type, "Remove Clusters")) { + } else if (!strcasecmp(msg_type, "Remove Clusters")) { return DBD_REMOVE_CLUSTERS; - } else if(!strcasecmp(msg_type, "Remove Users")) { + } else if (!strcasecmp(msg_type, "Remove Users")) { return DBD_REMOVE_USERS; - } else if(!strcasecmp(msg_type, "Roll Usage")) { + } else if (!strcasecmp(msg_type, "Roll Usage")) { return DBD_ROLL_USAGE; - } else if(!strcasecmp(msg_type, "Step Complete")) { + } else if (!strcasecmp(msg_type, "Step Complete")) { return DBD_STEP_COMPLETE; - } else if(!strcasecmp(msg_type, "Step Start")) { + } else if (!strcasecmp(msg_type, "Step Start")) { return DBD_STEP_START; - } else if(!strcasecmp(msg_type, "Get Jobs Conditional")) { + } else if (!strcasecmp(msg_type, "Get Jobs Conditional")) { return DBD_GET_JOBS_COND; - } else if(!strcasecmp(msg_type, "Get Transations")) { + } else if (!strcasecmp(msg_type, "Get Transations")) { return DBD_GET_TXN; - } else if(!strcasecmp(msg_type, "Got Transations")) { + } else if (!strcasecmp(msg_type, "Got Transations")) { return DBD_GOT_TXN; - } else if(!strcasecmp(msg_type, "Add QOS")) { + } else if (!strcasecmp(msg_type, "Add QOS")) { return DBD_ADD_QOS; - } else if(!strcasecmp(msg_type, "Get QOS")) { + } else if (!strcasecmp(msg_type, "Get QOS")) { return DBD_GET_QOS; - } else if(!strcasecmp(msg_type, "Got QOS")) { + } else if (!strcasecmp(msg_type, "Got QOS")) { return DBD_GOT_QOS; - } else if(!strcasecmp(msg_type, "Remove QOS")) { + } else if (!strcasecmp(msg_type, "Remove QOS")) { return DBD_REMOVE_QOS; - } else if(!strcasecmp(msg_type, "Add WCKeys")) { + } else if (!strcasecmp(msg_type, "Add WCKeys")) { return DBD_ADD_WCKEYS; - } else if(!strcasecmp(msg_type, "Get WCKeys")) { + } else if (!strcasecmp(msg_type, "Get WCKeys")) { return DBD_GET_WCKEYS; - } else if(!strcasecmp(msg_type, "Got WCKeys")) { + } else if (!strcasecmp(msg_type, "Got WCKeys")) { return DBD_GOT_WCKEYS; - } else if(!strcasecmp(msg_type, "Remove WCKeys")) { + } else if (!strcasecmp(msg_type, "Remove WCKeys")) { return DBD_REMOVE_WCKEYS; - } else if(!strcasecmp(msg_type, "Get WCKey Usage")) { + } else if (!strcasecmp(msg_type, "Get WCKey Usage")) { return DBD_GET_WCKEY_USAGE; - } else if(!strcasecmp(msg_type, "Got WCKey Usage")) { + } else if (!strcasecmp(msg_type, "Got WCKey Usage")) { return DBD_GOT_WCKEY_USAGE; - } else if(!strcasecmp(msg_type, "Add Reservation")) { + } else if (!strcasecmp(msg_type, "Add Reservation")) { return DBD_ADD_RESV; - } else if(!strcasecmp(msg_type, "Remove Reservation")) { + } else if (!strcasecmp(msg_type, "Remove Reservation")) { return DBD_REMOVE_RESV; - } else if(!strcasecmp(msg_type, "Modify Reservation")) { + } else if (!strcasecmp(msg_type, "Modify Reservation")) { return DBD_MODIFY_RESV; - } else if(!strcasecmp(msg_type, "Get Reservations")) { + } else if (!strcasecmp(msg_type, "Get Reservations")) { return DBD_GET_RESVS; - } else if(!strcasecmp(msg_type, "Got Reservations")) { + } else if (!strcasecmp(msg_type, "Got Reservations")) { return DBD_GOT_RESVS; - } else if(!strcasecmp(msg_type, "Get Config")) { + } else if (!strcasecmp(msg_type, "Get Config")) { return DBD_GET_CONFIG; - } else if(!strcasecmp(msg_type, "Got Config")) { + } else if (!strcasecmp(msg_type, "Got Config")) { return DBD_GOT_CONFIG; - } else if(!strcasecmp(msg_type, "Send Multiple Job Starts")) { + } else if (!strcasecmp(msg_type, "Send Multiple Job Starts")) { return DBD_SEND_MULT_JOB_START; - } else if(!strcasecmp(msg_type, "Got Multiple Job Starts")) { + } else if (!strcasecmp(msg_type, "Got Multiple Job Starts")) { return DBD_GOT_MULT_JOB_START; - } else if(!strcasecmp(msg_type, "Send Multiple Messages")) { + } else if (!strcasecmp(msg_type, "Send Multiple Messages")) { return DBD_SEND_MULT_MSG; - } else if(!strcasecmp(msg_type, "Got Multiple Message Returns")) { + } else if (!strcasecmp(msg_type, "Got Multiple Message Returns")) { return DBD_GOT_MULT_MSG; } else { return NO_VAL; @@ -1016,451 +1016,451 @@ extern char *slurmdbd_msg_type_2_str(slurmdbd_msg_type_t msg_type, int get_enum) { switch(msg_type) { case DBD_INIT: - if(get_enum) { + if (get_enum) { return "DBD_INIT"; } else return "Init"; break; case DBD_FINI: - if(get_enum) { + if (get_enum) { return "DBD_FINI"; } else return "Fini"; break; case DBD_ADD_ACCOUNTS: - if(get_enum) { + if (get_enum) { return "DBD_ADD_ACCOUNTS"; } else return "Add Accounts"; break; case DBD_ADD_ACCOUNT_COORDS: - if(get_enum) { + if (get_enum) { return "DBD_ADD_ACCOUNT_COORDS"; } else return "Add Account Coord"; break; case DBD_ADD_ASSOCS: - if(get_enum) { + if (get_enum) { return "DBD_ADD_ASSOCS"; } else return "Add Associations"; break; case DBD_ADD_CLUSTERS: - if(get_enum) { + if (get_enum) { return "DBD_ADD_CLUSTERS"; } else return "Add Clusters"; break; case DBD_ADD_USERS: - if(get_enum) { + if (get_enum) { return "DBD_ADD_USERS"; } else return "Add Users"; break; case DBD_CLUSTER_CPUS: - if(get_enum) { + if (get_enum) { return "DBD_CLUSTER_CPUS"; } else return "Cluster Processors"; break; case DBD_FLUSH_JOBS: - if(get_enum) { + if (get_enum) { return "DBD_FLUSH_JOBS"; } else return "Flush Jobs"; break; case DBD_GET_ACCOUNTS: - if(get_enum) { + if (get_enum) { return "DBD_GET_ACCOUNTS"; } else return "Get Accounts"; break; case DBD_GET_ASSOCS: - if(get_enum) { + if (get_enum) { return "DBD_GET_ASSOCS"; } else return "Get Associations"; break; case DBD_GET_ASSOC_USAGE: - if(get_enum) { + if (get_enum) { return "DBD_GET_ASSOC_USAGE"; } else return "Get Association Usage"; break; case DBD_GET_CLUSTERS: - if(get_enum) { + if (get_enum) { return "DBD_GET_CLUSTERS"; } else return "Get Clusters"; break; case DBD_GET_CLUSTER_USAGE: - if(get_enum) { + if (get_enum) { return "DBD_GET_CLUSTER_USAGE"; } else return "Get Cluster Usage"; break; case DBD_GET_EVENTS: - if(get_enum) { + if (get_enum) { return "DBD_GET_EVENTS"; } else return "Get Events"; break; case DBD_GET_JOBS: - if(get_enum) { + if (get_enum) { return "DBD_GET_JOBS"; } else return "Get Jobs"; break; case DBD_GET_PROBS: - if(get_enum) { + if (get_enum) { return "DBD_GET_PROBS"; } else return "Get Problems"; break; case DBD_GET_USERS: - if(get_enum) { + if (get_enum) { return "DBD_GET_USERS"; } else return "Get Users"; break; case DBD_GOT_ACCOUNTS: - if(get_enum) { + if (get_enum) { return "DBD_GOT_ACCOUNTS"; } else return "Got Accounts"; break; case DBD_GOT_ASSOCS: - if(get_enum) { + if (get_enum) { return "DBD_GOT_ASSOCS"; } else return "Got Associations"; break; case DBD_GOT_ASSOC_USAGE: - if(get_enum) { + if (get_enum) { return "DBD_GOT_ASSOC_USAGE"; } else return "Got Association Usage"; break; case DBD_GOT_CLUSTERS: - if(get_enum) { + if (get_enum) { return "DBD_GOT_CLUSTERS"; } else return "Got Clusters"; break; case DBD_GOT_CLUSTER_USAGE: - if(get_enum) { + if (get_enum) { return "DBD_GOT_CLUSTER_USAGE"; } else return "Got Cluster Usage"; break; case DBD_GOT_EVENTS: - if(get_enum) { + if (get_enum) { return "DBD_GOT_EVENTS"; } else return "Got Events"; break; case DBD_GOT_JOBS: - if(get_enum) { + if (get_enum) { return "DBD_GOT_JOBS"; } else return "Got Jobs"; break; case DBD_GOT_LIST: - if(get_enum) { + if (get_enum) { return "DBD_GOT_LIST"; } else return "Got List"; break; case DBD_GOT_PROBS: - if(get_enum) { + if (get_enum) { return "DBD_GOT_PROBS"; } else return "Got Problems"; break; case DBD_GOT_USERS: - if(get_enum) { + if (get_enum) { return "DBD_GOT_USERS"; } else return "Got Users"; break; case DBD_JOB_COMPLETE: - if(get_enum) { + if (get_enum) { return "DBD_JOB_COMPLETE"; } else return "Job Complete"; break; case DBD_JOB_START: - if(get_enum) { + if (get_enum) { return "DBD_JOB_START"; } else return "Job Start"; break; case DBD_ID_RC: - if(get_enum) { + if (get_enum) { return "DBD_ID_RC"; } else return "ID RC"; break; case DBD_JOB_SUSPEND: - if(get_enum) { + if (get_enum) { return "DBD_JOB_SUSPEND"; } else return "Job Suspend"; break; case DBD_MODIFY_ACCOUNTS: - if(get_enum) { + if (get_enum) { return "DBD_MODIFY_ACCOUNTS"; } else return "Modify Accounts"; break; case DBD_MODIFY_ASSOCS: - if(get_enum) { + if (get_enum) { return "DBD_MODIFY_ASSOCS"; } else return "Modify Associations"; break; case DBD_MODIFY_CLUSTERS: - if(get_enum) { + if (get_enum) { return "DBD_MODIFY_CLUSTERS"; } else return "Modify Clusters"; break; case DBD_MODIFY_JOB: - if(get_enum) { + if (get_enum) { return "DBD_MODIFY_JOB"; } else return "Modify Job"; break; case DBD_MODIFY_QOS: - if(get_enum) { + if (get_enum) { return "DBD_MODIFY_QOS"; } else return "Modify QOS"; break; case DBD_MODIFY_USERS: - if(get_enum) { + if (get_enum) { return "DBD_MODIFY_USERS"; } else return "Modify Users"; break; case DBD_NODE_STATE: - if(get_enum) { + if (get_enum) { return "DBD_NODE_STATE"; } else return "Node State"; break; case DBD_RC: - if(get_enum) { + if (get_enum) { return "DBD_RC"; } else return "Return Code"; break; case DBD_REGISTER_CTLD: - if(get_enum) { + if (get_enum) { return "DBD_REGISTER_CTLD"; } else return "Register Cluster"; break; case DBD_REMOVE_ACCOUNTS: - if(get_enum) { + if (get_enum) { return "DBD_REMOVE_ACCOUNTS"; } else return "Remove Accounts"; break; case DBD_REMOVE_ACCOUNT_COORDS: - if(get_enum) { + if (get_enum) { return "DBD_REMOVE_ACCOUNT_COORDS"; } else return "Remove Account Coords"; break; case DBD_ARCHIVE_DUMP: - if(get_enum) { + if (get_enum) { return "DBD_ARCHIVE_DUMP"; } else return "Archive Dump"; break; case DBD_ARCHIVE_LOAD: - if(get_enum) { + if (get_enum) { return "DBD_ARCHIVE_LOAD"; } else return "Archive Load"; break; case DBD_REMOVE_ASSOCS: - if(get_enum) { + if (get_enum) { return "DBD_REMOVE_ASSOCS"; } else return "Remove Associations"; break; case DBD_REMOVE_CLUSTERS: - if(get_enum) { + if (get_enum) { return "DBD_REMOVE_CLUSTERS"; } else return "Remove Clusters"; break; case DBD_REMOVE_USERS: - if(get_enum) { + if (get_enum) { return "DBD_REMOVE_USERS"; } else return "Remove Users"; break; case DBD_ROLL_USAGE: - if(get_enum) { + if (get_enum) { return "DBD_ROLL_USAGE"; } else return "Roll Usage"; break; case DBD_STEP_COMPLETE: - if(get_enum) { + if (get_enum) { return "DBD_STEP_COMPLETE"; } else return "Step Complete"; break; case DBD_STEP_START: - if(get_enum) { + if (get_enum) { return "DBD_STEP_START"; } else return "Step Start"; break; case DBD_GET_JOBS_COND: - if(get_enum) { + if (get_enum) { return "DBD_GET_JOBS_COND"; } else return "Get Jobs Conditional"; break; case DBD_GET_TXN: - if(get_enum) { + if (get_enum) { return "DBD_GET_TXN"; } else return "Get Transations"; break; case DBD_GOT_TXN: - if(get_enum) { + if (get_enum) { return "DBD_GOT_TXN"; } else return "Got Transations"; break; case DBD_ADD_QOS: - if(get_enum) { + if (get_enum) { return "DBD_ADD_QOS"; } else return "Add QOS"; break; case DBD_GET_QOS: - if(get_enum) { + if (get_enum) { return "DBD_GET_QOS"; } else return "Get QOS"; break; case DBD_GOT_QOS: - if(get_enum) { + if (get_enum) { return "DBD_GOT_QOS"; } else return "Got QOS"; break; case DBD_REMOVE_QOS: - if(get_enum) { + if (get_enum) { return "DBD_REMOVE_QOS"; } else return "Remove QOS"; break; case DBD_ADD_WCKEYS: - if(get_enum) { + if (get_enum) { return "DBD_ADD_WCKEYS"; } else return "Add WCKeys"; break; case DBD_GET_WCKEYS: - if(get_enum) { + if (get_enum) { return "DBD_GET_WCKEYS"; } else return "Get WCKeys"; break; case DBD_GOT_WCKEYS: - if(get_enum) { + if (get_enum) { return "DBD_GOT_WCKEYS"; } else return "Got WCKeys"; break; case DBD_REMOVE_WCKEYS: - if(get_enum) { + if (get_enum) { return "DBD_REMOVE_WCKEYS"; } else return "Remove WCKeys"; break; case DBD_GET_WCKEY_USAGE: - if(get_enum) { + if (get_enum) { return "DBD_GET_WCKEY_USAGE"; } else return "Get WCKey Usage"; break; case DBD_GOT_WCKEY_USAGE: - if(get_enum) { + if (get_enum) { return "DBD_GOT_WCKEY_USAGE"; } else return "Got WCKey Usage"; break; case DBD_ADD_RESV: - if(get_enum) { + if (get_enum) { return "DBD_ADD_RESV"; } else return "Add Reservation"; break; case DBD_REMOVE_RESV: - if(get_enum) { + if (get_enum) { return "DBD_REMOVE_RESV"; } else return "Remove Reservation"; break; case DBD_MODIFY_RESV: - if(get_enum) { + if (get_enum) { return "DBD_MODIFY_RESV"; } else return "Modify Reservation"; break; case DBD_GET_RESVS: - if(get_enum) { + if (get_enum) { return "DBD_GET_RESVS"; } else return "Get Reservations"; break; case DBD_GOT_RESVS: - if(get_enum) { + if (get_enum) { return "DBD_GOT_RESVS"; } else return "Got Reservations"; break; case DBD_GET_CONFIG: - if(get_enum) { + if (get_enum) { return "DBD_GET_CONFIG"; } else return "Get Config"; break; case DBD_GOT_CONFIG: - if(get_enum) { + if (get_enum) { return "DBD_GOT_CONFIG"; } else return "Got Config"; break; case DBD_SEND_MULT_JOB_START: - if(get_enum) { + if (get_enum) { return "DBD_SEND_MULT_JOB_START"; } else return "Send Multiple Job Starts"; break; case DBD_GOT_MULT_JOB_START: - if(get_enum) { + if (get_enum) { return "DBD_GOT_MULT_JOB_START"; } else return "Got Multiple Job Starts"; break; case DBD_SEND_MULT_MSG: - if(get_enum) { + if (get_enum) { return "DBD_SEND_MULT_MSG"; } else return "Send Multiple Messages"; break; case DBD_GOT_MULT_MSG: - if(get_enum) { + if (get_enum) { return "DBD_GOT_MULT_MSG"; } else return "Got Multiple Message Returns"; @@ -1476,7 +1476,7 @@ extern char *slurmdbd_msg_type_2_str(slurmdbd_msg_type_t msg_type, int get_enum) extern void slurmdbd_free_buffer(void *x) { Buf buffer = (Buf) x; - if(buffer) + if (buffer) free_buf(buffer); } @@ -1509,9 +1509,9 @@ static int _send_init_msg() read_timeout = slurm_get_msg_timeout() * 1000; rc = _get_return_code(SLURMDBD_VERSION, read_timeout); - if(tmp_errno) + if (tmp_errno) errno = tmp_errno; - else if(rc != SLURM_SUCCESS) + else if (rc != SLURM_SUCCESS) errno = rc; return rc; } @@ -1523,7 +1523,7 @@ static int _send_fini_msg(void) /* If the connection is already gone, we don't need to send a fini. */ - if(_fd_writeable(slurmdbd_fd) == -1) + if (_fd_writeable(slurmdbd_fd) == -1) return SLURM_SUCCESS; buffer = init_buf(1024); @@ -1572,7 +1572,7 @@ static int _send_msg(Buf buffer) return EAGAIN; /* if errno is ACCESS_DENIED do not try to reopen to connection just return that */ - if(errno == ESLURM_ACCESS_DENIED) + if (errno == ESLURM_ACCESS_DENIED) return ESLURM_ACCESS_DENIED; _reopen_slurmdbd_fd(); rc = _fd_writeable(slurmdbd_fd); @@ -2023,7 +2023,7 @@ static void *_agent(void *x) while (agent_shutdown == 0) { /* START_TIMER; */ slurm_mutex_lock(&slurmdbd_lock); - if(halt_agent) + if (halt_agent) pthread_cond_wait(&slurmdbd_cond, &slurmdbd_lock); if ((slurmdbd_fd < 0) && @@ -2080,7 +2080,7 @@ static void *_agent(void *x) slurm_mutex_unlock(&slurmdbd_lock); slurm_mutex_lock(&assoc_cache_mutex); - if(slurmdbd_fd >= 0 && running_cache) + if (slurmdbd_fd >= 0 && running_cache) pthread_cond_signal(&assoc_cache_cond); slurm_mutex_unlock(&assoc_cache_mutex); @@ -2113,7 +2113,7 @@ static void *_agent(void *x) } slurm_mutex_unlock(&slurmdbd_lock); slurm_mutex_lock(&assoc_cache_mutex); - if(slurmdbd_fd >= 0 && running_cache) + if (slurmdbd_fd >= 0 && running_cache) pthread_cond_signal(&assoc_cache_cond); slurm_mutex_unlock(&assoc_cache_mutex); @@ -2137,7 +2137,7 @@ static void *_agent(void *x) /* We still need to free a mult_msg even if we got a failure. */ - if(list_msg.my_list) { + if (list_msg.my_list) { if (list_msg.my_list != agent_list) list_destroy(list_msg.my_list); list_msg.my_list = NULL; @@ -2210,7 +2210,7 @@ static void _save_dbd_state(void) set_buf_offset(buffer, 0); unpack16(&msg_type, buffer); set_buf_offset(buffer, offset); - if(msg_type == DBD_REGISTER_CTLD) { + if (msg_type == DBD_REGISTER_CTLD) { free_buf(buffer); continue; } @@ -2243,7 +2243,7 @@ static void _load_dbd_state(void) fd = open(dbd_fname, O_RDONLY); if (fd < 0) { /* don't print an error message if there is no file */ - if(errno == ENOENT) + if (errno == ENOENT) debug4("slurmdbd: There is no state save file to " "open by name %s", dbd_fname); else @@ -2462,8 +2462,8 @@ static int _purge_job_start_req(void) \****************************************************************************/ extern void slurmdbd_free_acct_coord_msg(dbd_acct_coord_msg_t *msg) { - if(msg) { - if(msg->acct_list) { + if (msg) { + if (msg->acct_list) { list_destroy(msg->acct_list); msg->acct_list = NULL; } @@ -2496,7 +2496,7 @@ extern void slurmdbd_free_rec_msg(dbd_rec_msg_t *msg, fatal("Unknown rec type"); return; } - if(msg->rec) + if (msg->rec) (*(my_destroy))(msg->rec); xfree(msg); } @@ -2553,7 +2553,7 @@ extern void slurmdbd_free_cond_msg(dbd_cond_msg_t *msg, fatal("Unknown cond type"); return; } - if(msg->cond) + if (msg->cond) (*(my_destroy))(msg->cond); xfree(msg); } @@ -2561,7 +2561,7 @@ extern void slurmdbd_free_cond_msg(dbd_cond_msg_t *msg, extern void slurmdbd_free_init_msg(dbd_init_msg_t *msg) { - if(msg) { + if (msg) { xfree(msg->cluster_name); xfree(msg); } @@ -2613,7 +2613,7 @@ extern void slurmdbd_free_job_suspend_msg(dbd_job_suspend_msg_t *msg) extern void slurmdbd_free_list_msg(dbd_list_msg_t *msg) { if (msg) { - if(msg->my_list) + if (msg->my_list) list_destroy(msg->my_list); xfree(msg); } @@ -2656,9 +2656,9 @@ extern void slurmdbd_free_modify_msg(dbd_modify_msg_t *msg, return; } - if(msg->cond) + if (msg->cond) (*(destroy_cond))(msg->cond); - if(msg->rec) + if (msg->rec) (*(destroy_rec))(msg->rec); xfree(msg); } @@ -2675,7 +2675,7 @@ extern void slurmdbd_free_node_state_msg(dbd_node_state_msg_t *msg) extern void slurmdbd_free_rc_msg(dbd_rc_msg_t *msg) { - if(msg) { + if (msg) { xfree(msg->comment); xfree(msg); } @@ -2732,7 +2732,7 @@ extern void slurmdbd_free_usage_msg(dbd_usage_msg_t *msg, return; } - if(msg->rec) + if (msg->rec) (*(destroy_rec))(msg->rec); xfree(msg); } @@ -2749,11 +2749,11 @@ slurmdbd_pack_acct_coord_msg(dbd_acct_coord_msg_t *msg, ListIterator itr = NULL; uint32_t count = 0; - if(msg->acct_list) + if (msg->acct_list) count = list_count(msg->acct_list); pack32(count, buffer); - if(count) { + if (count) { itr = list_iterator_create(msg->acct_list); while((acct = list_next(itr))) { packstr(acct, buffer); @@ -2777,7 +2777,7 @@ slurmdbd_unpack_acct_coord_msg(dbd_acct_coord_msg_t **msg, *msg = msg_ptr; safe_unpack32(&count, buffer); - if(count) { + if (count) { msg_ptr->acct_list = list_create(slurm_destroy_char); for(i=0; i<count; i++) { safe_unpackstr_xmalloc(&acct, &uint32_tmp, buffer); @@ -2785,7 +2785,7 @@ slurmdbd_unpack_acct_coord_msg(dbd_acct_coord_msg_t **msg, } } - if(slurmdb_unpack_user_cond((void *)&msg_ptr->cond, rpc_version, buffer) + if (slurmdb_unpack_user_cond((void *)&msg_ptr->cond, rpc_version, buffer) == SLURM_ERROR) goto unpack_error; return SLURM_SUCCESS; @@ -2873,7 +2873,7 @@ extern int slurmdbd_unpack_rec_msg(dbd_rec_msg_t **msg, msg_ptr = xmalloc(sizeof(dbd_rec_msg_t)); *msg = msg_ptr; - if((*(my_function))(&msg_ptr->rec, rpc_version, buffer) == SLURM_ERROR) + if ((*(my_function))(&msg_ptr->rec, rpc_version, buffer) == SLURM_ERROR) goto unpack_error; return SLURM_SUCCESS; @@ -2995,7 +2995,7 @@ extern int slurmdbd_unpack_cond_msg(dbd_cond_msg_t **msg, msg_ptr = xmalloc(sizeof(dbd_cond_msg_t)); *msg = msg_ptr; - if((*(my_function))(&msg_ptr->cond, rpc_version, buffer) == SLURM_ERROR) + if ((*(my_function))(&msg_ptr->cond, rpc_version, buffer) == SLURM_ERROR) goto unpack_error; return SLURM_SUCCESS; @@ -3056,7 +3056,7 @@ slurmdbd_unpack_init_msg(dbd_init_msg_t **msg, /* We find out the version of the caller right here so use that as the rpc_version. */ - if(msg_ptr->version >= 7) { + if (msg_ptr->version >= 7) { safe_unpackstr_xmalloc(&msg_ptr->cluster_name, &tmp32, buffer); } @@ -3068,7 +3068,7 @@ slurmdbd_unpack_init_msg(dbd_init_msg_t **msg, goto unpack_error; } msg_ptr->uid = g_slurm_auth_get_uid(auth_cred, auth_info); - if(g_slurm_auth_errno(auth_cred) != SLURM_SUCCESS) { + if (g_slurm_auth_errno(auth_cred) != SLURM_SUCCESS) { error("Bad authentication: %s", g_slurm_auth_errstr(g_slurm_auth_errno(auth_cred))); rc = ESLURM_ACCESS_DENIED; @@ -3080,7 +3080,7 @@ slurmdbd_unpack_init_msg(dbd_init_msg_t **msg, unpack_error: slurmdbd_free_init_msg(msg_ptr); *msg = NULL; - if(rc == SLURM_SUCCESS) + if (rc == SLURM_SUCCESS) rc = SLURM_ERROR; return rc; } @@ -3426,14 +3426,14 @@ extern void slurmdbd_pack_list_msg(dbd_list_msg_t *msg, return; } - if(msg->my_list) { + if (msg->my_list) { count = list_count(msg->my_list); pack32(count, buffer); } else { // to let user know there wasn't a list (error) pack32((uint32_t)-1, buffer); } - if(count) { + if (count) { itr = list_iterator_create(msg->my_list); while((object = list_next(itr))) { (*(my_function))(object, rpc_version, buffer); @@ -3441,7 +3441,7 @@ extern void slurmdbd_pack_list_msg(dbd_list_msg_t *msg, list_iterator_destroy(itr); } - if(rpc_version >= 8) + if (rpc_version >= 8) pack32(msg->return_code, buffer); } @@ -3533,21 +3533,21 @@ extern int slurmdbd_unpack_list_msg(dbd_list_msg_t **msg, uint16_t rpc_version, *msg = msg_ptr; safe_unpack32(&count, buffer); - if((int)count > -1) { + if ((int)count > -1) { /* here we are looking to make the list if -1 or higher than 0. If -1 we don't want to have the list be NULL meaning an error occured. */ msg_ptr->my_list = list_create((*(my_destroy))); for(i=0; i<count; i++) { - if(((*(my_function))(&object, rpc_version, buffer)) + if (((*(my_function))(&object, rpc_version, buffer)) == SLURM_ERROR) goto unpack_error; list_append(msg_ptr->my_list, object); } } - if(rpc_version >= 8) + if (rpc_version >= 8) safe_unpack32(&msg_ptr->return_code, buffer); return SLURM_SUCCESS; @@ -3641,9 +3641,9 @@ extern int slurmdbd_unpack_modify_msg(dbd_modify_msg_t **msg, return SLURM_ERROR; } - if((*(my_cond))(&msg_ptr->cond, rpc_version, buffer) == SLURM_ERROR) + if ((*(my_cond))(&msg_ptr->cond, rpc_version, buffer) == SLURM_ERROR) goto unpack_error; - if((*(my_rec))(&msg_ptr->rec, rpc_version, buffer) == SLURM_ERROR) + if ((*(my_rec))(&msg_ptr->rec, rpc_version, buffer) == SLURM_ERROR) goto unpack_error; return SLURM_SUCCESS; @@ -3952,7 +3952,7 @@ extern int slurmdbd_unpack_usage_msg(dbd_usage_msg_t **msg, return SLURM_ERROR; } - if((*(my_rec))(&msg_ptr->rec, rpc_version, buffer) == SLURM_ERROR) + if ((*(my_rec))(&msg_ptr->rec, rpc_version, buffer) == SLURM_ERROR) goto unpack_error; unpack_time(&msg_ptr->start, buffer); @@ -3985,7 +3985,7 @@ extern int slurmdbd_unpack_buffer(void **out, uint32_t uint32_tmp; safe_unpackmem_xmalloc(&msg, &uint32_tmp, buffer); - if(!(out_ptr = create_buf(msg, uint32_tmp))) + if (!(out_ptr = create_buf(msg, uint32_tmp))) goto unpack_error; *out = out_ptr; diff --git a/src/common/stepd_api.c b/src/common/stepd_api.c index 0715a7e6da7..6136bfc6c4f 100644 --- a/src/common/stepd_api.c +++ b/src/common/stepd_api.c @@ -572,7 +572,7 @@ stepd_available(const char *directory, const char *nodename) } l = list_create((ListDelF) _free_step_loc_t); - if(_sockname_regex_init(&re, nodename) == -1) + if (_sockname_regex_init(&re, nodename) == -1) goto done; /* diff --git a/src/common/xstring.c b/src/common/xstring.c index 10a27fcb89b..a3caea739f2 100644 --- a/src/common/xstring.c +++ b/src/common/xstring.c @@ -440,7 +440,7 @@ char *xstrstrip(char *str) char quote_c = '\0'; int quote = 0; - if(!str) + if (!str) return NULL; /* first strip off the ("|')'s */ @@ -452,13 +452,13 @@ char *xstrstrip(char *str) start = i; while(str[i]) { - if(quote && str[i] == quote_c) { + if (quote && str[i] == quote_c) { found = 1; break; } i++; } - if(found) { + if (found) { meat = xmalloc((i-start)+1); memcpy(meat, str+start, (i-start)); } else @@ -515,7 +515,7 @@ bool xstring_is_whitespace(const char *str) */ char *xstrtolower(char *str) { - if(str) { + if (str) { int j = 0; while(str[j]) { str[j] = tolower((int)str[j]); @@ -540,7 +540,7 @@ static char *_xstrdup_vprintf(const char *fmt, va_list ap) char *p = NULL; va_list our_ap; - if((p = xmalloc(size)) == NULL) + if ((p = xmalloc(size)) == NULL) return NULL; while(1) { /* Try to print in the allocated space. */ diff --git a/src/common/xtree.c b/src/common/xtree.c index f1479227425..eb9b7d96d55 100644 --- a/src/common/xtree.c +++ b/src/common/xtree.c @@ -339,7 +339,7 @@ xtree_node_t* xtree_walk(xtree_t* tree, --level; if (!current_node) { return NULL; - } else if(current_node == node) { + } else if (current_node == node) { if (level >= min_level && !action(current_node, XTREE_ENDORDER, diff --git a/src/db_api/cluster_report_functions.c b/src/db_api/cluster_report_functions.c index 7330bc0bf9c..a0f7efbfad8 100644 --- a/src/db_api/cluster_report_functions.c +++ b/src/db_api/cluster_report_functions.c @@ -68,17 +68,17 @@ static void _process_ua(List user_list, slurmdb_association_rec_t *assoc) */ itr = list_iterator_create(user_list); while((slurmdb_report_user = list_next(itr))) { - if(!strcmp(slurmdb_report_user->name, assoc->user) + if (!strcmp(slurmdb_report_user->name, assoc->user) && !strcmp(slurmdb_report_user->acct, assoc->acct)) break; } list_iterator_destroy(itr); - if(!slurmdb_report_user) { + if (!slurmdb_report_user) { struct passwd *passwd_ptr = NULL; uid_t uid = NO_VAL; passwd_ptr = getpwnam(assoc->user); - if(passwd_ptr) + if (passwd_ptr) uid = passwd_ptr->pw_uid; /* In this report we are using the slurmdb_report user structure to store the information we want @@ -137,7 +137,7 @@ static void _process_uw(List user_list, slurmdb_wckey_rec_t *wckey) uid_t uid = NO_VAL; passwd_ptr = getpwnam(wckey->user); - if(passwd_ptr) + if (passwd_ptr) uid = passwd_ptr->pw_uid; /* In this report we are using the slurmdb_report user structure to store the information we want @@ -172,12 +172,12 @@ static void _process_wu(List assoc_list, slurmdb_wckey_rec_t *wckey) /* find the parent */ itr = list_iterator_create(assoc_list); while((parent_assoc = list_next(itr))) { - if(!parent_assoc->user + if (!parent_assoc->user && !strcmp(parent_assoc->acct, wckey->name)) break; } list_iterator_destroy(itr); - if(!parent_assoc) { + if (!parent_assoc) { parent_assoc = xmalloc(sizeof(slurmdb_report_assoc_rec_t)); list_append(assoc_list, @@ -214,20 +214,20 @@ static void _process_assoc_type( /* now add the associations of interest here by user */ while((assoc = list_next(itr))) { - if(!assoc->accounting_list + if (!assoc->accounting_list || !list_count(assoc->accounting_list) || ((type == CLUSTER_REPORT_UA) && !assoc->user)) { list_delete_item(itr); continue; } - if(strcmp(cluster_name, assoc->cluster)) + if (strcmp(cluster_name, assoc->cluster)) continue; - if(type == CLUSTER_REPORT_UA) + if (type == CLUSTER_REPORT_UA) _process_ua(slurmdb_report_cluster->user_list, assoc); - else if(type == CLUSTER_REPORT_AU) + else if (type == CLUSTER_REPORT_AU) _process_au(slurmdb_report_cluster->assoc_list, assoc); @@ -245,20 +245,20 @@ static void _process_wckey_type( /* now add the wckeyiations of interest here by user */ while((wckey = list_next(itr))) { - if(!wckey->accounting_list + if (!wckey->accounting_list || !list_count(wckey->accounting_list) || ((type == CLUSTER_REPORT_UW) && !wckey->user)) { list_delete_item(itr); continue; } - if(strcmp(cluster_name, wckey->cluster)) + if (strcmp(cluster_name, wckey->cluster)) continue; - if(type == CLUSTER_REPORT_UW) + if (type == CLUSTER_REPORT_UW) _process_uw(slurmdb_report_cluster->user_list, wckey); - else if(type == CLUSTER_REPORT_WU) + else if (type == CLUSTER_REPORT_WU) _process_wu(slurmdb_report_cluster->assoc_list, wckey); @@ -288,13 +288,13 @@ static List _process_util_by_report(void *db_conn, char *calling_name, cluster_cond.with_deleted = 1; cluster_cond.with_usage = 1; - if((type == CLUSTER_REPORT_UA) || (type == CLUSTER_REPORT_AU)) { + if ((type == CLUSTER_REPORT_UA) || (type == CLUSTER_REPORT_AU)) { start_time = ((slurmdb_association_cond_t *)cond)->usage_start; end_time = ((slurmdb_association_cond_t *)cond)->usage_end; cluster_cond.cluster_list = ((slurmdb_association_cond_t *)cond)->cluster_list; - } else if((type == CLUSTER_REPORT_UW) || (type == CLUSTER_REPORT_WU)) { + } else if ((type == CLUSTER_REPORT_UW) || (type == CLUSTER_REPORT_WU)) { start_time = ((slurmdb_wckey_cond_t *)cond)->usage_start; end_time = ((slurmdb_wckey_cond_t *)cond)->usage_end; @@ -317,32 +317,32 @@ static List _process_util_by_report(void *db_conn, char *calling_name, cluster_list = acct_storage_g_get_clusters( db_conn, my_uid, &cluster_cond); - if(!cluster_list) { + if (!cluster_list) { exit_code=1; fprintf(stderr, "%s: Problem with cluster query.\n", calling_name); goto end_it; } - if((type == CLUSTER_REPORT_UA) || (type == CLUSTER_REPORT_AU)) { + if ((type == CLUSTER_REPORT_UA) || (type == CLUSTER_REPORT_AU)) { ((slurmdb_association_cond_t *)cond)->usage_start = start_time; ((slurmdb_association_cond_t *)cond)->usage_end = end_time; type_list = acct_storage_g_get_associations( db_conn, my_uid, cond); - } else if((type == CLUSTER_REPORT_UW) || (type == CLUSTER_REPORT_WU)) { + } else if ((type == CLUSTER_REPORT_UW) || (type == CLUSTER_REPORT_WU)) { ((slurmdb_wckey_cond_t *)cond)->usage_start = start_time; ((slurmdb_wckey_cond_t *)cond)->usage_end = end_time; type_list = acct_storage_g_get_wckeys( db_conn, my_uid, cond); } - if(!type_list) { + if (!type_list) { exit_code=1; fprintf(stderr, "%s: Problem with get query.\n", calling_name); goto end_it; } - if((type == CLUSTER_REPORT_UA) || (type == CLUSTER_REPORT_AU)) { + if ((type == CLUSTER_REPORT_UA) || (type == CLUSTER_REPORT_AU)) { first_list = type_list; type_list = slurmdb_get_hierarchical_sorted_assoc_list( first_list); @@ -356,7 +356,7 @@ static List _process_util_by_report(void *db_conn, char *calling_name, /* check to see if this cluster is around during the time we are looking at */ - if(!cluster->accounting_list + if (!cluster->accounting_list || !list_count(cluster->accounting_list)) continue; @@ -366,10 +366,10 @@ static List _process_util_by_report(void *db_conn, char *calling_name, list_append(ret_list, slurmdb_report_cluster); slurmdb_report_cluster->name = xstrdup(cluster->name); - if((type == CLUSTER_REPORT_UA) || (type == CLUSTER_REPORT_UW)) + if ((type == CLUSTER_REPORT_UA) || (type == CLUSTER_REPORT_UW)) slurmdb_report_cluster->user_list = list_create(slurmdb_destroy_report_user_rec); - else if((type == CLUSTER_REPORT_AU) + else if ((type == CLUSTER_REPORT_AU) || (type == CLUSTER_REPORT_WU)) slurmdb_report_cluster->assoc_list = list_create(slurmdb_destroy_report_assoc_rec); @@ -387,10 +387,10 @@ static List _process_util_by_report(void *db_conn, char *calling_name, slurmdb_report_cluster->cpu_count /= list_count(cluster->accounting_list); - if((type == CLUSTER_REPORT_UA) || (type == CLUSTER_REPORT_AU)) + if ((type == CLUSTER_REPORT_UA) || (type == CLUSTER_REPORT_AU)) _process_assoc_type(type_itr, slurmdb_report_cluster, cluster->name, type); - else if((type == CLUSTER_REPORT_UW) + else if ((type == CLUSTER_REPORT_UW) || (type == CLUSTER_REPORT_WU)) _process_wckey_type(type_itr, slurmdb_report_cluster, cluster->name, type); @@ -401,23 +401,23 @@ static List _process_util_by_report(void *db_conn, char *calling_name, end_it: - if(type_list) { + if (type_list) { list_destroy(type_list); type_list = NULL; } - if(first_list) { + if (first_list) { list_destroy(first_list); first_list = NULL; } - if(cluster_list) { + if (cluster_list) { list_destroy(cluster_list); cluster_list = NULL; } - if(exit_code) { - if(ret_list) { + if (exit_code) { + if (ret_list) { list_destroy(ret_list); ret_list = NULL; } diff --git a/src/db_api/job_report_functions.c b/src/db_api/job_report_functions.c index aa540f45d25..9423e63b389 100644 --- a/src/db_api/job_report_functions.c +++ b/src/db_api/job_report_functions.c @@ -75,12 +75,12 @@ static void _check_create_grouping( itr = list_iterator_create(cluster_list); while((cluster_group = list_next(itr))) { - if(!strcmp(cluster, cluster_group->cluster)) + if (!strcmp(cluster, cluster_group->cluster)) break; } list_iterator_destroy(itr); - if(!cluster_group) { + if (!cluster_group) { cluster_group = xmalloc( sizeof(slurmdb_report_cluster_grouping_t)); cluster_group->cluster = xstrdup(cluster); @@ -91,12 +91,12 @@ static void _check_create_grouping( itr = list_iterator_create(cluster_group->acct_list); while((acct_group = list_next(itr))) { - if(!strcmp(name, acct_group->acct)) + if (!strcmp(name, acct_group->acct)) break; } list_iterator_destroy(itr); - if(!acct_group) { + if (!acct_group) { uint32_t last_size = 0; char *group = NULL; acct_group = xmalloc(sizeof(slurmdb_report_acct_grouping_t)); @@ -115,22 +115,22 @@ static void _check_create_grouping( job_group = xmalloc( sizeof(slurmdb_report_job_grouping_t)); job_group->jobs = list_create(NULL); - if(!individual) + if (!individual) job_group->min_size = last_size; last_size = atoi(group); - if(!individual) + if (!individual) job_group->max_size = last_size-1; else job_group->min_size = job_group->max_size = last_size; list_append(acct_group->groups, job_group); } - if(last_size && !individual) { + if (last_size && !individual) { job_group = xmalloc( sizeof(slurmdb_report_job_grouping_t)); job_group->jobs = list_create(NULL); job_group->min_size = last_size; - if(individual) + if (individual) job_group->max_size = job_group->min_size; else @@ -174,11 +174,11 @@ static List _process_grouped_report( here since we may be looking for sub accounts of a specific account. */ - if(!job_cond) { + if (!job_cond) { destroy_job_cond = 1; job_cond = xmalloc(sizeof(slurmdb_job_cond_t)); } - if(!grouping_list) { + if (!grouping_list) { destroy_grouping_list = 1; grouping_list = list_create(slurm_destroy_char); slurm_addto_char_list(grouping_list, "50,250,500,1000"); @@ -191,7 +191,7 @@ static List _process_grouped_report( job_cond->acct_list = tmp_acct_list; tmp_acct_list = NULL; - if(!job_list) { + if (!job_list) { exit_code=1; fprintf(stderr, " Problem with job query.\n"); goto end_it; @@ -199,21 +199,21 @@ static List _process_grouped_report( group_itr = list_iterator_create(grouping_list); /* make a group for each job size we find. */ - if(!list_count(grouping_list)) { + if (!list_count(grouping_list)) { char *group = NULL; char *tmp = NULL; individual = 1; itr = list_iterator_create(job_list); while((job = list_next(itr))) { - if(!job->elapsed || !job->alloc_cpus) + if (!job->elapsed || !job->alloc_cpus) continue; tmp = xstrdup_printf("%u", job->alloc_cpus); while((group = list_next(group_itr))) { - if(!strcmp(group, tmp)) { + if (!strcmp(group, tmp)) { break; } } - if(!group) + if (!group) list_append(grouping_list, tmp); else xfree(tmp); @@ -227,7 +227,7 @@ static List _process_grouped_report( cluster_itr = list_iterator_create(cluster_list); - if(flat_view) + if (flat_view) goto no_objects; if (!wckey_type || both) { @@ -237,8 +237,8 @@ static List _process_grouped_report( assoc_cond.cluster_list = job_cond->cluster_list; /* don't limit associations to having the partition_list */ //assoc_cond.partition_list = job_cond->partition_list; - if(!job_cond->acct_list || !list_count(job_cond->acct_list)) { - if(job_cond->acct_list) + if (!job_cond->acct_list || !list_count(job_cond->acct_list)) { + if (job_cond->acct_list) list_destroy(job_cond->acct_list); job_cond->acct_list = list_create(NULL); list_append(job_cond->acct_list, "root"); @@ -262,7 +262,7 @@ static List _process_grouped_report( } } - if(!object_list) { + if (!object_list) { debug2(" No join list given.\n"); goto no_objects; } @@ -277,7 +277,7 @@ static List _process_grouped_report( (slurmdb_association_rec_t *)object; if (!itr2) { char *name = NULL; - if(wckey_type) { + if (wckey_type) { cluster = wckey->cluster; name = wckey->name; } else { @@ -326,12 +326,12 @@ no_objects: char *local_cluster = "UNKNOWN"; char tmp_acct[200]; - if(!job->elapsed) { + if (!job->elapsed) { /* here we don't care about jobs that didn't * really run here */ continue; } - if(job->cluster) + if (job->cluster) local_cluster = job->cluster; if (!wckey_type) { @@ -358,14 +358,14 @@ no_objects: list_iterator_reset(cluster_itr); while((cluster_group = list_next(cluster_itr))) { - if(!strcmp(local_cluster, cluster_group->cluster)) + if (!strcmp(local_cluster, cluster_group->cluster)) break; } - if(!cluster_group) { + if (!cluster_group) { /* here we are only looking for groups that * were added with the associations above */ - if(!flat_view) + if (!flat_view) continue; cluster_group = xmalloc( sizeof(slurmdb_report_cluster_grouping_t)); @@ -378,12 +378,12 @@ no_objects: acct_itr = list_iterator_create(cluster_group->acct_list); while((acct_group = list_next(acct_itr))) { if (wckey_type) { - if(!strcmp(tmp_acct, acct_group->acct)) + if (!strcmp(tmp_acct, acct_group->acct)) break; continue; } - if(!flat_view + if (!flat_view && (acct_group->lft != (uint32_t)NO_VAL) && (job->lft != (uint32_t)NO_VAL)) { /* keep separate since we don't want @@ -408,13 +408,13 @@ no_objects: } list_iterator_destroy(acct_itr); - if(!acct_group) { + if (!acct_group) { char *group = NULL; uint32_t last_size = 0; /* here we are only looking for groups that * were added with the associations above */ - if(!flat_view) + if (!flat_view) continue; acct_group = xmalloc( @@ -428,22 +428,22 @@ no_objects: job_group = xmalloc( sizeof(slurmdb_report_job_grouping_t)); job_group->jobs = list_create(NULL); - if(!individual) + if (!individual) job_group->min_size = last_size; last_size = atoi(group); - if(!individual) + if (!individual) job_group->max_size = last_size-1; else job_group->min_size = job_group->max_size = last_size; list_append(acct_group->groups, job_group); } - if(last_size && !individual) { + if (last_size && !individual) { job_group = xmalloc( sizeof(slurmdb_report_job_grouping_t)); job_group->jobs = list_create(NULL); job_group->min_size = last_size; - if(individual) + if (individual) job_group->max_size = job_group->min_size; else @@ -456,7 +456,7 @@ no_objects: local_itr = list_iterator_create(acct_group->groups); while((job_group = list_next(local_itr))) { uint64_t total_secs = 0; - if((job->alloc_cpus < job_group->min_size) + if ((job->alloc_cpus < job_group->min_size) || (job->alloc_cpus > job_group->max_size)) continue; list_append(job_group->jobs, job); @@ -492,20 +492,20 @@ no_objects: list_iterator_destroy(cluster_itr); end_it: - if(object_list) + if (object_list) list_destroy(object_list); - if(object2_list) + if (object2_list) list_destroy(object2_list); - if(destroy_job_cond) + if (destroy_job_cond) slurmdb_destroy_job_cond(job_cond); - if(destroy_grouping_list && grouping_list) + if (destroy_grouping_list && grouping_list) list_destroy(grouping_list); - if(exit_code) { - if(cluster_list) { + if (exit_code) { + if (cluster_list) { list_destroy(cluster_list); cluster_list = NULL; } diff --git a/src/db_api/user_report_functions.c b/src/db_api/user_report_functions.c index 9083949bcda..af9b6aa1af6 100644 --- a/src/db_api/user_report_functions.c +++ b/src/db_api/user_report_functions.c @@ -73,18 +73,18 @@ extern List slurmdb_report_user_top_usage(void *db_conn, delete_cluster_list = 0; time_t start_time, end_time; - if(!user_cond) { + if (!user_cond) { delete_user_cond = 1; user_cond = xmalloc(sizeof(slurmdb_user_cond_t)); } - if(!user_cond->assoc_cond) { + if (!user_cond->assoc_cond) { delete_assoc_cond = 1; user_cond->assoc_cond = xmalloc(sizeof(slurmdb_association_cond_t)); } - if(!user_cond->assoc_cond->cluster_list) { + if (!user_cond->assoc_cond->cluster_list) { delete_cluster_list = 1; user_cond->assoc_cond->cluster_list = list_create(slurm_destroy_char); @@ -106,7 +106,7 @@ extern List slurmdb_report_user_top_usage(void *db_conn, user_cond->assoc_cond->usage_end = end_time; user_list = acct_storage_g_get_users(db_conn, my_uid, user_cond); - if(!user_list) { + if (!user_list) { exit_code=1; fprintf(stderr, " Problem with user query.\n"); goto end_it; @@ -125,7 +125,7 @@ extern List slurmdb_report_user_top_usage(void *db_conn, usage_cluster_list = acct_storage_g_get_clusters( db_conn, my_uid, &cluster_cond); - if(!usage_cluster_list) { + if (!usage_cluster_list) { exit_code=1; fprintf(stderr, " Problem with cluster query.\n"); goto end_it; @@ -139,7 +139,7 @@ extern List slurmdb_report_user_top_usage(void *db_conn, /* check to see if this cluster is around during the time we are looking at */ - if(!cluster->accounting_list + if (!cluster->accounting_list || !list_count(cluster->accounting_list)) continue; @@ -173,11 +173,11 @@ extern List slurmdb_report_user_top_usage(void *db_conn, cluster_itr = list_iterator_create(cluster_list); while((user = list_next(itr))) { struct passwd *passwd_ptr = NULL; - if(!user->assoc_list || !list_count(user->assoc_list)) + if (!user->assoc_list || !list_count(user->assoc_list)) continue; passwd_ptr = getpwnam(user->name); - if(passwd_ptr) + if (passwd_ptr) user->uid = passwd_ptr->pw_uid; else user->uid = (uint32_t)NO_VAL; @@ -185,16 +185,16 @@ extern List slurmdb_report_user_top_usage(void *db_conn, itr2 = list_iterator_create(user->assoc_list); while((assoc = list_next(itr2))) { - if(!assoc->accounting_list + if (!assoc->accounting_list || !list_count(assoc->accounting_list)) continue; while((slurmdb_report_cluster = list_next(cluster_itr))) { - if(!strcmp(slurmdb_report_cluster->name, + if (!strcmp(slurmdb_report_cluster->name, assoc->cluster)) { ListIterator user_itr = NULL; - if(!group_accounts) { + if (!group_accounts) { slurmdb_report_user = NULL; goto new_user; } @@ -203,13 +203,13 @@ extern List slurmdb_report_user_top_usage(void *db_conn, user_list); while((slurmdb_report_user = list_next(user_itr))) { - if(slurmdb_report_user->uid + if (slurmdb_report_user->uid != NO_VAL) { - if(slurmdb_report_user-> + if (slurmdb_report_user-> uid == user->uid) break; - } else if(slurmdb_report_user-> + } else if (slurmdb_report_user-> name && !strcasecmp( slurmdb_report_user-> @@ -219,7 +219,7 @@ extern List slurmdb_report_user_top_usage(void *db_conn, } list_iterator_destroy(user_itr); new_user: - if(!slurmdb_report_user) { + if (!slurmdb_report_user) { slurmdb_report_user = xmalloc( sizeof (slurmdb_report_user_rec_t)); @@ -237,7 +237,7 @@ extern List slurmdb_report_user_top_usage(void *db_conn, break; } } - if(!slurmdb_report_cluster) { + if (!slurmdb_report_cluster) { error("This cluster '%s' hasn't " "registered yet, but we have jobs " "that ran?", assoc->cluster); @@ -262,12 +262,12 @@ extern List slurmdb_report_user_top_usage(void *db_conn, itr3 = list_iterator_create( slurmdb_report_user->acct_list); while((object = list_next(itr3))) { - if(!strcmp(object, assoc->acct)) + if (!strcmp(object, assoc->acct)) break; } list_iterator_destroy(itr3); - if(!object) + if (!object) list_append(slurmdb_report_user->acct_list, xstrdup(assoc->acct)); itr3 = list_iterator_create(assoc->accounting_list); @@ -285,28 +285,28 @@ extern List slurmdb_report_user_top_usage(void *db_conn, list_iterator_destroy(cluster_itr); end_it: - if(delete_cluster_list) { + if (delete_cluster_list) { list_destroy(user_cond->assoc_cond->cluster_list); user_cond->assoc_cond->cluster_list = NULL; } - if(delete_assoc_cond) { + if (delete_assoc_cond) { slurmdb_destroy_association_cond(user_cond->assoc_cond); user_cond->assoc_cond = NULL; } - if(delete_user_cond) { + if (delete_user_cond) { slurmdb_destroy_user_cond(user_cond); user_cond = NULL; } - if(user_list) { + if (user_list) { list_destroy(user_list); user_list = NULL; } - if(exit_code) { - if(cluster_list) { + if (exit_code) { + if (cluster_list) { list_destroy(cluster_list); cluster_list = NULL; } diff --git a/src/sacct/options.c b/src/sacct/options.c index c2edaeacbe3..db1ffaba5e1 100644 --- a/src/sacct/options.c +++ b/src/sacct/options.c @@ -73,7 +73,7 @@ void _help_fields_msg(void) for (i = 0; fields[i].name; i++) { if (i & 3) printf(" "); - else if(i) + else if (i) printf("\n"); printf("%-13s", fields[i].name); } @@ -113,13 +113,13 @@ static int _addto_id_char_list(List char_list, char *names, bool gid) int quote = 0; int count = 0; - if(!char_list) { + if (!char_list) { error("No list was given to fill in"); return 0; } itr = list_iterator_create(char_list); - if(names) { + if (names) { if (names[i] == '\"' || names[i] == '\'') { quote_c = names[i]; quote = 1; @@ -128,23 +128,23 @@ static int _addto_id_char_list(List char_list, char *names, bool gid) start = i; while(names[i]) { //info("got %d - %d = %d", i, start, i-start); - if(quote && names[i] == quote_c) + if (quote && names[i] == quote_c) break; else if (names[i] == '\"' || names[i] == '\'') names[i] = '`'; - else if(names[i] == ',') { - if((i-start) > 0) { + else if (names[i] == ',') { + if ((i-start) > 0) { name = xmalloc((i-start+1)); memcpy(name, names+start, (i-start)); //info("got %s %d", name, i-start); name = _convert_to_id( name, gid ); while((tmp_char = list_next(itr))) { - if(!strcasecmp(tmp_char, name)) + if (!strcasecmp(tmp_char, name)) break; } - if(!tmp_char) { + if (!tmp_char) { list_append(char_list, name); count++; } else @@ -153,7 +153,7 @@ static int _addto_id_char_list(List char_list, char *names, bool gid) } i++; start = i; - if(!names[i]) { + if (!names[i]) { info("There is a problem with " "your request. It appears you " "have spaces inside your list."); @@ -162,17 +162,17 @@ static int _addto_id_char_list(List char_list, char *names, bool gid) } i++; } - if((i-start) > 0) { + if ((i-start) > 0) { name = xmalloc((i-start)+1); memcpy(name, names+start, (i-start)); name = _convert_to_id(name, gid); while((tmp_char = list_next(itr))) { - if(!strcasecmp(tmp_char, name)) + if (!strcasecmp(tmp_char, name)) break; } - if(!tmp_char) { + if (!tmp_char) { list_append(char_list, name); count++; } else @@ -193,13 +193,13 @@ static int _addto_state_char_list(List char_list, char *names) int quote = 0; int count = 0; - if(!char_list) { + if (!char_list) { error("No list was given to fill in"); return 0; } itr = list_iterator_create(char_list); - if(names) { + if (names) { if (names[i] == '\"' || names[i] == '\'') { quote_c = names[i]; quote = 1; @@ -208,12 +208,12 @@ static int _addto_state_char_list(List char_list, char *names) start = i; while(names[i]) { //info("got %d - %d = %d", i, start, i-start); - if(quote && names[i] == quote_c) + if (quote && names[i] == quote_c) break; else if (names[i] == '\"' || names[i] == '\'') names[i] = '`'; - else if(names[i] == ',') { - if((i-start) > 0) { + else if (names[i] == ',') { + if ((i-start) > 0) { name = xmalloc((i-start+1)); memcpy(name, names+start, (i-start)); c = job_state_num(name); @@ -224,11 +224,11 @@ static int _addto_state_char_list(List char_list, char *names) name = xstrdup_printf("%d", c); while((tmp_char = list_next(itr))) { - if(!strcasecmp(tmp_char, name)) + if (!strcasecmp(tmp_char, name)) break; } - if(!tmp_char) { + if (!tmp_char) { list_append(char_list, name); count++; } else @@ -237,7 +237,7 @@ static int _addto_state_char_list(List char_list, char *names) } i++; start = i; - if(!names[i]) { + if (!names[i]) { info("There is a problem with " "your request. It appears you " "have spaces inside your list."); @@ -246,7 +246,7 @@ static int _addto_state_char_list(List char_list, char *names) } i++; } - if((i-start) > 0) { + if ((i-start) > 0) { name = xmalloc((i-start)+1); memcpy(name, names+start, (i-start)); c = job_state_num(name); @@ -256,11 +256,11 @@ static int _addto_state_char_list(List char_list, char *names) name = xstrdup_printf("%d", c); while((tmp_char = list_next(itr))) { - if(!strcasecmp(tmp_char, name)) + if (!strcasecmp(tmp_char, name)) break; } - if(!tmp_char) { + if (!tmp_char) { list_append(char_list, name); count++; } else @@ -284,13 +284,13 @@ static int _addto_step_list(List step_list, char *names) int quote = 0; int count = 0; - if(!step_list) { + if (!step_list) { error("No list was given to fill in"); return 0; } itr = list_iterator_create(step_list); - if(names) { + if (names) { if (names[i] == '\"' || names[i] == '\'') { quote_c = names[i]; quote = 1; @@ -299,12 +299,12 @@ static int _addto_step_list(List step_list, char *names) start = i; while(names[i]) { //info("got %d - %d = %d", i, start, i-start); - if(quote && names[i] == quote_c) + if (quote && names[i] == quote_c) break; else if (names[i] == '\"' || names[i] == '\'') names[i] = '`'; - else if(names[i] == ',') { - if((i-start) > 0) { + else if (names[i] == ',') { + if ((i-start) > 0) { char *dot = NULL; name = xmalloc((i-start+1)); memcpy(name, names+start, (i-start)); @@ -330,7 +330,7 @@ static int _addto_step_list(List step_list, char *names) xfree(name); while((curr_step = list_next(itr))) { - if((curr_step->jobid + if ((curr_step->jobid == selected_step->jobid) && (curr_step->stepid == selected_step-> @@ -338,7 +338,7 @@ static int _addto_step_list(List step_list, char *names) break; } - if(!curr_step) { + if (!curr_step) { list_append(step_list, selected_step); count++; @@ -352,7 +352,7 @@ static int _addto_step_list(List step_list, char *names) } i++; } - if((i-start) > 0) { + if ((i-start) > 0) { name = xmalloc((i-start)+1); memcpy(name, names+start, (i-start)); @@ -374,13 +374,13 @@ static int _addto_step_list(List step_list, char *names) xfree(name); while((curr_step = list_next(itr))) { - if((curr_step->jobid == selected_step->jobid) + if ((curr_step->jobid == selected_step->jobid) && (curr_step->stepid == selected_step->stepid)) break; } - if(!curr_step) { + if (!curr_step) { list_append(step_list, selected_step); count++; } else @@ -538,25 +538,25 @@ int get_data(void) ListIterator itr_step = NULL; slurmdb_job_cond_t *job_cond = params.job_cond; - if(params.opt_completion) { + if (params.opt_completion) { jobs = g_slurm_jobcomp_get_jobs(job_cond); return SLURM_SUCCESS; } else { jobs = slurmdb_jobs_get(acct_db_conn, job_cond); } - if(!jobs) + if (!jobs) return SLURM_ERROR; itr = list_iterator_create(jobs); while((job = list_next(itr))) { - if(job->user) { + if (job->user) { struct passwd *pw = NULL; if ((pw=getpwnam(job->user))) job->uid = pw->pw_uid; } - if(!job->steps || !list_count(job->steps)) + if (!job->steps || !list_count(job->steps)) continue; itr_step = list_iterator_create(job->steps); @@ -564,7 +564,7 @@ int get_data(void) /* now aggregate the aggregatable */ job->alloc_cpus = MAX(job->alloc_cpus, step->ncpus); - if(step->state < JOB_COMPLETE) + if (step->state < JOB_COMPLETE) continue; job->tot_cpu_sec += step->tot_cpu_sec; job->tot_cpu_usec += step->tot_cpu_usec; @@ -667,7 +667,7 @@ void parse_command_line(int argc, char **argv) all_users = 1; break; case 'A': - if(!job_cond->acct_list) + if (!job_cond->acct_list) job_cond->acct_list = list_create(slurm_destroy_char); slurm_addto_char_list(job_cond->acct_list, optarg); @@ -683,12 +683,12 @@ void parse_command_line(int argc, char **argv) everything else. */ case 'M': - if(!strcasecmp(optarg, "-1")) { + if (!strcasecmp(optarg, "-1")) { all_clusters = 1; break; } all_clusters=0; - if(!job_cond->cluster_list) + if (!job_cond->cluster_list) job_cond->cluster_list = list_create(slurm_destroy_char); slurm_addto_char_list(job_cond->cluster_list, optarg); @@ -709,7 +709,7 @@ void parse_command_line(int argc, char **argv) params.opt_filein = xstrdup(optarg); break; case 'g': - if(!job_cond->groupid_list) + if (!job_cond->groupid_list) job_cond->groupid_list = list_create(slurm_destroy_char); _addto_id_char_list(job_cond->groupid_list, optarg, 1); @@ -754,7 +754,7 @@ void parse_command_line(int argc, char **argv) exit(1); } - if(!job_cond->step_list) + if (!job_cond->step_list) job_cond->step_list = list_create( slurmdb_destroy_selected_step); _addto_step_list(job_cond->step_list, optarg); @@ -781,7 +781,7 @@ void parse_command_line(int argc, char **argv) print_fields_have_header = 0; break; case 'N': - if(job_cond->used_nodes) { + if (job_cond->used_nodes) { error("Aleady asked for nodes '%s'", job_cond->used_nodes); break; @@ -789,7 +789,7 @@ void parse_command_line(int argc, char **argv) job_cond->used_nodes = xstrdup(optarg); break; case OPT_LONG_NAME: - if(!job_cond->jobname_list) + if (!job_cond->jobname_list) job_cond->jobname_list = list_create(slurm_destroy_char); slurm_addto_char_list(job_cond->jobname_list, optarg); @@ -815,16 +815,16 @@ void parse_command_line(int argc, char **argv) acct_db_conn, &qos_cond); } - if(!job_cond->qos_list) + if (!job_cond->qos_list) job_cond->qos_list = list_create(slurm_destroy_char); - if(!slurmdb_addto_qos_char_list(job_cond->qos_list, + if (!slurmdb_addto_qos_char_list(job_cond->qos_list, g_qos_list, optarg, 0)) fatal("problem processing qos list"); break; case 'r': - if(!job_cond->partition_list) + if (!job_cond->partition_list) job_cond->partition_list = list_create(slurm_destroy_char); @@ -832,7 +832,7 @@ void parse_command_line(int argc, char **argv) optarg); break; case 's': - if(!job_cond->state_list) + if (!job_cond->state_list) job_cond->state_list = list_create(slurm_destroy_char); @@ -850,12 +850,12 @@ void parse_command_line(int argc, char **argv) params.opt_help = 3; break; case 'u': - if(!strcmp(optarg, "-1")) { + if (!strcmp(optarg, "-1")) { all_users = 1; break; } all_users = 0; - if(!job_cond->userid_list) + if (!job_cond->userid_list) job_cond->userid_list = list_create(slurm_destroy_char); _addto_id_char_list(job_cond->userid_list, optarg, 0); @@ -866,7 +866,7 @@ void parse_command_line(int argc, char **argv) verbosity++; break; case 'W': - if(!job_cond->wckey_list) + if (!job_cond->wckey_list) job_cond->wckey_list = list_create(slurm_destroy_char); slurm_addto_char_list(job_cond->wckey_list, optarg); @@ -875,7 +875,7 @@ void parse_command_line(int argc, char **argv) print_slurm_version(); exit(0); case 'x': - if(!job_cond->associd_list) + if (!job_cond->associd_list) job_cond->associd_list = list_create(slurm_destroy_char); slurm_addto_char_list(job_cond->associd_list, optarg); @@ -904,7 +904,7 @@ void parse_command_line(int argc, char **argv) job_cond->duplicates = params.opt_dup; job_cond->without_steps = params.opt_allocs; - if(!job_cond->usage_start && !job_cond->step_list) { + if (!job_cond->usage_start && !job_cond->step_list) { struct tm start_tm; job_cond->usage_start = time(NULL); @@ -920,13 +920,13 @@ void parse_command_line(int argc, char **argv) job_cond->usage_start = mktime(&start_tm); } - if(verbosity > 0) { + if (verbosity > 0) { char *start_char =NULL, *end_char = NULL; start_char = xstrdup(ctime(&job_cond->usage_start)); /* remove the new line */ start_char[strlen(start_char)-1] = '\0'; - if(job_cond->usage_end) { + if (job_cond->usage_end) { end_char = xstrdup(ctime(&job_cond->usage_end)); /* remove the new line */ end_char[strlen(end_char)-1] = '\0'; @@ -949,7 +949,7 @@ void parse_command_line(int argc, char **argv) params.opt_help, params.opt_allocs); - if(params.opt_completion) { + if (params.opt_completion) { g_slurm_jobcomp_init(params.opt_filein); acct_type = slurm_get_jobcomp_type(); @@ -971,15 +971,15 @@ void parse_command_line(int argc, char **argv) } xfree(acct_type); acct_db_conn = slurmdb_connection_get(); - if(errno != SLURM_SUCCESS) { + if (errno != SLURM_SUCCESS) { error("Problem talking to the database: %m"); exit(1); } } /* specific clusters requested? */ - if(all_clusters) { - if(job_cond->cluster_list + if (all_clusters) { + if (job_cond->cluster_list && list_count(job_cond->cluster_list)) { list_destroy(job_cond->cluster_list); job_cond->cluster_list = NULL; @@ -992,12 +992,12 @@ void parse_command_line(int argc, char **argv) while((start = list_next(itr))) debug2("\t: %s", start); list_iterator_destroy(itr); - } else if(!job_cond->cluster_list + } else if (!job_cond->cluster_list || !list_count(job_cond->cluster_list)) { - if(!job_cond->cluster_list) + if (!job_cond->cluster_list) job_cond->cluster_list = list_create(slurm_destroy_char); - if((start = slurm_get_cluster_name())) { + if ((start = slurm_get_cluster_name())) { list_append(job_cond->cluster_list, start); debug2("Clusters requested:\t%s", start); } @@ -1005,17 +1005,17 @@ void parse_command_line(int argc, char **argv) /* if any jobs or nodes are specified set to look for all users if none are set */ - if(!job_cond->userid_list || !list_count(job_cond->userid_list)) - if((job_cond->step_list && list_count(job_cond->step_list)) + if (!job_cond->userid_list || !list_count(job_cond->userid_list)) + if ((job_cond->step_list && list_count(job_cond->step_list)) || job_cond->used_nodes) all_users=1; /* set all_users for user root if not requesting any */ - if(!job_cond->userid_list && !params.opt_uid) + if (!job_cond->userid_list && !params.opt_uid) all_users = 1; - if(all_users) { - if(job_cond->userid_list && list_count(job_cond->userid_list)) { + if (all_users) { + if (job_cond->userid_list && list_count(job_cond->userid_list)) { list_destroy(job_cond->userid_list); job_cond->userid_list = NULL; } @@ -1026,9 +1026,9 @@ void parse_command_line(int argc, char **argv) while((start = list_next(itr))) debug2("\t: %s", start); list_iterator_destroy(itr); - } else if(!job_cond->userid_list + } else if (!job_cond->userid_list || !list_count(job_cond->userid_list)) { - if(!job_cond->userid_list) + if (!job_cond->userid_list) job_cond->userid_list = list_create(slurm_destroy_char); start = xstrdup_printf("%u", params.opt_uid); list_append(job_cond->userid_list, start); @@ -1064,7 +1064,7 @@ void parse_command_line(int argc, char **argv) debug2("Jobs requested:"); itr = list_iterator_create(job_cond->step_list); while((selected_step = list_next(itr))) { - if(selected_step->stepid != NO_VAL) + if (selected_step->stepid != NO_VAL) debug2("\t: %d.%d", selected_step->jobid, selected_step->stepid); @@ -1098,7 +1098,7 @@ void parse_command_line(int argc, char **argv) char time_str[128], tmp1[32], tmp2[32]; mins2time_str(job_cond->timelimit_min, tmp1, sizeof(tmp1)); sprintf(time_str, "%s", tmp1); - if(job_cond->timelimit_max) { + if (job_cond->timelimit_max) { int len = strlen(tmp1); mins2time_str(job_cond->timelimit_max, tmp2, sizeof(tmp2)); @@ -1118,8 +1118,8 @@ void parse_command_line(int argc, char **argv) } /* select the output fields */ - if(brief_output) { - if(params.opt_completion) + if (brief_output) { + if (params.opt_completion) dot = BRIEF_COMP_FIELDS; else dot = BRIEF_FIELDS; @@ -1127,8 +1127,8 @@ void parse_command_line(int argc, char **argv) xstrfmtcat(params.opt_field_list, "%s,", dot); } - if(long_output) { - if(params.opt_completion) + if (long_output) { + if (params.opt_completion) dot = LONG_COMP_FIELDS; else dot = LONG_FIELDS; @@ -1137,7 +1137,7 @@ void parse_command_line(int argc, char **argv) } if (params.opt_field_list==NULL) { - if(params.opt_completion) + if (params.opt_completion) dot = DEFAULT_COMP_FIELDS; else dot = DEFAULT_FIELDS; @@ -1154,10 +1154,10 @@ void parse_command_line(int argc, char **argv) *end = 0; while (isspace(*start)) start++; /* discard whitespace */ - if(!(int)*start) + if (!(int)*start) continue; - if((tmp_char = strstr(start, "\%"))) { + if ((tmp_char = strstr(start, "\%"))) { newlen = atoi(tmp_char+1); tmp_char[0] = '\0'; } @@ -1171,7 +1171,7 @@ void parse_command_line(int argc, char **argv) error("Invalid field requested: \"%s\"", start); exit(1); foundfield: - if(newlen) + if (newlen) fields[i].len = newlen; list_append(print_fields_list, &fields[i]); start = end + 1; @@ -1221,12 +1221,12 @@ void do_list(void) slurmdb_job_rec_t *job = NULL; slurmdb_step_rec_t *step = NULL; - if(!jobs) + if (!jobs) return; itr = list_iterator_create(jobs); while((job = list_next(itr))) { - if(list_count(job->steps)) { + if (list_count(job->steps)) { int cnt = list_count(job->steps); job->stats.cpu_ave /= (double)cnt; job->stats.rss_ave /= (double)cnt; @@ -1241,7 +1241,7 @@ void do_list(void) && (job->track_steps || !job->show_full)) { itr_step = list_iterator_create(job->steps); while((step = list_next(itr_step))) { - if(step->end == 0) + if (step->end == 0) step->end = job->end; print_fields(JOBSTEP, step); } @@ -1264,7 +1264,7 @@ void do_list_completion(void) ListIterator itr = NULL; jobcomp_job_rec_t *job = NULL; - if(!jobs) + if (!jobs) return; itr = list_iterator_create(jobs); @@ -1283,16 +1283,16 @@ void sacct_init() void sacct_fini() { - if(print_fields_itr) + if (print_fields_itr) list_iterator_destroy(print_fields_itr); - if(print_fields_list) + if (print_fields_list) list_destroy(print_fields_list); - if(jobs) + if (jobs) list_destroy(jobs); - if(g_qos_list) + if (g_qos_list) list_destroy(g_qos_list); - if(params.opt_completion) + if (params.opt_completion) g_slurm_jobcomp_fini(); else { slurmdb_connection_close(&acct_db_conn); diff --git a/src/sacct/print.c b/src/sacct/print.c index 60da32b3de5..7523ff8dcb5 100644 --- a/src/sacct/print.c +++ b/src/sacct/print.c @@ -50,7 +50,7 @@ char *_elapsed_time(long secs, long usecs) long subsec = 0; char *str = NULL; - if(secs < 0 || secs == (long)NO_VAL) + if (secs < 0 || secs == (long)NO_VAL) return NULL; @@ -58,7 +58,7 @@ char *_elapsed_time(long secs, long usecs) secs++; usecs -= 1E6; } - if(usecs > 0) { + if (usecs > 0) { /* give me 3 significant digits to tack onto the sec */ subsec = (usecs/1000); } @@ -73,7 +73,7 @@ char *_elapsed_time(long secs, long usecs) else if (hours) str = xstrdup_printf("%2.2ld:%2.2ld:%2.2ld", hours, minutes, seconds); - else if(subsec) + else if (subsec) str = xstrdup_printf("%2.2ld:%2.2ld.%3.3ld", minutes, seconds, subsec); else @@ -88,17 +88,17 @@ static char *_find_qos_name_from_list( ListIterator itr = NULL; slurmdb_qos_rec_t *qos = NULL; - if(!qos_list || qosid == NO_VAL) + if (!qos_list || qosid == NO_VAL) return NULL; itr = list_iterator_create(qos_list); while((qos = list_next(itr))) { - if(qosid == qos->id) + if (qosid == qos->id) break; } list_iterator_destroy(itr); - if(qos) + if (qos) return qos->name; else return "Unknown"; @@ -120,13 +120,13 @@ void print_fields(type_t type, void *object) switch(type) { case JOB: step = NULL; - if(!job->track_steps) + if (!job->track_steps) step = (slurmdb_step_rec_t *)job->first_step_ptr; /* set this to avoid printing out info for things that don't mean anything. Like an allocation that never ran anything. */ - if(!step) + if (!step) job->track_steps = 1; break; @@ -148,7 +148,7 @@ void print_fields(type_t type, void *object) case JOB: tmp_int = job->alloc_cpus; // we want to use the step info - if(!step) + if (!step) break; case JOBSTEP: tmp_int = step->ncpus; @@ -220,7 +220,7 @@ void print_fields(type_t type, void *object) case PRINT_AVECPU: switch(type) { case JOB: - if(!job->track_steps) + if (!job->track_steps) tmp_dub = job->stats.cpu_ave; break; case JOBSTEP: @@ -242,7 +242,7 @@ void print_fields(type_t type, void *object) case PRINT_AVEPAGES: switch(type) { case JOB: - if(!job->track_steps) + if (!job->track_steps) tmp_dub = job->stats.pages_ave; break; case JOBSTEP: @@ -264,7 +264,7 @@ void print_fields(type_t type, void *object) case PRINT_AVERSS: switch(type) { case JOB: - if(!job->track_steps) + if (!job->track_steps) tmp_dub = job->stats.rss_ave; break; case JOBSTEP: @@ -286,7 +286,7 @@ void print_fields(type_t type, void *object) case PRINT_AVEVSIZE: switch(type) { case JOB: - if(!job->track_steps) + if (!job->track_steps) tmp_dub = job->stats.vsize_ave; break; case JOBSTEP: @@ -611,7 +611,7 @@ void print_fields(type_t type, void *object) case JOB: /* below really should be step. It is not a typo */ - if(!job->track_steps) + if (!job->track_steps) tmp_char = slurm_step_layout_type_name( step->task_dist); break; @@ -632,7 +632,7 @@ void print_fields(type_t type, void *object) case PRINT_MAXPAGES: switch(type) { case JOB: - if(!job->track_steps) + if (!job->track_steps) tmp_int = job->stats.pages_max; break; case JOBSTEP: @@ -642,7 +642,7 @@ void print_fields(type_t type, void *object) default: break; } - if(tmp_int != NO_VAL) + if (tmp_int != NO_VAL) convert_num_unit((float)tmp_int, outbuf, sizeof(outbuf), UNIT_KILO); @@ -654,7 +654,7 @@ void print_fields(type_t type, void *object) case PRINT_MAXPAGESNODE: switch(type) { case JOB: - if(!job->track_steps) + if (!job->track_steps) tmp_char = find_hostname( job->stats.pages_max_nodeid, job->nodes); @@ -677,7 +677,7 @@ void print_fields(type_t type, void *object) case PRINT_MAXPAGESTASK: switch(type) { case JOB: - if(!job->track_steps) + if (!job->track_steps) tmp_int = job->stats.pages_max_taskid; break; @@ -698,7 +698,7 @@ void print_fields(type_t type, void *object) case PRINT_MAXRSS: switch(type) { case JOB: - if(!job->track_steps) + if (!job->track_steps) tmp_int = job->stats.rss_max; break; case JOBSTEP: @@ -708,7 +708,7 @@ void print_fields(type_t type, void *object) default: break; } - if(tmp_int != NO_VAL) + if (tmp_int != NO_VAL) convert_num_unit((float)tmp_int, outbuf, sizeof(outbuf), UNIT_KILO); @@ -720,7 +720,7 @@ void print_fields(type_t type, void *object) case PRINT_MAXRSSNODE: switch(type) { case JOB: - if(!job->track_steps) + if (!job->track_steps) tmp_char = find_hostname( job->stats.rss_max_nodeid, job->nodes); @@ -743,7 +743,7 @@ void print_fields(type_t type, void *object) case PRINT_MAXRSSTASK: switch(type) { case JOB: - if(!job->track_steps) + if (!job->track_steps) tmp_int = job->stats.rss_max_taskid; break; case JOBSTEP: @@ -763,7 +763,7 @@ void print_fields(type_t type, void *object) case PRINT_MAXVSIZE: switch(type) { case JOB: - if(!job->track_steps) + if (!job->track_steps) tmp_int = job->stats.vsize_max; break; case JOBSTEP: @@ -774,7 +774,7 @@ void print_fields(type_t type, void *object) tmp_int = NO_VAL; break; } - if(tmp_int != NO_VAL) + if (tmp_int != NO_VAL) convert_num_unit((float)tmp_int, outbuf, sizeof(outbuf), UNIT_KILO); @@ -786,7 +786,7 @@ void print_fields(type_t type, void *object) case PRINT_MAXVSIZENODE: switch(type) { case JOB: - if(!job->track_steps) + if (!job->track_steps) tmp_char = find_hostname( job->stats.vsize_max_nodeid, job->nodes); @@ -809,7 +809,7 @@ void print_fields(type_t type, void *object) case PRINT_MAXVSIZETASK: switch(type) { case JOB: - if(!job->track_steps) + if (!job->track_steps) tmp_int = job->stats.vsize_max_taskid; break; @@ -830,7 +830,7 @@ void print_fields(type_t type, void *object) case PRINT_MINCPU: switch(type) { case JOB: - if(!job->track_steps) + if (!job->track_steps) tmp_dub = job->stats.cpu_min; break; case JOBSTEP: @@ -850,7 +850,7 @@ void print_fields(type_t type, void *object) case PRINT_MINCPUNODE: switch(type) { case JOB: - if(!job->track_steps) + if (!job->track_steps) tmp_char = find_hostname( job->stats.cpu_min_nodeid, job->nodes); @@ -873,7 +873,7 @@ void print_fields(type_t type, void *object) case PRINT_MINCPUTASK: switch(type) { case JOB: - if(!job->track_steps) + if (!job->track_steps) tmp_int = job->stats.cpu_min_taskid; break; case JOBSTEP: @@ -926,7 +926,7 @@ void print_fields(type_t type, void *object) break; } - if(!tmp_int) { + if (!tmp_int) { hostlist_t hl = hostlist_create(tmp_char); tmp_int = hostlist_count(hl); hostlist_destroy(hl); @@ -940,10 +940,10 @@ void print_fields(type_t type, void *object) case PRINT_NTASKS: switch(type) { case JOB: - if(!job->track_steps && !step) + if (!job->track_steps && !step) tmp_int = job->alloc_cpus; // we want to use the step info - if(!step) + if (!step) break; case JOBSTEP: tmp_int = step->ntasks; @@ -1066,7 +1066,7 @@ void print_fields(type_t type, void *object) case PRINT_RESV: switch(type) { case JOB: - if(job->start) + if (job->start) tmp_int = job->start - job->eligible; else tmp_int = time(NULL) - job->eligible; @@ -1087,7 +1087,7 @@ void print_fields(type_t type, void *object) case PRINT_RESV_CPU: switch(type) { case JOB: - if(job->start) + if (job->start) tmp_int = (job->start - job->eligible) * job->req_cpus; else @@ -1110,7 +1110,7 @@ void print_fields(type_t type, void *object) case PRINT_RESV_CPU_RAW: switch(type) { case JOB: - if(job->start) + if (job->start) tmp_int = (job->start - job->eligible) * job->req_cpus; else @@ -1173,11 +1173,11 @@ void print_fields(type_t type, void *object) "%s by %d", job_state_string(tmp_int), tmp_int2); - else if(tmp_int != NO_VAL) + else if (tmp_int != NO_VAL) snprintf(outbuf, FORMAT_STRING_SIZE, "%s", job_state_string(tmp_int)); - else if(tmp_char) + else if (tmp_char) snprintf(outbuf, FORMAT_STRING_SIZE, "%s", tmp_char); @@ -1255,7 +1255,7 @@ void print_fields(type_t type, void *object) tmp_char = "UNLIMITED"; else if (job->timelimit == NO_VAL) tmp_char = "Partition_Limit"; - else if(job->timelimit) { + else if (job->timelimit) { char tmp1[128]; mins2time_str(job->timelimit, tmp1, sizeof(tmp1)); @@ -1302,7 +1302,7 @@ void print_fields(type_t type, void *object) case PRINT_UID: switch(type) { case JOB: - if(job->user) { + if (job->user) { if ((pw=getpwnam(job->user))) tmp_int = pw->pw_uid; } else @@ -1325,9 +1325,9 @@ void print_fields(type_t type, void *object) case PRINT_USER: switch(type) { case JOB: - if(job->user) + if (job->user) tmp_char = job->user; - else if(job->uid != -1) { + else if (job->uid != -1) { if ((pw=getpwuid(job->uid))) tmp_char = pw->pw_name; } diff --git a/src/sacct/process.c b/src/sacct/process.c index 070ab03aa50..58df0c29285 100644 --- a/src/sacct/process.c +++ b/src/sacct/process.c @@ -46,12 +46,12 @@ char *find_hostname(uint32_t pos, char *hosts) hostlist_t hostlist = NULL; char *temp = NULL, *host = NULL; - if(!hosts || (pos == (uint32_t)NO_VAL)) + if (!hosts || (pos == (uint32_t)NO_VAL)) return NULL; hostlist = hostlist_create(hosts); temp = hostlist_nth(hostlist, pos); - if(temp) { + if (temp) { host = xstrdup(temp); free(temp); } diff --git a/src/sacct/sacct.c b/src/sacct/sacct.c index 80a4b83d91e..6e716431ce3 100644 --- a/src/sacct/sacct.c +++ b/src/sacct/sacct.c @@ -133,9 +133,9 @@ int main(int argc, char **argv) switch (op) { case SACCT_LIST: print_fields_header(print_fields_list); - if(get_data() == SLURM_ERROR) + if (get_data() == SLURM_ERROR) exit(errno); - if(params.opt_completion) + if (params.opt_completion) do_list_completion(); else do_list(); diff --git a/src/sacctmgr/account_functions.c b/src/sacctmgr/account_functions.c index 6bb1252656d..4ca4a716ff7 100644 --- a/src/sacctmgr/account_functions.c +++ b/src/sacctmgr/account_functions.c @@ -53,13 +53,13 @@ static int _set_cond(int *start, int argc, char *argv[], int command_len = 0; int option = 0; - if(!acct_cond) { + if (!acct_cond) { exit_code=1; fprintf(stderr, "No acct_cond given"); return -1; } - if(!acct_cond->assoc_cond) { + if (!acct_cond->assoc_cond) { acct_cond->assoc_cond = xmalloc(sizeof(slurmdb_association_cond_t)); } @@ -68,11 +68,11 @@ static int _set_cond(int *start, int argc, char *argv[], for (i=(*start); i<argc; i++) { end = parse_option_end(argv[i]); - if(!end) + if (!end) command_len=strlen(argv[i]); else { command_len=end-1; - if(argv[i][end] == '=') { + if (argv[i][end] == '=') { option = (int)argv[i][end-1]; end++; } @@ -101,47 +101,47 @@ static int _set_cond(int *start, int argc, char *argv[], } else if (!end && !strncasecmp(argv[i], "WOPLimits", MAX(command_len, 4))) { assoc_cond->without_parent_limits = 1; - } else if(!end && !strncasecmp(argv[i], "where", + } else if (!end && !strncasecmp(argv[i], "where", MAX(command_len, 5))) { continue; - } else if(!end + } else if (!end || !strncasecmp(argv[i], "Names", MAX(command_len, 1)) || !strncasecmp(argv[i], "Accounts", MAX(command_len, 1)) || !strncasecmp(argv[i], "Acct", MAX(command_len, 4))) { - if(!assoc_cond->acct_list) { + if (!assoc_cond->acct_list) { assoc_cond->acct_list = list_create(slurm_destroy_char); } - if(slurm_addto_char_list( + if (slurm_addto_char_list( assoc_cond->acct_list, argv[i]+end)) u_set = 1; } else if (!strncasecmp(argv[i], "Descriptions", MAX(command_len, 1))) { - if(!acct_cond->description_list) { + if (!acct_cond->description_list) { acct_cond->description_list = list_create(slurm_destroy_char); } - if(slurm_addto_char_list(acct_cond->description_list, + if (slurm_addto_char_list(acct_cond->description_list, argv[i]+end)) u_set = 1; } else if (!strncasecmp(argv[i], "Format", MAX(command_len, 1))) { - if(format_list) + if (format_list) slurm_addto_char_list(format_list, argv[i]+end); } else if (!strncasecmp(argv[i], "Organizations", MAX(command_len, 1))) { - if(!acct_cond->organization_list) { + if (!acct_cond->organization_list) { acct_cond->organization_list = list_create(slurm_destroy_char); } - if(slurm_addto_char_list(acct_cond->organization_list, + if (slurm_addto_char_list(acct_cond->organization_list, argv[i]+end)) u_set = 1; - } else if(!(a_set = sacctmgr_set_association_cond( + } else if (!(a_set = sacctmgr_set_association_cond( assoc_cond, argv[i], argv[i]+end, command_len, option))) { exit_code=1; @@ -153,11 +153,11 @@ static int _set_cond(int *start, int argc, char *argv[], (*start) = i; - if(u_set && a_set) + if (u_set && a_set) return 3; - else if(a_set) + else if (a_set) return 2; - else if(u_set) + else if (u_set) return 1; return 0; @@ -178,11 +178,11 @@ static int _set_rec(int *start, int argc, char *argv[], for (i=(*start); i<argc; i++) { end = parse_option_end(argv[i]); - if(!end) + if (!end) command_len=strlen(argv[i]); else { command_len=end-1; - if(argv[i][end] == '=') { + if (argv[i][end] == '=') { option = (int)argv[i][end-1]; end++; } @@ -191,17 +191,17 @@ static int _set_rec(int *start, int argc, char *argv[], if (!strncasecmp(argv[i], "Where", MAX(command_len, 5))) { i--; break; - } else if(!end && !strncasecmp(argv[i], "set", + } else if (!end && !strncasecmp(argv[i], "set", MAX(command_len, 3))) { continue; - } else if(!end + } else if (!end || !strncasecmp(argv[i], "Accounts", MAX(command_len, 1)) || !strncasecmp(argv[i], "Names", MAX(command_len, 1)) || !strncasecmp(argv[i], "Acct", MAX(command_len, 4))) { - if(acct_list) + if (acct_list) slurm_addto_char_list(acct_list, argv[i]+end); else { exit_code=1; @@ -211,7 +211,7 @@ static int _set_rec(int *start, int argc, char *argv[], } } else if (!strncasecmp(argv[i], "Clusters", MAX(command_len, 1))) { - if(cluster_list) + if (cluster_list) slurm_addto_char_list(cluster_list, argv[i]+end); else { @@ -231,7 +231,7 @@ static int _set_rec(int *start, int argc, char *argv[], } else if (!strncasecmp (argv[i], "RawUsage", MAX(command_len, 7))) { uint32_t usage; - if(!assoc) + if (!assoc) continue; assoc->usage = xmalloc(sizeof( assoc_mgr_association_usage_t)); @@ -240,7 +240,7 @@ static int _set_rec(int *start, int argc, char *argv[], assoc->usage->usage_raw = usage; a_set = 1; } - } else if(!assoc || + } else if (!assoc || (assoc && !(a_set = sacctmgr_set_association_rec( assoc, argv[i], argv[i]+end, command_len, option)))) { @@ -253,11 +253,11 @@ static int _set_rec(int *start, int argc, char *argv[], (*start) = i; - if(u_set && a_set) + if (u_set && a_set) return 3; - else if(a_set) + else if (a_set) return 2; - else if(u_set) + else if (u_set) return 1; return 0; @@ -269,14 +269,14 @@ static int _isdefault_old(List acct_list) slurmdb_user_cond_t user_cond; List ret_list = NULL; - if(!acct_list || !list_count(acct_list)) + if (!acct_list || !list_count(acct_list)) return rc; memset(&user_cond, 0, sizeof(slurmdb_user_cond_t)); user_cond.def_acct_list = acct_list; ret_list = acct_storage_g_get_users(db_conn, my_uid, &user_cond); - if(ret_list && list_count(ret_list)) { + if (ret_list && list_count(ret_list)) { ListIterator itr = list_iterator_create(ret_list); slurmdb_user_rec_t *user = NULL; fprintf(stderr," Users listed below have these " @@ -289,7 +289,7 @@ static int _isdefault_old(List acct_list) rc = 1; } - if(ret_list) + if (ret_list) list_destroy(ret_list); return rc; @@ -387,10 +387,10 @@ extern int sacctmgr_add_account(int argc, char *argv[]) limit_set += _set_rec(&i, argc, argv, name_list, cluster_list, start_acct, start_assoc); } - if(exit_code) + if (exit_code) return SLURM_ERROR; - if(!name_list || !list_count(name_list)) { + if (!name_list || !list_count(name_list)) { list_destroy(name_list); list_destroy(cluster_list); slurmdb_destroy_association_rec(start_assoc); @@ -410,7 +410,7 @@ extern int sacctmgr_add_account(int argc, char *argv[]) db_conn, my_uid, &account_cond); } - if(!local_account_list) { + if (!local_account_list) { exit_code=1; fprintf(stderr, " Problem getting accounts from database. " "Contact your admin.\n"); @@ -421,14 +421,14 @@ extern int sacctmgr_add_account(int argc, char *argv[]) return SLURM_ERROR; } - if(!start_assoc->parent_acct) + if (!start_assoc->parent_acct) start_assoc->parent_acct = xstrdup("root"); - if(!cluster_list || !list_count(cluster_list)) { + if (!cluster_list || !list_count(cluster_list)) { slurmdb_cluster_rec_t *cluster_rec = NULL; List tmp_list = acct_storage_g_get_clusters(db_conn, my_uid, NULL); - if(!tmp_list) { + if (!tmp_list) { exit_code=1; fprintf(stderr, " Problem getting clusters from database. " @@ -441,7 +441,7 @@ extern int sacctmgr_add_account(int argc, char *argv[]) return SLURM_ERROR; } - if(!list_count(tmp_list)) { + if (!list_count(tmp_list)) { exit_code=1; fprintf(stderr, " Can't add accounts, no cluster " @@ -454,7 +454,7 @@ extern int sacctmgr_add_account(int argc, char *argv[]) list_destroy(local_account_list); return SLURM_ERROR; } - if(!cluster_list) + if (!cluster_list) list_create(slurm_destroy_char); else list_flush(cluster_list); @@ -482,10 +482,10 @@ extern int sacctmgr_add_account(int argc, char *argv[]) list_iterator_reset(itr); while((cluster_rec = list_next(itr))) { - if(!strcasecmp(cluster_rec->name, cluster)) + if (!strcasecmp(cluster_rec->name, cluster)) break; } - if(!cluster_rec) { + if (!cluster_rec) { exit_code=1; fprintf(stderr, " This cluster '%s' " "doesn't exist.\n" @@ -499,7 +499,7 @@ extern int sacctmgr_add_account(int argc, char *argv[]) list_iterator_destroy(itr_c); list_destroy(temp_list); - if(!list_count(cluster_list)) { + if (!list_count(cluster_list)) { slurmdb_destroy_association_rec(start_assoc); slurmdb_destroy_account_rec(start_acct); list_destroy(local_account_list); @@ -524,7 +524,7 @@ extern int sacctmgr_add_account(int argc, char *argv[]) local_assoc_list = acct_storage_g_get_associations( db_conn, my_uid, &assoc_cond); list_destroy(assoc_cond.acct_list); - if(!local_assoc_list) { + if (!local_assoc_list) { exit_code=1; fprintf(stderr, " Problem getting associations from database. " "Contact your admin.\n"); @@ -538,7 +538,7 @@ extern int sacctmgr_add_account(int argc, char *argv[]) itr = list_iterator_create(name_list); while((name = list_next(itr))) { - if(!name[0]) { + if (!name[0]) { exit_code=1; fprintf(stderr, " No blank names are " "allowed when adding.\n"); @@ -547,21 +547,21 @@ extern int sacctmgr_add_account(int argc, char *argv[]) } acct = NULL; - if(!sacctmgr_find_account_from_list(local_account_list, name)) { + if (!sacctmgr_find_account_from_list(local_account_list, name)) { acct = xmalloc(sizeof(slurmdb_account_rec_t)); acct->assoc_list = list_create(slurmdb_destroy_association_rec); acct->name = xstrdup(name); - if(start_acct->description) + if (start_acct->description) acct->description = xstrdup(start_acct->description); else acct->description = xstrdup(name); - if(start_acct->organization) + if (start_acct->organization) acct->organization = xstrdup(start_acct->organization); - else if(strcmp(start_assoc->parent_acct, "root")) + else if (strcmp(start_assoc->parent_acct, "root")) acct->organization = xstrdup(start_assoc->parent_acct); else @@ -573,12 +573,12 @@ extern int sacctmgr_add_account(int argc, char *argv[]) itr_c = list_iterator_create(cluster_list); while((cluster = list_next(itr_c))) { - if(sacctmgr_find_account_base_assoc_from_list( + if (sacctmgr_find_account_base_assoc_from_list( local_assoc_list, name, cluster)) { //printf(" already have this assoc\n"); continue; } - if(!sacctmgr_find_account_base_assoc_from_list( + if (!sacctmgr_find_account_base_assoc_from_list( local_assoc_list, start_assoc->parent_acct, cluster)) { exit_code=1; @@ -616,7 +616,7 @@ extern int sacctmgr_add_account(int argc, char *argv[]) assoc->qos_list = copy_char_list(start_assoc->qos_list); - if(acct) + if (acct) list_append(acct->assoc_list, assoc); else list_append(assoc_list, assoc); @@ -634,25 +634,25 @@ extern int sacctmgr_add_account(int argc, char *argv[]) list_destroy(local_assoc_list); - if(!list_count(acct_list) && !list_count(assoc_list)) { + if (!list_count(acct_list) && !list_count(assoc_list)) { printf(" Nothing new added.\n"); goto end_it; - } else if(!assoc_str) { + } else if (!assoc_str) { exit_code=1; fprintf(stderr, " No associations created.\n"); goto end_it; } - if(acct_str) { + if (acct_str) { printf(" Adding Account(s)\n%s", acct_str); printf(" Settings\n"); - if(start_acct->description) + if (start_acct->description) printf(" Description = %s\n", start_acct->description); else printf(" Description = %s\n", "Account Name"); - if(start_acct->organization) + if (start_acct->organization) printf(" Organization = %s\n", start_acct->organization); else @@ -662,23 +662,23 @@ extern int sacctmgr_add_account(int argc, char *argv[]) xfree(acct_str); } - if(assoc_str) { + if (assoc_str) { printf(" Associations\n%s", assoc_str); xfree(assoc_str); } - if(limit_set) { + if (limit_set) { printf(" Settings\n"); sacctmgr_print_assoc_limits(start_assoc); } notice_thread_init(); - if(list_count(acct_list)) + if (list_count(acct_list)) rc = acct_storage_g_add_accounts(db_conn, my_uid, acct_list); - if(rc == SLURM_SUCCESS) { - if(list_count(assoc_list)) + if (rc == SLURM_SUCCESS) { + if (list_count(assoc_list)) rc = acct_storage_g_add_associations(db_conn, my_uid, assoc_list); } else { @@ -691,8 +691,8 @@ extern int sacctmgr_add_account(int argc, char *argv[]) } notice_thread_fini(); - if(rc == SLURM_SUCCESS) { - if(commit_check("Would you like to commit changes?")) { + if (rc == SLURM_SUCCESS) { + if (commit_check("Would you like to commit changes?")) { acct_storage_g_commit(db_conn, 1); } else { printf(" Changes Discarded\n"); @@ -747,26 +747,26 @@ extern int sacctmgr_list_account(int argc, char *argv[]) cond_set |= prev_set; } - if(exit_code) { + if (exit_code) { slurmdb_destroy_account_cond(acct_cond); list_destroy(format_list); return SLURM_ERROR; - } else if(!list_count(format_list)) { + } else if (!list_count(format_list)) { slurm_addto_char_list(format_list, "Acc,Des,O"); - if(acct_cond->with_assocs) + if (acct_cond->with_assocs) slurm_addto_char_list(format_list, "Cl,ParentN,U,Share,GrpJ,GrpN," "GrpCPUs,GrpMEM,GrpS,GrpWall,GrpCPUMins," "MaxJ,MaxN,MaxCPUs,MaxS,MaxW," "MaxCPUMins,QOS,DefaultQOS"); - if(acct_cond->with_coords) + if (acct_cond->with_coords) slurm_addto_char_list(format_list, "Coord"); } - if(!acct_cond->with_assocs && cond_set > 1) { - if(!commit_check("You requested options that are only vaild " + if (!acct_cond->with_assocs && cond_set > 1) { + if (!commit_check("You requested options that are only vaild " "when querying with the withassoc option.\n" "Are you sure you want to continue?")) { printf("Aborted\n"); @@ -779,7 +779,7 @@ extern int sacctmgr_list_account(int argc, char *argv[]) print_fields_list = sacctmgr_process_format_list(format_list); list_destroy(format_list); - if(exit_code) { + if (exit_code) { slurmdb_destroy_account_cond(acct_cond); list_destroy(print_fields_list); return SLURM_ERROR; @@ -788,7 +788,7 @@ extern int sacctmgr_list_account(int argc, char *argv[]) acct_list = acct_storage_g_get_accounts(db_conn, my_uid, acct_cond); slurmdb_destroy_account_cond(acct_cond); - if(!acct_list) { + if (!acct_list) { exit_code=1; fprintf(stderr, " Problem with query.\n"); list_destroy(print_fields_list); @@ -802,7 +802,7 @@ extern int sacctmgr_list_account(int argc, char *argv[]) field_count = list_count(print_fields_list); while((acct = list_next(itr))) { - if(acct->assoc_list) { + if (acct->assoc_list) { ListIterator itr3 = list_iterator_create(acct->assoc_list); while((assoc = list_next(itr3))) { @@ -937,20 +937,20 @@ extern int sacctmgr_modify_account(int argc, char *argv[]) } } - if(exit_code) { + if (exit_code) { slurmdb_destroy_account_cond(acct_cond); slurmdb_destroy_account_rec(acct); slurmdb_destroy_association_rec(assoc); return SLURM_ERROR; - } else if(!rec_set) { + } else if (!rec_set) { exit_code=1; fprintf(stderr, " You didn't give me anything to set\n"); slurmdb_destroy_account_cond(acct_cond); slurmdb_destroy_account_rec(acct); slurmdb_destroy_association_rec(assoc); return SLURM_ERROR; - } else if(!cond_set) { - if(!commit_check("You didn't set any conditions with 'WHERE'.\n" + } else if (!cond_set) { + if (!commit_check("You didn't set any conditions with 'WHERE'.\n" "Are you sure you want to continue?")) { printf("Aborted\n"); slurmdb_destroy_account_cond(acct_cond); @@ -975,8 +975,8 @@ extern int sacctmgr_modify_account(int argc, char *argv[]) } notice_thread_init(); - if(rec_set & 1) { // process the account changes - if(cond_set == 2) { + if (rec_set & 1) { // process the account changes + if (cond_set == 2) { exit_code=1; fprintf(stderr, " There was a problem with your " @@ -986,7 +986,7 @@ extern int sacctmgr_modify_account(int argc, char *argv[]) } ret_list = acct_storage_g_modify_accounts( db_conn, my_uid, acct_cond, acct); - if(ret_list && list_count(ret_list)) { + if (ret_list && list_count(ret_list)) { char *object = NULL; ListIterator itr = list_iterator_create(ret_list); printf(" Modified accounts...\n"); @@ -995,7 +995,7 @@ extern int sacctmgr_modify_account(int argc, char *argv[]) } list_iterator_destroy(itr); set = 1; - } else if(ret_list) { + } else if (ret_list) { printf(" Nothing modified\n"); rc = SLURM_ERROR; } else { @@ -1006,13 +1006,13 @@ extern int sacctmgr_modify_account(int argc, char *argv[]) rc = SLURM_ERROR; } - if(ret_list) + if (ret_list) list_destroy(ret_list); } assoc_start: - if(rec_set == 3 || rec_set == 2) { // process the association changes - if(cond_set == 1 && !acct_cond->assoc_cond->acct_list) { + if (rec_set == 3 || rec_set == 2) { // process the association changes + if (cond_set == 1 && !acct_cond->assoc_cond->acct_list) { rc = SLURM_ERROR; exit_code=1; fprintf(stderr, @@ -1021,10 +1021,10 @@ assoc_start: goto assoc_end; } - if(assoc->parent_acct) { + if (assoc->parent_acct) { slurmdb_account_rec_t *acct_rec = sacctmgr_find_account(assoc->parent_acct); - if(!acct_rec) { + if (!acct_rec) { exit_code=1; fprintf(stderr, " Parent Account %s doesn't exist.\n", @@ -1037,7 +1037,7 @@ assoc_start: ret_list = acct_storage_g_modify_associations( db_conn, my_uid, acct_cond->assoc_cond, assoc); - if(ret_list && list_count(ret_list)) { + if (ret_list && list_count(ret_list)) { set = 1; if (assoc->def_qos_id != NO_VAL) set = sacctmgr_check_default_qos( @@ -1058,7 +1058,7 @@ assoc_start: list_iterator_destroy(itr); set = 1; } - } else if(ret_list) { + } else if (ret_list) { printf(" Nothing modified\n"); } else { exit_code=1; @@ -1068,15 +1068,15 @@ assoc_start: rc = SLURM_ERROR; } - if(ret_list) + if (ret_list) list_destroy(ret_list); } assoc_end: notice_thread_fini(); - if(set) { - if(commit_check("Would you like to commit changes?")) + if (set) { + if (commit_check("Would you like to commit changes?")) acct_storage_g_commit(db_conn, 1); else { printf(" Changes Discarded\n"); @@ -1109,7 +1109,7 @@ extern int sacctmgr_delete_account(int argc, char *argv[]) cond_set |= prev_set; } - if(!cond_set) { + if (!cond_set) { exit_code=1; fprintf(stderr, " No conditions given to remove, not executing.\n"); @@ -1117,24 +1117,24 @@ extern int sacctmgr_delete_account(int argc, char *argv[]) return SLURM_ERROR; } - if(exit_code) { + if (exit_code) { slurmdb_destroy_account_cond(acct_cond); return SLURM_ERROR; } /* check to see if person is trying to remove root account. This is * bad, and should not be allowed outside of deleting a cluster. */ - if(acct_cond->assoc_cond + if (acct_cond->assoc_cond && acct_cond->assoc_cond->acct_list && list_count(acct_cond->assoc_cond->acct_list)) { char *tmp_char = NULL; itr = list_iterator_create(acct_cond->assoc_cond->acct_list); while((tmp_char = list_next(itr))) { - if(!strcasecmp(tmp_char, "root")) + if (!strcasecmp(tmp_char, "root")) break; } list_iterator_destroy(itr); - if(tmp_char) { + if (tmp_char) { exit_code=1; fprintf(stderr, " You are not allowed to remove " "the root account.\n" @@ -1150,10 +1150,10 @@ extern int sacctmgr_delete_account(int argc, char *argv[]) acct_cond->assoc_cond->only_defs = 0; notice_thread_init(); - if(cond_set == 1) { + if (cond_set == 1) { ret_list = acct_storage_g_remove_accounts( db_conn, my_uid, acct_cond); - } else if(cond_set & 2) { + } else if (cond_set & 2) { ret_list = acct_storage_g_remove_associations( db_conn, my_uid, acct_cond->assoc_cond); } @@ -1161,7 +1161,7 @@ extern int sacctmgr_delete_account(int argc, char *argv[]) notice_thread_fini(); slurmdb_destroy_account_cond(acct_cond); - if(ret_list && list_count(ret_list)) { + if (ret_list && list_count(ret_list)) { char *object = NULL; ListIterator itr = NULL; @@ -1170,7 +1170,7 @@ extern int sacctmgr_delete_account(int argc, char *argv[]) * output from acct_storage_g_remove_accounts, and * with a previously got assoc_list. */ - if(_isdefault(cond_set, ret_list, local_assoc_list)) { + if (_isdefault(cond_set, ret_list, local_assoc_list)) { exit_code=1; fprintf(stderr, " Please either remove the " "accounts listed " @@ -1185,7 +1185,7 @@ extern int sacctmgr_delete_account(int argc, char *argv[]) /* If there were jobs running with an association to be deleted, don't. */ - if(rc == ESLURM_JOBS_RUNNING_ON_ASSOC) { + if (rc == ESLURM_JOBS_RUNNING_ON_ASSOC) { fprintf(stderr, " Error with request: %s\n", slurm_strerror(rc)); while((object = list_next(itr))) { @@ -1195,22 +1195,22 @@ extern int sacctmgr_delete_account(int argc, char *argv[]) goto end_it; } - if(cond_set == 1) { + if (cond_set == 1) { printf(" Deleting accounts...\n"); - } else if(cond_set & 2) { + } else if (cond_set & 2) { printf(" Deleting account associations...\n"); } while((object = list_next(itr))) { printf(" %s\n", object); } list_iterator_destroy(itr); - if(commit_check("Would you like to commit changes?")) { + if (commit_check("Would you like to commit changes?")) { acct_storage_g_commit(db_conn, 1); } else { printf(" Changes Discarded\n"); acct_storage_g_commit(db_conn, 0); } - } else if(ret_list) { + } else if (ret_list) { printf(" Nothing deleted\n"); } else { exit_code=1; @@ -1222,7 +1222,7 @@ extern int sacctmgr_delete_account(int argc, char *argv[]) end_it: - if(ret_list) + if (ret_list) list_destroy(ret_list); if (local_assoc_list) list_destroy(local_assoc_list); diff --git a/src/sacctmgr/archive_functions.c b/src/sacctmgr/archive_functions.c index dacdb7039d6..f4a221ca777 100644 --- a/src/sacctmgr/archive_functions.c +++ b/src/sacctmgr/archive_functions.c @@ -66,13 +66,13 @@ extern int _addto_uid_char_list(List char_list, char *names) int quote = 0; int count = 0; - if(!char_list) { + if (!char_list) { error("No list was given to fill in"); return 0; } itr = list_iterator_create(char_list); - if(names) { + if (names) { if (names[i] == '\"' || names[i] == '\'') { quote_c = names[i]; quote = 1; @@ -81,23 +81,23 @@ extern int _addto_uid_char_list(List char_list, char *names) start = i; while(names[i]) { //info("got %d - %d = %d", i, start, i-start); - if(quote && names[i] == quote_c) + if (quote && names[i] == quote_c) break; else if (names[i] == '\"' || names[i] == '\'') names[i] = '`'; - else if(names[i] == ',') { - if((i-start) > 0) { + else if (names[i] == ',') { + if ((i-start) > 0) { name = xmalloc((i-start+1)); memcpy(name, names+start, (i-start)); //info("got %s %d", name, i-start); name = _string_to_uid( name ); while((tmp_char = list_next(itr))) { - if(!strcasecmp(tmp_char, name)) + if (!strcasecmp(tmp_char, name)) break; } - if(!tmp_char) { + if (!tmp_char) { list_append(char_list, name); count++; } else @@ -106,7 +106,7 @@ extern int _addto_uid_char_list(List char_list, char *names) } i++; start = i; - if(!names[i]) { + if (!names[i]) { info("There is a problem with " "your request. It appears you " "have spaces inside your list."); @@ -115,17 +115,17 @@ extern int _addto_uid_char_list(List char_list, char *names) } i++; } - if((i-start) > 0) { + if ((i-start) > 0) { name = xmalloc((i-start)+1); memcpy(name, names+start, (i-start)); name = _string_to_uid( name ); while((tmp_char = list_next(itr))) { - if(!strcasecmp(tmp_char, name)) + if (!strcasecmp(tmp_char, name)) break; } - if(!tmp_char) { + if (!tmp_char) { list_append(char_list, name); count++; } else @@ -146,17 +146,17 @@ static int _set_cond(int *start, int argc, char *argv[], uint32_t tmp; slurmdb_job_cond_t *job_cond = NULL; - if(!arch_cond) { + if (!arch_cond) { error("No arch_cond given"); return -1; } - if(!arch_cond->job_cond) + if (!arch_cond->job_cond) arch_cond->job_cond = xmalloc(sizeof(slurmdb_job_cond_t)); job_cond = arch_cond->job_cond; for (i=(*start); i<argc; i++) { end = parse_option_end(argv[i]); - if(!end) + if (!end) command_len=strlen(argv[i]); else { command_len=end-1; @@ -165,29 +165,29 @@ static int _set_cond(int *start, int argc, char *argv[], } } - if(!end && !strncasecmp(argv[i], "where", + if (!end && !strncasecmp(argv[i], "where", MAX(command_len, 5))) { continue; - } else if(!end && !strncasecmp(argv[i], "events", + } else if (!end && !strncasecmp(argv[i], "events", MAX(command_len, 1))) { arch_cond->purge_event |= SLURMDB_PURGE_ARCHIVE; set = 1; - } else if(!end && !strncasecmp(argv[i], "jobs", + } else if (!end && !strncasecmp(argv[i], "jobs", MAX(command_len, 1))) { arch_cond->purge_job |= SLURMDB_PURGE_ARCHIVE; set = 1; - } else if(!end && !strncasecmp(argv[i], "steps", + } else if (!end && !strncasecmp(argv[i], "steps", MAX(command_len, 1))) { arch_cond->purge_step |= SLURMDB_PURGE_ARCHIVE; set = 1; - } else if(!end && !strncasecmp(argv[i], "suspend", + } else if (!end && !strncasecmp(argv[i], "suspend", MAX(command_len, 1))) { arch_cond->purge_suspend |= SLURMDB_PURGE_ARCHIVE; set = 1; - } else if(!end + } else if (!end || !strncasecmp(argv[i], "Clusters", MAX(command_len, 1))) { - if(!job_cond->cluster_list) + if (!job_cond->cluster_list) job_cond->cluster_list = list_create(slurm_destroy_char); slurm_addto_char_list(job_cond->cluster_list, @@ -195,7 +195,7 @@ static int _set_cond(int *start, int argc, char *argv[], set = 1; } else if (!strncasecmp (argv[i], "Accounts", MAX(command_len, 2))) { - if(!job_cond->acct_list) + if (!job_cond->acct_list) job_cond->acct_list = list_create(slurm_destroy_char); slurm_addto_char_list(job_cond->acct_list, @@ -203,7 +203,7 @@ static int _set_cond(int *start, int argc, char *argv[], set = 1; } else if (!strncasecmp (argv[i], "Associations", MAX(command_len, 2))) { - if(!job_cond->associd_list) + if (!job_cond->associd_list) job_cond->associd_list = list_create(slurm_destroy_char); slurm_addto_char_list(job_cond->associd_list, @@ -218,7 +218,7 @@ static int _set_cond(int *start, int argc, char *argv[], job_cond->usage_end = parse_time(argv[i]+end, 1); set = 1; } else if (!strncasecmp (argv[i], "Gid", MAX(command_len, 2))) { - if(!job_cond->groupid_list) + if (!job_cond->groupid_list) job_cond->groupid_list = list_create(slurm_destroy_char); slurm_addto_char_list(job_cond->groupid_list, @@ -229,7 +229,7 @@ static int _set_cond(int *start, int argc, char *argv[], char *end_char = NULL, *start_char = argv[i]+end; slurmdb_selected_step_t *selected_step = NULL; char *dot = NULL; - if(!job_cond->step_list) + if (!job_cond->step_list) job_cond->step_list = list_create(slurm_destroy_char); @@ -238,7 +238,7 @@ static int _set_cond(int *start, int argc, char *argv[], *end_char = 0; while (isspace(*start_char)) start_char++; /* discard whitespace */ - if(!(int)*start_char) + if (!(int)*start_char) continue; selected_step = xmalloc( sizeof(slurmdb_selected_step_t)); @@ -259,7 +259,7 @@ static int _set_cond(int *start, int argc, char *argv[], set = 1; } else if (!strncasecmp (argv[i], "Partitions", MAX(command_len, 2))) { - if(!job_cond->partition_list) + if (!job_cond->partition_list) job_cond->partition_list = list_create(slurm_destroy_char); slurm_addto_char_list(job_cond->partition_list, @@ -353,7 +353,7 @@ static int _set_cond(int *start, int argc, char *argv[], set = 1; } else if (!strncasecmp (argv[i], "Users", MAX(command_len, 1))) { - if(!job_cond->userid_list) + if (!job_cond->userid_list) job_cond->userid_list = list_create(slurm_destroy_char); _addto_uid_char_list(job_cond->userid_list, @@ -386,22 +386,22 @@ extern int sacctmgr_archive_dump(int argc, char *argv[]) _set_cond(&i, argc, argv, arch_cond); } - if(!arch_cond->purge_event) + if (!arch_cond->purge_event) arch_cond->purge_event = NO_VAL; - if(!arch_cond->purge_job) + if (!arch_cond->purge_job) arch_cond->purge_job = NO_VAL; - if(!arch_cond->purge_step) + if (!arch_cond->purge_step) arch_cond->purge_step = NO_VAL; - if(!arch_cond->purge_suspend) + if (!arch_cond->purge_suspend) arch_cond->purge_suspend = NO_VAL; - if(exit_code) { + if (exit_code) { slurmdb_destroy_archive_cond(arch_cond); return SLURM_ERROR; } if (arch_cond->archive_dir) { - if(stat(arch_cond->archive_dir, &st) < 0) { + if (stat(arch_cond->archive_dir, &st) < 0) { exit_code = errno; fprintf(stderr, " dump: Failed to stat %s: %m\n " "Note: For archive dump, " @@ -429,7 +429,7 @@ extern int sacctmgr_archive_dump(int argc, char *argv[]) } if (arch_cond->archive_script) { - if(stat(arch_cond->archive_script, &st) < 0) { + if (stat(arch_cond->archive_script, &st) < 0) { exit_code = errno; fprintf(stderr, " dump: Failed to stat %s: %m\n " "Note: For archive dump, the script must be on " @@ -455,8 +455,8 @@ extern int sacctmgr_archive_dump(int argc, char *argv[]) } rc = jobacct_storage_g_archive(db_conn, arch_cond); - if(rc == SLURM_SUCCESS) { - if(commit_check("Would you like to commit changes?")) { + if (rc == SLURM_SUCCESS) { + if (commit_check("Would you like to commit changes?")) { acct_storage_g_commit(db_conn, 1); } else { printf(" Changes Discarded\n"); @@ -483,7 +483,7 @@ extern int sacctmgr_archive_load(int argc, char *argv[]) for (i=0; i<argc; i++) { int end = parse_option_end(argv[i]); - if(!end) + if (!end) command_len=strlen(argv[i]); else { command_len=end-1; @@ -492,7 +492,7 @@ extern int sacctmgr_archive_load(int argc, char *argv[]) } } - if(!end + if (!end || !strncasecmp (argv[i], "File", MAX(command_len, 1))) { arch_rec->archive_file = strip_quotes(argv[i]+end, NULL, 0); @@ -505,7 +505,7 @@ extern int sacctmgr_archive_load(int argc, char *argv[]) } } - if(exit_code) { + if (exit_code) { slurmdb_destroy_archive_rec(arch_rec); return SLURM_ERROR; } @@ -524,7 +524,7 @@ extern int sacctmgr_archive_load(int argc, char *argv[]) arch_rec->archive_file = fullpath; } - if(stat(arch_rec->archive_file, &st) < 0) { + if (stat(arch_rec->archive_file, &st) < 0) { exit_code = errno; fprintf(stderr, " load: Failed to stat %s: %m\n " "Note: For archive load, the file must be on " @@ -535,8 +535,8 @@ extern int sacctmgr_archive_load(int argc, char *argv[]) } rc = jobacct_storage_g_archive_load(db_conn, arch_rec); - if(rc == SLURM_SUCCESS) { - if(commit_check("Would you like to commit changes?")) { + if (rc == SLURM_SUCCESS) { + if (commit_check("Would you like to commit changes?")) { acct_storage_g_commit(db_conn, 1); } else { printf(" Changes Discarded\n"); diff --git a/src/sacctmgr/association_functions.c b/src/sacctmgr/association_functions.c index b5e9600bbc9..0cfd10896c3 100644 --- a/src/sacctmgr/association_functions.c +++ b/src/sacctmgr/association_functions.c @@ -119,7 +119,7 @@ static int _set_cond(int *start, int argc, char *argv[], if (format_list) slurm_addto_char_list(format_list, argv[i]+end); - } else if(!(set = sacctmgr_set_association_cond( + } else if (!(set = sacctmgr_set_association_cond( assoc_cond, argv[i], argv[i]+end, command_len, option)) || exit_code) { exit_code = 1; @@ -406,14 +406,14 @@ extern int sacctmgr_set_association_cond(slurmdb_association_cond_t *assoc_cond, if (slurm_addto_char_list(assoc_cond->parent_acct_list, value)) set = 1; } else if (!strncasecmp (type, "QosLevel", MAX(command_len, 1))) { - if(!assoc_cond->qos_list) + if (!assoc_cond->qos_list) assoc_cond->qos_list = list_create(slurm_destroy_char); - if(!g_qos_list) + if (!g_qos_list) g_qos_list = acct_storage_g_get_qos( db_conn, my_uid, NULL); - if(slurmdb_addto_qos_char_list(assoc_cond->qos_list, g_qos_list, + if (slurmdb_addto_qos_char_list(assoc_cond->qos_list, g_qos_list, value, option)) set = 1; } else if (!strncasecmp (type, "Users", MAX(command_len, 1))) { @@ -437,17 +437,17 @@ extern int sacctmgr_set_association_rec(slurmdb_association_rec_t *assoc, return set; if (!strncasecmp (type, "DefaultQOS", MAX(command_len, 8))) { - if(!g_qos_list) + if (!g_qos_list) g_qos_list = acct_storage_g_get_qos( db_conn, my_uid, NULL); - if(atoi(value) == -1) + if (atoi(value) == -1) assoc->def_qos_id = -1; else assoc->def_qos_id = str_2_slurmdb_qos( g_qos_list, value); - if(assoc->def_qos_id == NO_VAL) { + if (assoc->def_qos_id == NO_VAL) { fprintf(stderr, "You gave a bad default qos '%s'. " "Use 'list qos' to get " @@ -569,7 +569,7 @@ extern void sacctmgr_print_association_rec(slurmdb_association_rec_t *assoc, xassert(field); - if(!assoc) { + if (!assoc) { field->print_routine(field, NULL, last); return; } diff --git a/src/sacctmgr/cluster_functions.c b/src/sacctmgr/cluster_functions.c index 26ded4d08c9..410f7e55e82 100644 --- a/src/sacctmgr/cluster_functions.c +++ b/src/sacctmgr/cluster_functions.c @@ -59,7 +59,7 @@ static int _set_cond(int *start, int argc, char *argv[], for (i=(*start); i<argc; i++) { end = parse_option_end(argv[i]); - if(!end) + if (!end) command_len=strlen(argv[i]); else { command_len=end-1; @@ -71,7 +71,7 @@ static int _set_cond(int *start, int argc, char *argv[], if (!strncasecmp(argv[i], "Set", MAX(command_len, 3))) { i--; break; - } else if(!end && !strncasecmp(argv[i], "where", + } else if (!end && !strncasecmp(argv[i], "where", MAX(command_len, 5))) { continue; } else if (!end && @@ -81,21 +81,21 @@ static int _set_cond(int *start, int argc, char *argv[], } else if (!end && !strncasecmp(argv[i], "WOLimits", MAX(command_len, 3))) { without_limits = 1; - } else if(!end || !strncasecmp(argv[i], "Names", + } else if (!end || !strncasecmp(argv[i], "Names", MAX(command_len, 1)) || !strncasecmp(argv[i], "Clusters", MAX(command_len, 3))) { - if(!cluster_cond->cluster_list) + if (!cluster_cond->cluster_list) cluster_cond->cluster_list = list_create(slurm_destroy_char); - if(slurm_addto_char_list(cluster_cond->cluster_list, + if (slurm_addto_char_list(cluster_cond->cluster_list, argv[i]+end)) a_set = 1; } else if (!strncasecmp(argv[i], "Classification", MAX(command_len, 3))) { cluster_cond->classification = str_2_classification(argv[i]+end); - if(cluster_cond->classification) + if (cluster_cond->classification) c_set = 1; } else if (!strncasecmp(argv[i], "flags", MAX(command_len, 2))) { @@ -104,23 +104,23 @@ static int _set_cond(int *start, int argc, char *argv[], c_set = 1; } else if (!strncasecmp(argv[i], "Format", MAX(command_len, 2))) { - if(format_list) + if (format_list) slurm_addto_char_list(format_list, argv[i]+end); - } else if(!end || !strncasecmp(argv[i], "PluginIDSelect", + } else if (!end || !strncasecmp(argv[i], "PluginIDSelect", MAX(command_len, 1))) { - if(!cluster_cond->plugin_id_select_list) + if (!cluster_cond->plugin_id_select_list) cluster_cond->plugin_id_select_list = list_create(slurm_destroy_char); - if(slurm_addto_char_list( + if (slurm_addto_char_list( cluster_cond->plugin_id_select_list, argv[i]+end)) c_set = 1; - } else if(!end || !strncasecmp(argv[i], "RPCVersions", + } else if (!end || !strncasecmp(argv[i], "RPCVersions", MAX(command_len, 1))) { - if(!cluster_cond->rpc_version_list) + if (!cluster_cond->rpc_version_list) cluster_cond->rpc_version_list = list_create(slurm_destroy_char); - if(slurm_addto_char_list(cluster_cond->rpc_version_list, + if (slurm_addto_char_list(cluster_cond->rpc_version_list, argv[i]+end)) c_set = 1; } else { @@ -133,11 +133,11 @@ static int _set_cond(int *start, int argc, char *argv[], } (*start) = i; - if(c_set && a_set) + if (c_set && a_set) return 3; - else if(a_set) { + else if (a_set) { return 2; - } else if(c_set) + } else if (c_set) return 1; return 0; } @@ -155,11 +155,11 @@ static int _set_rec(int *start, int argc, char *argv[], for (i=(*start); i<argc; i++) { end = parse_option_end(argv[i]); - if(!end) + if (!end) command_len=strlen(argv[i]); else { command_len=end-1; - if(argv[i][end] == '=') { + if (argv[i][end] == '=') { option = (int)argv[i][end-1]; end++; } @@ -168,23 +168,23 @@ static int _set_rec(int *start, int argc, char *argv[], if (!strncasecmp(argv[i], "Where", MAX(command_len, 5))) { i--; break; - } else if(!end && !strncasecmp(argv[i], "set", + } else if (!end && !strncasecmp(argv[i], "set", MAX(command_len, 3))) { continue; - } else if(!end + } else if (!end || !strncasecmp(argv[i], "Names", MAX(command_len, 1)) || !strncasecmp(argv[i], "Clusters", MAX(command_len, 3))) { - if(name_list) + if (name_list) slurm_addto_char_list(name_list, argv[i]+end); } else if (!strncasecmp(argv[i], "Classification", MAX(command_len, 3))) { - if(classification) { + if (classification) { *classification = str_2_classification(argv[i]+end); - if(*classification) + if (*classification) set = 1; } } else if (!strncasecmp(argv[i], "GrpCPUMins", @@ -198,7 +198,7 @@ static int _set_rec(int *start, int argc, char *argv[], exit_code=1; fprintf(stderr, "GrpWall is not a valid option " "for the root association of a cluster.\n"); - } else if(!assoc || + } else if (!assoc || (assoc && !(set = sacctmgr_set_association_rec( assoc, argv[i], argv[i]+end, command_len, option)))) { @@ -239,10 +239,10 @@ extern int sacctmgr_add_cluster(int argc, char *argv[]) limit_set += _set_rec(&i, argc, argv, name_list, &start_assoc, &class); } - if(exit_code) { + if (exit_code) { list_destroy(name_list); return SLURM_ERROR; - } else if(!list_count(name_list)) { + } else if (!list_count(name_list)) { list_destroy(name_list); exit_code=1; fprintf(stderr, " Need name of cluster to add.\n"); @@ -257,7 +257,7 @@ extern int sacctmgr_add_cluster(int argc, char *argv[]) temp_list = acct_storage_g_get_clusters(db_conn, my_uid, &cluster_cond); - if(!temp_list) { + if (!temp_list) { exit_code=1; fprintf(stderr, " Problem getting clusters from database. " @@ -272,10 +272,10 @@ extern int sacctmgr_add_cluster(int argc, char *argv[]) list_iterator_reset(itr); while((cluster_rec = list_next(itr))) { - if(!strcasecmp(cluster_rec->name, name)) + if (!strcasecmp(cluster_rec->name, name)) break; } - if(cluster_rec) { + if (cluster_rec) { printf(" This cluster %s already exists. " "Not adding.\n", name); list_delete_item(itr_c); @@ -284,7 +284,7 @@ extern int sacctmgr_add_cluster(int argc, char *argv[]) list_iterator_destroy(itr); list_iterator_destroy(itr_c); list_destroy(temp_list); - if(!list_count(name_list)) { + if (!list_count(name_list)) { list_destroy(name_list); return SLURM_ERROR; } @@ -294,7 +294,7 @@ extern int sacctmgr_add_cluster(int argc, char *argv[]) cluster_list = list_create(slurmdb_destroy_cluster_rec); itr = list_iterator_create(name_list); while((name = list_next(itr))) { - if(!name[0]) { + if (!name[0]) { exit_code=1; fprintf(stderr, " No blank names are " "allowed when adding.\n"); @@ -312,7 +312,7 @@ extern int sacctmgr_add_cluster(int argc, char *argv[]) xmalloc(sizeof(slurmdb_association_rec_t)); slurmdb_init_association_rec(cluster->root_assoc, 0); printf(" Name = %s\n", cluster->name); - if(cluster->classification) + if (cluster->classification) printf(" Classification= %s\n", get_classification_str(cluster->classification)); @@ -341,14 +341,14 @@ extern int sacctmgr_add_cluster(int argc, char *argv[]) list_iterator_destroy(itr); list_destroy(name_list); - if(limit_set) { + if (limit_set) { printf(" Default Limits\n"); sacctmgr_print_assoc_limits(&start_assoc); - if(start_assoc.qos_list) + if (start_assoc.qos_list) list_destroy(start_assoc.qos_list); } - if(!list_count(cluster_list)) { + if (!list_count(cluster_list)) { printf(" Nothing new added.\n"); goto end_it; } @@ -357,11 +357,11 @@ extern int sacctmgr_add_cluster(int argc, char *argv[]) rolled back. So we ask before hand if they are serious about it so we can rollback if needed. */ - if(commit_check("Would you like to commit changes?")) { + if (commit_check("Would you like to commit changes?")) { notice_thread_init(); rc = acct_storage_g_add_clusters(db_conn, my_uid, cluster_list); notice_thread_fini(); - if(rc == SLURM_SUCCESS) { + if (rc == SLURM_SUCCESS) { acct_storage_g_commit(db_conn, 1); } else { exit_code=1; @@ -411,16 +411,16 @@ extern int sacctmgr_list_cluster(int argc, char *argv[]) _set_cond(&i, argc, argv, cluster_cond, format_list); } - if(exit_code) { + if (exit_code) { slurmdb_destroy_cluster_cond(cluster_cond); list_destroy(format_list); return SLURM_ERROR; } - if(!list_count(format_list)) { + if (!list_count(format_list)) { slurm_addto_char_list(format_list, "Cl,Controlh,Controlp,RPC"); - if(!without_limits) + if (!without_limits) slurm_addto_char_list(format_list, "Fa,GrpJ,GrpN,GrpS,MaxJ,MaxN," "MaxS,MaxW,QOS,DefaultQOS"); @@ -431,7 +431,7 @@ extern int sacctmgr_list_cluster(int argc, char *argv[]) print_fields_list = sacctmgr_process_format_list(format_list); list_destroy(format_list); - if(exit_code) { + if (exit_code) { slurmdb_destroy_cluster_cond(cluster_cond); list_destroy(print_fields_list); return SLURM_ERROR; @@ -441,7 +441,7 @@ extern int sacctmgr_list_cluster(int argc, char *argv[]) cluster_cond); slurmdb_destroy_cluster_cond(cluster_cond); - if(!cluster_list) { + if (!cluster_list) { exit_code=1; fprintf(stderr, " Problem with query.\n"); list_destroy(print_fields_list); @@ -496,7 +496,7 @@ extern int sacctmgr_list_cluster(int argc, char *argv[]) break; } case PRINT_DQOS: - if(!g_qos_list) { + if (!g_qos_list) { g_qos_list = acct_storage_g_get_qos( db_conn, my_uid, @@ -588,7 +588,7 @@ extern int sacctmgr_list_cluster(int argc, char *argv[]) { hostlist_t hl = hostlist_create(cluster->nodes); int cnt = 0; - if(hl) { + if (hl) { cnt = hostlist_count(hl); hostlist_destroy(hl); } @@ -605,7 +605,7 @@ extern int sacctmgr_list_cluster(int argc, char *argv[]) (curr_inx == field_count)); break; case PRINT_QOS: - if(!g_qos_list) + if (!g_qos_list) g_qos_list = acct_storage_g_get_qos( db_conn, my_uid, NULL); @@ -693,36 +693,36 @@ extern int sacctmgr_modify_cluster(int argc, char *argv[]) } } - if(!rec_set) { + if (!rec_set) { exit_code=1; fprintf(stderr, " You didn't give me anything to set\n"); rc = SLURM_ERROR; goto end_it; - } else if(!cond_set) { - if(!commit_check("You didn't set any conditions with 'WHERE'.\n" + } else if (!cond_set) { + if (!commit_check("You didn't set any conditions with 'WHERE'.\n" "Are you sure you want to continue?")) { printf("Aborted\n"); rc = SLURM_SUCCESS; goto end_it; } - } else if(exit_code) { + } else if (exit_code) { rc = SLURM_ERROR; goto end_it; } - if(cond_set & 1) { + if (cond_set & 1) { List temp_list = NULL; temp_list = acct_storage_g_get_clusters(db_conn, my_uid, &cluster_cond); - if(!temp_list) { + if (!temp_list) { exit_code=1; fprintf(stderr, " Problem getting clusters from database. " "Contact your admin.\n"); rc = SLURM_ERROR; goto end_it; - } else if(!list_count(temp_list)) { + } else if (!list_count(temp_list)) { fprintf(stderr, " Query didn't return any clusters.\n"); rc = SLURM_ERROR; @@ -731,16 +731,16 @@ extern int sacctmgr_modify_cluster(int argc, char *argv[]) /* we are only looking for the clusters returned from this query, so we free the cluster_list and replace it */ - if(assoc_cond->cluster_list) + if (assoc_cond->cluster_list) list_destroy(assoc_cond->cluster_list); assoc_cond->cluster_list = temp_list; } printf(" Setting\n"); - if(rec_set) { + if (rec_set) { printf(" Default Limits =\n"); sacctmgr_print_assoc_limits(assoc); - if(class_rec) + if (class_rec) printf(" Cluster Classification = %s\n", get_classification_str(class_rec)); } @@ -750,7 +750,7 @@ extern int sacctmgr_modify_cluster(int argc, char *argv[]) ret_list = acct_storage_g_modify_associations( db_conn, my_uid, assoc_cond, assoc); - if(ret_list && list_count(ret_list)) { + if (ret_list && list_count(ret_list)) { char *object = NULL; ListIterator itr = list_iterator_create(ret_list); printf(" Modified cluster defaults for associations...\n"); @@ -759,7 +759,7 @@ extern int sacctmgr_modify_cluster(int argc, char *argv[]) } list_iterator_destroy(itr); set = 1; - } else if(ret_list) { + } else if (ret_list) { printf(" Nothing modified\n"); } else { exit_code=1; @@ -768,10 +768,10 @@ extern int sacctmgr_modify_cluster(int argc, char *argv[]) rc = SLURM_ERROR; } - if(ret_list) + if (ret_list) list_destroy(ret_list); - if(class_rec) { + if (class_rec) { slurmdb_cluster_rec_t cluster_rec; slurmdb_init_cluster_rec(&cluster_rec, 0); @@ -782,7 +782,7 @@ extern int sacctmgr_modify_cluster(int argc, char *argv[]) ret_list = acct_storage_g_modify_clusters( db_conn, my_uid, &cluster_cond, &cluster_rec); - if(ret_list && list_count(ret_list)) { + if (ret_list && list_count(ret_list)) { char *object = NULL; ListIterator itr = list_iterator_create(ret_list); printf(" Modified cluster classifications...\n"); @@ -791,7 +791,7 @@ extern int sacctmgr_modify_cluster(int argc, char *argv[]) } list_iterator_destroy(itr); set = 1; - } else if(ret_list) { + } else if (ret_list) { printf(" Nothing modified\n"); } else { exit_code=1; @@ -800,14 +800,14 @@ extern int sacctmgr_modify_cluster(int argc, char *argv[]) rc = SLURM_ERROR; } - if(ret_list) + if (ret_list) list_destroy(ret_list); } notice_thread_fini(); - if(set) { - if(commit_check("Would you like to commit changes?")) + if (set) { + if (commit_check("Would you like to commit changes?")) acct_storage_g_commit(db_conn, 1); else { printf(" Changes Discarded\n"); @@ -842,10 +842,10 @@ extern int sacctmgr_delete_cluster(int argc, char *argv[]) cond_set |= prev_set; } - if(exit_code) { + if (exit_code) { slurmdb_destroy_cluster_cond(cluster_cond); return SLURM_ERROR; - } else if(!cond_set) { + } else if (!cond_set) { exit_code=1; fprintf(stderr, " No conditions given to remove, not executing.\n"); @@ -853,7 +853,7 @@ extern int sacctmgr_delete_cluster(int argc, char *argv[]) return SLURM_ERROR; } - if(!list_count(cluster_cond->cluster_list) + if (!list_count(cluster_cond->cluster_list) && !cluster_cond->classification) { exit_code=1; fprintf(stderr, @@ -870,13 +870,13 @@ extern int sacctmgr_delete_cluster(int argc, char *argv[]) slurmdb_destroy_cluster_cond(cluster_cond); - if(ret_list && list_count(ret_list)) { + if (ret_list && list_count(ret_list)) { char *object = NULL; ListIterator itr = list_iterator_create(ret_list); /* If there were jobs running with an association to be deleted, don't. */ - if(rc == ESLURM_JOBS_RUNNING_ON_ASSOC) { + if (rc == ESLURM_JOBS_RUNNING_ON_ASSOC) { fprintf(stderr, " Error with request: %s\n", slurm_strerror(rc)); while((object = list_next(itr))) { @@ -891,13 +891,13 @@ extern int sacctmgr_delete_cluster(int argc, char *argv[]) printf(" %s\n", object); } list_iterator_destroy(itr); - if(commit_check("Would you like to commit changes?")) { + if (commit_check("Would you like to commit changes?")) { acct_storage_g_commit(db_conn, 1); } else { printf(" Changes Discarded\n"); acct_storage_g_commit(db_conn, 0); } - } else if(ret_list) { + } else if (ret_list) { printf(" Nothing deleted\n"); } else { exit_code=1; @@ -906,7 +906,7 @@ extern int sacctmgr_delete_cluster(int argc, char *argv[]) rc = SLURM_ERROR; } - if(ret_list) + if (ret_list) list_destroy(ret_list); return rc; diff --git a/src/sacctmgr/common.c b/src/sacctmgr/common.c index 9d4de71d281..78755e66ee8 100644 --- a/src/sacctmgr/common.c +++ b/src/sacctmgr/common.c @@ -155,7 +155,7 @@ static print_field_t *_get_print_field(char *object) char *tmp_char = NULL; int command_len, field_len = 0; - if((tmp_char = strstr(object, "\%"))) { + if ((tmp_char = strstr(object, "\%"))) { field_len = atoi(tmp_char+1); tmp_char[0] = '\0'; } @@ -248,22 +248,22 @@ static print_field_t *_get_print_field(char *object) field->name = xstrdup("Descr"); field->len = 20; field->print_routine = print_fields_str; - } else if(!strncasecmp("Duration", object, MAX(command_len, 2))) { + } else if (!strncasecmp("Duration", object, MAX(command_len, 2))) { field->type = PRINT_DURATION; field->name = xstrdup("Duration"); field->len = 13; field->print_routine = print_fields_time_from_secs; - } else if(!strncasecmp("End", object, MAX(command_len, 2))) { + } else if (!strncasecmp("End", object, MAX(command_len, 2))) { field->type = PRINT_END; field->name = xstrdup("End"); field->len = 19; field->print_routine = print_fields_date; - } else if(!strncasecmp("EventRaw", object, MAX(command_len, 6))) { + } else if (!strncasecmp("EventRaw", object, MAX(command_len, 6))) { field->type = PRINT_EVENTRAW; field->name = xstrdup("EventRaw"); field->len = 8; field->print_routine = print_fields_uint; - } else if(!strncasecmp("Event", object, MAX(command_len, 2))) { + } else if (!strncasecmp("Event", object, MAX(command_len, 2))) { field->type = PRINT_EVENT; field->name = xstrdup("Event"); field->len = 7; @@ -617,7 +617,7 @@ extern int sacctmgr_remove_assoc_usage(slurmdb_association_cond_t *assoc_cond) } } - if(!commit_check("Would you like to reset usage?")) { + if (!commit_check("Would you like to reset usage?")) { printf(" Changes Discarded\n"); return rc; } @@ -1567,7 +1567,7 @@ extern List sacctmgr_process_format_list(List format_list) char *object = NULL; while((object = list_next(itr))) { - if(!(field = _get_print_field(object))) + if (!(field = _get_print_field(object))) exit(1); list_append(print_fields_list, field); diff --git a/src/sacctmgr/event_functions.c b/src/sacctmgr/event_functions.c index 67f371e8ee2..e3bd1253f51 100644 --- a/src/sacctmgr/event_functions.c +++ b/src/sacctmgr/event_functions.c @@ -89,13 +89,13 @@ static int _addto_state_char_list(List char_list, char *names) int quote = 0; int count = 0; - if(!char_list) { + if (!char_list) { error("No list was given to fill in"); return 0; } itr = list_iterator_create(char_list); - if(names) { + if (names) { if (names[i] == '\"' || names[i] == '\'') { quote_c = names[i]; quote = 1; @@ -104,12 +104,12 @@ static int _addto_state_char_list(List char_list, char *names) start = i; while(names[i]) { //info("got %d - %d = %d", i, start, i-start); - if(quote && names[i] == quote_c) + if (quote && names[i] == quote_c) break; else if (names[i] == '\"' || names[i] == '\'') names[i] = '`'; - else if(names[i] == ',') { - if((i-start) > 0) { + else if (names[i] == ',') { + if ((i-start) > 0) { name = xmalloc((i-start+1)); memcpy(name, names+start, (i-start)); c = _decode_node_state(name); @@ -120,11 +120,11 @@ static int _addto_state_char_list(List char_list, char *names) name = xstrdup_printf("%u", c); while((tmp_char = list_next(itr))) { - if(!strcasecmp(tmp_char, name)) + if (!strcasecmp(tmp_char, name)) break; } - if(!tmp_char) { + if (!tmp_char) { list_append(char_list, name); count++; } else @@ -133,7 +133,7 @@ static int _addto_state_char_list(List char_list, char *names) } i++; start = i; - if(!names[i]) { + if (!names[i]) { info("There is a problem with " "your request. It appears you " "have spaces inside your list."); @@ -142,7 +142,7 @@ static int _addto_state_char_list(List char_list, char *names) } i++; } - if((i-start) > 0) { + if ((i-start) > 0) { name = xmalloc((i-start)+1); memcpy(name, names+start, (i-start)); c = _decode_node_state(name); @@ -152,11 +152,11 @@ static int _addto_state_char_list(List char_list, char *names) name = xstrdup_printf("%u", c); while((tmp_char = list_next(itr))) { - if(!strcasecmp(tmp_char, name)) + if (!strcasecmp(tmp_char, name)) break; } - if(!tmp_char) { + if (!tmp_char) { list_append(char_list, name); count++; } else @@ -199,13 +199,13 @@ static int _addto_id_char_list(List char_list, char *names, bool gid) int quote = 0; int count = 0; - if(!char_list) { + if (!char_list) { error("No list was given to fill in"); return 0; } itr = list_iterator_create(char_list); - if(names) { + if (names) { if (names[i] == '\"' || names[i] == '\'') { quote_c = names[i]; quote = 1; @@ -214,23 +214,23 @@ static int _addto_id_char_list(List char_list, char *names, bool gid) start = i; while(names[i]) { //info("got %d - %d = %d", i, start, i-start); - if(quote && names[i] == quote_c) + if (quote && names[i] == quote_c) break; else if (names[i] == '\"' || names[i] == '\'') names[i] = '`'; - else if(names[i] == ',') { - if((i-start) > 0) { + else if (names[i] == ',') { + if ((i-start) > 0) { name = xmalloc((i-start+1)); memcpy(name, names+start, (i-start)); //info("got %s %d", name, i-start); name = _convert_to_id( name, gid ); while((tmp_char = list_next(itr))) { - if(!strcasecmp(tmp_char, name)) + if (!strcasecmp(tmp_char, name)) break; } - if(!tmp_char) { + if (!tmp_char) { list_append(char_list, name); count++; } else @@ -239,7 +239,7 @@ static int _addto_id_char_list(List char_list, char *names, bool gid) } i++; start = i; - if(!names[i]) { + if (!names[i]) { info("There is a problem with " "your request. It appears you " "have spaces inside your list."); @@ -248,17 +248,17 @@ static int _addto_id_char_list(List char_list, char *names, bool gid) } i++; } - if((i-start) > 0) { + if ((i-start) > 0) { name = xmalloc((i-start)+1); memcpy(name, names+start, (i-start)); name = _convert_to_id(name, gid); while((tmp_char = list_next(itr))) { - if(!strcasecmp(tmp_char, name)) + if (!strcasecmp(tmp_char, name)) break; } - if(!tmp_char) { + if (!tmp_char) { list_append(char_list, name); count++; } else @@ -279,11 +279,11 @@ static int _set_cond(int *start, int argc, char *argv[], int local_cluster_flag = 0; int all_time_flag = 0; - if(!event_cond->cluster_list) + if (!event_cond->cluster_list) event_cond->cluster_list = list_create(slurm_destroy_char); for (i=(*start); i<argc; i++) { end = parse_option_end(argv[i]); - if(!end) + if (!end) command_len=strlen(argv[i]); else { command_len=end-1; @@ -292,39 +292,39 @@ static int _set_cond(int *start, int argc, char *argv[], } } - if(!end && !strncasecmp(argv[i], "all_clusters", + if (!end && !strncasecmp(argv[i], "all_clusters", MAX(command_len, 5))) { local_cluster_flag = 1; - } else if(!end && !strncasecmp(argv[i], "all_time", + } else if (!end && !strncasecmp(argv[i], "all_time", MAX(command_len, 5))) { all_time_flag = 1; - } else if(!end && !strncasecmp(argv[i], "where", + } else if (!end && !strncasecmp(argv[i], "where", MAX(command_len, 5))) { continue; - } else if(!end || (!strncasecmp (argv[i], "Events", + } else if (!end || (!strncasecmp (argv[i], "Events", MAX(command_len, 1)))) { ListIterator itr = NULL; List tmp_list = list_create(slurm_destroy_char); char *temp = NULL; - if(slurm_addto_char_list(tmp_list, + if (slurm_addto_char_list(tmp_list, argv[i]+end)) set = 1; /* check to make sure user gave ints here */ itr = list_iterator_create(tmp_list); while ((temp = list_next(itr))) { - if(!strncasecmp("Node", temp, + if (!strncasecmp("Node", temp, MAX(strlen(temp), 1))) { - if(event_cond->event_type) + if (event_cond->event_type) event_cond->event_type = SLURMDB_EVENT_ALL; else event_cond->event_type = SLURMDB_EVENT_NODE; - } else if(!strncasecmp("Cluster", temp, + } else if (!strncasecmp("Cluster", temp, MAX(strlen(temp), 1))) { - if(event_cond->event_type) + if (event_cond->event_type) event_cond->event_type = SLURMDB_EVENT_ALL; else @@ -344,10 +344,10 @@ static int _set_cond(int *start, int argc, char *argv[], list_destroy(tmp_list); } else if (!strncasecmp (argv[i], "Clusters", MAX(command_len, 1))) { - if(!event_cond->cluster_list) + if (!event_cond->cluster_list) event_cond->cluster_list = list_create(slurm_destroy_char); - if(slurm_addto_char_list(event_cond->cluster_list, + if (slurm_addto_char_list(event_cond->cluster_list, argv[i]+end)) set = 1; } else if (!strncasecmp (argv[i], "End", MAX(command_len, 1))) { @@ -355,7 +355,7 @@ static int _set_cond(int *start, int argc, char *argv[], set = 1; } else if (!strncasecmp (argv[i], "Format", MAX(command_len, 1))) { - if(format_list) + if (format_list) slurm_addto_char_list(format_list, argv[i]+end); } else if (!strncasecmp (argv[i], "MinCpus", MAX(command_len, 2))) { @@ -369,18 +369,18 @@ static int _set_cond(int *start, int argc, char *argv[], set = 1; } else if (!strncasecmp (argv[i], "Nodes", MAX(command_len, 1))) { - if(!event_cond->node_list) + if (!event_cond->node_list) event_cond->node_list = list_create(slurm_destroy_char); - if(slurm_addto_char_list(event_cond->node_list, + if (slurm_addto_char_list(event_cond->node_list, argv[i]+end)) set = 1; } else if (!strncasecmp (argv[i], "Reason", MAX(command_len, 1))) { - if(!event_cond->reason_list) + if (!event_cond->reason_list) event_cond->reason_list = list_create(slurm_destroy_char); - if(slurm_addto_char_list(event_cond->reason_list, + if (slurm_addto_char_list(event_cond->reason_list, argv[i]+end)) set = 1; } else if (!strncasecmp (argv[i], "Start", @@ -389,20 +389,20 @@ static int _set_cond(int *start, int argc, char *argv[], set = 1; } else if (!strncasecmp (argv[i], "States", MAX(command_len, 4))) { - if(!event_cond->state_list) + if (!event_cond->state_list) event_cond->state_list = list_create(slurm_destroy_char); - if(_addto_state_char_list(event_cond->state_list, + if (_addto_state_char_list(event_cond->state_list, argv[i]+end)) { event_cond->event_type = SLURMDB_EVENT_NODE; set = 1; } } else if (!strncasecmp (argv[i], "User", MAX(command_len, 1))) { - if(!event_cond->reason_uid_list) + if (!event_cond->reason_uid_list) event_cond->reason_uid_list = list_create(slurm_destroy_char); - if(_addto_id_char_list(event_cond->reason_uid_list, + if (_addto_id_char_list(event_cond->reason_uid_list, argv[i]+end, 0)) { event_cond->event_type = SLURMDB_EVENT_NODE; set = 1; @@ -414,18 +414,18 @@ static int _set_cond(int *start, int argc, char *argv[], } (*start) = i; - if(!local_cluster_flag && !list_count(event_cond->cluster_list)) { + if (!local_cluster_flag && !list_count(event_cond->cluster_list)) { char *temp = slurm_get_cluster_name(); - if(temp) + if (temp) list_append(event_cond->cluster_list, temp); } - if(!all_time_flag && !event_cond->period_start) { + if (!all_time_flag && !event_cond->period_start) { event_cond->period_start = time(NULL); - if(!event_cond->state_list) { + if (!event_cond->state_list) { struct tm start_tm; - if(!localtime_r(&event_cond->period_start, &start_tm)) { + if (!localtime_r(&event_cond->period_start, &start_tm)) { fprintf(stderr, " Couldn't get localtime from %ld", (long)event_cond->period_start); @@ -470,7 +470,7 @@ extern int sacctmgr_list_event(int argc, char *argv[]) struct tm start_tm; event_cond->period_start = time(NULL); - if(!localtime_r(&event_cond->period_start, &start_tm)) { + if (!localtime_r(&event_cond->period_start, &start_tm)) { fprintf(stderr, " Couldn't get localtime from %ld", (long)event_cond->period_start); @@ -493,7 +493,7 @@ extern int sacctmgr_list_event(int argc, char *argv[]) _set_cond(&i, argc, argv, event_cond, format_list); } - if(exit_code) { + if (exit_code) { slurmdb_destroy_event_cond(event_cond); list_destroy(format_list); return SLURM_ERROR; @@ -501,8 +501,8 @@ extern int sacctmgr_list_event(int argc, char *argv[]) print_fields_list = list_create(destroy_print_field); - if(!list_count(format_list)) { - if(event_cond->event_type == SLURMDB_EVENT_CLUSTER) + if (!list_count(format_list)) { + if (event_cond->event_type == SLURMDB_EVENT_CLUSTER) slurm_addto_char_list(format_list, "Cluster,Cpus,Start,End," "ClusterNodes"); @@ -518,7 +518,7 @@ extern int sacctmgr_list_event(int argc, char *argv[]) int command_len = 0; int newlen = 0; - if((tmp_char = strstr(object, "\%"))) { + if ((tmp_char = strstr(object, "\%"))) { newlen = atoi(tmp_char+1); tmp_char[0] = '\0'; } @@ -526,76 +526,76 @@ extern int sacctmgr_list_event(int argc, char *argv[]) command_len = strlen(object); field = xmalloc(sizeof(print_field_t)); - if(!strncasecmp("ClusterNodes", object, + if (!strncasecmp("ClusterNodes", object, MAX(command_len, 8))) { field->type = PRINT_CLUSTER_NODES; field->name = xstrdup("Cluster Nodes"); field->len = 20; field->print_routine = print_fields_str; - } else if(!strncasecmp("Cluster", object, + } else if (!strncasecmp("Cluster", object, MAX(command_len, 1))) { field->type = PRINT_CLUSTER; field->name = xstrdup("Cluster"); field->len = 10; field->print_routine = print_fields_str; - } else if(!strncasecmp("CPUs", object, + } else if (!strncasecmp("CPUs", object, MAX(command_len, 2))) { field->type = PRINT_CPUS; field->name = xstrdup("CPUs"); field->len = 7; field->print_routine = print_fields_str; - } else if(!strncasecmp("Duration", object, + } else if (!strncasecmp("Duration", object, MAX(command_len, 2))) { field->type = PRINT_DURATION; field->name = xstrdup("Duration"); field->len = 13; field->print_routine = print_fields_time_from_secs; - } else if(!strncasecmp("End", object, MAX(command_len, 2))) { + } else if (!strncasecmp("End", object, MAX(command_len, 2))) { field->type = PRINT_END; field->name = xstrdup("End"); field->len = 19; field->print_routine = print_fields_date; - } else if(!strncasecmp("EventRaw", object, + } else if (!strncasecmp("EventRaw", object, MAX(command_len, 6))) { field->type = PRINT_EVENTRAW; field->name = xstrdup("EventRaw"); field->len = 8; field->print_routine = print_fields_uint; - } else if(!strncasecmp("Event", object, + } else if (!strncasecmp("Event", object, MAX(command_len, 2))) { field->type = PRINT_EVENT; field->name = xstrdup("Event"); field->len = 7; field->print_routine = print_fields_str; - } else if(!strncasecmp("NodeName", object, + } else if (!strncasecmp("NodeName", object, MAX(command_len, 1))) { field->type = PRINT_NODENAME; field->name = xstrdup("Node Name"); field->len = -15; field->print_routine = print_fields_str; - } else if(!strncasecmp("Reason", object, MAX(command_len, 1))) { + } else if (!strncasecmp("Reason", object, MAX(command_len, 1))) { field->type = PRINT_REASON; field->name = xstrdup("Reason"); field->len = 30; field->print_routine = print_fields_str; - } else if(!strncasecmp("Start", object, + } else if (!strncasecmp("Start", object, MAX(command_len, 1))) { field->type = PRINT_START; field->name = xstrdup("Start"); field->len = 19; field->print_routine = print_fields_date; - } else if(!strncasecmp("StateRaw", object, + } else if (!strncasecmp("StateRaw", object, MAX(command_len, 6))) { field->type = PRINT_STATERAW; field->name = xstrdup("StateRaw"); field->len = 8; field->print_routine = print_fields_uint; - } else if(!strncasecmp("State", object, MAX(command_len, 1))) { + } else if (!strncasecmp("State", object, MAX(command_len, 1))) { field->type = PRINT_STATE; field->name = xstrdup("State"); field->len = 6; field->print_routine = print_fields_str; - } else if(!strncasecmp("User", object, MAX(command_len, 1))) { + } else if (!strncasecmp("User", object, MAX(command_len, 1))) { field->type = PRINT_USER; field->name = xstrdup("User"); field->len = 15; @@ -607,7 +607,7 @@ extern int sacctmgr_list_event(int argc, char *argv[]) continue; } - if(newlen) + if (newlen) field->len = newlen; list_append(print_fields_list, field); @@ -615,7 +615,7 @@ extern int sacctmgr_list_event(int argc, char *argv[]) list_iterator_destroy(itr); list_destroy(format_list); - if(exit_code) { + if (exit_code) { list_destroy(print_fields_list); return SLURM_ERROR; } @@ -623,7 +623,7 @@ extern int sacctmgr_list_event(int argc, char *argv[]) event_list = acct_storage_g_get_events(db_conn, my_uid, event_cond); slurmdb_destroy_event_cond(event_cond); - if(!event_list) { + if (!event_list) { exit_code=1; fprintf(stderr, " Error with request: %s\n", slurm_strerror(errno)); @@ -661,7 +661,7 @@ extern int sacctmgr_list_event(int argc, char *argv[]) (curr_inx == field_count)); break; case PRINT_DURATION: - if(!newend) + if (!newend) newend = time(NULL); field->print_routine( field, @@ -679,9 +679,9 @@ extern int sacctmgr_list_event(int argc, char *argv[]) (curr_inx == field_count)); break; case PRINT_EVENT: - if(event->event_type == SLURMDB_EVENT_CLUSTER) + if (event->event_type == SLURMDB_EVENT_CLUSTER) tmp_char = "Cluster"; - else if(event->event_type == SLURMDB_EVENT_NODE) + else if (event->event_type == SLURMDB_EVENT_NODE) tmp_char = "Node"; else tmp_char = "Unknown"; @@ -708,7 +708,7 @@ extern int sacctmgr_list_event(int argc, char *argv[]) (curr_inx == field_count)); break; case PRINT_STATE: - if(event->event_type == SLURMDB_EVENT_CLUSTER) + if (event->event_type == SLURMDB_EVENT_CLUSTER) tmp_char = NULL; else tmp_char = node_state_string_compact( @@ -719,7 +719,7 @@ extern int sacctmgr_list_event(int argc, char *argv[]) (curr_inx == field_count)); break; case PRINT_USER: - if(event->reason_uid != NO_VAL) { + if (event->reason_uid != NO_VAL) { tmp_char = uid_to_string( event->reason_uid); snprintf(tmp, sizeof(tmp), "%s(%u)", diff --git a/src/sacctmgr/file_functions.c b/src/sacctmgr/file_functions.c index 9aa00a137f9..0861c065422 100644 --- a/src/sacctmgr/file_functions.c +++ b/src/sacctmgr/file_functions.c @@ -785,7 +785,7 @@ static int _mod_assoc(sacctmgr_file_opts_t *file_opts, file_opts->grp_jobs); } - if((file_opts->grp_mem != NO_VAL) + if ((file_opts->grp_mem != NO_VAL) && (assoc->grp_mem != file_opts->grp_mem)) { mod_assoc.grp_mem = file_opts->grp_mem; changed = 1; @@ -1758,7 +1758,7 @@ extern int print_file_add_limits_to_line(char **line, if (assoc->grp_jobs != INFINITE) xstrfmtcat(*line, ":GrpJobs=%u", assoc->grp_jobs); - if(assoc->grp_mem != INFINITE) + if (assoc->grp_mem != INFINITE) xstrfmtcat(*line, ":GrpMemory=%u", assoc->grp_mem); if (assoc->grp_nodes != INFINITE) diff --git a/src/sacctmgr/job_functions.c b/src/sacctmgr/job_functions.c index 5ccfe6104c4..5d9e2deb975 100644 --- a/src/sacctmgr/job_functions.c +++ b/src/sacctmgr/job_functions.c @@ -112,7 +112,7 @@ static int _set_rec(int *start, int argc, char *argv[], for (i=(*start); i<argc; i++) { end = parse_option_end(argv[i]); - if(!end) + if (!end) command_len=strlen(argv[i]); else { command_len=end-1; @@ -124,10 +124,10 @@ static int _set_rec(int *start, int argc, char *argv[], if (!strncasecmp (argv[i], "Where", MAX(command_len, 5))) { i--; break; - } else if(!end && !strncasecmp(argv[i], "set", + } else if (!end && !strncasecmp(argv[i], "set", MAX(command_len, 3))) { continue; - } else if(!end) { + } else if (!end) { exit_code=1; fprintf(stderr, " Bad format on %s: End your option with " @@ -146,7 +146,7 @@ static int _set_rec(int *start, int argc, char *argv[], MAX(command_len, 12))) || (!strncasecmp(argv[i], "DerivedES", MAX(command_len, 9)))) { - if(job->derived_es) + if (job->derived_es) xfree(job->derived_es); job->derived_es = strip_quotes(argv[i]+end, NULL, 1); set = 1; diff --git a/src/sacctmgr/problem_functions.c b/src/sacctmgr/problem_functions.c index 653f385f29a..6a794ac2604 100644 --- a/src/sacctmgr/problem_functions.c +++ b/src/sacctmgr/problem_functions.c @@ -49,7 +49,7 @@ static int _set_cond(int *start, int argc, char *argv[], for (i=(*start); i<argc; i++) { end = parse_option_end(argv[i]); - if(!end) + if (!end) command_len=strlen(argv[i]); else { command_len=end-1; @@ -61,14 +61,14 @@ static int _set_cond(int *start, int argc, char *argv[], if (!end && !strncasecmp (argv[i], "Tree", MAX(command_len, 4))) { tree_display = 1; - } else if(!end && !strncasecmp(argv[i], "where", + } else if (!end && !strncasecmp(argv[i], "where", MAX(command_len, 5))) { continue; - } else if(!end || !strncasecmp (argv[i], "Ids", + } else if (!end || !strncasecmp (argv[i], "Ids", MAX(command_len, 1)) || !strncasecmp (argv[i], "Problems", MAX(command_len, 2))) { - if(!assoc_cond->id_list) + if (!assoc_cond->id_list) assoc_cond->id_list = list_create(slurm_destroy_char); slurm_addto_char_list(assoc_cond->id_list, @@ -78,7 +78,7 @@ static int _set_cond(int *start, int argc, char *argv[], MAX(command_len, 2)) || !strncasecmp (argv[i], "Acct", MAX(command_len, 4))) { - if(!assoc_cond->acct_list) + if (!assoc_cond->acct_list) assoc_cond->acct_list = list_create(slurm_destroy_char); slurm_addto_char_list(assoc_cond->acct_list, @@ -86,7 +86,7 @@ static int _set_cond(int *start, int argc, char *argv[], set = 1; } else if (!strncasecmp (argv[i], "Clusters", MAX(command_len, 1))) { - if(!assoc_cond->cluster_list) + if (!assoc_cond->cluster_list) assoc_cond->cluster_list = list_create(slurm_destroy_char); slurm_addto_char_list(assoc_cond->cluster_list, @@ -94,12 +94,12 @@ static int _set_cond(int *start, int argc, char *argv[], set = 1; } else if (!strncasecmp (argv[i], "Format", MAX(command_len, 1))) { - if(format_list) + if (format_list) slurm_addto_char_list(format_list, argv[i]+end); } else if (!strncasecmp (argv[i], "Partitions", MAX(command_len, 4))) { - if(!assoc_cond->partition_list) + if (!assoc_cond->partition_list) assoc_cond->partition_list = list_create(slurm_destroy_char); slurm_addto_char_list(assoc_cond->partition_list, @@ -107,7 +107,7 @@ static int _set_cond(int *start, int argc, char *argv[], set = 1; } else if (!strncasecmp (argv[i], "Users", MAX(command_len, 1))) { - if(!assoc_cond->user_list) + if (!assoc_cond->user_list) assoc_cond->user_list = list_create(slurm_destroy_char); slurm_addto_char_list(assoc_cond->user_list, @@ -151,17 +151,17 @@ extern int sacctmgr_list_problem(int argc, char *argv[]) _set_cond(&i, argc, argv, assoc_cond, format_list); } - if(exit_code) { + if (exit_code) { slurmdb_destroy_association_cond(assoc_cond); list_destroy(format_list); return SLURM_ERROR; - } else if(!list_count(format_list)) + } else if (!list_count(format_list)) slurm_addto_char_list(format_list, "Cl,Acct,User,Problem"); print_fields_list = sacctmgr_process_format_list(format_list); list_destroy(format_list); - if(exit_code) { + if (exit_code) { slurmdb_destroy_association_cond(assoc_cond); list_destroy(print_fields_list); return SLURM_ERROR; @@ -170,7 +170,7 @@ extern int sacctmgr_list_problem(int argc, char *argv[]) assoc_list = acct_storage_g_get_problems(db_conn, my_uid, assoc_cond); slurmdb_destroy_association_cond(assoc_cond); - if(!assoc_list) { + if (!assoc_list) { exit_code=1; fprintf(stderr, " Error with request: %s\n", slurm_strerror(errno)); @@ -228,7 +228,7 @@ extern int sacctmgr_list_problem(int argc, char *argv[]) printf("\n"); } - if(tree_list) + if (tree_list) list_destroy(tree_list); list_iterator_destroy(itr2); diff --git a/src/sacctmgr/qos_functions.c b/src/sacctmgr/qos_functions.c index 4414a541c00..04a504ad496 100644 --- a/src/sacctmgr/qos_functions.c +++ b/src/sacctmgr/qos_functions.c @@ -49,7 +49,7 @@ static uint16_t _parse_preempt_modes(char *names) uint16_t preempt_mode = 0; uint16_t ret_mode = 0; - if(names) { + if (names) { if (names[i] == '\"' || names[i] == '\'') { quote_c = names[i]; quote = 1; @@ -58,17 +58,17 @@ static uint16_t _parse_preempt_modes(char *names) start = i; while(names[i]) { //info("got %d - %d = %d", i, start, i-start); - if(quote && names[i] == quote_c) + if (quote && names[i] == quote_c) break; else if (names[i] == '\"' || names[i] == '\'') names[i] = '`'; - else if(names[i] == ',') { + else if (names[i] == ',') { name = xmalloc((i-start+1)); memcpy(name, names+start, (i-start)); //info("got %s %d", name, i-start); ret_mode = preempt_mode_num(name); - if(ret_mode == (uint16_t)NO_VAL) { + if (ret_mode == (uint16_t)NO_VAL) { error("Unknown preempt_mode given '%s'", name); xfree(name); @@ -81,7 +81,7 @@ static uint16_t _parse_preempt_modes(char *names) i++; start = i; - if(!names[i]) { + if (!names[i]) { info("There is a problem with " "your request. It appears you " "have spaces inside your list."); @@ -96,7 +96,7 @@ static uint16_t _parse_preempt_modes(char *names) //info("got %s %d", name, i-start); ret_mode = preempt_mode_num(name); - if(ret_mode == (uint16_t)NO_VAL) { + if (ret_mode == (uint16_t)NO_VAL) { error("Unknown preempt_mode given '%s'", name); xfree(name); @@ -119,14 +119,14 @@ static int _set_cond(int *start, int argc, char *argv[], int end = 0; int command_len = 0; - if(!qos_cond) { + if (!qos_cond) { error("No qos_cond given"); return -1; } for (i=(*start); i<argc; i++) { end = parse_option_end(argv[i]); - if(!end) + if (!end) command_len=strlen(argv[i]); else { command_len=end-1; @@ -141,44 +141,44 @@ static int _set_cond(int *start, int argc, char *argv[], } else if (!end && !strncasecmp (argv[i], "WithDeleted", MAX(command_len, 5))) { qos_cond->with_deleted = 1; - } else if(!end && !strncasecmp(argv[i], "where", + } else if (!end && !strncasecmp(argv[i], "where", MAX(command_len, 5))) { continue; - } else if(!end + } else if (!end || !strncasecmp (argv[i], "Names", MAX(command_len, 1)) || !strncasecmp (argv[i], "QOSLevel", MAX(command_len, 1))) { - if(!qos_cond->name_list) { + if (!qos_cond->name_list) { qos_cond->name_list = list_create(slurm_destroy_char); } - if(slurm_addto_char_list(qos_cond->name_list, + if (slurm_addto_char_list(qos_cond->name_list, argv[i]+end)) set = 1; - } else if(!strncasecmp (argv[i], "Descriptions", + } else if (!strncasecmp (argv[i], "Descriptions", MAX(command_len, 1))) { - if(!qos_cond->description_list) { + if (!qos_cond->description_list) { qos_cond->description_list = list_create(slurm_destroy_char); } - if(slurm_addto_char_list(qos_cond->description_list, + if (slurm_addto_char_list(qos_cond->description_list, argv[i]+end)) set = 1; } else if (!strncasecmp (argv[i], "Format", MAX(command_len, 1))) { - if(format_list) + if (format_list) slurm_addto_char_list(format_list, argv[i]+end); - } else if(!strncasecmp (argv[i], "Ids", MAX(command_len, 1))) { + } else if (!strncasecmp (argv[i], "Ids", MAX(command_len, 1))) { ListIterator itr = NULL; char *temp = NULL; uint32_t id = 0; - if(!qos_cond->id_list) { + if (!qos_cond->id_list) { qos_cond->id_list = list_create(slurm_destroy_char); } - if(slurm_addto_char_list(qos_cond->id_list, + if (slurm_addto_char_list(qos_cond->id_list, argv[i]+end)) set = 1; @@ -194,11 +194,11 @@ static int _set_cond(int *start, int argc, char *argv[], list_iterator_destroy(itr); } else if (!strncasecmp (argv[i], "PreemptMode", MAX(command_len, 8))) { - if(!qos_cond) + if (!qos_cond) continue; qos_cond->preempt_mode |= _parse_preempt_modes(argv[i]+end); - if(qos_cond->preempt_mode == (uint16_t)NO_VAL) { + if (qos_cond->preempt_mode == (uint16_t)NO_VAL) { fprintf(stderr, " Bad Preempt Mode given: %s\n", argv[i]); @@ -234,11 +234,11 @@ static int _set_rec(int *start, int argc, char *argv[], for (i=(*start); i<argc; i++) { end = parse_option_end(argv[i]); - if(!end) + if (!end) command_len=strlen(argv[i]); else { command_len=end-1; - if(argv[i][end] == '=') { + if (argv[i][end] == '=') { option = (int)argv[i][end-1]; end++; } @@ -247,23 +247,23 @@ static int _set_rec(int *start, int argc, char *argv[], if (!strncasecmp (argv[i], "Where", MAX(command_len, 5))) { i--; break; - } else if(!end && !strncasecmp(argv[i], "set", + } else if (!end && !strncasecmp(argv[i], "set", MAX(command_len, 3))) { continue; - } else if(!end + } else if (!end || !strncasecmp (argv[i], "Name", MAX(command_len, 1))) { - if(name_list) + if (name_list) slurm_addto_char_list(name_list, argv[i]+end); } else if (!strncasecmp (argv[i], "Description", MAX(command_len, 1))) { - if(!qos->description) + if (!qos->description) qos->description = strip_quotes(argv[i]+end, NULL, 1); set = 1; } else if (!strncasecmp (argv[i], "Flags", MAX(command_len, 2))) { - if(!qos) + if (!qos) continue; qos->flags = str_2_qos_flags(argv[i]+end, option); if (qos->flags == QOS_FLAG_NOTSET) { @@ -290,7 +290,7 @@ static int _set_rec(int *start, int argc, char *argv[], } } else if (!strncasecmp (argv[i], "GrpCPUMins", MAX(command_len, 7))) { - if(!qos) + if (!qos) continue; if (get_uint64(argv[i]+end, &qos->grp_cpu_mins, @@ -298,49 +298,49 @@ static int _set_rec(int *start, int argc, char *argv[], set = 1; } else if (!strncasecmp (argv[i], "GrpCPURunMins", MAX(command_len, 7))) { - if(!qos) + if (!qos) continue; if (get_uint64(argv[i]+end, &qos->grp_cpu_run_mins, "GrpCPURunMins") == SLURM_SUCCESS) set = 1; } else if (!strncasecmp (argv[i], "GrpCPUs", MAX(command_len, 7))) { - if(!qos) + if (!qos) continue; if (get_uint(argv[i]+end, &qos->grp_cpus, "GrpCPUs") == SLURM_SUCCESS) set = 1; } else if (!strncasecmp (argv[i], "GrpJobs", MAX(command_len, 4))) { - if(!qos) + if (!qos) continue; if (get_uint(argv[i]+end, &qos->grp_jobs, "GrpJobs") == SLURM_SUCCESS) set = 1; } else if (!strncasecmp (argv[i], "GrpMemory", MAX(command_len, 4))) { - if(!qos) + if (!qos) continue; if (get_uint(argv[i]+end, &qos->grp_mem, "GrpMemory") == SLURM_SUCCESS) set = 1; } else if (!strncasecmp (argv[i], "GrpNodes", MAX(command_len, 4))) { - if(!qos) + if (!qos) continue; if (get_uint(argv[i]+end, &qos->grp_nodes, "GrpNodes") == SLURM_SUCCESS) set = 1; } else if (!strncasecmp (argv[i], "GrpSubmitJobs", MAX(command_len, 4))) { - if(!qos) + if (!qos) continue; if (get_uint(argv[i]+end, &qos->grp_submit_jobs, "GrpSubmitJobs") == SLURM_SUCCESS) set = 1; } else if (!strncasecmp (argv[i], "GrpWall", MAX(command_len, 4))) { - if(!qos) + if (!qos) continue; mins = time_str2mins(argv[i]+end); if (mins != NO_VAL) { @@ -354,7 +354,7 @@ static int _set_rec(int *start, int argc, char *argv[], } } else if (!strncasecmp (argv[i], "MaxCPUMinsPerJob", MAX(command_len, 7))) { - if(!qos) + if (!qos) continue; if (get_uint64(argv[i]+end, &qos->max_cpu_mins_pj, @@ -362,28 +362,28 @@ static int _set_rec(int *start, int argc, char *argv[], set = 1; } else if (!strncasecmp (argv[i], "MaxCPUsPerJob", MAX(command_len, 7))) { - if(!qos) + if (!qos) continue; if (get_uint(argv[i]+end, &qos->max_cpus_pj, "MaxCPUs") == SLURM_SUCCESS) set = 1; } else if (!strncasecmp (argv[i], "MaxCPUsPerUser", MAX(command_len, 11))) { - if(!qos) + if (!qos) continue; if (get_uint(argv[i]+end, &qos->max_cpus_pu, "MaxCPUsPerUser") == SLURM_SUCCESS) set = 1; } else if (!strncasecmp (argv[i], "MaxJobsPerUser", MAX(command_len, 4))) { - if(!qos) + if (!qos) continue; if (get_uint(argv[i]+end, &qos->max_jobs_pu, "MaxJobs") == SLURM_SUCCESS) set = 1; } else if (!strncasecmp (argv[i], "MaxNodesPerJob", MAX(command_len, 4))) { - if(!qos) + if (!qos) continue; if (get_uint(argv[i]+end, &qos->max_nodes_pj, @@ -391,7 +391,7 @@ static int _set_rec(int *start, int argc, char *argv[], set = 1; } else if (!strncasecmp (argv[i], "MaxNodesPerUser", MAX(command_len, 8))) { - if(!qos) + if (!qos) continue; if (get_uint(argv[i]+end, &qos->max_nodes_pu, @@ -399,14 +399,14 @@ static int _set_rec(int *start, int argc, char *argv[], set = 1; } else if (!strncasecmp (argv[i], "MaxSubmitJobsPerUser", MAX(command_len, 4))) { - if(!qos) + if (!qos) continue; if (get_uint(argv[i]+end, &qos->max_submit_jobs_pu, "MaxSubmitJobs") == SLURM_SUCCESS) set = 1; } else if (!strncasecmp (argv[i], "MaxWallDurationPerJob", MAX(command_len, 4))) { - if(!qos) + if (!qos) continue; mins = time_str2mins(argv[i]+end); if (mins != NO_VAL) { @@ -420,10 +420,10 @@ static int _set_rec(int *start, int argc, char *argv[], } } else if (!strncasecmp (argv[i], "PreemptMode", MAX(command_len, 8))) { - if(!qos) + if (!qos) continue; qos->preempt_mode = preempt_mode_num(argv[i]+end); - if(qos->preempt_mode == (uint16_t)NO_VAL) { + if (qos->preempt_mode == (uint16_t)NO_VAL) { fprintf(stderr, " Bad Preempt Mode given: %s\n", argv[i]); @@ -437,18 +437,18 @@ static int _set_rec(int *start, int argc, char *argv[], /* Preempt needs to follow PreemptMode */ } else if (!strncasecmp (argv[i], "Preempt", MAX(command_len, 7))) { - if(!qos) + if (!qos) continue; - if(!qos->preempt_list) + if (!qos->preempt_list) qos->preempt_list = list_create(slurm_destroy_char); - if(!g_qos_list) + if (!g_qos_list) g_qos_list = acct_storage_g_get_qos( db_conn, my_uid, NULL); - if(slurmdb_addto_qos_char_list(qos->preempt_list, + if (slurmdb_addto_qos_char_list(qos->preempt_list, g_qos_list, argv[i]+end, option)) set = 1; @@ -456,7 +456,7 @@ static int _set_rec(int *start, int argc, char *argv[], exit_code = 1; } else if (!strncasecmp (argv[i], "Priority", MAX(command_len, 3))) { - if(!qos) + if (!qos) continue; if (get_uint(argv[i]+end, &qos->priority, @@ -464,7 +464,7 @@ static int _set_rec(int *start, int argc, char *argv[], set = 1; } else if (!strncasecmp (argv[i], "UsageFactor", MAX(command_len, 6))) { - if(!qos) + if (!qos) continue; if (get_double(argv[i]+end, &qos->usage_factor, @@ -472,7 +472,7 @@ static int _set_rec(int *start, int argc, char *argv[], set = 1; } else if (!strncasecmp (argv[i], "UsageThreshold", MAX(command_len, 6))) { - if(!qos) + if (!qos) continue; if (get_double(argv[i]+end, &qos->usage_thres, "UsageThreshold") == SLURM_SUCCESS) @@ -499,7 +499,7 @@ static bool _isdefault(List qos_list) List ret_list = NULL; char *name = NULL; - if(!qos_list || !list_count(qos_list)) + if (!qos_list || !list_count(qos_list)) return rc; /* this needs to happen before any removing takes place so we @@ -513,7 +513,7 @@ static bool _isdefault(List qos_list) itr = list_iterator_create(qos_list); while ((name = list_next(itr))) { uint32_t id = str_2_slurmdb_qos(g_qos_list, name); - if(id == NO_VAL) + if (id == NO_VAL) continue; list_append(assoc_cond.def_qos_id_list, xstrdup_printf("%u", id)); @@ -524,7 +524,7 @@ static bool _isdefault(List qos_list) db_conn, my_uid, &assoc_cond); list_destroy(assoc_cond.def_qos_id_list); - if(!ret_list || !list_count(ret_list)) + if (!ret_list || !list_count(ret_list)) goto end_it; fprintf(stderr," Associations listed below have these " @@ -554,7 +554,7 @@ static bool _isdefault(List qos_list) list_iterator_destroy(itr); rc = 1; end_it: - if(ret_list) + if (ret_list) list_destroy(ret_list); return rc; @@ -585,11 +585,11 @@ extern int sacctmgr_add_qos(int argc, char *argv[]) limit_set += _set_rec(&i, argc, argv, name_list, start_qos); } - if(exit_code) { + if (exit_code) { list_destroy(name_list); xfree(description); return SLURM_ERROR; - } else if(!list_count(name_list)) { + } else if (!list_count(name_list)) { list_destroy(name_list); slurmdb_destroy_qos_rec(start_qos); exit_code=1; @@ -597,10 +597,10 @@ extern int sacctmgr_add_qos(int argc, char *argv[]) return SLURM_SUCCESS; } - if(!g_qos_list) { + if (!g_qos_list) { g_qos_list = acct_storage_g_get_qos(db_conn, my_uid, NULL); - if(!g_qos_list) { + if (!g_qos_list) { exit_code=1; fprintf(stderr, " Problem getting qos's " "from database. " @@ -616,11 +616,11 @@ extern int sacctmgr_add_qos(int argc, char *argv[]) itr = list_iterator_create(name_list); while((name = list_next(itr))) { qos = NULL; - if(!sacctmgr_find_qos_from_list(g_qos_list, name)) { + if (!sacctmgr_find_qos_from_list(g_qos_list, name)) { qos = xmalloc(sizeof(slurmdb_qos_rec_t)); slurmdb_init_qos_rec(qos, 0); qos->name = xstrdup(name); - if(start_qos->description) + if (start_qos->description) qos->description = xstrdup(start_qos->description); else @@ -667,15 +667,15 @@ extern int sacctmgr_add_qos(int argc, char *argv[]) g_qos_list = NULL; } - if(!list_count(qos_list)) { + if (!list_count(qos_list)) { printf(" Nothing new added.\n"); goto end_it; } - if(qos_str) { + if (qos_str) { printf(" Adding QOS(s)\n%s", qos_str); printf(" Settings\n"); - if(description) + if (description) printf(" Description = %s\n", description); else printf(" Description = %s\n", "QOS Name"); @@ -686,15 +686,15 @@ extern int sacctmgr_add_qos(int argc, char *argv[]) } notice_thread_init(); - if(list_count(qos_list)) + if (list_count(qos_list)) rc = acct_storage_g_add_qos(db_conn, my_uid, qos_list); else goto end_it; notice_thread_fini(); - if(rc == SLURM_SUCCESS) { - if(commit_check("Would you like to commit changes?")) { + if (rc == SLURM_SUCCESS) { + if (commit_check("Would you like to commit changes?")) { acct_storage_g_commit(db_conn, 1); } else { printf(" Changes Discarded\n"); @@ -738,11 +738,11 @@ extern int sacctmgr_list_qos(int argc, char *argv[]) _set_cond(&i, argc, argv, qos_cond, format_list); } - if(exit_code) { + if (exit_code) { slurmdb_destroy_qos_cond(qos_cond); list_destroy(format_list); return SLURM_ERROR; - } else if(!list_count(format_list)) { + } else if (!list_count(format_list)) { slurm_addto_char_list(format_list, "Name,Prio,GraceT,Preempt,PreemptM," "Flags%40,UsageThres,UsageFactor," @@ -757,14 +757,14 @@ extern int sacctmgr_list_qos(int argc, char *argv[]) print_fields_list = sacctmgr_process_format_list(format_list); list_destroy(format_list); - if(exit_code) { + if (exit_code) { list_destroy(print_fields_list); return SLURM_ERROR; } qos_list = acct_storage_g_get_qos(db_conn, my_uid, qos_cond); slurmdb_destroy_qos_cond(qos_cond); - if(!qos_list) { + if (!qos_list) { exit_code=1; fprintf(stderr, " Problem with query.\n"); list_destroy(print_fields_list); @@ -908,7 +908,7 @@ extern int sacctmgr_list_qos(int argc, char *argv[]) (curr_inx == field_count)); break; case PRINT_PREE: - if(!g_qos_list) + if (!g_qos_list) g_qos_list = acct_storage_g_get_qos( db_conn, my_uid, NULL); @@ -919,7 +919,7 @@ extern int sacctmgr_list_qos(int argc, char *argv[]) case PRINT_PREEM: { char *tmp_char = "cluster"; - if(qos->preempt_mode) + if (qos->preempt_mode) tmp_char = xstrtolower( preempt_mode_string( qos->preempt_mode)); @@ -983,18 +983,18 @@ extern int sacctmgr_modify_qos(int argc, char *argv[]) } } - if(exit_code) { + if (exit_code) { slurmdb_destroy_qos_cond(qos_cond); slurmdb_destroy_qos_rec(qos); return SLURM_ERROR; - } else if(!rec_set) { + } else if (!rec_set) { exit_code=1; fprintf(stderr, " You didn't give me anything to set\n"); slurmdb_destroy_qos_cond(qos_cond); slurmdb_destroy_qos_rec(qos); return SLURM_ERROR; - } else if(!cond_set) { - if(!commit_check("You didn't set any conditions with 'WHERE'.\n" + } else if (!cond_set) { + if (!commit_check("You didn't set any conditions with 'WHERE'.\n" "Are you sure you want to continue?")) { printf("Aborted\n"); slurmdb_destroy_qos_cond(qos_cond); @@ -1006,7 +1006,7 @@ extern int sacctmgr_modify_qos(int argc, char *argv[]) notice_thread_init(); ret_list = acct_storage_g_modify_qos(db_conn, my_uid, qos_cond, qos); - if(ret_list && list_count(ret_list)) { + if (ret_list && list_count(ret_list)) { char *object = NULL; ListIterator itr = list_iterator_create(ret_list); printf(" Modified qos...\n"); @@ -1015,7 +1015,7 @@ extern int sacctmgr_modify_qos(int argc, char *argv[]) } list_iterator_destroy(itr); set = 1; - } else if(ret_list) { + } else if (ret_list) { printf(" Nothing modified\n"); } else { exit_code=1; @@ -1024,13 +1024,13 @@ extern int sacctmgr_modify_qos(int argc, char *argv[]) rc = SLURM_ERROR; } - if(ret_list) + if (ret_list) list_destroy(ret_list); notice_thread_fini(); - if(set) { - if(commit_check("Would you like to commit changes?")) + if (set) { + if (commit_check("Would you like to commit changes?")) acct_storage_g_commit(db_conn, 1); else { printf(" Changes Discarded\n"); @@ -1061,13 +1061,13 @@ extern int sacctmgr_delete_qos(int argc, char *argv[]) set += _set_cond(&i, argc, argv, qos_cond, NULL); } - if(!set) { + if (!set) { exit_code=1; fprintf(stderr, " No conditions given to remove, not executing.\n"); slurmdb_destroy_qos_cond(qos_cond); return SLURM_ERROR; - } else if(set == -1) { + } else if (set == -1) { slurmdb_destroy_qos_cond(qos_cond); return SLURM_ERROR; } @@ -1081,7 +1081,7 @@ extern int sacctmgr_delete_qos(int argc, char *argv[]) notice_thread_fini(); slurmdb_destroy_qos_cond(qos_cond); - if(ret_list && list_count(ret_list)) { + if (ret_list && list_count(ret_list)) { char *object = NULL; ListIterator itr = NULL; @@ -1108,13 +1108,13 @@ extern int sacctmgr_delete_qos(int argc, char *argv[]) printf(" %s\n", object); } list_iterator_destroy(itr); - if(commit_check("Would you like to commit changes?")) { + if (commit_check("Would you like to commit changes?")) { acct_storage_g_commit(db_conn, 1); } else { printf(" Changes Discarded\n"); acct_storage_g_commit(db_conn, 0); } - } else if(ret_list) { + } else if (ret_list) { printf(" Nothing deleted\n"); } else { exit_code=1; @@ -1124,7 +1124,7 @@ extern int sacctmgr_delete_qos(int argc, char *argv[]) } end_it: - if(ret_list) + if (ret_list) list_destroy(ret_list); return rc; diff --git a/src/sacctmgr/sacctmgr.c b/src/sacctmgr/sacctmgr.c index f60d8fc5de5..3f238f29d89 100644 --- a/src/sacctmgr/sacctmgr.c +++ b/src/sacctmgr/sacctmgr.c @@ -178,7 +178,7 @@ main (int argc, char *argv[]) /* Check to see if we are running a supported accounting plugin */ temp = slurm_get_accounting_storage_type(); - if(strcasecmp(temp, "accounting_storage/slurmdbd") + if (strcasecmp(temp, "accounting_storage/slurmdbd") && strcasecmp(temp, "accounting_storage/mysql")) { fprintf (stderr, "You are not running a supported " "accounting_storage plugin\n(%s).\n" @@ -192,20 +192,20 @@ main (int argc, char *argv[]) errno = 0; db_conn = slurmdb_connection_get(); - if(errno != SLURM_SUCCESS) { + if (errno != SLURM_SUCCESS) { int tmp_errno = errno; - if((input_field_count == 2) && + if ((input_field_count == 2) && (!strncasecmp(argv[2], "Configuration", strlen(argv[1]))) && ((!strncasecmp(argv[1], "list", strlen(argv[0]))) || (!strncasecmp(argv[1], "show", strlen(argv[0]))))) { - if(tmp_errno == ESLURM_DB_CONNECTION) { + if (tmp_errno == ESLURM_DB_CONNECTION) { tmp_errno = 0; sacctmgr_list_config(true); } else sacctmgr_list_config(false); } errno = tmp_errno; - if(errno) + if (errno) error("Problem talking to the database: %m"); exit(1); } @@ -225,7 +225,7 @@ main (int argc, char *argv[]) * them to fix it and let the process happen since there * are checks for global exit_code we need to reset it. */ - if(exit_code) { + if (exit_code) { local_exit_code = exit_code; exit_code = 0; } @@ -236,11 +236,11 @@ main (int argc, char *argv[]) */ if (exit_flag == 2) putchar('\n'); - if(local_exit_code) + if (local_exit_code) exit_code = local_exit_code; acct_storage_g_close_connection(&db_conn); slurm_acct_storage_fini(); - if(g_qos_list) + if (g_qos_list) list_destroy(g_qos_list); exit(exit_code); } @@ -469,16 +469,16 @@ _process_command (int argc, char *argv[]) argv[0]); } - if(argc > 1) + if (argc > 1) my_start = parse_time(argv[1], 1); - if(argc > 2) + if (argc > 2) my_end = parse_time(argv[2], 1); - if(argc > 3) + if (argc > 3) archive_data = atoi(argv[3]); - if(acct_storage_g_roll_usage(db_conn, my_start, + if (acct_storage_g_roll_usage(db_conn, my_start, my_end, archive_data) == SLURM_SUCCESS) { - if(commit_check("Would you like to commit rollup?")) { + if (commit_check("Would you like to commit rollup?")) { acct_storage_g_commit(db_conn, 1); } else { printf(" Rollup Discarded\n"); @@ -511,13 +511,13 @@ static void _add_it (int argc, char *argv[]) int error_code = SLURM_SUCCESS; int command_len = 0; - if(readonly_flag) { + if (readonly_flag) { exit_code = 1; fprintf(stderr, "Can't run this command in readonly mode.\n"); return; } - if(!argv[0]) + if (!argv[0]) goto helpme; command_len = strlen(argv[0]); @@ -561,13 +561,13 @@ static void _archive_it (int argc, char *argv[]) int error_code = SLURM_SUCCESS; int command_len = 0; - if(readonly_flag) { + if (readonly_flag) { exit_code = 1; fprintf(stderr, "Can't run this command in readonly mode.\n"); return; } - if(!argv[0]) + if (!argv[0]) goto helpme; command_len = strlen(argv[0]); @@ -604,7 +604,7 @@ static void _show_it (int argc, char *argv[]) int error_code = SLURM_SUCCESS; int command_len = 0; - if(!argv[0]) + if (!argv[0]) goto helpme; command_len = strlen(argv[0]); @@ -666,13 +666,13 @@ static void _modify_it (int argc, char *argv[]) int error_code = SLURM_SUCCESS; int command_len = 0; - if(readonly_flag) { + if (readonly_flag) { exit_code = 1; fprintf(stderr, "Can't run this command in readonly mode.\n"); return; } - if(!argv[0]) + if (!argv[0]) goto helpme; command_len = strlen(argv[0]); @@ -716,13 +716,13 @@ static void _delete_it (int argc, char *argv[]) int error_code = SLURM_SUCCESS; int command_len = 0; - if(readonly_flag) { + if (readonly_flag) { exit_code = 1; fprintf(stderr, "Can't run this command in readonly mode.\n"); return; } - if(!argv[0]) + if (!argv[0]) goto helpme; command_len = strlen(argv[0]); diff --git a/src/sacctmgr/txn_functions.c b/src/sacctmgr/txn_functions.c index a44cab64885..ba52a82ea19 100644 --- a/src/sacctmgr/txn_functions.c +++ b/src/sacctmgr/txn_functions.c @@ -51,7 +51,7 @@ static int _set_cond(int *start, int argc, char *argv[], for (i=(*start); i<argc; i++) { end = parse_option_end(argv[i]); - if(!end) + if (!end) command_len=strlen(argv[i]); else { command_len=end-1; @@ -60,14 +60,14 @@ static int _set_cond(int *start, int argc, char *argv[], } } - if(!end && !strncasecmp(argv[i], "where", + if (!end && !strncasecmp(argv[i], "where", MAX(command_len, 5))) { continue; - } else if(!end && !strncasecmp(argv[i], "withassocinfo", + } else if (!end && !strncasecmp(argv[i], "withassocinfo", MAX(command_len, 5))) { txn_cond->with_assoc_info = 1; set = 1; - } else if(!end + } else if (!end || (!strncasecmp (argv[i], "Ids", MAX(command_len, 1))) || (!strncasecmp (argv[i], "Txn", @@ -76,11 +76,11 @@ static int _set_cond(int *start, int argc, char *argv[], char *temp = NULL; uint32_t id = 0; - if(!txn_cond->id_list) + if (!txn_cond->id_list) txn_cond->id_list = list_create(slurm_destroy_char); - if(slurm_addto_char_list(txn_cond->id_list, + if (slurm_addto_char_list(txn_cond->id_list, argv[i]+end)) set = 1; @@ -96,37 +96,37 @@ static int _set_cond(int *start, int argc, char *argv[], list_iterator_destroy(itr); } else if (!strncasecmp (argv[i], "Accounts", MAX(command_len, 3))) { - if(!txn_cond->acct_list) + if (!txn_cond->acct_list) txn_cond->acct_list = list_create(slurm_destroy_char); - if(slurm_addto_char_list(txn_cond->acct_list, + if (slurm_addto_char_list(txn_cond->acct_list, argv[i]+end)) set = 1; } else if (!strncasecmp (argv[i], "Action", MAX(command_len, 4))) { - if(!txn_cond->action_list) + if (!txn_cond->action_list) txn_cond->action_list = list_create(slurm_destroy_char); - if(addto_action_char_list(txn_cond->action_list, + if (addto_action_char_list(txn_cond->action_list, argv[i]+end)) set = 1; else exit_code=1; } else if (!strncasecmp (argv[i], "Actors", MAX(command_len, 4))) { - if(!txn_cond->actor_list) + if (!txn_cond->actor_list) txn_cond->actor_list = list_create(slurm_destroy_char); - if(slurm_addto_char_list(txn_cond->actor_list, + if (slurm_addto_char_list(txn_cond->actor_list, argv[i]+end)) set = 1; } else if (!strncasecmp (argv[i], "Clusters", MAX(command_len, 3))) { - if(!txn_cond->cluster_list) + if (!txn_cond->cluster_list) txn_cond->cluster_list = list_create(slurm_destroy_char); - if(slurm_addto_char_list(txn_cond->cluster_list, + if (slurm_addto_char_list(txn_cond->cluster_list, argv[i]+end)) set = 1; } else if (!strncasecmp (argv[i], "End", MAX(command_len, 1))) { @@ -134,7 +134,7 @@ static int _set_cond(int *start, int argc, char *argv[], set = 1; } else if (!strncasecmp (argv[i], "Format", MAX(command_len, 1))) { - if(format_list) + if (format_list) slurm_addto_char_list(format_list, argv[i]+end); } else if (!strncasecmp (argv[i], "Start", MAX(command_len, 1))) { @@ -142,10 +142,10 @@ static int _set_cond(int *start, int argc, char *argv[], set = 1; } else if (!strncasecmp (argv[i], "Users", MAX(command_len, 1))) { - if(!txn_cond->user_list) + if (!txn_cond->user_list) txn_cond->user_list = list_create(slurm_destroy_char); - if(slurm_addto_char_list(txn_cond->user_list, + if (slurm_addto_char_list(txn_cond->user_list, argv[i]+end)) set = 1; } else { @@ -183,15 +183,15 @@ extern int sacctmgr_list_txn(int argc, char *argv[]) _set_cond(&i, argc, argv, txn_cond, format_list); } - if(exit_code) { + if (exit_code) { slurmdb_destroy_txn_cond(txn_cond); list_destroy(format_list); return SLURM_ERROR; } - if(!list_count(format_list)) { + if (!list_count(format_list)) { slurm_addto_char_list(format_list, "T,Action,Actor,Where,Info"); - if(txn_cond->with_assoc_info) + if (txn_cond->with_assoc_info) slurm_addto_char_list(format_list, "User,Account,Cluster"); } @@ -199,7 +199,7 @@ extern int sacctmgr_list_txn(int argc, char *argv[]) print_fields_list = sacctmgr_process_format_list(format_list); list_destroy(format_list); - if(exit_code) { + if (exit_code) { list_destroy(print_fields_list); return SLURM_ERROR; } @@ -207,7 +207,7 @@ extern int sacctmgr_list_txn(int argc, char *argv[]) txn_list = acct_storage_g_get_txn(db_conn, my_uid, txn_cond); slurmdb_destroy_txn_cond(txn_cond); - if(!txn_list) { + if (!txn_list) { exit_code=1; fprintf(stderr, " Error with request: %s\n", slurm_strerror(errno)); diff --git a/src/sacctmgr/user_functions.c b/src/sacctmgr/user_functions.c index e26d84549fc..3542d2c13dd 100644 --- a/src/sacctmgr/user_functions.c +++ b/src/sacctmgr/user_functions.c @@ -59,7 +59,7 @@ static int _set_cond(int *start, int argc, char *argv[], int command_len = 0; int option = 0; - if(!user_cond) { + if (!user_cond) { error("No user_cond given"); return -1; } @@ -75,16 +75,16 @@ static int _set_cond(int *start, int argc, char *argv[], * accounts. Having it blank is fine, it just needs to * exist. */ - if(!assoc_cond->user_list) + if (!assoc_cond->user_list) assoc_cond->user_list = list_create(slurm_destroy_char); for (i=(*start); i<argc; i++) { end = parse_option_end(argv[i]); - if(!end) + if (!end) command_len=strlen(argv[i]); else { command_len=end-1; - if(argv[i][end] == '=') { + if (argv[i][end] == '=') { option = (int)argv[i][end-1]; end++; } @@ -112,15 +112,15 @@ static int _set_cond(int *start, int argc, char *argv[], } else if (!end && !strncasecmp(argv[i], "WOPLimits", MAX(command_len, 4))) { assoc_cond->without_parent_limits = 1; - } else if(!end && !strncasecmp(argv[i], "where", + } else if (!end && !strncasecmp(argv[i], "where", MAX(command_len, 5))) { continue; - } else if(!end + } else if (!end || !strncasecmp(argv[i], "Names", MAX(command_len, 1)) || !strncasecmp(argv[i], "Users", MAX(command_len, 1))) { - if(slurm_addto_char_list(assoc_cond->user_list, + if (slurm_addto_char_list(assoc_cond->user_list, argv[i]+end)) u_set = 1; else @@ -145,29 +145,29 @@ static int _set_cond(int *start, int argc, char *argv[], } } else if (!strncasecmp(argv[i], "DefaultAccount", MAX(command_len, 8))) { - if(!user_cond->def_acct_list) { + if (!user_cond->def_acct_list) { user_cond->def_acct_list = list_create(slurm_destroy_char); } - if(slurm_addto_char_list(user_cond->def_acct_list, + if (slurm_addto_char_list(user_cond->def_acct_list, argv[i]+end)) u_set = 1; else exit_code=1; } else if (!strncasecmp(argv[i], "DefaultWCKey", MAX(command_len, 8))) { - if(!user_cond->def_wckey_list) { + if (!user_cond->def_wckey_list) { user_cond->def_wckey_list = list_create(slurm_destroy_char); } - if(slurm_addto_char_list(user_cond->def_wckey_list, + if (slurm_addto_char_list(user_cond->def_wckey_list, argv[i]+end)) u_set = 1; else exit_code=1; } else if (!strncasecmp(argv[i], "Format", MAX(command_len, 1))) { - if(format_list) { + if (format_list) { /* We need this to get the defaults. (Usually * only for the calling cluster) */ if (slurm_strcasestr(argv[i]+end, "default")) @@ -175,7 +175,7 @@ static int _set_cond(int *start, int argc, char *argv[], slurm_addto_char_list(format_list, argv[i]+end); } - } else if(!(a_set = sacctmgr_set_association_cond( + } else if (!(a_set = sacctmgr_set_association_cond( assoc_cond, argv[i], argv[i]+end, command_len, option))) { exit_code=1; @@ -187,11 +187,11 @@ static int _set_cond(int *start, int argc, char *argv[], (*start) = i; - if(u_set && a_set) + if (u_set && a_set) return 3; - else if(a_set) { + else if (a_set) { return 2; - } else if(u_set) + } else if (u_set) return 1; return 0; @@ -210,11 +210,11 @@ static int _set_rec(int *start, int argc, char *argv[], for (i=(*start); i<argc; i++) { end = parse_option_end(argv[i]); - if(!end) + if (!end) command_len=strlen(argv[i]); else { command_len=end-1; - if(argv[i][end] == '=') { + if (argv[i][end] == '=') { option = (int)argv[i][end-1]; end++; } @@ -223,10 +223,10 @@ static int _set_rec(int *start, int argc, char *argv[], if (!strncasecmp(argv[i], "Where", MAX(command_len, 5))) { i--; break; - } else if(!end && !strncasecmp(argv[i], "set", + } else if (!end && !strncasecmp(argv[i], "set", MAX(command_len, 3))) { continue; - } else if(!end) { + } else if (!end) { exit_code=1; fprintf(stderr, " Bad format on %s: End your option with " @@ -238,27 +238,27 @@ static int _set_rec(int *start, int argc, char *argv[], u_set = 1; } else if (!strncasecmp(argv[i], "DefaultAccount", MAX(command_len, 8))) { - if(user->default_acct) + if (user->default_acct) xfree(user->default_acct); user->default_acct = strip_quotes(argv[i]+end, NULL, 1); u_set = 1; } else if (!strncasecmp(argv[i], "DefaultWCKey", MAX(command_len, 8))) { - if(user->default_wckey) + if (user->default_wckey) xfree(user->default_wckey); user->default_wckey = strip_quotes(argv[i]+end, NULL, 1); u_set = 1; } else if (!strncasecmp(argv[i], "NewName", MAX(command_len, 1))) { - if(user->name) + if (user->name) xfree(user->name); user->name = strip_quotes(argv[i]+end, NULL, 1); u_set = 1; } else if (!strncasecmp (argv[i], "RawUsage", MAX(command_len, 7))) { uint32_t usage; - if(!assoc) + if (!assoc) continue; assoc->usage = xmalloc(sizeof( assoc_mgr_association_usage_t)); @@ -267,7 +267,7 @@ static int _set_rec(int *start, int argc, char *argv[], assoc->usage->usage_raw = usage; a_set = 1; } - } else if(!assoc || + } else if (!assoc || (assoc && !(a_set = sacctmgr_set_association_rec( assoc, argv[i], argv[i]+end, command_len, option)))) { @@ -280,11 +280,11 @@ static int _set_rec(int *start, int argc, char *argv[], (*start) = i; - if(u_set && a_set) + if (u_set && a_set) return 3; - else if(u_set) + else if (u_set) return 1; - else if(a_set) + else if (a_set) return 2; return 0; } @@ -373,7 +373,7 @@ static int _check_default_associations(char *def_acct, */ while((user = list_next(itr))) { while((cluster = list_next(itr_c))) { - if(!sacctmgr_find_association_from_list( + if (!sacctmgr_find_association_from_list( local_assoc_list, user, def_acct, cluster, "*")) { regret = xmalloc(sizeof(regret_t)); @@ -383,7 +383,7 @@ static int _check_default_associations(char *def_acct, xfree so we can override it here since we aren't allocating any extra memory */ - if(!regret_list) + if (!regret_list) regret_list = list_create(slurm_destroy_char); list_append(regret_list, regret); @@ -396,7 +396,7 @@ static int _check_default_associations(char *def_acct, list_iterator_destroy(itr_c); list_destroy(local_assoc_list); - if(regret_list) { + if (regret_list) { itr = list_iterator_create(regret_list); printf(" Can't modify because these users " "aren't associated with new " @@ -459,7 +459,7 @@ static int _check_default_wckeys(char *def_wckey, */ while((user = list_next(itr))) { while((cluster = list_next(itr_c))) { - if(!sacctmgr_find_wckey_from_list( + if (!sacctmgr_find_wckey_from_list( local_wckey_list, user, def_wckey, cluster)) { regret = xmalloc(sizeof(regret_t)); @@ -469,7 +469,7 @@ static int _check_default_wckeys(char *def_wckey, xfree so we can override it here since we aren't allocating any extra memory */ - if(!regret_list) + if (!regret_list) regret_list = list_create(slurm_destroy_char); list_append(regret_list, regret); @@ -482,7 +482,7 @@ static int _check_default_wckeys(char *def_wckey, list_iterator_destroy(itr_c); list_destroy(local_wckey_list); - if(regret_list) { + if (regret_list) { itr = list_iterator_create(regret_list); printf(" Can't modify because these users " "aren't associated with new " @@ -517,20 +517,20 @@ static int _check_coord_request(slurmdb_user_cond_t *user_cond, bool check) List local_user_list = NULL; int rc = SLURM_SUCCESS; - if(!user_cond) { + if (!user_cond) { exit_code=1; fprintf(stderr, " You need to specify the user_cond here.\n"); return SLURM_ERROR; } - if(check && (!user_cond->assoc_cond->user_list + if (check && (!user_cond->assoc_cond->user_list || !list_count(user_cond->assoc_cond->user_list))) { exit_code=1; fprintf(stderr, " You need to specify a user list here.\n"); return SLURM_ERROR; } - if(check && (!user_cond->assoc_cond->acct_list + if (check && (!user_cond->assoc_cond->acct_list || !list_count(user_cond->assoc_cond->acct_list))) { exit_code=1; fprintf(stderr, " You need to specify an account list here.\n"); @@ -541,14 +541,14 @@ static int _check_coord_request(slurmdb_user_cond_t *user_cond, bool check) account_cond.assoc_cond = user_cond->assoc_cond; local_acct_list = acct_storage_g_get_accounts(db_conn, my_uid, &account_cond); - if(!local_acct_list) { + if (!local_acct_list) { exit_code=1; fprintf(stderr, " Problem getting accounts from database. " "Contact your admin.\n"); return SLURM_ERROR; } - if(user_cond->assoc_cond->acct_list && + if (user_cond->assoc_cond->acct_list && (list_count(local_acct_list) != list_count(user_cond->assoc_cond->acct_list))) { @@ -557,11 +557,11 @@ static int _check_coord_request(slurmdb_user_cond_t *user_cond, bool check) while((name = list_next(itr))) { while((acct_rec = list_next(itr2))) { - if(!strcmp(name, acct_rec->name)) + if (!strcmp(name, acct_rec->name)) break; } list_iterator_reset(itr2); - if(!acct_rec) { + if (!acct_rec) { fprintf(stderr, " You specified a non-existant " "account '%s'.\n", name); @@ -574,16 +574,16 @@ static int _check_coord_request(slurmdb_user_cond_t *user_cond, bool check) } local_user_list = acct_storage_g_get_users(db_conn, my_uid, user_cond); - if(!local_user_list) { + if (!local_user_list) { exit_code=1; fprintf(stderr, " Problem getting users from database. " "Contact your admin.\n"); - if(local_acct_list) + if (local_acct_list) list_destroy(local_acct_list); return SLURM_ERROR; } - if(user_cond->assoc_cond->user_list && + if (user_cond->assoc_cond->user_list && (list_count(local_user_list) != list_count(user_cond->assoc_cond->user_list))) { @@ -592,11 +592,11 @@ static int _check_coord_request(slurmdb_user_cond_t *user_cond, bool check) while((name = list_next(itr))) { while((user_rec = list_next(itr2))) { - if(!strcmp(name, user_rec->name)) + if (!strcmp(name, user_rec->name)) break; } list_iterator_reset(itr2); - if(!user_rec) { + if (!user_rec) { fprintf(stderr, " You specified a non-existant " "user '%s'.\n", name); @@ -608,9 +608,9 @@ static int _check_coord_request(slurmdb_user_cond_t *user_cond, bool check) list_iterator_destroy(itr2); } - if(local_acct_list) + if (local_acct_list) list_destroy(local_acct_list); - if(local_user_list) + if (local_user_list) list_destroy(local_user_list); return rc; @@ -653,7 +653,7 @@ extern int sacctmgr_add_user(int argc, char *argv[]) int option = 0; uint16_t track_wckey = slurm_get_track_wckey(); -/* if(!list_count(sacctmgr_cluster_list)) { */ +/* if (!list_count(sacctmgr_cluster_list)) { */ /* printf(" Can't add users, no cluster defined yet.\n" */ /* " Please contact your administrator.\n"); */ /* return SLURM_ERROR; */ @@ -673,20 +673,20 @@ extern int sacctmgr_add_user(int argc, char *argv[]) for (i=0; i<argc; i++) { int end = parse_option_end(argv[i]); - if(!end) + if (!end) command_len=strlen(argv[i]); else { command_len=end-1; - if(argv[i][end] == '=') { + if (argv[i][end] == '=') { option = (int)argv[i][end-1]; end++; } } - if(!end + if (!end || !strncasecmp(argv[i], "Names", MAX(command_len, 1)) || !strncasecmp(argv[i], "Users", MAX(command_len, 1))) { - if(!slurm_addto_char_list(assoc_cond->user_list, + if (!slurm_addto_char_list(assoc_cond->user_list, argv[i]+end)) exit_code=1; } else if (!strncasecmp(argv[i], "AdminLevel", @@ -694,7 +694,7 @@ extern int sacctmgr_add_user(int argc, char *argv[]) admin_level = str_2_slurmdb_admin_level(argv[i]+end); } else if (!strncasecmp(argv[i], "DefaultAccount", MAX(command_len, 8))) { - if(default_acct) { + if (default_acct) { fprintf(stderr, " Already listed DefaultAccount %s\n", default_acct); @@ -706,7 +706,7 @@ extern int sacctmgr_add_user(int argc, char *argv[]) default_acct); } else if (!strncasecmp(argv[i], "DefaultWCKey", MAX(command_len, 8))) { - if(default_wckey) { + if (default_wckey) { fprintf(stderr, " Already listed DefaultWCKey %s\n", default_wckey); @@ -720,7 +720,7 @@ extern int sacctmgr_add_user(int argc, char *argv[]) MAX(command_len, 1))) { slurm_addto_char_list(wckey_cond->name_list, argv[i]+end); - } else if(!(limit_set = sacctmgr_set_association_rec( + } else if (!(limit_set = sacctmgr_set_association_rec( &start_assoc, argv[i], argv[i]+end, command_len, option)) && !(limit_set = sacctmgr_set_association_cond( @@ -731,11 +731,11 @@ extern int sacctmgr_add_user(int argc, char *argv[]) } } - if(exit_code) { + if (exit_code) { slurmdb_destroy_wckey_cond(wckey_cond); slurmdb_destroy_association_cond(assoc_cond); return SLURM_ERROR; - } else if(!list_count(assoc_cond->user_list)) { + } else if (!list_count(assoc_cond->user_list)) { slurmdb_destroy_wckey_cond(wckey_cond); slurmdb_destroy_association_cond(assoc_cond); exit_code=1; @@ -758,7 +758,7 @@ extern int sacctmgr_add_user(int argc, char *argv[]) db_conn, my_uid, &user_cond); } - if(!local_user_list) { + if (!local_user_list) { exit_code=1; fprintf(stderr, " Problem getting users from database. " "Contact your admin.\n"); @@ -768,13 +768,13 @@ extern int sacctmgr_add_user(int argc, char *argv[]) } - if(!list_count(assoc_cond->cluster_list)) { + if (!list_count(assoc_cond->cluster_list)) { if (_check_and_set_cluster_list(assoc_cond->cluster_list) != SLURM_SUCCESS) { slurmdb_destroy_wckey_cond(wckey_cond); slurmdb_destroy_association_cond(assoc_cond); list_destroy(local_user_list); - if(local_acct_list) + if (local_acct_list) list_destroy(local_acct_list); return SLURM_ERROR; } @@ -795,10 +795,10 @@ extern int sacctmgr_add_user(int argc, char *argv[]) list_iterator_reset(itr); while((cluster_rec = list_next(itr))) { - if(!strcasecmp(cluster_rec->name, cluster)) + if (!strcasecmp(cluster_rec->name, cluster)) break; } - if(!cluster_rec) { + if (!cluster_rec) { exit_code=1; fprintf(stderr, " This cluster '%s' " "doesn't exist.\n" @@ -812,18 +812,18 @@ extern int sacctmgr_add_user(int argc, char *argv[]) list_iterator_destroy(itr_c); list_destroy(temp_list); - if(!list_count(assoc_cond->cluster_list)) { + if (!list_count(assoc_cond->cluster_list)) { slurmdb_destroy_wckey_cond(wckey_cond); slurmdb_destroy_association_cond(assoc_cond); list_destroy(local_user_list); - if(local_acct_list) + if (local_acct_list) list_destroy(local_acct_list); return SLURM_ERROR; } } - if(!list_count(assoc_cond->acct_list)) { - if(!list_count(wckey_cond->name_list)) { + if (!list_count(assoc_cond->acct_list)) { + if (!list_count(wckey_cond->name_list)) { slurmdb_destroy_wckey_cond(wckey_cond); slurmdb_destroy_association_cond(assoc_cond); exit_code=1; @@ -841,7 +841,7 @@ extern int sacctmgr_add_user(int argc, char *argv[]) local_acct_list = acct_storage_g_get_accounts( db_conn, my_uid, &account_cond); - if(!local_acct_list) { + if (!local_acct_list) { exit_code=1; fprintf(stderr, " Problem getting accounts " "from database. Contact your admin.\n"); @@ -870,10 +870,10 @@ extern int sacctmgr_add_user(int argc, char *argv[]) } } - if(track_wckey || default_wckey) { + if (track_wckey || default_wckey) { wckey_cond->cluster_list = assoc_cond->cluster_list; wckey_cond->user_list = assoc_cond->user_list; - if(!(local_wckey_list = acct_storage_g_get_wckeys( + if (!(local_wckey_list = acct_storage_g_get_wckeys( db_conn, my_uid, wckey_cond))) info("If you are a coordinator ignore " "the previous error"); @@ -895,7 +895,7 @@ extern int sacctmgr_add_user(int argc, char *argv[]) char *local_def_acct = NULL; char *local_def_wckey = NULL; - if(!name[0]) { + if (!name[0]) { exit_code=1; fprintf(stderr, " No blank names are " "allowed when adding.\n"); @@ -907,7 +907,7 @@ extern int sacctmgr_add_user(int argc, char *argv[]) local_def_wckey = xstrdup(default_wckey); user = NULL; - if(!(user_rec = sacctmgr_find_user_from_list( + if (!(user_rec = sacctmgr_find_user_from_list( local_user_list, name))) { uid_t pw_uid; @@ -917,13 +917,13 @@ extern int sacctmgr_add_user(int argc, char *argv[]) local_def_acct = xstrdup( list_peek(assoc_cond->acct_list)); - if(!local_def_wckey + if (!local_def_wckey && wckey_cond->name_list && list_count(wckey_cond->name_list)) local_def_wckey = xstrdup( list_peek(wckey_cond->name_list)); - if(!local_def_acct || !local_def_acct[0]) { + if (!local_def_acct || !local_def_acct[0]) { exit_code=1; fprintf(stderr, " Need a default account for " "these users to add.\n"); @@ -932,8 +932,8 @@ extern int sacctmgr_add_user(int argc, char *argv[]) xfree(local_def_wckey); goto no_default; } - if(first) { - if(!sacctmgr_find_account_from_list( + if (first) { + if (!sacctmgr_find_account_from_list( local_acct_list, local_def_acct)) { exit_code=1; fprintf(stderr, " This account '%s' " @@ -953,7 +953,7 @@ extern int sacctmgr_add_user(int argc, char *argv[]) "\nAre you sure you want to continue?", name); - if(!commit_check(warning)) { + if (!commit_check(warning)) { xfree(warning); rc = SLURM_ERROR; list_flush(user_list); @@ -1039,7 +1039,7 @@ extern int sacctmgr_add_user(int argc, char *argv[]) assoc_cond->partition_list); while((partition = list_next(itr_p))) { partition_set = 1; - if(sacctmgr_find_association_from_list( + if (sacctmgr_find_association_from_list( local_assoc_list, name, account, cluster, partition)) @@ -1102,13 +1102,13 @@ extern int sacctmgr_add_user(int argc, char *argv[]) assoc->partition); } list_iterator_destroy(itr_p); - if(partition_set) { + if (partition_set) { if (!default_acct && local_def_acct) xfree(local_def_acct); continue; } - if(sacctmgr_find_association_from_list( + if (sacctmgr_find_association_from_list( local_assoc_list, name, account, cluster, NULL)) { if (!default_acct && local_def_acct) @@ -1120,7 +1120,7 @@ extern int sacctmgr_add_user(int argc, char *argv[]) sizeof(slurmdb_association_rec_t)); slurmdb_init_association_rec(assoc, 0); assoc->user = xstrdup(name); - if(local_def_acct + if (local_def_acct && !strcmp(local_def_acct, account)) assoc->is_def = 1; assoc->acct = xstrdup(account); @@ -1152,7 +1152,7 @@ extern int sacctmgr_add_user(int argc, char *argv[]) assoc->qos_list = copy_char_list(start_assoc.qos_list); - if(user) + if (user) list_append(user->assoc_list, assoc); else list_append(assoc_list, assoc); @@ -1172,14 +1172,14 @@ extern int sacctmgr_add_user(int argc, char *argv[]) xfree(local_def_acct); /* continue here if not doing wckeys */ - if(!track_wckey && !local_def_wckey) + if (!track_wckey && !local_def_wckey) continue; itr_w = list_iterator_create(wckey_cond->name_list); while((account = list_next(itr_w))) { itr_c = list_iterator_create(assoc_cond->cluster_list); while((cluster = list_next(itr_c))) { - if(sacctmgr_find_wckey_from_list( + if (sacctmgr_find_wckey_from_list( local_wckey_list, name, account, cluster)) { continue; @@ -1204,10 +1204,10 @@ extern int sacctmgr_add_user(int argc, char *argv[]) wckey->user = xstrdup(name); wckey->name = xstrdup(account); wckey->cluster = xstrdup(cluster); - if(local_def_wckey + if (local_def_wckey && !strcmp(local_def_wckey, account)) wckey->is_def = 1; - if(user) + if (user) list_append(user->wckey_list, wckey); else list_append(wckey_list, wckey); @@ -1228,68 +1228,68 @@ extern int sacctmgr_add_user(int argc, char *argv[]) no_default: list_iterator_destroy(itr); list_destroy(local_user_list); - if(local_acct_list) + if (local_acct_list) list_destroy(local_acct_list); - if(local_assoc_list) + if (local_assoc_list) list_destroy(local_assoc_list); - if(local_wckey_list) + if (local_wckey_list) list_destroy(local_wckey_list); slurmdb_destroy_wckey_cond(wckey_cond); slurmdb_destroy_association_cond(assoc_cond); - if(!list_count(user_list) && !list_count(assoc_list) + if (!list_count(user_list) && !list_count(assoc_list) && !list_count(wckey_list)) { printf(" Nothing new added.\n"); goto end_it; - } else if(!assoc_str && !wckey_str) { + } else if (!assoc_str && !wckey_str) { exit_code=1; fprintf(stderr, " No associations or wckeys created.\n"); goto end_it; } - if(user_str) { + if (user_str) { printf(" Adding User(s)\n%s", user_str); printf(" Settings =\n"); printf(" Default Account = %s\n", default_acct); - if(default_wckey) + if (default_wckey) printf(" Default WCKey = %s\n", default_wckey); - if(admin_level != SLURMDB_ADMIN_NOTSET) + if (admin_level != SLURMDB_ADMIN_NOTSET) printf(" Admin Level = %s\n", slurmdb_admin_level_str(admin_level)); xfree(user_str); } - if(assoc_str) { + if (assoc_str) { printf(" Associations =\n%s", assoc_str); xfree(assoc_str); } - if(wckey_str) { + if (wckey_str) { printf(" WCKeys =\n%s", wckey_str); xfree(wckey_str); } - if(limit_set) { + if (limit_set) { printf(" Non Default Settings\n"); sacctmgr_print_assoc_limits(&start_assoc); - if(start_assoc.qos_list) + if (start_assoc.qos_list) list_destroy(start_assoc.qos_list); } notice_thread_init(); - if(list_count(user_list)) { + if (list_count(user_list)) { rc = acct_storage_g_add_users(db_conn, my_uid, user_list); } - if(rc == SLURM_SUCCESS) { - if(list_count(assoc_list)) + if (rc == SLURM_SUCCESS) { + if (list_count(assoc_list)) rc = acct_storage_g_add_associations(db_conn, my_uid, assoc_list); } - if(rc == SLURM_SUCCESS) { - if(list_count(wckey_list)) + if (rc == SLURM_SUCCESS) { + if (list_count(wckey_list)) rc = acct_storage_g_add_wckeys(db_conn, my_uid, wckey_list); } else { @@ -1303,8 +1303,8 @@ no_default: notice_thread_fini(); - if(rc == SLURM_SUCCESS) { - if(commit_check("Would you like to commit changes?")) { + if (rc == SLURM_SUCCESS) { + if (commit_check("Would you like to commit changes?")) { acct_storage_g_commit(db_conn, 1); } else { printf(" Changes Discarded\n"); @@ -1347,10 +1347,10 @@ extern int sacctmgr_add_coord(int argc, char *argv[]) cond_set |= prev_set; } - if(exit_code) { + if (exit_code) { slurmdb_destroy_user_cond(user_cond); return SLURM_ERROR; - } else if(!cond_set) { + } else if (!cond_set) { exit_code=1; fprintf(stderr, " You need to specify conditions to " "to add the coordinator.\n"); @@ -1358,7 +1358,7 @@ extern int sacctmgr_add_coord(int argc, char *argv[]) return SLURM_ERROR; } - if((_check_coord_request(user_cond, true) == SLURM_ERROR) + if ((_check_coord_request(user_cond, true) == SLURM_ERROR) || exit_code) { slurmdb_destroy_user_cond(user_cond); return SLURM_ERROR; @@ -1386,8 +1386,8 @@ extern int sacctmgr_add_coord(int argc, char *argv[]) notice_thread_fini(); slurmdb_destroy_user_cond(user_cond); - if(rc == SLURM_SUCCESS) { - if(commit_check("Would you like to commit changes?")) { + if (rc == SLURM_SUCCESS) { + if (commit_check("Would you like to commit changes?")) { acct_storage_g_commit(db_conn, 1); } else { printf(" Changes Discarded\n"); @@ -1432,14 +1432,14 @@ extern int sacctmgr_list_user(int argc, char *argv[]) cond_set |= prev_set; } - if(exit_code) { + if (exit_code) { slurmdb_destroy_user_cond(user_cond); list_destroy(format_list); return SLURM_ERROR; } - if(!list_count(format_list)) { - if(slurm_get_track_wckey()) + if (!list_count(format_list)) { + if (slurm_get_track_wckey()) slurm_addto_char_list(format_list, "U,DefaultA,DefaultW,Ad"); else @@ -1460,8 +1460,8 @@ extern int sacctmgr_list_user(int argc, char *argv[]) user_cond->with_wckeys = 1; } - if(!user_cond->with_assocs && cond_set > 1) { - if(!commit_check("You requested options that are only vaild " + if (!user_cond->with_assocs && cond_set > 1) { + if (!commit_check("You requested options that are only vaild " "when querying with the withassoc option.\n" "Are you sure you want to continue?")) { printf("Aborted\n"); @@ -1474,7 +1474,7 @@ extern int sacctmgr_list_user(int argc, char *argv[]) print_fields_list = sacctmgr_process_format_list(format_list); list_destroy(format_list); - if(exit_code) { + if (exit_code) { slurmdb_destroy_user_cond(user_cond); list_destroy(print_fields_list); return SLURM_ERROR; @@ -1483,7 +1483,7 @@ extern int sacctmgr_list_user(int argc, char *argv[]) user_list = acct_storage_g_get_users(db_conn, my_uid, user_cond); slurmdb_destroy_user_cond(user_cond); - if(!user_list) { + if (!user_list) { exit_code=1; fprintf(stderr, " Problem with query.\n"); list_destroy(print_fields_list); @@ -1497,7 +1497,7 @@ extern int sacctmgr_list_user(int argc, char *argv[]) field_count = list_count(print_fields_list); while((user = list_next(itr))) { - if(user->assoc_list) { + if (user->assoc_list) { char *curr_cluster = NULL; ListIterator itr3 = list_iterator_create(user->assoc_list); @@ -1709,20 +1709,20 @@ extern int sacctmgr_modify_user(int argc, char *argv[]) } } - if(exit_code) { + if (exit_code) { slurmdb_destroy_user_cond(user_cond); slurmdb_destroy_user_rec(user); slurmdb_destroy_association_rec(assoc); return SLURM_ERROR; - } else if(!rec_set) { + } else if (!rec_set) { exit_code=1; fprintf(stderr, " You didn't give me anything to set\n"); slurmdb_destroy_user_cond(user_cond); slurmdb_destroy_user_rec(user); slurmdb_destroy_association_rec(assoc); return SLURM_ERROR; - } else if(!cond_set) { - if(!commit_check("You didn't set any conditions with 'WHERE'.\n" + } else if (!cond_set) { + if (!commit_check("You didn't set any conditions with 'WHERE'.\n" "Are you sure you want to continue?")) { printf("Aborted\n"); slurmdb_destroy_user_cond(user_cond); @@ -1754,8 +1754,8 @@ extern int sacctmgr_modify_user(int argc, char *argv[]) _check_and_set_cluster_list(user_cond->assoc_cond->cluster_list); notice_thread_init(); - if(rec_set & 1) { // process the account changes - if(cond_set == 2) { + if (rec_set & 1) { // process the account changes + if (cond_set == 2) { rc = SLURM_ERROR; exit_code=1; fprintf(stderr, @@ -1764,15 +1764,15 @@ extern int sacctmgr_modify_user(int argc, char *argv[]) goto assoc_start; } - if(user_cond->assoc_cond + if (user_cond->assoc_cond && user_cond->assoc_cond->acct_list && list_count(user_cond->assoc_cond->acct_list)) { notice_thread_fini(); - if(commit_check( + if (commit_check( " You specified Accounts in your " "request. Did you mean " "DefaultAccounts?\n")) { - if(!user_cond->def_acct_list) + if (!user_cond->def_acct_list) user_cond->def_acct_list = list_create(slurm_destroy_char); list_transfer(user_cond->def_acct_list, @@ -1817,20 +1817,20 @@ extern int sacctmgr_modify_user(int argc, char *argv[]) exit_code=1; fprintf(stderr, " Error with request: %s\n", slurm_strerror(errno)); - if(errno == ESLURM_ONE_CHANGE) + if (errno == ESLURM_ONE_CHANGE) fprintf(stderr, " If you are changing a users " "name you can only specify 1 user " "at a time.\n"); rc = SLURM_ERROR; } - if(ret_list) + if (ret_list) list_destroy(ret_list); } assoc_start: - if(rec_set & 2) { // process the association changes - if(cond_set == 1 + if (rec_set & 2) { // process the association changes + if (cond_set == 1 && !list_count(user_cond->assoc_cond->user_list)) { rc = SLURM_ERROR; exit_code=1; @@ -1843,7 +1843,7 @@ assoc_start: ret_list = acct_storage_g_modify_associations( db_conn, my_uid, user_cond->assoc_cond, assoc); - if(ret_list && list_count(ret_list)) { + if (ret_list && list_count(ret_list)) { char *object = NULL; ListIterator itr; set = 1; @@ -1864,7 +1864,7 @@ assoc_start: } list_iterator_destroy(itr); } - } else if(ret_list) { + } else if (ret_list) { printf(" Nothing modified\n"); } else { exit_code=1; @@ -1873,14 +1873,14 @@ assoc_start: rc = SLURM_ERROR; } - if(ret_list) + if (ret_list) list_destroy(ret_list); } assoc_end: notice_thread_fini(); - if(set) { - if(commit_check("Would you like to commit changes?")) + if (set) { + if (commit_check("Would you like to commit changes?")) acct_storage_g_commit(db_conn, 1); else { printf(" Changes Discarded\n"); @@ -1919,7 +1919,7 @@ extern int sacctmgr_delete_user(int argc, char *argv[]) && list_count(user_cond->assoc_cond->cluster_list)) cond_set |= 2; - if(!cond_set) { + if (!cond_set) { exit_code=1; fprintf(stderr, " No conditions given to remove, not executing.\n"); @@ -1927,7 +1927,7 @@ extern int sacctmgr_delete_user(int argc, char *argv[]) return SLURM_ERROR; } - if(exit_code) { + if (exit_code) { slurmdb_destroy_user_cond(user_cond); return SLURM_ERROR; } @@ -1946,14 +1946,14 @@ extern int sacctmgr_delete_user(int argc, char *argv[]) slurmdb_destroy_user_cond(user_cond); - if(ret_list && list_count(ret_list)) { + if (ret_list && list_count(ret_list)) { char *object = NULL; List del_user_list = NULL; ListIterator itr = list_iterator_create(ret_list); /* If there were jobs running with an association to be deleted, don't. */ - if(rc == ESLURM_JOBS_RUNNING_ON_ASSOC) { + if (rc == ESLURM_JOBS_RUNNING_ON_ASSOC) { fprintf(stderr, " Error with request: %s\n", slurm_strerror(rc)); while((object = list_next(itr))) { @@ -1964,9 +1964,9 @@ extern int sacctmgr_delete_user(int argc, char *argv[]) acct_storage_g_commit(db_conn, 0); return rc; } - if(cond_set == 1) { + if (cond_set == 1) { printf(" Deleting users...\n"); - } else if(cond_set & 2) { + } else if (cond_set & 2) { printf(" Deleting user associations...\n"); } while((object = list_next(itr))) { @@ -2047,13 +2047,13 @@ extern int sacctmgr_delete_user(int argc, char *argv[]) } } - if(commit_check("Would you like to commit changes?")) { + if (commit_check("Would you like to commit changes?")) { acct_storage_g_commit(db_conn, 1); } else { printf(" Changes Discarded\n"); acct_storage_g_commit(db_conn, 0); } - } else if(ret_list) { + } else if (ret_list) { printf(" Nothing deleted\n"); } else { exit_code=1; @@ -2089,23 +2089,23 @@ extern int sacctmgr_delete_coord(int argc, char *argv[]) cond_set |= prev_set; } - if(exit_code) { + if (exit_code) { slurmdb_destroy_user_cond(user_cond); return SLURM_ERROR; - } else if(!cond_set) { + } else if (!cond_set) { exit_code=1; fprintf(stderr, " You need to specify a user list " "or account list here.\n"); slurmdb_destroy_user_cond(user_cond); return SLURM_ERROR; } - if((_check_coord_request(user_cond, false) == SLURM_ERROR) + if ((_check_coord_request(user_cond, false) == SLURM_ERROR) || exit_code) { slurmdb_destroy_user_cond(user_cond); return SLURM_ERROR; } - if(user_cond->assoc_cond->user_list) { + if (user_cond->assoc_cond->user_list) { itr = list_iterator_create(user_cond->assoc_cond->user_list); while((name = list_next(itr))) { xstrfmtcat(user_str, " %s\n", name); @@ -2114,7 +2114,7 @@ extern int sacctmgr_delete_coord(int argc, char *argv[]) list_iterator_destroy(itr); } - if(user_cond->assoc_cond->acct_list) { + if (user_cond->assoc_cond->acct_list) { itr = list_iterator_create(user_cond->assoc_cond->acct_list); while((name = list_next(itr))) { xstrfmtcat(acct_str, " %s\n", name); @@ -2123,7 +2123,7 @@ extern int sacctmgr_delete_coord(int argc, char *argv[]) list_iterator_destroy(itr); } - if(!user_str && !acct_str) { + if (!user_str && !acct_str) { exit_code=1; fprintf(stderr, " You need to specify a user list " "or an account list here.\n"); @@ -2134,9 +2134,9 @@ extern int sacctmgr_delete_coord(int argc, char *argv[]) * just assumed. Right now it doesn't do it correctly though. * This is why we are doing it this way. */ - if(user_str) { + if (user_str) { printf(" Removing Coordinators with user name\n%s", user_str); - if(acct_str) + if (acct_str) printf(" From Account(s)\n%s", acct_str); else printf(" From all accounts\n"); @@ -2150,7 +2150,7 @@ extern int sacctmgr_delete_coord(int argc, char *argv[]) slurmdb_destroy_user_cond(user_cond); - if(ret_list && list_count(ret_list)) { + if (ret_list && list_count(ret_list)) { char *object = NULL; ListIterator itr = list_iterator_create(ret_list); printf(" Removed Coordinators (sub accounts not listed)...\n"); @@ -2159,7 +2159,7 @@ extern int sacctmgr_delete_coord(int argc, char *argv[]) } list_iterator_destroy(itr); set = 1; - } else if(ret_list) { + } else if (ret_list) { printf(" Nothing removed\n"); } else { exit_code=1; @@ -2168,11 +2168,11 @@ extern int sacctmgr_delete_coord(int argc, char *argv[]) rc = SLURM_ERROR; } - if(ret_list) + if (ret_list) list_destroy(ret_list); notice_thread_fini(); - if(set) { - if(commit_check("Would you like to commit changes?")) + if (set) { + if (commit_check("Would you like to commit changes?")) acct_storage_g_commit(db_conn, 1); else { printf(" Changes Discarded\n"); diff --git a/src/sacctmgr/wckey_functions.c b/src/sacctmgr/wckey_functions.c index 31a9e958ae5..4a8c6b3ab4b 100644 --- a/src/sacctmgr/wckey_functions.c +++ b/src/sacctmgr/wckey_functions.c @@ -49,14 +49,14 @@ static int _set_cond(int *start, int argc, char *argv[], int end = 0; int command_len = 0; - if(!wckey_cond) { + if (!wckey_cond) { error("No wckey_cond given"); return -1; } for (i=(*start); i<argc; i++) { end = parse_option_end(argv[i]); - if(!end) + if (!end) command_len=strlen(argv[i]); else { command_len=end-1; @@ -65,22 +65,22 @@ static int _set_cond(int *start, int argc, char *argv[], } } - if(!end && !strncasecmp(argv[i], "where", + if (!end && !strncasecmp(argv[i], "where", MAX(command_len, 5))) { continue; - } else if(!end && !strncasecmp(argv[i], "withdeleted", + } else if (!end && !strncasecmp(argv[i], "withdeleted", MAX(command_len, 5))) { wckey_cond->with_deleted = 1; set = 1; - } else if(!end + } else if (!end || !strncasecmp (argv[i], "WCKeys", MAX(command_len, 3)) || !strncasecmp (argv[i], "Names", MAX(command_len, 3))) { - if(!wckey_cond->name_list) + if (!wckey_cond->name_list) wckey_cond->name_list = list_create(slurm_destroy_char); - if(slurm_addto_char_list(wckey_cond->name_list, + if (slurm_addto_char_list(wckey_cond->name_list, argv[i]+end)) set = 1; } else if (!strncasecmp (argv[i], "Ids", @@ -89,11 +89,11 @@ static int _set_cond(int *start, int argc, char *argv[], char *temp = NULL; uint32_t id = 0; - if(!wckey_cond->id_list) + if (!wckey_cond->id_list) wckey_cond->id_list = list_create(slurm_destroy_char); - if(slurm_addto_char_list(wckey_cond->id_list, + if (slurm_addto_char_list(wckey_cond->id_list, argv[i]+end)) set = 1; @@ -109,10 +109,10 @@ static int _set_cond(int *start, int argc, char *argv[], list_iterator_destroy(itr); } else if (!strncasecmp (argv[i], "Clusters", MAX(command_len, 3))) { - if(!wckey_cond->cluster_list) + if (!wckey_cond->cluster_list) wckey_cond->cluster_list = list_create(slurm_destroy_char); - if(slurm_addto_char_list(wckey_cond->cluster_list, + if (slurm_addto_char_list(wckey_cond->cluster_list, argv[i]+end)) set = 1; } else if (!strncasecmp (argv[i], "End", MAX(command_len, 1))) { @@ -120,7 +120,7 @@ static int _set_cond(int *start, int argc, char *argv[], set = 1; } else if (!strncasecmp (argv[i], "Format", MAX(command_len, 1))) { - if(format_list) + if (format_list) slurm_addto_char_list(format_list, argv[i]+end); } else if (!strncasecmp (argv[i], "Start", MAX(command_len, 1))) { @@ -128,10 +128,10 @@ static int _set_cond(int *start, int argc, char *argv[], set = 1; } else if (!strncasecmp (argv[i], "Users", MAX(command_len, 1))) { - if(!wckey_cond->user_list) + if (!wckey_cond->user_list) wckey_cond->user_list = list_create(slurm_destroy_char); - if(slurm_addto_char_list(wckey_cond->user_list, + if (slurm_addto_char_list(wckey_cond->user_list, argv[i]+end)) set = 1; } else { @@ -178,13 +178,13 @@ extern int sacctmgr_list_wckey(int argc, char *argv[]) _set_cond(&i, argc, argv, wckey_cond, format_list); } - if(exit_code) { + if (exit_code) { slurmdb_destroy_wckey_cond(wckey_cond); list_destroy(format_list); return SLURM_ERROR; } - if(!list_count(format_list)) { + if (!list_count(format_list)) { slurm_addto_char_list(format_list, "Name,Cluster,User"); } @@ -197,7 +197,7 @@ extern int sacctmgr_list_wckey(int argc, char *argv[]) int command_len = 0; int newlen = 0; - if((tmp_char = strstr(object, "\%"))) { + if ((tmp_char = strstr(object, "\%"))) { newlen = atoi(tmp_char+1); tmp_char[0] = '\0'; } @@ -205,24 +205,24 @@ extern int sacctmgr_list_wckey(int argc, char *argv[]) command_len = strlen(object); field = xmalloc(sizeof(print_field_t)); - if(!strncasecmp("WCKeys", object, MAX(command_len, 1)) + if (!strncasecmp("WCKeys", object, MAX(command_len, 1)) || !strncasecmp("Names", object, MAX(command_len, 1))) { field->type = PRINT_NAME; field->name = xstrdup("WCKey"); field->len = 10; field->print_routine = print_fields_str; - } else if(!strncasecmp("Clusters", object, + } else if (!strncasecmp("Clusters", object, MAX(command_len, 2))) { field->type = PRINT_CLUSTER; field->name = xstrdup("Cluster"); field->len = 10; field->print_routine = print_fields_str; - } else if(!strncasecmp("IDs", object, MAX(command_len, 1))) { + } else if (!strncasecmp("IDs", object, MAX(command_len, 1))) { field->type = PRINT_ID; field->name = xstrdup("ID"); field->len = 6; field->print_routine = print_fields_uint; - } else if(!strncasecmp("Users", object, MAX(command_len, 1))) { + } else if (!strncasecmp("Users", object, MAX(command_len, 1))) { field->type = PRINT_USER; field->name = xstrdup("User"); field->len = 10; @@ -234,7 +234,7 @@ extern int sacctmgr_list_wckey(int argc, char *argv[]) continue; } - if(newlen) + if (newlen) field->len = newlen; list_append(print_fields_list, field); @@ -242,7 +242,7 @@ extern int sacctmgr_list_wckey(int argc, char *argv[]) list_iterator_destroy(itr); list_destroy(format_list); - if(exit_code) { + if (exit_code) { slurmdb_destroy_wckey_cond(wckey_cond); list_destroy(print_fields_list); return SLURM_ERROR; @@ -251,7 +251,7 @@ extern int sacctmgr_list_wckey(int argc, char *argv[]) wckey_list = acct_storage_g_get_wckeys(db_conn, my_uid, wckey_cond); slurmdb_destroy_wckey_cond(wckey_cond); - if(!wckey_list) { + if (!wckey_list) { exit_code=1; fprintf(stderr, " Error with request: %s\n", slurm_strerror(errno)); diff --git a/src/salloc/opt.c b/src/salloc/opt.c index 73d5fc5f812..fec7209ea88 100644 --- a/src/salloc/opt.c +++ b/src/salloc/opt.c @@ -229,12 +229,12 @@ static bool _valid_node_list(char **node_list_pptr) procs to use then we need exactly this many since we are saying, lay it out this way! Same for max and min nodes. Other than that just read in as many in the hostfile */ - if(opt.ntasks_set) + if (opt.ntasks_set) count = opt.ntasks; - else if(opt.nodes_set) { - if(opt.max_nodes) + else if (opt.nodes_set) { + if (opt.max_nodes) count = opt.max_nodes; - else if(opt.min_nodes) + else if (opt.min_nodes) count = opt.min_nodes; } @@ -1390,7 +1390,7 @@ static bool _opt_verify(void) if (opt.distribution == SLURM_DIST_PLANE && opt.plane_size) { if ((opt.ntasks/opt.plane_size) < opt.min_nodes) { if (((opt.min_nodes-1)*opt.plane_size) >= opt.ntasks) { -#if(0) +#if (0) info("Too few processes ((n/plane_size) %d < N %d) " "and ((N-1)*(plane_size) %d >= n %d)) ", opt.ntasks/opt.plane_size, opt.min_nodes, @@ -1466,12 +1466,12 @@ static bool _opt_verify(void) } /* else if (opt.ntasks_set && !opt.nodes_set) */ - if(!opt.nodelist) { - if((opt.nodelist = xstrdup(getenv("SLURM_HOSTFILE")))) { + if (!opt.nodelist) { + if ((opt.nodelist = xstrdup(getenv("SLURM_HOSTFILE")))) { /* make sure the file being read in has a / in it to make sure it is a file in the valid_node_list function */ - if(!strstr(opt.nodelist, "/")) { + if (!strstr(opt.nodelist, "/")) { char *add_slash = xstrdup("./"); xstrcat(add_slash, opt.nodelist); xfree(opt.nodelist); @@ -1494,14 +1494,14 @@ static bool _opt_verify(void) /* set up the proc and node counts based on the arbitrary list of nodes */ - if((opt.distribution == SLURM_DIST_ARBITRARY) + if ((opt.distribution == SLURM_DIST_ARBITRARY) && (!opt.nodes_set || !opt.ntasks_set)) { hostlist_t hl = hostlist_create(opt.nodelist); - if(!opt.ntasks_set) { + if (!opt.ntasks_set) { opt.ntasks_set = 1; opt.ntasks = hostlist_count(hl); } - if(!opt.nodes_set) { + if (!opt.nodes_set) { opt.nodes_set = 1; hostlist_uniq(hl); opt.min_nodes = opt.max_nodes = hostlist_count(hl); @@ -1723,7 +1723,7 @@ static void _opt_list(void) if (opt.jobid != NO_VAL) info("jobid : %u", opt.jobid); info("distribution : %s", format_task_dist_states(opt.distribution)); - if(opt.distribution == SLURM_DIST_PLANE) + if (opt.distribution == SLURM_DIST_PLANE) info("plane size : %u", opt.plane_size); info("verbose : %d", opt.verbose); if (opt.immediate <= 1) diff --git a/src/salloc/salloc.c b/src/salloc/salloc.c index fa5dac38c12..074d868f9cd 100644 --- a/src/salloc/salloc.c +++ b/src/salloc/salloc.c @@ -1058,7 +1058,7 @@ static int _blocks_dealloc(void) return -1; } for (i=0; i<new_bg_ptr->record_count; i++) { - if(new_bg_ptr->block_array[i].state == BG_BLOCK_TERM) { + if (new_bg_ptr->block_array[i].state == BG_BLOCK_TERM) { rc = 1; break; } diff --git a/src/sbatch/mult_cluster.c b/src/sbatch/mult_cluster.c index 0f4af2b000d..4049748cc82 100644 --- a/src/sbatch/mult_cluster.c +++ b/src/sbatch/mult_cluster.c @@ -68,9 +68,9 @@ static int _sort_local_cluster(local_cluster_rec_t* rec_a, else if (rec_a->preempt_cnt > rec_b->preempt_cnt) return 1; - if(!strcmp(local_cluster_name, rec_a->cluster_rec->name)) + if (!strcmp(local_cluster_name, rec_a->cluster_rec->name)) return -1; - else if(!strcmp(local_cluster_name, rec_b->cluster_rec->name)) + else if (!strcmp(local_cluster_name, rec_b->cluster_rec->name)) return 1; return 0; diff --git a/src/sbatch/opt.c b/src/sbatch/opt.c index 2530fe8b8af..209060de515 100644 --- a/src/sbatch/opt.c +++ b/src/sbatch/opt.c @@ -253,12 +253,12 @@ static bool _valid_node_list(char **node_list_pptr) procs to use then we need exactly this many since we are saying, lay it out this way! Same for max and min nodes. Other than that just read in as many in the hostfile */ - if(opt.ntasks_set) + if (opt.ntasks_set) count = opt.ntasks; - else if(opt.nodes_set) { - if(opt.max_nodes) + else if (opt.nodes_set) { + if (opt.max_nodes) count = opt.max_nodes; - else if(opt.min_nodes) + else if (opt.min_nodes) count = opt.min_nodes; } @@ -1864,7 +1864,7 @@ static char *_get_pbs_node_name(char *node_options, int *i) value = xmalloc((*i)-start+1); memcpy(value, node_options+start, (*i)-start); - if(node_options[*i]) + if (node_options[*i]) (*i)++; return value; @@ -1876,7 +1876,7 @@ static void _get_next_pbs_node_part(char *node_options, int *i) && node_options[*i] != '+' && node_options[*i] != ':') (*i)++; - if(node_options[*i]) + if (node_options[*i]) (*i)++; } @@ -1889,14 +1889,14 @@ static void _parse_pbs_nodes_opts(char *node_opts) hostlist_t hl = hostlist_create(NULL); while(node_opts[i]) { - if(!strncmp(node_opts+i, "ppn=", 4)) { + if (!strncmp(node_opts+i, "ppn=", 4)) { i+=4; ppn += strtol(node_opts+i, NULL, 10); _get_next_pbs_node_part(node_opts, &i); - } else if(isdigit(node_opts[i])) { + } else if (isdigit(node_opts[i])) { node_cnt += strtol(node_opts+i, NULL, 10); _get_next_pbs_node_part(node_opts, &i); - } else if(isalpha(node_opts[i])) { + } else if (isalpha(node_opts[i])) { temp = _get_pbs_node_name(node_opts, &i); hostlist_push(hl, temp); xfree(temp); @@ -1905,20 +1905,20 @@ static void _parse_pbs_nodes_opts(char *node_opts) } - if(!node_cnt) + if (!node_cnt) node_cnt = 1; else { opt.nodes_set = true; opt.min_nodes = opt.max_nodes = node_cnt; } - if(ppn) { + if (ppn) { ppn *= node_cnt; opt.ntasks_set = true; opt.ntasks = ppn; } - if(hostlist_count(hl) > 0) { + if (hostlist_count(hl) > 0) { xfree(opt.nodelist); opt.nodelist = hostlist_ranged_string_xmalloc(hl); #ifdef HAVE_BG @@ -1936,7 +1936,7 @@ static void _get_next_pbs_option(char *pbs_options, int *i) { while(pbs_options[*i] && pbs_options[*i] != ',') (*i)++; - if(pbs_options[*i]) + if (pbs_options[*i]) (*i)++; } @@ -1950,7 +1950,7 @@ static char *_get_pbs_option_value(char *pbs_options, int *i) value = xmalloc((*i)-start+1); memcpy(value, pbs_options+start, (*i)-start); - if(pbs_options[*i]) + if (pbs_options[*i]) (*i)++; return value; @@ -1962,10 +1962,10 @@ static void _parse_pbs_resource_list(char *rl) char *temp = NULL; while(rl[i]) { - if(!strncmp(rl+i, "arch=", 5)) { + if (!strncmp(rl+i, "arch=", 5)) { i+=5; _get_next_pbs_option(rl, &i); - } else if(!strncmp(rl+i, "cput=", 5)) { + } else if (!strncmp(rl+i, "cput=", 5)) { i+=5; temp = _get_pbs_option_value(rl, &i); if (!temp) { @@ -1975,12 +1975,12 @@ static void _parse_pbs_resource_list(char *rl) xfree(opt.time_limit_str); opt.time_limit_str = xstrdup(temp); xfree(temp); - } else if(!strncmp(rl+i, "file=", 5)) { + } else if (!strncmp(rl+i, "file=", 5)) { int end = 0; i+=5; temp = _get_pbs_option_value(rl, &i); - if(!temp) { + if (!temp) { error("No value given for file"); exit(error_exit); } @@ -1998,15 +1998,15 @@ static void _parse_pbs_resource_list(char *rl) exit(error_exit); } xfree(temp); - } else if(!strncmp(rl+i, "host=", 5)) { + } else if (!strncmp(rl+i, "host=", 5)) { i+=5; _get_next_pbs_option(rl, &i); - } else if(!strncmp(rl+i, "mem=", 4)) { + } else if (!strncmp(rl+i, "mem=", 4)) { int end = 0; i+=4; temp = _get_pbs_option_value(rl, &i); - if(!temp) { + if (!temp) { error("No value given for mem"); exit(error_exit); } @@ -2066,7 +2066,7 @@ static void _parse_pbs_resource_list(char *rl) } xfree(temp); #endif /* HAVE_CRAY */ - } else if(!strncmp(rl+i, "nice=", 5)) { + } else if (!strncmp(rl+i, "nice=", 5)) { i+=5; temp = _get_pbs_option_value(rl, &i); if (temp) @@ -2088,47 +2088,47 @@ static void _parse_pbs_resource_list(char *rl) } } xfree(temp); - } else if(!strncmp(rl+i, "nodes=", 6)) { + } else if (!strncmp(rl+i, "nodes=", 6)) { i+=6; temp = _get_pbs_option_value(rl, &i); - if(!temp) { + if (!temp) { error("No value given for nodes"); exit(error_exit); } _parse_pbs_nodes_opts(temp); xfree(temp); - } else if(!strncmp(rl+i, "opsys=", 6)) { + } else if (!strncmp(rl+i, "opsys=", 6)) { i+=6; _get_next_pbs_option(rl, &i); - } else if(!strncmp(rl+i, "other=", 6)) { + } else if (!strncmp(rl+i, "other=", 6)) { i+=6; _get_next_pbs_option(rl, &i); - } else if(!strncmp(rl+i, "pcput=", 6)) { + } else if (!strncmp(rl+i, "pcput=", 6)) { i+=6; temp = _get_pbs_option_value(rl, &i); - if(!temp) { + if (!temp) { error("No value given for pcput"); exit(error_exit); } xfree(opt.time_limit_str); opt.time_limit_str = xstrdup(temp); xfree(temp); - } else if(!strncmp(rl+i, "pmem=", 5)) { + } else if (!strncmp(rl+i, "pmem=", 5)) { i+=5; _get_next_pbs_option(rl, &i); - } else if(!strncmp(rl+i, "pvmem=", 6)) { + } else if (!strncmp(rl+i, "pvmem=", 6)) { i+=6; _get_next_pbs_option(rl, &i); - } else if(!strncmp(rl+i, "software=", 9)) { + } else if (!strncmp(rl+i, "software=", 9)) { i+=9; _get_next_pbs_option(rl, &i); - } else if(!strncmp(rl+i, "vmem=", 5)) { + } else if (!strncmp(rl+i, "vmem=", 5)) { i+=5; _get_next_pbs_option(rl, &i); - } else if(!strncmp(rl+i, "walltime=", 9)) { + } else if (!strncmp(rl+i, "walltime=", 9)) { i+=9; temp = _get_pbs_option_value(rl, &i); - if(!temp) { + if (!temp) { error("No value given for walltime"); exit(error_exit); } @@ -2242,7 +2242,7 @@ static bool _opt_verify(void) if ((opt.min_nodes <= 0) || ((opt.ntasks/opt.plane_size) < opt.min_nodes)) { if (((opt.min_nodes-1)*opt.plane_size) >= opt.ntasks) { -#if(0) +#if (0) info("Too few processes ((n/plane_size) %d < N %d) " "and ((N-1)*(plane_size) %d >= n %d)) ", opt.ntasks/opt.plane_size, opt.min_nodes, @@ -2339,12 +2339,12 @@ static bool _opt_verify(void) } /* else if (opt.ntasks_set && !opt.nodes_set) */ - if(!opt.nodelist) { - if((opt.nodelist = xstrdup(getenv("SLURM_HOSTFILE")))) { + if (!opt.nodelist) { + if ((opt.nodelist = xstrdup(getenv("SLURM_HOSTFILE")))) { /* make sure the file being read in has a / in it to make sure it is a file in the valid_node_list function */ - if(!strstr(opt.nodelist, "/")) { + if (!strstr(opt.nodelist, "/")) { char *add_slash = xstrdup("./"); xstrcat(add_slash, opt.nodelist); xfree(opt.nodelist); @@ -2367,14 +2367,14 @@ static bool _opt_verify(void) /* set up the proc and node counts based on the arbitrary list of nodes */ - if((opt.distribution == SLURM_DIST_ARBITRARY) + if ((opt.distribution == SLURM_DIST_ARBITRARY) && (!opt.nodes_set || !opt.ntasks_set)) { hostlist_t hl = hostlist_create(opt.nodelist); - if(!opt.ntasks_set) { + if (!opt.ntasks_set) { opt.ntasks_set = 1; opt.ntasks = hostlist_count(hl); } - if(!opt.nodes_set) { + if (!opt.nodes_set) { opt.nodes_set = 1; hostlist_uniq(hl); opt.min_nodes = opt.max_nodes = hostlist_count(hl); @@ -2715,7 +2715,7 @@ static void _opt_list(void) info("wckey : `%s'", opt.wckey); info("distribution : %s", format_task_dist_states(opt.distribution)); - if(opt.distribution == SLURM_DIST_PLANE) + if (opt.distribution == SLURM_DIST_PLANE) info("plane size : %u", opt.plane_size); info("verbose : %d", opt.verbose); info("immediate : %s", tf_(opt.immediate)); diff --git a/src/sbcast/agent.c b/src/sbcast/agent.c index 9c3864c0e47..f31486627e6 100644 --- a/src/sbcast/agent.c +++ b/src/sbcast/agent.c @@ -148,7 +148,7 @@ extern void send_rpc(file_bcast_msg_t *bcast_msg, while (i < sbcast_cred->node_cnt) { int j = 0; name = hostlist_shift(hl); - if(!name) { + if (!name) { debug3("no more nodes to send to"); break; } @@ -157,7 +157,7 @@ extern void send_rpc(file_bcast_msg_t *bcast_msg, i++; for(j = 0; j < span[threads_used]; j++) { name = hostlist_shift(hl); - if(!name) + if (!name) break; hostlist_push(new_hl, name); free(name); diff --git a/src/scontrol/info_job.c b/src/scontrol/info_job.c index b325a4a4e2d..77cc8eeec9a 100644 --- a/src/scontrol/info_job.c +++ b/src/scontrol/info_job.c @@ -790,7 +790,7 @@ static int _blocks_dealloc(void) return -1; } for (i=0; i<new_bg_ptr->record_count; i++) { - if(new_bg_ptr->block_array[i].state == BG_BLOCK_TERM) { + if (new_bg_ptr->block_array[i].state == BG_BLOCK_TERM) { rc = 1; break; } @@ -909,7 +909,7 @@ extern int scontrol_job_ready(char *job_id_str) return SLURM_ERROR; } - if(cluster_flags & CLUSTER_FLAG_BG) { + if (cluster_flags & CLUSTER_FLAG_BG) { resource_allocation_response_msg_t *alloc; rc = slurm_allocation_lookup_lite(job_id, &alloc); if (rc == SLURM_SUCCESS) { diff --git a/src/scontrol/scontrol.c b/src/scontrol/scontrol.c index 239dbbaf0b9..2cf70f24a85 100644 --- a/src/scontrol/scontrol.c +++ b/src/scontrol/scontrol.c @@ -611,7 +611,7 @@ _process_command (int argc, char *argv[]) if (quiet_flag == -1) fprintf(stderr, "no input"); return 0; - } else if(tag) + } else if (tag) tag_len = strlen(tag); else { if (quiet_flag == -1) @@ -681,17 +681,17 @@ _process_command (int argc, char *argv[]) old_res_info_ptr = NULL; slurm_free_ctl_conf(old_slurm_ctl_conf_ptr); old_slurm_ctl_conf_ptr = NULL; - /* if(old_block_info_ptr) */ + /* if (old_block_info_ptr) */ /* old_block_info_ptr->last_update = 0; */ - /* if(old_job_info_ptr) */ + /* if (old_job_info_ptr) */ /* old_job_info_ptr->last_update = 0; */ - /* if(old_node_info_ptr) */ + /* if (old_node_info_ptr) */ /* old_node_info_ptr->last_update = 0; */ - /* if(old_part_info_ptr) */ + /* if (old_part_info_ptr) */ /* old_part_info_ptr->last_update = 0; */ - /* if(old_res_info_ptr) */ + /* if (old_res_info_ptr) */ /* old_res_info_ptr->last_update = 0; */ - /* if(old_slurm_ctl_conf_ptr) */ + /* if (old_slurm_ctl_conf_ptr) */ /* old_slurm_ctl_conf_ptr->last_update = 0; */ } else if (strncasecmp (tag, "create", MAX(tag_len, 2)) == 0) { @@ -1315,7 +1315,7 @@ _delete_it (int argc, char *argv[]) slurm_perror(errmsg); } } else if (strncasecmp (tag, "BlockName", MAX(tag_len, 3)) == 0) { - if(cluster_flags & CLUSTER_FLAG_BG) { + if (cluster_flags & CLUSTER_FLAG_BG) { update_block_msg_t block_msg; slurm_init_update_block_msg ( &block_msg ); block_msg.bg_block_id = val; @@ -1524,7 +1524,7 @@ _update_it (int argc, char *argv[]) exit_code = 1; fprintf(stderr, "No valid entity in update command\n"); fprintf(stderr, "Input line must include \"NodeName\", "); - if(cluster_flags & CLUSTER_FLAG_BG) { + if (cluster_flags & CLUSTER_FLAG_BG) { fprintf(stderr, "\"BlockName\", \"SubMPName\" " "(i.e. bgl000[0-3]),"); } @@ -1552,7 +1552,7 @@ _update_bluegene_block (int argc, char *argv[]) int i, update_cnt = 0; update_block_msg_t block_msg; - if(!(cluster_flags & CLUSTER_FLAG_BG)) { + if (!(cluster_flags & CLUSTER_FLAG_BG)) { exit_code = 1; fprintf(stderr, "This only works on a bluegene system.\n"); return 0; @@ -1609,7 +1609,7 @@ _update_bluegene_block (int argc, char *argv[]) } } - if(!block_msg.bg_block_id) { + if (!block_msg.bg_block_id) { error("You didn't supply a block name."); return 0; } else if (block_msg.state == (uint16_t)NO_VAL) { @@ -1639,7 +1639,7 @@ _update_bluegene_subbp (int argc, char *argv[]) int i, update_cnt = 0; update_block_msg_t block_msg; - if(!(cluster_flags & CLUSTER_FLAG_BG)) { + if (!(cluster_flags & CLUSTER_FLAG_BG)) { exit_code = 1; fprintf(stderr, "This only works on a bluegene system.\n"); return 0; @@ -1688,7 +1688,7 @@ _update_bluegene_subbp (int argc, char *argv[]) } } - if(!block_msg.mp_str) { + if (!block_msg.mp_str) { error("You didn't supply an ionode list."); return 0; } else if (block_msg.state == (uint16_t)NO_VAL) { diff --git a/src/scontrol/update_job.c b/src/scontrol/update_job.c index 3bb7540b787..a25e56b14f8 100644 --- a/src/scontrol/update_job.c +++ b/src/scontrol/update_job.c @@ -754,7 +754,7 @@ scontrol_update_job (int argc, char *argv[]) } else if (strncasecmp(tag, "Conn-Type", MAX(taglen, 2)) == 0) { verify_conn_type(val, job_msg.conn_type); - if(job_msg.conn_type[0] != (uint16_t)NO_VAL) + if (job_msg.conn_type[0] != (uint16_t)NO_VAL) update_cnt++; } else if (strncasecmp(tag, "Licenses", MAX(taglen, 1)) == 0) { diff --git a/src/sinfo/print.c b/src/sinfo/print.c index a8c0da53418..eceaf600081 100644 --- a/src/sinfo/print.c +++ b/src/sinfo/print.c @@ -438,7 +438,7 @@ int _print_cpus_aiot(sinfo_data_t * sinfo_data, int width, char tmpo[8]; char tmpt[8]; if (sinfo_data) { - if(params.cluster_flags & CLUSTER_FLAG_BG) { + if (params.cluster_flags & CLUSTER_FLAG_BG) { convert_num_unit((float)sinfo_data->cpus_alloc, tmpa, sizeof(tmpa), UNIT_NONE); convert_num_unit((float)sinfo_data->cpus_idle, @@ -687,7 +687,7 @@ int _print_node_list(sinfo_data_t * sinfo_data, int width, xfree(tmp); } else { char *title = "NODELIST"; - if(params.cluster_flags & CLUSTER_FLAG_BG) + if (params.cluster_flags & CLUSTER_FLAG_BG) title = "MIDPLANELIST"; _print_str(title, width, right_justify, false); @@ -726,7 +726,7 @@ int _print_nodes_t(sinfo_data_t * sinfo_data, int width, char id[FORMAT_STRING_SIZE]; char tmp[8]; if (sinfo_data) { - if(params.cluster_flags & CLUSTER_FLAG_BG) + if (params.cluster_flags & CLUSTER_FLAG_BG) convert_num_unit((float)sinfo_data->nodes_total, tmp, sizeof(tmp), UNIT_NONE); else @@ -749,7 +749,7 @@ int _print_nodes_ai(sinfo_data_t * sinfo_data, int width, char tmpa[8]; char tmpi[8]; if (sinfo_data) { - if(params.cluster_flags & CLUSTER_FLAG_BG) { + if (params.cluster_flags & CLUSTER_FLAG_BG) { convert_num_unit((float)sinfo_data->nodes_alloc, tmpa, sizeof(tmpa), UNIT_NONE); convert_num_unit((float)sinfo_data->nodes_idle, @@ -780,7 +780,7 @@ int _print_nodes_aiot(sinfo_data_t * sinfo_data, int width, char tmpo[8]; char tmpt[8]; if (sinfo_data) { - if(params.cluster_flags & CLUSTER_FLAG_BG) { + if (params.cluster_flags & CLUSTER_FLAG_BG) { convert_num_unit((float)sinfo_data->nodes_alloc, tmpa, sizeof(tmpa), UNIT_NONE); convert_num_unit((float)sinfo_data->nodes_idle, diff --git a/src/sinfo/sinfo.c b/src/sinfo/sinfo.c index ce0b66c3978..d82eb66937c 100644 --- a/src/sinfo/sinfo.c +++ b/src/sinfo/sinfo.c @@ -513,7 +513,7 @@ static bool _filter_out(node_info_t *node_ptr) SELECT_NODEDATA_SUBCNT, NODE_STATE_ERROR, &cpus); - if(cpus) { + if (cpus) { match = true; break; } @@ -523,7 +523,7 @@ static bool _filter_out(node_info_t *node_ptr) SELECT_NODEDATA_SUBCNT, NODE_STATE_ALLOCATED, &cpus); - if(cpus) { + if (cpus) { match = true; break; } @@ -920,21 +920,21 @@ static int _handle_subgrps(List sinfo_list, uint16_t part_num, iterator = list_iterator_create(params.state_list); for(i=0; i<state_cnt; i++) { - if(iterator) { + if (iterator) { node_info_t tmp_node, *tmp_node_ptr = &tmp_node; while ((node_state = list_next(iterator))) { tmp_node_ptr->node_state = *node_state; - if((((state[i] == NODE_STATE_ALLOCATED) + if ((((state[i] == NODE_STATE_ALLOCATED) && IS_NODE_DRAINING(tmp_node_ptr)) || (*node_state == NODE_STATE_DRAIN)) || (*node_state == state[i])) break; } list_iterator_reset(iterator); - if(!node_state) + if (!node_state) continue; } - if(select_g_select_nodeinfo_get(node_ptr->select_nodeinfo, + if (select_g_select_nodeinfo_get(node_ptr->select_nodeinfo, SELECT_NODEDATA_SUBCNT, state[i], &size) == SLURM_SUCCESS @@ -948,22 +948,22 @@ static int _handle_subgrps(List sinfo_list, uint16_t part_num, } /* now handle the idle */ - if(iterator) { + if (iterator) { while ((node_state = list_next(iterator))) { node_info_t tmp_node, *tmp_node_ptr = &tmp_node; tmp_node_ptr->node_state = *node_state; - if(((*node_state == NODE_STATE_DRAIN) + if (((*node_state == NODE_STATE_DRAIN) || IS_NODE_DRAINED(tmp_node_ptr)) || (*node_state == NODE_STATE_IDLE)) break; } list_iterator_destroy(iterator); - if(!node_state) + if (!node_state) return SLURM_SUCCESS; } node_ptr->node_state &= NODE_STATE_FLAGS; node_ptr->node_state |= NODE_STATE_IDLE; - if((int)node_scaling > 0) + if ((int)node_scaling > 0) _insert_node_ptr(sinfo_list, part_num, part_ptr, node_ptr, node_scaling); diff --git a/src/slurmctld/acct_policy.c b/src/slurmctld/acct_policy.c index 51f775008a8..2dae7735109 100644 --- a/src/slurmctld/acct_policy.c +++ b/src/slurmctld/acct_policy.c @@ -197,14 +197,14 @@ static void _adjust_limit_usage(int type, struct job_record *job_ptr) used_limits->submit_jobs++; break; case ACCT_POLICY_REM_SUBMIT: - if(qos_ptr->usage->grp_used_submit_jobs) + if (qos_ptr->usage->grp_used_submit_jobs) qos_ptr->usage->grp_used_submit_jobs--; else debug2("acct_policy_remove_job_submit: " "grp_submit_jobs underflow for qos %s", qos_ptr->name); - if(used_limits->submit_jobs) + if (used_limits->submit_jobs) used_limits->submit_jobs--; else debug2("acct_policy_remove_job_submit: " @@ -240,7 +240,7 @@ static void _adjust_limit_usage(int type, struct job_record *job_ptr) } qos_ptr->usage->grp_used_mem -= job_memory; - if((int32_t)qos_ptr->usage->grp_used_mem < 0) { + if ((int32_t)qos_ptr->usage->grp_used_mem < 0) { qos_ptr->usage->grp_used_mem = 0; debug2("acct_policy_job_fini: grp_used_mem " "underflow for qos %s", qos_ptr->name); @@ -1799,7 +1799,7 @@ extern bool acct_policy_job_runnable(struct job_record *job_ptr) * parents since we have pre-propogated them, so just * continue with the next parent */ - if(parent) { + if (parent) { assoc_ptr = assoc_ptr->usage->parent_assoc_ptr; continue; } @@ -2179,7 +2179,7 @@ extern bool acct_policy_job_time_out(struct job_record *job_ptr) assoc = assoc->usage->parent_assoc_ptr; /* these limits don't apply to the root assoc */ - if(assoc == assoc_mgr_root_assoc) + if (assoc == assoc_mgr_root_assoc) break; } job_failed: diff --git a/src/slurmctld/agent.c b/src/slurmctld/agent.c index f1359fb3543..e4d6be51466 100644 --- a/src/slurmctld/agent.c +++ b/src/slurmctld/agent.c @@ -429,12 +429,12 @@ static agent_info_t *_make_agent_info(agent_arg_t *agent_arg_ptr) thread_ptr[thr_count].state = DSH_NEW; thread_ptr[thr_count].addr = agent_arg_ptr->addr; name = hostlist_shift(agent_arg_ptr->hostlist); - if(!name) { + if (!name) { debug3("no more nodes to send to"); break; } hl = hostlist_create(name); - if(thread_ptr[thr_count].addr && span[thr_count]) { + if (thread_ptr[thr_count].addr && span[thr_count]) { debug("warning: you will only be sending this to %s", name); span[thr_count] = 0; @@ -874,7 +874,7 @@ static void *_thread_per_group_rpc(void *args) msg.address = *thread_ptr->addr; } else { //info("no address given"); - if(slurm_conf_get_addr(thread_ptr->nodelist, + if (slurm_conf_get_addr(thread_ptr->nodelist, &msg.address) == SLURM_ERROR) { error("_thread_per_group_rpc: " "can't find address for host %s, " @@ -1006,7 +1006,7 @@ static void *_thread_per_group_rpc(void *args) } if (srun_agent) thread_state = DSH_FAILED; - else if(ret_data_info->type == RESPONSE_FORWARD_FAILED) + else if (ret_data_info->type == RESPONSE_FORWARD_FAILED) /* check if a forward failed */ thread_state = DSH_NO_RESP; else { /* some will fail that don't mean anything went @@ -1058,7 +1058,7 @@ static int _setup_requeue(agent_arg_t *agent_arg_ptr, thd_t *thread_ptr, debug("got the name %s to resend out of %d", ret_data_info->node_name, count); - if(agent_arg_ptr) { + if (agent_arg_ptr) { hostlist_push(agent_arg_ptr->hostlist, ret_data_info->node_name); @@ -1098,7 +1098,7 @@ static void _queue_agent_retry(agent_info_t * agent_info_ptr, int count) j = 0; for (i = 0; i < agent_info_ptr->thread_count; i++) { - if(!thread_ptr[i].ret_list) { + if (!thread_ptr[i].ret_list) { if (thread_ptr[i].state != DSH_NO_RESP) continue; @@ -1110,7 +1110,7 @@ static void _queue_agent_retry(agent_info_t * agent_info_ptr, int count) if ((++j) == count) break; } else { - if(_setup_requeue(agent_arg_ptr, &thread_ptr[i], + if (_setup_requeue(agent_arg_ptr, &thread_ptr[i], count, &j)) break; } @@ -1459,9 +1459,9 @@ static void _mail_proc(mail_info_t *mi) (void) close(1); (void) close(2); fd = open("/dev/null", O_RDWR); // 0 - if(dup(fd) == -1) // 1 + if (dup(fd) == -1) // 1 error("Couldn't do a dup for 1: %m"); - if(dup(fd) == -1) // 2 + if (dup(fd) == -1) // 2 error("Couldn't do a dup for 2 %m"); execle(slurmctld_conf.mail_prog, "mail", "-s", mi->message, mi->user_name, diff --git a/src/slurmctld/controller.c b/src/slurmctld/controller.c index 285f0ed0053..174bd6db19e 100644 --- a/src/slurmctld/controller.c +++ b/src/slurmctld/controller.c @@ -325,7 +325,7 @@ int main(int argc, char *argv[]) association_based_accounting = slurm_get_is_association_based_accounting(); accounting_enforce = slurmctld_conf.accounting_storage_enforce; - if(!strcasecmp(slurmctld_conf.accounting_storage_type, + if (!strcasecmp(slurmctld_conf.accounting_storage_type, "accounting_storage/slurmdbd")) { with_slurmdbd = 1; /* we need job_list not to be NULL */ @@ -1132,7 +1132,7 @@ static int _accounting_cluster_ready() cluster_nodes, cluster_cpus, event_time); xfree(cluster_nodes); - if(rc == ACCOUNTING_FIRST_REG) { + if (rc == ACCOUNTING_FIRST_REG) { /* see if we are running directly to a database * instead of a slurmdbd. */ @@ -1163,7 +1163,7 @@ static int _accounting_mark_all_nodes_down(char *reason) } xfree(state_file); - if((rc = acct_storage_g_flush_jobs_on_cluster(acct_db_conn, + if ((rc = acct_storage_g_flush_jobs_on_cluster(acct_db_conn, event_time)) == SLURM_ERROR) return rc; @@ -1172,7 +1172,7 @@ static int _accounting_mark_all_nodes_down(char *reason) for (i = 0; i < node_record_count; i++, node_ptr++) { if (node_ptr->name == '\0') continue; - if((rc = clusteracct_storage_g_node_down( + if ((rc = clusteracct_storage_g_node_down( acct_db_conn, node_ptr, event_time, reason, slurm_get_slurm_user_id())) @@ -1787,12 +1787,12 @@ static void _parse_commandline(int argc, char *argv[]) break; case 'r': recover = 1; - if(!bg_recover_override) + if (!bg_recover_override) bg_recover = 1; break; case 'R': recover = 2; - if(!bg_recover_override) + if (!bg_recover_override) bg_recover = 1; break; case 'v': @@ -2076,13 +2076,13 @@ static void *_assoc_cache_mgr(void *no_data) /* This is here to see if we are exiting. If we get NO_VAL then just return since we are closing down. */ - if(running_cache == (uint16_t)NO_VAL) { + if (running_cache == (uint16_t)NO_VAL) { slurm_mutex_unlock(&assoc_cache_mutex); return NULL; } lock_slurmctld(job_write_lock); assoc_mgr_refresh_lists(acct_db_conn, NULL); - if(running_cache) + if (running_cache) unlock_slurmctld(job_write_lock); slurm_mutex_unlock(&assoc_cache_mutex); } @@ -2117,10 +2117,10 @@ static void *_assoc_cache_mgr(void *no_data) (size_t)job_ptr->assoc_ptr, job_ptr->assoc_id, job_ptr->job_id); } - if(job_ptr->qos_id) { + if (job_ptr->qos_id) { memset(&qos_rec, 0, sizeof(slurmdb_qos_rec_t)); qos_rec.id = job_ptr->qos_id; - if((assoc_mgr_fill_in_qos( + if ((assoc_mgr_fill_in_qos( acct_db_conn, &qos_rec, accounting_enforce, (slurmdb_qos_rec_t **)&job_ptr->qos_ptr)) diff --git a/src/slurmctld/job_mgr.c b/src/slurmctld/job_mgr.c index 53c1fea7f23..5073ef20144 100644 --- a/src/slurmctld/job_mgr.c +++ b/src/slurmctld/job_mgr.c @@ -1579,7 +1579,7 @@ static int _load_job_state(Buf buffer, uint16_t protocol_version) } /* make sure we have this job completed in the * database */ - if(IS_JOB_FINISHED(job_ptr)) { + if (IS_JOB_FINISHED(job_ptr)) { jobacct_storage_g_job_complete(acct_db_conn, job_ptr); job_finished = 1; } @@ -5622,7 +5622,7 @@ static int _list_find_job_old(void *job_entry, void *key) the slurmdbd lets put it on the list to be handled later when it comes back up since we won't get another chance. */ - if(with_slurmdbd && !job_ptr->db_index) + if (with_slurmdbd && !job_ptr->db_index) jobacct_storage_g_job_start(acct_db_conn, job_ptr); return 1; /* Purge the job */ } @@ -6095,7 +6095,7 @@ static void _pack_default_job_details(struct job_record *job_ptr, pack32((uint32_t) 0, buffer); } else { pack32(detail_ptr->min_cpus, buffer); - if(detail_ptr->max_cpus != NO_VAL) + if (detail_ptr->max_cpus != NO_VAL) pack32(detail_ptr->max_cpus, buffer); else pack32((uint32_t) 0, buffer); @@ -8035,7 +8035,7 @@ int update_job(job_desc_msg_t * job_specs, uid_t uid) error_code = ESLURM_DISABLED; else { char *conn_type_char = conn_type_string_full(conn_type); - if((conn_type[0] >= SELECT_SMALL) + if ((conn_type[0] >= SELECT_SMALL) && (detail_ptr->min_cpus >= cpus_per_mp)) { info("update_job: could not change " "conn_type to '%s' because cpu " @@ -8045,7 +8045,7 @@ int update_job(job_desc_msg_t * job_specs, uid_t uid) detail_ptr->min_cpus, job_ptr->job_id); error_code = ESLURM_INVALID_NODE_COUNT; - } else if(((conn_type[0] == SELECT_TORUS) + } else if (((conn_type[0] == SELECT_TORUS) || (conn_type[0] == SELECT_MESH)) && (detail_ptr->min_cpus < cpus_per_mp)) { info("update_job: could not change " @@ -8075,7 +8075,7 @@ int update_job(job_desc_msg_t * job_specs, uid_t uid) /* check to make sure we didn't mess up with the proc count */ select_g_select_jobinfo_get(job_ptr->select_jobinfo, SELECT_JOBDATA_CONN_TYPE, &conn_type); - if(detail_ptr && + if (detail_ptr && (((conn_type[0] >= SELECT_SMALL) && (detail_ptr->min_cpus >= cpus_per_mp)) || (((conn_type[0] == SELECT_TORUS)|| (conn_type[0] == SELECT_MESH)) @@ -8318,7 +8318,7 @@ extern void job_pre_resize_acctg(struct job_record *job_ptr) /* if we don't have a db_index go a start this one up since if running with the slurmDBD the job may not have started yet. */ - if(!job_ptr->db_index) + if (!job_ptr->db_index) jobacct_storage_g_job_start(acct_db_conn, job_ptr); job_ptr->job_state |= JOB_RESIZING; @@ -9816,13 +9816,13 @@ extern int job_hold_by_assoc_id(uint32_t assoc_id) job_ptr->assoc_ptr = ((slurmdb_association_rec_t *) job_ptr->assoc_ptr)->usage->parent_assoc_ptr; - if(job_ptr->assoc_ptr) + if (job_ptr->assoc_ptr) job_ptr->assoc_id = ((slurmdb_association_rec_t *) job_ptr->assoc_ptr)->id; } - if(IS_JOB_FINISHED(job_ptr)) + if (IS_JOB_FINISHED(job_ptr)) continue; info("Association deleted, holding job %u", @@ -9861,20 +9861,20 @@ extern int job_hold_by_qos_id(uint32_t qos_id) continue; /* move up to the parent that should still exist */ - if(job_ptr->qos_ptr) { + if (job_ptr->qos_ptr) { /* Force a start so the association doesn't get lost. Since there could be some delay in the start of the job when running with the slurmdbd. */ - if(!job_ptr->db_index) { + if (!job_ptr->db_index) { jobacct_storage_g_job_start(acct_db_conn, job_ptr); } job_ptr->qos_ptr = NULL; } - if(IS_JOB_FINISHED(job_ptr)) + if (IS_JOB_FINISHED(job_ptr)) continue; info("QOS deleted, holding job %u", job_ptr->job_id); @@ -9986,7 +9986,7 @@ extern int update_job_wckey(char *module, struct job_record *job_ptr, info("%s: invalid wckey %s for job_id %u", module, new_wckey, job_ptr->job_id); return ESLURM_INVALID_WCKEY; - } else if(association_based_accounting + } else if (association_based_accounting && !wckey_ptr && !(accounting_enforce & ACCOUNTING_ENFORCE_WCKEYS)) { /* if not enforcing associations we want to look for @@ -9996,7 +9996,7 @@ extern int update_job_wckey(char *module, struct job_record *job_ptr, wckey_rec.name = NULL; assoc_mgr_fill_in_wckey(acct_db_conn, &wckey_rec, accounting_enforce, &wckey_ptr); - if(!wckey_ptr) { + if (!wckey_ptr) { debug("%s: we didn't have a wckey record for wckey " "'%s' and user '%u', and we can't seem to find " "a default one either. Setting it anyway. " @@ -10263,11 +10263,11 @@ static int _checkpoint_job_record (struct job_record *job_ptr, char *image_dir) (void) unlink(new_file); else { /* file shuffle */ (void) unlink(old_file); - if(link(ckpt_file, old_file)) + if (link(ckpt_file, old_file)) debug4("unable to create link for %s -> %s: %m", ckpt_file, old_file); (void) unlink(ckpt_file); - if(link(new_file, ckpt_file)) + if (link(new_file, ckpt_file)) debug4("unable to create link for %s -> %s: %m", new_file, ckpt_file); (void) unlink(new_file); diff --git a/src/slurmctld/node_mgr.c b/src/slurmctld/node_mgr.c index cff7a4396d3..7b0f452ccd3 100644 --- a/src/slurmctld/node_mgr.c +++ b/src/slurmctld/node_mgr.c @@ -188,11 +188,11 @@ int dump_all_node_state ( void ) (void) unlink (new_file); else { /* file shuffle */ (void) unlink (old_file); - if(link(reg_file, old_file)) + if (link(reg_file, old_file)) debug4("unable to create link for %s -> %s: %m", reg_file, old_file); (void) unlink (reg_file); - if(link(new_file, reg_file)) + if (link(new_file, reg_file)) debug4("unable to create link for %s -> %s: %m", new_file, reg_file); (void) unlink (new_file); @@ -2869,7 +2869,7 @@ void make_node_idle(struct node_record *node_ptr, bitstr_t *node_bitmap = NULL; if (job_ptr) { /* Specific job completed */ - if(job_ptr->node_bitmap_cg) + if (job_ptr->node_bitmap_cg) node_bitmap = job_ptr->node_bitmap_cg; else node_bitmap = job_ptr->node_bitmap; @@ -2988,7 +2988,7 @@ extern int send_nodes_to_accounting(time_t event_time) /* send nodes not in not 'up' state */ node_ptr = node_record_table_ptr; for (i = 0; i < node_record_count; i++, node_ptr++) { - if(node_ptr->reason) + if (node_ptr->reason) reason = node_ptr->reason; else reason = "First Registration"; @@ -2998,14 +2998,14 @@ extern int send_nodes_to_accounting(time_t event_time) /* At this point, the node appears to be up, but on some systems we need to make sure there aren't some part of a node in an error state. */ - if(node_ptr->select_nodeinfo) { + if (node_ptr->select_nodeinfo) { uint16_t err_cpus = 0; select_g_select_nodeinfo_get( node_ptr->select_nodeinfo, SELECT_NODEDATA_SUBCNT, NODE_STATE_ERROR, &err_cpus); - if(err_cpus) { + if (err_cpus) { struct node_record send_node; struct config_record config_rec; int cpus_per_node = 1; @@ -3020,7 +3020,7 @@ extern int send_nodes_to_accounting(time_t event_time) SELECT_GET_NODE_SCALING, &node_scaling); - if(node_scaling) + if (node_scaling) cpus_per_node = node_ptr->cpus / node_scaling; err_cpus *= cpus_per_node; diff --git a/src/slurmctld/partition_mgr.c b/src/slurmctld/partition_mgr.c index f24362bb56d..4b39ec1d598 100644 --- a/src/slurmctld/partition_mgr.c +++ b/src/slurmctld/partition_mgr.c @@ -233,7 +233,7 @@ struct part_record *create_part_record(void) part_ptr->preempt_mode = default_part.preempt_mode; part_ptr->priority = default_part.priority; part_ptr->grace_time = default_part.grace_time; - if(part_max_priority) + if (part_max_priority) part_ptr->norm_priority = (double)default_part.priority / (double)part_max_priority; part_ptr->node_bitmap = NULL; @@ -498,7 +498,7 @@ int load_all_part_state(void) safe_unpackstr_xmalloc( &ver_str, &name_len, buffer); debug3("Version string in part_state header is %s", ver_str); - if(ver_str) { + if (ver_str) { if (!strcmp(ver_str, PART_STATE_VERSION)) { protocol_version = SLURM_PROTOCOL_VERSION; } @@ -1133,7 +1133,7 @@ extern int update_part (update_part_msg_t * part_desc, bool create_flag) * the normalized priorities of all the other * partitions. If not then just set this partition. */ - if(part_ptr->priority > part_max_priority) { + if (part_ptr->priority > part_max_priority) { ListIterator itr = list_iterator_create(part_list); struct part_record *part2 = NULL; diff --git a/src/slurmctld/proc_req.c b/src/slurmctld/proc_req.c index e26cd7efef3..4ab8c809b7e 100644 --- a/src/slurmctld/proc_req.c +++ b/src/slurmctld/proc_req.c @@ -1115,7 +1115,7 @@ static void _slurm_rpc_get_shares(slurm_msg_t *msg) response_msg.msg_type = RESPONSE_SHARE_INFO; response_msg.data = &resp_msg; slurm_send_node_msg(msg->conn_fd, &response_msg); - if(resp_msg.assoc_shares_list) + if (resp_msg.assoc_shares_list) list_destroy(resp_msg.assoc_shares_list); END_TIMER2("_slurm_rpc_get_share"); debug2("_slurm_rpc_get_shares %s", TIME_STR); @@ -1142,7 +1142,7 @@ static void _slurm_rpc_get_priority_factors(slurm_msg_t *msg) response_msg.msg_type = RESPONSE_PRIORITY_FACTORS; response_msg.data = &resp_msg; slurm_send_node_msg(msg->conn_fd, &response_msg); - if(resp_msg.priority_factors_list) + if (resp_msg.priority_factors_list) list_destroy(resp_msg.priority_factors_list); END_TIMER2("_slurm_rpc_get_priority_factors"); debug2("_slurm_rpc_get_priority_factors %s", TIME_STR); @@ -4231,7 +4231,7 @@ inline static void _slurm_rpc_accounting_update_msg(slurm_msg_t *msg) slurm_send_rc_msg(msg, EACCES); return; } - if(update_ptr->update_list && list_count(update_ptr->update_list)) + if (update_ptr->update_list && list_count(update_ptr->update_list)) rc = assoc_mgr_update(update_ptr->update_list); END_TIMER2("_slurm_rpc_accounting_update_msg"); diff --git a/src/slurmctld/step_mgr.c b/src/slurmctld/step_mgr.c index 756fdb59807..094780fe6ca 100644 --- a/src/slurmctld/step_mgr.c +++ b/src/slurmctld/step_mgr.c @@ -2304,7 +2304,7 @@ static void _pack_ctld_job_step_info(struct step_record *step_ptr, Buf buffer, if (step_ptr->job_ptr->total_cpus) cpu_cnt = step_ptr->job_ptr->total_cpus; - else if(step_ptr->job_ptr->details) + else if (step_ptr->job_ptr->details) cpu_cnt = step_ptr->job_ptr->details->min_cpus; else cpu_cnt = step_ptr->job_ptr->cpu_cnt; diff --git a/src/smap/configure_functions.c b/src/smap/configure_functions.c index 3ac4a2c7f0d..051a16f02bf 100644 --- a/src/smap/configure_functions.c +++ b/src/smap/configure_functions.c @@ -587,7 +587,7 @@ static int _create_allocation(char *com, List allocated_blocks) } } start_request: - if(!_full_request(request, NULL, allocated_blocks)) + if (!_full_request(request, NULL, allocated_blocks)) destroy_select_ba_request(request); } @@ -1133,7 +1133,7 @@ static int _add_bg_record(select_ba_request_t *blockreq, List allocated_blocks) memcpy(blockreq->start, best_start, sizeof(blockreq->start)); - if(!_full_request(blockreq, mark_bitmap, allocated_blocks)) + if (!_full_request(blockreq, mark_bitmap, allocated_blocks)) destroy_select_ba_request(blockreq); fini: FREE_NULL_BITMAP(mark_bitmap); diff --git a/src/smap/opts.c b/src/smap/opts.c index 9a7d87b39f6..9bde3b4e8ea 100644 --- a/src/smap/opts.c +++ b/src/smap/opts.c @@ -126,16 +126,16 @@ extern void parse_command_line(int argc, char *argv[]) * pset size. This number should be large enough. */ params.io_bit = bit_alloc(128); - if(bit_unfmt(params.io_bit, optarg) == -1) { + if (bit_unfmt(params.io_bit, optarg) == -1) { error("'%s' invalid entry for --ionodes", optarg); exit(1); } break; case 'M': - if(params.clusters) + if (params.clusters) list_destroy(params.clusters); - if(!(params.clusters = + if (!(params.clusters = slurmdb_get_info_cluster(optarg))) { error("'%s' can't be reached now, " "or it is an invalid entry for " diff --git a/src/sprio/opts.c b/src/sprio/opts.c index ea96ef138fb..6cd6928bf23 100644 --- a/src/sprio/opts.c +++ b/src/sprio/opts.c @@ -142,9 +142,9 @@ parse_command_line( int argc, char* argv[] ) params.long_list = true; break; case (int) 'M': - if(params.clusters) + if (params.clusters) list_destroy(params.clusters); - if(!(params.clusters = + if (!(params.clusters = slurmdb_get_info_cluster(optarg))) { error("'%s' can't be reached now, " "or it is an invalid entry for " diff --git a/src/squeue/print.c b/src/squeue/print.c index f76aee87897..ee2db7a99da 100644 --- a/src/squeue/print.c +++ b/src/squeue/print.c @@ -709,7 +709,7 @@ int _print_job_nodes(job_info_t * job, int width, bool right, char* suffix) { if (job == NULL) { /* Print the Header instead */ char *title = "NODELIST"; - if(params.cluster_flags & CLUSTER_FLAG_BG) + if (params.cluster_flags & CLUSTER_FLAG_BG) title = "MIDPLANELIST"; _print_str(title, width, right, false); } else { @@ -740,7 +740,7 @@ int _print_job_reason_list(job_info_t * job, int width, bool right, { if (job == NULL) { /* Print the Header instead */ char *title = "NODELIST(REASON)"; - if(params.cluster_flags & CLUSTER_FLAG_BG) + if (params.cluster_flags & CLUSTER_FLAG_BG) title = "MIDPLANELIST(REASON)"; _print_str(title, width, right, false); } else if (!IS_JOB_COMPLETING(job) @@ -761,7 +761,7 @@ int _print_job_reason_list(job_info_t * job, int width, bool right, select_g_select_jobinfo_get(job->select_jobinfo, SELECT_JOBDATA_IONODES, &ionodes); - if(ionodes) { + if (ionodes) { xstrfmtcat(nodes, "[%s]", ionodes); xfree(ionodes); _print_str(nodes, width, right, false); @@ -801,7 +801,7 @@ int _print_job_num_cpus(job_info_t * job, int width, bool right, char* suffix) if (job == NULL) /* Print the Header instead */ _print_str("CPUS", width, right, true); else { - if(params.cluster_flags & CLUSTER_FLAG_BG) + if (params.cluster_flags & CLUSTER_FLAG_BG) convert_num_unit((float)job->num_cpus, tmp_char, sizeof(tmp_char), UNIT_NONE); else @@ -823,7 +823,7 @@ int _print_job_num_nodes(job_info_t * job, int width, bool right_justify, if (job == NULL) /* Print the Header instead */ _print_str("NODES", width, right_justify, true); else { - if(params.cluster_flags & CLUSTER_FLAG_BG) + if (params.cluster_flags & CLUSTER_FLAG_BG) select_g_select_jobinfo_get(job->select_jobinfo, SELECT_JOBDATA_NODE_CNT, &node_cnt); @@ -831,7 +831,7 @@ int _print_job_num_nodes(job_info_t * job, int width, bool right_justify, if ((node_cnt == 0) || (node_cnt == NO_VAL)) node_cnt = _get_node_cnt(job); - if(params.cluster_flags & CLUSTER_FLAG_BG) + if (params.cluster_flags & CLUSTER_FLAG_BG) convert_num_unit((float)node_cnt, tmp_char, sizeof(tmp_char), UNIT_NONE); else @@ -1417,7 +1417,7 @@ int _print_step_nodes(job_step_info_t * step, int width, bool right, { if (step == NULL) { /* Print the Header instead */ char *title = "NODELIST"; - if(params.cluster_flags & CLUSTER_FLAG_BG) + if (params.cluster_flags & CLUSTER_FLAG_BG) title = "MIDPLANELIST"; _print_str(title, width, right, false); diff --git a/src/sreport/cluster_reports.c b/src/sreport/cluster_reports.c index 2f4a71358fe..179b253b26c 100644 --- a/src/sreport/cluster_reports.c +++ b/src/sreport/cluster_reports.c @@ -81,7 +81,7 @@ static int _set_wckey_cond(int *start, int argc, char *argv[], int local_cluster_flag = all_clusters_flag; time_t start_time, end_time; - if(!wckey_cond) { + if (!wckey_cond) { error("No wckey_cond given"); return -1; } @@ -89,12 +89,12 @@ static int _set_wckey_cond(int *start, int argc, char *argv[], wckey_cond->with_usage = 1; wckey_cond->with_deleted = 1; - if(!wckey_cond->cluster_list) + if (!wckey_cond->cluster_list) wckey_cond->cluster_list = list_create(slurm_destroy_char); for (i=(*start); i<argc; i++) { end = parse_option_end(argv[i]); - if(!end) + if (!end) command_len=strlen(argv[i]); else { command_len=end-1; @@ -103,28 +103,28 @@ static int _set_wckey_cond(int *start, int argc, char *argv[], } } - if(!end && !strncasecmp(argv[i], "all_clusters", + if (!end && !strncasecmp(argv[i], "all_clusters", MAX(command_len, 1))) { local_cluster_flag = 1; - } else if(!end && !strncasecmp(argv[i], "withdeleted", + } else if (!end && !strncasecmp(argv[i], "withdeleted", MAX(command_len, 5))) { wckey_cond->with_deleted = 1; set = 1; - } else if(!end + } else if (!end || !strncasecmp (argv[i], "WCKeys", MAX(command_len, 3))) { - if(!wckey_cond->name_list) + if (!wckey_cond->name_list) wckey_cond->name_list = list_create(slurm_destroy_char); - if(slurm_addto_char_list(wckey_cond->name_list, + if (slurm_addto_char_list(wckey_cond->name_list, argv[i]+end)) set = 1; } else if (!strncasecmp (argv[i], "Clusters", MAX(command_len, 3))) { - if(!wckey_cond->cluster_list) + if (!wckey_cond->cluster_list) wckey_cond->cluster_list = list_create(slurm_destroy_char); - if(slurm_addto_char_list(wckey_cond->cluster_list, + if (slurm_addto_char_list(wckey_cond->cluster_list, argv[i]+end)) set = 1; } else if (!strncasecmp (argv[i], "End", MAX(command_len, 1))) { @@ -132,7 +132,7 @@ static int _set_wckey_cond(int *start, int argc, char *argv[], set = 1; } else if (!strncasecmp (argv[i], "Format", MAX(command_len, 1))) { - if(format_list) + if (format_list) slurm_addto_char_list(format_list, argv[i]+end); } else if (!strncasecmp (argv[i], "Start", MAX(command_len, 1))) { @@ -140,10 +140,10 @@ static int _set_wckey_cond(int *start, int argc, char *argv[], set = 1; } else if (!strncasecmp (argv[i], "User", MAX(command_len, 1))) { - if(!wckey_cond->user_list) + if (!wckey_cond->user_list) wckey_cond->user_list = list_create(slurm_destroy_char); - if(slurm_addto_char_list(wckey_cond->user_list, + if (slurm_addto_char_list(wckey_cond->user_list, argv[i]+end)) set = 1; } else { @@ -154,9 +154,9 @@ static int _set_wckey_cond(int *start, int argc, char *argv[], (*start) = i; - if(!local_cluster_flag && !list_count(wckey_cond->cluster_list)) { + if (!local_cluster_flag && !list_count(wckey_cond->cluster_list)) { char *temp = slurm_get_cluster_name(); - if(temp) + if (temp) list_append(wckey_cond->cluster_list, temp); } @@ -184,7 +184,7 @@ static int _set_assoc_cond(int *start, int argc, char *argv[], time_t start_time, end_time; int command_len = 0; - if(!assoc_cond) { + if (!assoc_cond) { error("We need an slurmdb_association_cond to call this"); return SLURM_ERROR; } @@ -192,11 +192,11 @@ static int _set_assoc_cond(int *start, int argc, char *argv[], assoc_cond->with_usage = 1; assoc_cond->with_deleted = 1; - if(!assoc_cond->cluster_list) + if (!assoc_cond->cluster_list) assoc_cond->cluster_list = list_create(slurm_destroy_char); for (i=(*start); i<argc; i++) { end = parse_option_end(argv[i]); - if(!end) + if (!end) command_len=strlen(argv[i]); else { command_len=end-1; @@ -205,16 +205,16 @@ static int _set_assoc_cond(int *start, int argc, char *argv[], } } - if(!end && !strncasecmp(argv[i], "all_clusters", + if (!end && !strncasecmp(argv[i], "all_clusters", MAX(command_len, 1))) { local_cluster_flag = 1; } else if (!end && !strncasecmp (argv[i], "Tree", MAX(command_len, 4))) { tree_display = 1; - } else if(!end + } else if (!end || !strncasecmp (argv[i], "Users", MAX(command_len, 1))) { - if(!assoc_cond->user_list) + if (!assoc_cond->user_list) assoc_cond->user_list = list_create(slurm_destroy_char); slurm_addto_char_list(assoc_cond->user_list, @@ -224,7 +224,7 @@ static int _set_assoc_cond(int *start, int argc, char *argv[], MAX(command_len, 2)) || !strncasecmp(argv[i], "Acct", MAX(command_len, 4))) { - if(!assoc_cond->acct_list) + if (!assoc_cond->acct_list) assoc_cond->acct_list = list_create(slurm_destroy_char); slurm_addto_char_list(assoc_cond->acct_list, @@ -240,7 +240,7 @@ static int _set_assoc_cond(int *start, int argc, char *argv[], set = 1; } else if (!strncasecmp (argv[i], "Format", MAX(command_len, 1))) { - if(format_list) + if (format_list) slurm_addto_char_list(format_list, argv[i]+end); } else if (!strncasecmp (argv[i], "Start", @@ -255,9 +255,9 @@ static int _set_assoc_cond(int *start, int argc, char *argv[], } (*start) = i; - if(!local_cluster_flag && !list_count(assoc_cond->cluster_list)) { + if (!local_cluster_flag && !list_count(assoc_cond->cluster_list)) { char *temp = slurm_get_cluster_name(); - if(temp) + if (temp) list_append(assoc_cond->cluster_list, temp); } @@ -285,7 +285,7 @@ static int _set_cluster_cond(int *start, int argc, char *argv[], time_t start_time, end_time; int command_len = 0; - if(!cluster_cond) { + if (!cluster_cond) { error("We need an slurmdb_cluster_cond to call this"); return SLURM_ERROR; } @@ -293,11 +293,11 @@ static int _set_cluster_cond(int *start, int argc, char *argv[], cluster_cond->with_deleted = 1; cluster_cond->with_usage = 1; - if(!cluster_cond->cluster_list) + if (!cluster_cond->cluster_list) cluster_cond->cluster_list = list_create(slurm_destroy_char); for (i=(*start); i<argc; i++) { end = parse_option_end(argv[i]); - if(!end) + if (!end) command_len=strlen(argv[i]); else { command_len=end-1; @@ -306,10 +306,10 @@ static int _set_cluster_cond(int *start, int argc, char *argv[], } } - if(!end && !strncasecmp(argv[i], "all_clusters", + if (!end && !strncasecmp(argv[i], "all_clusters", MAX(command_len, 1))) { local_cluster_flag = 1; - } else if(!end + } else if (!end || !strncasecmp (argv[i], "Clusters", MAX(command_len, 1))) { slurm_addto_char_list(cluster_cond->cluster_list, @@ -320,7 +320,7 @@ static int _set_cluster_cond(int *start, int argc, char *argv[], set = 1; } else if (!strncasecmp (argv[i], "Format", MAX(command_len, 1))) { - if(format_list) + if (format_list) slurm_addto_char_list(format_list, argv[i]+end); } else if (!strncasecmp (argv[i], "Start", @@ -335,9 +335,9 @@ static int _set_cluster_cond(int *start, int argc, char *argv[], } (*start) = i; - if(!local_cluster_flag && !list_count(cluster_cond->cluster_list)) { + if (!local_cluster_flag && !list_count(cluster_cond->cluster_list)) { char *temp = slurm_get_cluster_name(); - if(temp) + if (temp) list_append(cluster_cond->cluster_list, temp); } @@ -360,14 +360,14 @@ static int _setup_print_fields_list(List format_list) print_field_t *field = NULL; char *object = NULL; - if(!format_list || !list_count(format_list)) { + if (!format_list || !list_count(format_list)) { exit_code=1; fprintf(stderr, " we need a format list " "to set up the print.\n"); return SLURM_ERROR; } - if(!print_fields_list) + if (!print_fields_list) print_fields_list = list_create(destroy_print_field); itr = list_iterator_create(format_list); @@ -376,7 +376,7 @@ static int _setup_print_fields_list(List format_list) int command_len = 0; int newlen = 0; - if((tmp_char = strstr(object, "\%"))) { + if ((tmp_char = strstr(object, "\%"))) { newlen = atoi(tmp_char+1); tmp_char[0] = '\0'; } @@ -384,125 +384,125 @@ static int _setup_print_fields_list(List format_list) command_len = strlen(object); field = xmalloc(sizeof(print_field_t)); - if(!strncasecmp("Accounts", object, MAX(command_len, 2))) { + if (!strncasecmp("Accounts", object, MAX(command_len, 2))) { field->type = PRINT_CLUSTER_ACCT; field->name = xstrdup("Account"); - if(tree_display) + if (tree_display) field->len = -20; else field->len = 15; field->print_routine = print_fields_str; - } else if(!strncasecmp("allocated", object, + } else if (!strncasecmp("allocated", object, MAX(command_len, 2))) { field->type = PRINT_CLUSTER_ACPU; field->name = xstrdup("Allocated"); - if(time_format == SLURMDB_REPORT_TIME_SECS_PER + if (time_format == SLURMDB_REPORT_TIME_SECS_PER || time_format == SLURMDB_REPORT_TIME_MINS_PER || time_format == SLURMDB_REPORT_TIME_HOURS_PER) field->len = 20; else field->len = 12; field->print_routine = slurmdb_report_print_time; - } else if(!strncasecmp("Cluster", object, + } else if (!strncasecmp("Cluster", object, MAX(command_len, 2))) { field->type = PRINT_CLUSTER_NAME; field->name = xstrdup("Cluster"); field->len = 9; field->print_routine = print_fields_str; - } else if(!strncasecmp("cpucount", object, + } else if (!strncasecmp("cpucount", object, MAX(command_len, 2))) { field->type = PRINT_CLUSTER_CPUS; field->name = xstrdup("CPU count"); field->len = 9; field->print_routine = print_fields_uint; - } else if(!strncasecmp("down", object, MAX(command_len, 1))) { + } else if (!strncasecmp("down", object, MAX(command_len, 1))) { field->type = PRINT_CLUSTER_DCPU; field->name = xstrdup("Down"); - if(time_format == SLURMDB_REPORT_TIME_SECS_PER + if (time_format == SLURMDB_REPORT_TIME_SECS_PER || time_format == SLURMDB_REPORT_TIME_MINS_PER || time_format == SLURMDB_REPORT_TIME_HOURS_PER) field->len = 18; else field->len = 10; field->print_routine = slurmdb_report_print_time; - } else if(!strncasecmp("idle", object, MAX(command_len, 1))) { + } else if (!strncasecmp("idle", object, MAX(command_len, 1))) { field->type = PRINT_CLUSTER_ICPU; field->name = xstrdup("Idle"); - if(time_format == SLURMDB_REPORT_TIME_SECS_PER + if (time_format == SLURMDB_REPORT_TIME_SECS_PER || time_format == SLURMDB_REPORT_TIME_MINS_PER || time_format == SLURMDB_REPORT_TIME_HOURS_PER) field->len = 20; else field->len = 12; field->print_routine = slurmdb_report_print_time; - } else if(!strncasecmp("Login", object, MAX(command_len, 1))) { + } else if (!strncasecmp("Login", object, MAX(command_len, 1))) { field->type = PRINT_CLUSTER_USER_LOGIN; field->name = xstrdup("Login"); field->len = 9; field->print_routine = print_fields_str; - } else if(!strncasecmp("overcommited", object, + } else if (!strncasecmp("overcommited", object, MAX(command_len, 1))) { field->type = PRINT_CLUSTER_OCPU; field->name = xstrdup("Over Comm"); - if(time_format == SLURMDB_REPORT_TIME_SECS_PER + if (time_format == SLURMDB_REPORT_TIME_SECS_PER || time_format == SLURMDB_REPORT_TIME_MINS_PER || time_format == SLURMDB_REPORT_TIME_HOURS_PER) field->len = 18; else field->len = 9; field->print_routine = slurmdb_report_print_time; - } else if(!strncasecmp("PlannedDown", object, + } else if (!strncasecmp("PlannedDown", object, MAX(command_len, 2))) { field->type = PRINT_CLUSTER_PDCPU; field->name = xstrdup("PLND Down"); - if(time_format == SLURMDB_REPORT_TIME_SECS_PER + if (time_format == SLURMDB_REPORT_TIME_SECS_PER || time_format == SLURMDB_REPORT_TIME_MINS_PER || time_format == SLURMDB_REPORT_TIME_HOURS_PER) field->len = 18; else field->len = 10; field->print_routine = slurmdb_report_print_time; - } else if(!strncasecmp("Proper", object, MAX(command_len, 2))) { + } else if (!strncasecmp("Proper", object, MAX(command_len, 2))) { field->type = PRINT_CLUSTER_USER_PROPER; field->name = xstrdup("Proper Name"); field->len = 15; field->print_routine = print_fields_str; - } else if(!strncasecmp("reported", object, + } else if (!strncasecmp("reported", object, MAX(command_len, 3))) { field->type = PRINT_CLUSTER_TOTAL; field->name = xstrdup("Reported"); - if(time_format == SLURMDB_REPORT_TIME_SECS_PER + if (time_format == SLURMDB_REPORT_TIME_SECS_PER || time_format == SLURMDB_REPORT_TIME_MINS_PER || time_format == SLURMDB_REPORT_TIME_HOURS_PER) field->len = 20; else field->len = 12; field->print_routine = slurmdb_report_print_time; - } else if(!strncasecmp("reserved", object, + } else if (!strncasecmp("reserved", object, MAX(command_len, 3))) { field->type = PRINT_CLUSTER_RCPU; field->name = xstrdup("Reserved"); - if(time_format == SLURMDB_REPORT_TIME_SECS_PER + if (time_format == SLURMDB_REPORT_TIME_SECS_PER || time_format == SLURMDB_REPORT_TIME_MINS_PER || time_format == SLURMDB_REPORT_TIME_HOURS_PER) field->len = 18; else field->len = 9; field->print_routine = slurmdb_report_print_time; - } else if(!strncasecmp("Used", object, MAX(command_len, 1))) { + } else if (!strncasecmp("Used", object, MAX(command_len, 1))) { field->type = PRINT_CLUSTER_AMOUNT_USED; field->name = xstrdup("Used"); - if(time_format == SLURMDB_REPORT_TIME_SECS_PER + if (time_format == SLURMDB_REPORT_TIME_SECS_PER || time_format == SLURMDB_REPORT_TIME_MINS_PER || time_format == SLURMDB_REPORT_TIME_HOURS_PER) field->len = 18; else field->len = 10; field->print_routine = slurmdb_report_print_time; - } else if(!strncasecmp("WCKey", object, MAX(command_len, 2))) { + } else if (!strncasecmp("WCKey", object, MAX(command_len, 2))) { field->type = PRINT_CLUSTER_WCKEY; field->name = xstrdup("WCKey"); - if(tree_display) + if (tree_display) field->len = 20; else field->len = 15; @@ -514,7 +514,7 @@ static int _setup_print_fields_list(List format_list) continue; } - if(newlen) + if (newlen) field->len = newlen; list_append(print_fields_list, field); @@ -539,13 +539,13 @@ static List _get_cluster_list(int argc, char *argv[], uint32_t *total_time, _set_cluster_cond(&i, argc, argv, cluster_cond, format_list); cluster_list = slurmdb_clusters_get(db_conn, cluster_cond); - if(!cluster_list) { + if (!cluster_list) { exit_code=1; fprintf(stderr, " Problem with cluster query.\n"); return NULL; } - if(print_fields_have_header) { + if (print_fields_have_header) { char start_char[20]; char end_char[20]; time_t my_start = cluster_cond->usage_start; @@ -606,20 +606,20 @@ extern int cluster_account_by_user(int argc, char *argv[]) _set_assoc_cond(&i, argc, argv, assoc_cond, format_list); - if(!list_count(format_list)) + if (!list_count(format_list)) slurm_addto_char_list(format_list, "Cluster,Ac,Login,Proper,Used"); _setup_print_fields_list(format_list); list_destroy(format_list); - if(!(slurmdb_report_cluster_list = + if (!(slurmdb_report_cluster_list = slurmdb_report_cluster_account_by_user(db_conn, assoc_cond))) { exit_code = 1; goto end_it; } - if(print_fields_have_header) { + if (print_fields_have_header) { char start_char[20]; char end_char[20]; time_t my_start = assoc_cond->usage_start; @@ -656,7 +656,7 @@ extern int cluster_account_by_user(int argc, char *argv[]) while((slurmdb_report_cluster = list_next(cluster_itr))) { //list_sort(slurmdb_report_cluster->assoc_list, // (ListCmpF)sort_assoc_dec); - if(tree_list) + if (tree_list) list_flush(tree_list); else tree_list = list_create(slurmdb_destroy_print_tree); @@ -664,17 +664,17 @@ extern int cluster_account_by_user(int argc, char *argv[]) itr = list_iterator_create(slurmdb_report_cluster->assoc_list); while((slurmdb_report_assoc = list_next(itr))) { int curr_inx = 1; - if(!slurmdb_report_assoc->cpu_secs) + if (!slurmdb_report_assoc->cpu_secs) continue; while((field = list_next(itr2))) { char *tmp_char = NULL; struct passwd *pwd = NULL; switch(field->type) { case PRINT_CLUSTER_ACCT: - if(tree_display) { + if (tree_display) { char *local_acct = NULL; char *parent_acct = NULL; - if(slurmdb_report_assoc->user) { + if (slurmdb_report_assoc->user) { local_acct = xstrdup_printf( "|%s", @@ -716,14 +716,14 @@ extern int cluster_account_by_user(int argc, char *argv[]) (curr_inx == field_count)); break; case PRINT_CLUSTER_USER_PROPER: - if(slurmdb_report_assoc->user) + if (slurmdb_report_assoc->user) pwd = getpwnam( slurmdb_report_assoc->user); - if(pwd) { + if (pwd) { tmp_char = strtok(pwd->pw_gecos, ","); - if(!tmp_char) + if (!tmp_char) tmp_char = pwd->pw_gecos; } @@ -756,12 +756,12 @@ extern int cluster_account_by_user(int argc, char *argv[]) end_it: slurmdb_destroy_association_cond(assoc_cond); - if(slurmdb_report_cluster_list) { + if (slurmdb_report_cluster_list) { list_destroy(slurmdb_report_cluster_list); slurmdb_report_cluster_list = NULL; } - if(print_fields_list) { + if (print_fields_list) { list_destroy(print_fields_list); print_fields_list = NULL; } @@ -792,20 +792,20 @@ extern int cluster_user_by_account(int argc, char *argv[]) _set_assoc_cond(&i, argc, argv, assoc_cond, format_list); - if(!list_count(format_list)) + if (!list_count(format_list)) slurm_addto_char_list(format_list, "Cluster,Login,Proper,Ac,Used"); _setup_print_fields_list(format_list); list_destroy(format_list); - if(!(slurmdb_report_cluster_list = + if (!(slurmdb_report_cluster_list = slurmdb_report_cluster_user_by_account(db_conn, assoc_cond))) { exit_code = 1; goto end_it; } - if(print_fields_have_header) { + if (print_fields_have_header) { char start_char[20]; char end_char[20]; time_t my_start = assoc_cond->usage_start; @@ -846,7 +846,7 @@ extern int cluster_user_by_account(int argc, char *argv[]) int curr_inx = 1; /* we don't care if they didn't use any time */ - if(!slurmdb_report_user->cpu_secs) + if (!slurmdb_report_user->cpu_secs) continue; while((field = list_next(itr2))) { @@ -873,11 +873,11 @@ extern int cluster_user_by_account(int argc, char *argv[]) break; case PRINT_CLUSTER_USER_PROPER: pwd = getpwnam(slurmdb_report_user->name); - if(pwd) { + if (pwd) { tmp_char = strtok(pwd->pw_gecos, ","); - if(!tmp_char) + if (!tmp_char) tmp_char = pwd->pw_gecos; } @@ -910,12 +910,12 @@ extern int cluster_user_by_account(int argc, char *argv[]) end_it: slurmdb_destroy_association_cond(assoc_cond); - if(slurmdb_report_cluster_list) { + if (slurmdb_report_cluster_list) { list_destroy(slurmdb_report_cluster_list); slurmdb_report_cluster_list = NULL; } - if(print_fields_list) { + if (print_fields_list) { list_destroy(print_fields_list); print_fields_list = NULL; } @@ -946,20 +946,20 @@ extern int cluster_user_by_wckey(int argc, char *argv[]) _set_wckey_cond(&i, argc, argv, wckey_cond, format_list); - if(!list_count(format_list)) + if (!list_count(format_list)) slurm_addto_char_list(format_list, "Cluster,Login,Proper,WCkey,Used"); _setup_print_fields_list(format_list); list_destroy(format_list); - if(!(slurmdb_report_cluster_list = + if (!(slurmdb_report_cluster_list = slurmdb_report_cluster_user_by_wckey(db_conn, wckey_cond))) { exit_code = 1; goto end_it; } - if(print_fields_have_header) { + if (print_fields_have_header) { char start_char[20]; char end_char[20]; time_t my_start = wckey_cond->usage_start; @@ -1000,7 +1000,7 @@ extern int cluster_user_by_wckey(int argc, char *argv[]) int curr_inx = 1; /* we don't care if they didn't use any time */ - if(!slurmdb_report_user->cpu_secs) + if (!slurmdb_report_user->cpu_secs) continue; while((field = list_next(itr2))) { @@ -1027,11 +1027,11 @@ extern int cluster_user_by_wckey(int argc, char *argv[]) break; case PRINT_CLUSTER_USER_PROPER: pwd = getpwnam(slurmdb_report_user->name); - if(pwd) { + if (pwd) { tmp_char = strtok(pwd->pw_gecos, ","); - if(!tmp_char) + if (!tmp_char) tmp_char = pwd->pw_gecos; } @@ -1064,12 +1064,12 @@ extern int cluster_user_by_wckey(int argc, char *argv[]) end_it: slurmdb_destroy_wckey_cond(wckey_cond); - if(slurmdb_report_cluster_list) { + if (slurmdb_report_cluster_list) { list_destroy(slurmdb_report_cluster_list); slurmdb_report_cluster_list = NULL; } - if(print_fields_list) { + if (print_fields_list) { list_destroy(print_fields_list); print_fields_list = NULL; } @@ -1096,12 +1096,12 @@ extern int cluster_utilization(int argc, char *argv[]) print_fields_list = list_create(destroy_print_field); - if(!(cluster_list = _get_cluster_list(argc, argv, &total_time, + if (!(cluster_list = _get_cluster_list(argc, argv, &total_time, "Cluster Utilization", format_list))) goto end_it; - if(!list_count(format_list)) + if (!list_count(format_list)) slurm_addto_char_list(format_list, "Cl,al,d,planned,i,res,rep"); _setup_print_fields_list(format_list); @@ -1121,7 +1121,7 @@ extern int cluster_utilization(int argc, char *argv[]) uint64_t local_total_time = 0; int curr_inx = 1; - if(!cluster->accounting_list + if (!cluster->accounting_list || !list_count(cluster->accounting_list)) continue; @@ -1227,12 +1227,12 @@ extern int cluster_utilization(int argc, char *argv[]) list_iterator_destroy(itr); end_it: - if(cluster_list) { + if (cluster_list) { list_destroy(cluster_list); cluster_list = NULL; } - if(print_fields_list) { + if (print_fields_list) { list_destroy(print_fields_list); print_fields_list = NULL; } @@ -1264,20 +1264,20 @@ extern int cluster_wckey_by_user(int argc, char *argv[]) _set_wckey_cond(&i, argc, argv, wckey_cond, format_list); - if(!list_count(format_list)) + if (!list_count(format_list)) slurm_addto_char_list(format_list, "Cluster,WCKey,Login,Proper,Used"); _setup_print_fields_list(format_list); list_destroy(format_list); - if(!(slurmdb_report_cluster_list = + if (!(slurmdb_report_cluster_list = slurmdb_report_cluster_wckey_by_user(db_conn, wckey_cond))) { exit_code = 1; goto end_it; } - if(print_fields_have_header) { + if (print_fields_have_header) { char start_char[20]; char end_char[20]; time_t my_start = wckey_cond->usage_start; @@ -1314,7 +1314,7 @@ extern int cluster_wckey_by_user(int argc, char *argv[]) while((slurmdb_report_cluster = list_next(cluster_itr))) { //list_sort(slurmdb_report_cluster->wckey_list, // (ListCmpF)sort_wckey_dec); - if(tree_list) + if (tree_list) list_flush(tree_list); else tree_list = list_create(slurmdb_destroy_print_tree); @@ -1322,7 +1322,7 @@ extern int cluster_wckey_by_user(int argc, char *argv[]) itr = list_iterator_create(slurmdb_report_cluster->assoc_list); while((slurmdb_report_assoc = list_next(itr))) { int curr_inx = 1; - if(!slurmdb_report_assoc->cpu_secs) + if (!slurmdb_report_assoc->cpu_secs) continue; while((field = list_next(itr2))) { char *tmp_char = NULL; @@ -1348,14 +1348,14 @@ extern int cluster_wckey_by_user(int argc, char *argv[]) (curr_inx == field_count)); break; case PRINT_CLUSTER_USER_PROPER: - if(slurmdb_report_assoc->user) + if (slurmdb_report_assoc->user) pwd = getpwnam( slurmdb_report_assoc->user); - if(pwd) { + if (pwd) { tmp_char = strtok(pwd->pw_gecos, ","); - if(!tmp_char) + if (!tmp_char) tmp_char = pwd->pw_gecos; } @@ -1388,12 +1388,12 @@ extern int cluster_wckey_by_user(int argc, char *argv[]) end_it: slurmdb_destroy_wckey_cond(wckey_cond); - if(slurmdb_report_cluster_list) { + if (slurmdb_report_cluster_list) { list_destroy(slurmdb_report_cluster_list); slurmdb_report_cluster_list = NULL; } - if(print_fields_list) { + if (print_fields_list) { list_destroy(print_fields_list); print_fields_list = NULL; } diff --git a/src/sreport/common.c b/src/sreport/common.c index cc9eaef1a29..e798d30b605 100644 --- a/src/sreport/common.c +++ b/src/sreport/common.c @@ -45,16 +45,16 @@ extern void slurmdb_report_print_time(print_field_t *field, uint64_t value, { int abs_len = abs(field->len); - if(!total_time) + if (!total_time) total_time = 1; /* (value == unset) || (value == cleared) */ - if((value == NO_VAL) || (value == INFINITE)) { - if(print_fields_parsable_print + if ((value == NO_VAL) || (value == INFINITE)) { + if (print_fields_parsable_print == PRINT_FIELDS_PARSABLE_NO_ENDING && last) ; - else if(print_fields_parsable_print) + else if (print_fields_parsable_print) printf("|"); else printf("%-*s ", abs_len, " "); @@ -106,13 +106,13 @@ extern void slurmdb_report_print_time(print_field_t *field, uint64_t value, break; } - if(print_fields_parsable_print + if (print_fields_parsable_print == PRINT_FIELDS_PARSABLE_NO_ENDING && last) printf("%s", output); - else if(print_fields_parsable_print) + else if (print_fields_parsable_print) printf("%s|", output); - else if(field->len == abs_len) + else if (field->len == abs_len) printf("%*.*s ", abs_len, abs_len, output); else printf("%-*.*s ", abs_len, abs_len, output); @@ -125,12 +125,12 @@ extern int parse_option_end(char *option) { int end = 0; - if(!option) + if (!option) return 0; while(option[end] && option[end] != '=') end++; - if(!option[end]) + if (!option[end]) return 0; end++; return end; @@ -143,7 +143,7 @@ extern char *strip_quotes(char *option, int *increased) int i=0, start=0; char *meat = NULL; - if(!option) + if (!option) return NULL; /* first strip off the ("|')'s */ @@ -152,7 +152,7 @@ extern char *strip_quotes(char *option, int *increased) start = i; while(option[i]) { - if(option[i] == '\"' || option[i] == '\'') { + if (option[i] == '\"' || option[i] == '\'') { end++; break; } @@ -163,7 +163,7 @@ extern char *strip_quotes(char *option, int *increased) meat = xmalloc((i-start)+1); memcpy(meat, option+start, (i-start)); - if(increased) + if (increased) (*increased) += end; return meat; @@ -175,30 +175,30 @@ extern void addto_char_list(List char_list, char *names) char *name = NULL, *tmp_char = NULL; ListIterator itr = NULL; - if(!char_list) { + if (!char_list) { error("No list was given to fill in"); return; } itr = list_iterator_create(char_list); - if(names) { + if (names) { if (names[i] == '\"' || names[i] == '\'') i++; start = i; while(names[i]) { - if(names[i] == '\"' || names[i] == '\'') + if (names[i] == '\"' || names[i] == '\'') break; - else if(names[i] == ',') { - if((i-start) > 0) { + else if (names[i] == ',') { + if ((i-start) > 0) { name = xmalloc((i-start+1)); memcpy(name, names+start, (i-start)); while((tmp_char = list_next(itr))) { - if(!strcasecmp(tmp_char, name)) + if (!strcasecmp(tmp_char, name)) break; } - if(!tmp_char) + if (!tmp_char) list_append(char_list, name); else xfree(name); @@ -209,15 +209,15 @@ extern void addto_char_list(List char_list, char *names) } i++; } - if((i-start) > 0) { + if ((i-start) > 0) { name = xmalloc((i-start)+1); memcpy(name, names+start, (i-start)); while((tmp_char = list_next(itr))) { - if(!strcasecmp(tmp_char, name)) + if (!strcasecmp(tmp_char, name)) break; } - if(!tmp_char) + if (!tmp_char) list_append(char_list, name); else xfree(name); @@ -237,14 +237,14 @@ extern int sort_user_dec(slurmdb_report_user_rec_t *user_a, { int diff = 0; - if(sort_flag == SLURMDB_REPORT_SORT_TIME) { + if (sort_flag == SLURMDB_REPORT_SORT_TIME) { if (user_a->cpu_secs > user_b->cpu_secs) return -1; else if (user_a->cpu_secs < user_b->cpu_secs) return 1; } - if(!user_a->name || !user_b->name) + if (!user_a->name || !user_b->name) return 0; diff = strcmp(user_a->name, user_b->name); @@ -270,7 +270,7 @@ extern int sort_cluster_dec(slurmdb_report_cluster_rec_t *cluster_a, { int diff = 0; - if(!cluster_a->name || !cluster_b->name) + if (!cluster_a->name || !cluster_b->name) return 0; diff = strcmp(cluster_a->name, cluster_b->name); @@ -298,7 +298,7 @@ extern int sort_assoc_dec(slurmdb_report_assoc_rec_t *assoc_a, { int diff = 0; - if(!assoc_a->acct || !assoc_b->acct) + if (!assoc_a->acct || !assoc_b->acct) return 0; diff = strcmp(assoc_a->acct, assoc_b->acct); @@ -308,9 +308,9 @@ extern int sort_assoc_dec(slurmdb_report_assoc_rec_t *assoc_a, else if (diff < 0) return -1; - if(!assoc_a->user && assoc_b->user) + if (!assoc_a->user && assoc_b->user) return 1; - else if(!assoc_b->user) + else if (!assoc_b->user) return -1; diff = strcmp(assoc_a->user, assoc_b->user); @@ -335,7 +335,7 @@ extern int sort_reservations_dec(slurmdb_reservation_rec_t *resv_a, { int diff = 0; - if(!resv_a->cluster || !resv_b->cluster) + if (!resv_a->cluster || !resv_b->cluster) return 0; diff = strcmp(resv_a->cluster, resv_b->cluster); @@ -345,7 +345,7 @@ extern int sort_reservations_dec(slurmdb_reservation_rec_t *resv_a, else if (diff < 0) return -1; - if(!resv_a->name || !resv_b->name) + if (!resv_a->name || !resv_b->name) return 0; diff = strcmp(resv_a->name, resv_b->name); @@ -355,9 +355,9 @@ extern int sort_reservations_dec(slurmdb_reservation_rec_t *resv_a, else if (diff < 0) return -1; - if(resv_a->time_start < resv_b->time_start) + if (resv_a->time_start < resv_b->time_start) return 1; - else if(resv_a->time_start > resv_b->time_start) + else if (resv_a->time_start > resv_b->time_start) return -1; return 0; @@ -368,7 +368,7 @@ extern int get_uint(char *in_value, uint32_t *out_value, char *type) char *ptr = NULL, *meat = NULL; long num; - if(!(meat = strip_quotes(in_value, NULL))) { + if (!(meat = strip_quotes(in_value, NULL))) { error("Problem with strip_quotes"); return SLURM_ERROR; } diff --git a/src/sreport/job_reports.c b/src/sreport/job_reports.c index c632469531c..ead16cd96b4 100644 --- a/src/sreport/job_reports.c +++ b/src/sreport/job_reports.c @@ -73,7 +73,7 @@ static int _sort_cluster_grouping_dec( { int diff = 0; - if(!cluster_a->cluster || !cluster_b->cluster) + if (!cluster_a->cluster || !cluster_b->cluster) return 0; diff = strcmp(cluster_a->cluster, cluster_b->cluster); @@ -103,7 +103,7 @@ static int _sort_acct_grouping_dec(slurmdb_report_acct_grouping_t *acct_a, char tmp_acct_b[200]; char *wckey_a = NULL, *wckey_b = NULL; - if(!acct_a->acct || !acct_b->acct) + if (!acct_a->acct || !acct_b->acct) return 0; snprintf(tmp_acct_a, sizeof(tmp_acct_a), "%s", acct_a->acct); @@ -121,7 +121,7 @@ static int _sort_acct_grouping_dec(slurmdb_report_acct_grouping_t *acct_a, else if (diff < 0) return -1; - if(!wckey_a || !wckey_b) + if (!wckey_a || !wckey_b) return 0; diff = strcmp(wckey_a, wckey_b); @@ -157,13 +157,13 @@ static int _addto_uid_char_list(List char_list, char *names) int quote = 0; int count = 0; - if(!char_list) { + if (!char_list) { error("No list was given to fill in"); return 0; } itr = list_iterator_create(char_list); - if(names) { + if (names) { if (names[i] == '\"' || names[i] == '\'') { quote_c = names[i]; quote = 1; @@ -172,23 +172,23 @@ static int _addto_uid_char_list(List char_list, char *names) start = i; while(names[i]) { //info("got %d - %d = %d", i, start, i-start); - if(quote && names[i] == quote_c) + if (quote && names[i] == quote_c) break; else if (names[i] == '\"' || names[i] == '\'') names[i] = '`'; - else if(names[i] == ',') { - if((i-start) > 0) { + else if (names[i] == ',') { + if ((i-start) > 0) { name = xmalloc((i-start+1)); memcpy(name, names+start, (i-start)); //info("got %s %d", name, i-start); name = _string_to_uid( name ); while((tmp_char = list_next(itr))) { - if(!strcasecmp(tmp_char, name)) + if (!strcasecmp(tmp_char, name)) break; } - if(!tmp_char) { + if (!tmp_char) { list_append(char_list, name); count++; } else @@ -197,7 +197,7 @@ static int _addto_uid_char_list(List char_list, char *names) } i++; start = i; - if(!names[i]) { + if (!names[i]) { info("There is a problem with " "your request. It appears you " "have spaces inside your list."); @@ -206,17 +206,17 @@ static int _addto_uid_char_list(List char_list, char *names) } i++; } - if((i-start) > 0) { + if ((i-start) > 0) { name = xmalloc((i-start)+1); memcpy(name, names+start, (i-start)); name = _string_to_uid( name ); while((tmp_char = list_next(itr))) { - if(!strcasecmp(tmp_char, name)) + if (!strcasecmp(tmp_char, name)) break; } - if(!tmp_char) { + if (!tmp_char) { list_append(char_list, name); count++; } else @@ -238,21 +238,21 @@ static int _set_cond(int *start, int argc, char *argv[], time_t start_time, end_time; int command_len = 0; - if(!job_cond->cluster_list) + if (!job_cond->cluster_list) job_cond->cluster_list = list_create(slurm_destroy_char); for (i=(*start); i<argc; i++) { end = parse_option_end(argv[i]); - if(!end) + if (!end) command_len=strlen(argv[i]); else command_len=end-1; - if(!end && !strncasecmp(argv[i], "all_clusters", + if (!end && !strncasecmp(argv[i], "all_clusters", MAX(command_len, 1))) { local_cluster_flag = 1; continue; - } else if(!end && !strncasecmp(argv[i], "PrintJobCount", + } else if (!end && !strncasecmp(argv[i], "PrintJobCount", MAX(command_len, 2))) { print_job_count = 1; continue; @@ -260,7 +260,7 @@ static int _set_cond(int *start, int argc, char *argv[], MAX(command_len, 2))) { flat_view = true; continue; - } else if(!end + } else if (!end || !strncasecmp (argv[i], "Clusters", MAX(command_len, 1))) { slurm_addto_char_list(job_cond->cluster_list, @@ -270,7 +270,7 @@ static int _set_cond(int *start, int argc, char *argv[], MAX(command_len, 2)) || !strncasecmp(argv[i], "Acct", MAX(command_len, 4))) { - if(!job_cond->acct_list) + if (!job_cond->acct_list) job_cond->acct_list = list_create(slurm_destroy_char); slurm_addto_char_list(job_cond->acct_list, @@ -278,7 +278,7 @@ static int _set_cond(int *start, int argc, char *argv[], set = 1; } else if (!strncasecmp (argv[i], "Associations", MAX(command_len, 2))) { - if(!job_cond->associd_list) + if (!job_cond->associd_list) job_cond->associd_list = list_create(slurm_destroy_char); slurm_addto_char_list(job_cond->associd_list, @@ -289,10 +289,10 @@ static int _set_cond(int *start, int argc, char *argv[], set = 1; } else if (!strncasecmp (argv[i], "Format", MAX(command_len, 2))) { - if(format_list) + if (format_list) slurm_addto_char_list(format_list, argv[i]+end); } else if (!strncasecmp (argv[i], "Gid", MAX(command_len, 2))) { - if(!job_cond->groupid_list) + if (!job_cond->groupid_list) job_cond->groupid_list = list_create(slurm_destroy_char); slurm_addto_char_list(job_cond->groupid_list, @@ -300,9 +300,9 @@ static int _set_cond(int *start, int argc, char *argv[], set = 1; } else if (!strncasecmp (argv[i], "grouping", MAX(command_len, 2))) { - if(!strncasecmp(argv[i]+end, "individual", 1)) { + if (!strncasecmp(argv[i]+end, "individual", 1)) { individual_grouping = 1; - } else if(grouping_list) + } else if (grouping_list) slurm_addto_char_list(grouping_list, argv[i]+end); } else if (!strncasecmp (argv[i], "Jobs", @@ -310,7 +310,7 @@ static int _set_cond(int *start, int argc, char *argv[], char *end_char = NULL, *start_char = argv[i]+end; slurmdb_selected_step_t *selected_step = NULL; char *dot = NULL; - if(!job_cond->step_list) + if (!job_cond->step_list) job_cond->step_list = list_create(slurm_destroy_char); @@ -319,7 +319,7 @@ static int _set_cond(int *start, int argc, char *argv[], *end_char = 0; while (isspace(*start_char)) start_char++; /* discard whitespace */ - if(!(int)*start_char) + if (!(int)*start_char) continue; selected_step = xmalloc( sizeof(slurmdb_selected_step_t)); @@ -338,9 +338,9 @@ static int _set_cond(int *start, int argc, char *argv[], } set = 1; - } else if(!strncasecmp (argv[i], "Nodes", + } else if (!strncasecmp (argv[i], "Nodes", MAX(command_len, 1))) { - if(job_cond->used_nodes) { + if (job_cond->used_nodes) { error("You already specified nodes '%s' " " combine your request into 1 nodes=.", job_cond->used_nodes); @@ -351,7 +351,7 @@ static int _set_cond(int *start, int argc, char *argv[], set = 1; } else if (!strncasecmp (argv[i], "Partitions", MAX(command_len, 2))) { - if(!job_cond->partition_list) + if (!job_cond->partition_list) job_cond->partition_list = list_create(slurm_destroy_char); slurm_addto_char_list(job_cond->partition_list, @@ -363,7 +363,7 @@ static int _set_cond(int *start, int argc, char *argv[], set = 1; } else if (!strncasecmp (argv[i], "Users", MAX(command_len, 1))) { - if(!job_cond->userid_list) + if (!job_cond->userid_list) job_cond->userid_list = list_create(slurm_destroy_char); _addto_uid_char_list(job_cond->userid_list, @@ -371,7 +371,7 @@ static int _set_cond(int *start, int argc, char *argv[], set = 1; } else if (!strncasecmp (argv[i], "Wckeys", MAX(command_len, 2))) { - if(!job_cond->wckey_list) + if (!job_cond->wckey_list) job_cond->wckey_list = list_create(slurm_destroy_char); slurm_addto_char_list(job_cond->wckey_list, @@ -385,9 +385,9 @@ static int _set_cond(int *start, int argc, char *argv[], } (*start) = i; - if(!local_cluster_flag && !list_count(job_cond->cluster_list)) { + if (!local_cluster_flag && !list_count(job_cond->cluster_list)) { char *temp = slurm_get_cluster_name(); - if(temp) + if (temp) list_append(job_cond->cluster_list, temp); } @@ -411,14 +411,14 @@ static int _setup_print_fields_list(List format_list) print_field_t *field = NULL; char *object = NULL; - if(!format_list || !list_count(format_list)) { + if (!format_list || !list_count(format_list)) { exit_code=1; fprintf(stderr, " We need a format list to set up the print.\n"); return SLURM_ERROR; } - if(!print_fields_list) + if (!print_fields_list) print_fields_list = list_create(destroy_print_field); itr = list_iterator_create(format_list); @@ -427,7 +427,7 @@ static int _setup_print_fields_list(List format_list) int command_len = 0; int newlen = 0; - if((tmp_char = strstr(object, "\%"))) { + if ((tmp_char = strstr(object, "\%"))) { newlen = atoi(tmp_char+1); tmp_char[0] = '\0'; } @@ -435,49 +435,49 @@ static int _setup_print_fields_list(List format_list) command_len = strlen(object); field = xmalloc(sizeof(print_field_t)); - if(!strncasecmp("Account", object, MAX(command_len, 1)) + if (!strncasecmp("Account", object, MAX(command_len, 1)) || !strncasecmp("Acct", object, MAX(command_len, 4))) { field->type = PRINT_JOB_ACCOUNT; field->name = xstrdup("Account"); field->len = 9; field->print_routine = print_fields_str; - } else if(!strncasecmp("Cluster", object, + } else if (!strncasecmp("Cluster", object, MAX(command_len, 2))) { field->type = PRINT_JOB_CLUSTER; field->name = xstrdup("Cluster"); field->len = 9; field->print_routine = print_fields_str; - } else if(!strncasecmp("CpuCount", object, + } else if (!strncasecmp("CpuCount", object, MAX(command_len, 2))) { field->type = PRINT_JOB_CPUS; field->name = xstrdup("CPU Count"); field->len = 9; field->print_routine = print_fields_uint; - } else if(!strncasecmp("Duration", object, + } else if (!strncasecmp("Duration", object, MAX(command_len, 1))) { field->type = PRINT_JOB_DUR; field->name = xstrdup("Duration"); field->len = 12; field->print_routine = print_fields_time; - } else if(!strncasecmp("JobCount", object, + } else if (!strncasecmp("JobCount", object, MAX(command_len, 2))) { field->type = PRINT_JOB_COUNT; field->name = xstrdup("Job Count"); field->len = 9; field->print_routine = print_fields_uint; - } else if(!strncasecmp("NodeCount", object, + } else if (!strncasecmp("NodeCount", object, MAX(command_len, 2))) { field->type = PRINT_JOB_NODES; field->name = xstrdup("Node Count"); field->len = 9; field->print_routine = print_fields_uint; - } else if(!strncasecmp("User", object, + } else if (!strncasecmp("User", object, MAX(command_len, 1))) { field->type = PRINT_JOB_USER; field->name = xstrdup("User"); field->len = 9; field->print_routine = print_fields_str; - } else if(!strncasecmp("Wckey", object, + } else if (!strncasecmp("Wckey", object, MAX(command_len, 1))) { field->type = PRINT_JOB_WCKEY; field->name = xstrdup("Wckey"); @@ -490,7 +490,7 @@ static int _setup_print_fields_list(List format_list) continue; } - if(newlen) + if (newlen) field->len = newlen; list_append(print_fields_list, field); @@ -510,72 +510,72 @@ static int _setup_grouping_print_fields_list(List grouping_list) uint32_t size = 0; char *tmp_char = NULL; - if(!grouping_list || !list_count(grouping_list)) { + if (!grouping_list || !list_count(grouping_list)) { exit_code=1; fprintf(stderr, " We need a grouping list to " "set up the print.\n"); return SLURM_ERROR; } - if(!grouping_print_fields_list) + if (!grouping_print_fields_list) grouping_print_fields_list = list_create(destroy_print_field); itr = list_iterator_create(grouping_list); while((object = list_next(itr))) { field = xmalloc(sizeof(print_field_t)); size = atoi(object); - if(print_job_count) + if (print_job_count) field->type = PRINT_JOB_COUNT; else field->type = PRINT_JOB_SIZE; - if(individual_grouping) + if (individual_grouping) field->name = xstrdup_printf("%u cpus", size); else field->name = xstrdup_printf("%u-%u cpus", last_size, size-1); - if(time_format == SLURMDB_REPORT_TIME_SECS_PER + if (time_format == SLURMDB_REPORT_TIME_SECS_PER || time_format == SLURMDB_REPORT_TIME_MINS_PER || time_format == SLURMDB_REPORT_TIME_HOURS_PER) field->len = 20; else field->len = 13; - if(print_job_count) + if (print_job_count) field->print_routine = print_fields_uint; else field->print_routine = slurmdb_report_print_time; last_size = size; last_object = object; - if((tmp_char = strstr(object, "\%"))) { + if ((tmp_char = strstr(object, "\%"))) { int newlen = atoi(tmp_char+1); - if(newlen) + if (newlen) field->len = newlen; } list_append(grouping_print_fields_list, field); } list_iterator_destroy(itr); - if(last_size && !individual_grouping) { + if (last_size && !individual_grouping) { field = xmalloc(sizeof(print_field_t)); - if(print_job_count) + if (print_job_count) field->type = PRINT_JOB_COUNT; else field->type = PRINT_JOB_SIZE; field->name = xstrdup_printf(">= %u cpus", last_size); - if(time_format == SLURMDB_REPORT_TIME_SECS_PER + if (time_format == SLURMDB_REPORT_TIME_SECS_PER || time_format == SLURMDB_REPORT_TIME_MINS_PER || time_format == SLURMDB_REPORT_TIME_HOURS_PER) field->len = 20; else field->len = 13; - if(print_job_count) + if (print_job_count) field->print_routine = print_fields_uint; else field->print_routine = slurmdb_report_print_time; - if((tmp_char = strstr(last_object, "\%"))) { + if ((tmp_char = strstr(last_object, "\%"))) { int newlen = atoi(tmp_char+1); - if(newlen) + if (newlen) field->len = newlen; } list_append(grouping_print_fields_list, field); @@ -621,16 +621,16 @@ extern int job_sizes_grouped_by_top_acct(int argc, char *argv[]) _set_cond(&i, argc, argv, job_cond, format_list, grouping_list); - if(!list_count(format_list)) + if (!list_count(format_list)) slurm_addto_char_list(format_list, "Cl,a"); - if(!individual_grouping && !list_count(grouping_list)) + if (!individual_grouping && !list_count(grouping_list)) slurm_addto_char_list(grouping_list, "50,250,500,1000"); _setup_print_fields_list(format_list); list_destroy(format_list); - if(!(slurmdb_report_cluster_grouping_list = + if (!(slurmdb_report_cluster_grouping_list = slurmdb_report_job_sizes_grouped_by_top_account(db_conn, job_cond, grouping_list, flat_view))) { exit_code = 1; @@ -639,7 +639,7 @@ extern int job_sizes_grouped_by_top_acct(int argc, char *argv[]) _setup_grouping_print_fields_list(grouping_list); - if(print_fields_have_header) { + if (print_fields_have_header) { char start_char[20]; char end_char[20]; time_t my_start = job_cond->usage_start; @@ -652,7 +652,7 @@ extern int job_sizes_grouped_by_top_acct(int argc, char *argv[]) printf("Job Sizes %s - %s (%d secs)\n", start_char, end_char, (int)(job_cond->usage_end - job_cond->usage_start)); - if(print_job_count) + if (print_job_count) printf("Units are in number of jobs ran\n"); else printf("Time reported in %s\n", time_format_string); @@ -757,35 +757,35 @@ extern int job_sizes_grouped_by_top_acct(int argc, char *argv[]) end_it: xfree(total_field.name); - if(print_job_count) + if (print_job_count) print_job_count = 0; - if(individual_grouping) + if (individual_grouping) individual_grouping = 0; slurmdb_destroy_job_cond(job_cond); - if(grouping_list) { + if (grouping_list) { list_destroy(grouping_list); grouping_list = NULL; } - if(assoc_list) { + if (assoc_list) { list_destroy(assoc_list); assoc_list = NULL; } - if(slurmdb_report_cluster_grouping_list) { + if (slurmdb_report_cluster_grouping_list) { list_destroy(slurmdb_report_cluster_grouping_list); slurmdb_report_cluster_grouping_list = NULL; } - if(print_fields_list) { + if (print_fields_list) { list_destroy(print_fields_list); print_fields_list = NULL; } - if(grouping_print_fields_list) { + if (grouping_print_fields_list) { list_destroy(grouping_print_fields_list); grouping_print_fields_list = NULL; } @@ -829,16 +829,16 @@ extern int job_sizes_grouped_by_wckey(int argc, char *argv[]) _set_cond(&i, argc, argv, job_cond, format_list, grouping_list); - if(!list_count(format_list)) + if (!list_count(format_list)) slurm_addto_char_list(format_list, "Cl,wc"); - if(!individual_grouping && !list_count(grouping_list)) + if (!individual_grouping && !list_count(grouping_list)) slurm_addto_char_list(grouping_list, "50,250,500,1000"); _setup_print_fields_list(format_list); list_destroy(format_list); - if(!(slurmdb_report_cluster_grouping_list = + if (!(slurmdb_report_cluster_grouping_list = slurmdb_report_job_sizes_grouped_by_wckey(db_conn, job_cond, grouping_list))) { exit_code = 1; @@ -847,7 +847,7 @@ extern int job_sizes_grouped_by_wckey(int argc, char *argv[]) _setup_grouping_print_fields_list(grouping_list); - if(print_fields_have_header) { + if (print_fields_have_header) { char start_char[20]; char end_char[20]; time_t my_start = job_cond->usage_start; @@ -860,7 +860,7 @@ extern int job_sizes_grouped_by_wckey(int argc, char *argv[]) printf("Job Sizes by Wckey %s - %s (%d secs)\n", start_char, end_char, (int)(job_cond->usage_end - job_cond->usage_start)); - if(print_job_count) + if (print_job_count) printf("Units are in number of jobs ran\n"); else printf("Time reported in %s\n", time_format_string); @@ -965,35 +965,35 @@ extern int job_sizes_grouped_by_wckey(int argc, char *argv[]) end_it: xfree(total_field.name); - if(print_job_count) + if (print_job_count) print_job_count = 0; - if(individual_grouping) + if (individual_grouping) individual_grouping = 0; slurmdb_destroy_job_cond(job_cond); - if(grouping_list) { + if (grouping_list) { list_destroy(grouping_list); grouping_list = NULL; } - if(wckey_list) { + if (wckey_list) { list_destroy(wckey_list); wckey_list = NULL; } - if(slurmdb_report_cluster_grouping_list) { + if (slurmdb_report_cluster_grouping_list) { list_destroy(slurmdb_report_cluster_grouping_list); slurmdb_report_cluster_grouping_list = NULL; } - if(print_fields_list) { + if (print_fields_list) { list_destroy(print_fields_list); print_fields_list = NULL; } - if(grouping_print_fields_list) { + if (grouping_print_fields_list) { list_destroy(grouping_print_fields_list); grouping_print_fields_list = NULL; } @@ -1038,16 +1038,16 @@ extern int job_sizes_grouped_by_top_acct_and_wckey(int argc, char *argv[]) _set_cond(&i, argc, argv, job_cond, format_list, grouping_list); - if(!list_count(format_list)) + if (!list_count(format_list)) slurm_addto_char_list(format_list, "Cl,a%-20"); - if(!individual_grouping && !list_count(grouping_list)) + if (!individual_grouping && !list_count(grouping_list)) slurm_addto_char_list(grouping_list, "50,250,500,1000"); _setup_print_fields_list(format_list); list_destroy(format_list); - if(!(slurmdb_report_cluster_grouping_list = + if (!(slurmdb_report_cluster_grouping_list = slurmdb_report_job_sizes_grouped_by_top_account_then_wckey( db_conn, job_cond, grouping_list, flat_view))) { exit_code = 1; @@ -1056,7 +1056,7 @@ extern int job_sizes_grouped_by_top_acct_and_wckey(int argc, char *argv[]) _setup_grouping_print_fields_list(grouping_list); - if(print_fields_have_header) { + if (print_fields_have_header) { char start_char[20]; char end_char[20]; time_t my_start = job_cond->usage_start; @@ -1069,7 +1069,7 @@ extern int job_sizes_grouped_by_top_acct_and_wckey(int argc, char *argv[]) printf("Job Sizes %s - %s (%d secs)\n", start_char, end_char, (int)(job_cond->usage_end - job_cond->usage_start)); - if(print_job_count) + if (print_job_count) printf("Units are in number of jobs ran\n"); else printf("Time reported in %s\n", time_format_string); @@ -1174,35 +1174,35 @@ extern int job_sizes_grouped_by_top_acct_and_wckey(int argc, char *argv[]) end_it: xfree(total_field.name); - if(print_job_count) + if (print_job_count) print_job_count = 0; - if(individual_grouping) + if (individual_grouping) individual_grouping = 0; slurmdb_destroy_job_cond(job_cond); - if(grouping_list) { + if (grouping_list) { list_destroy(grouping_list); grouping_list = NULL; } - if(assoc_list) { + if (assoc_list) { list_destroy(assoc_list); assoc_list = NULL; } - if(slurmdb_report_cluster_grouping_list) { + if (slurmdb_report_cluster_grouping_list) { list_destroy(slurmdb_report_cluster_grouping_list); slurmdb_report_cluster_grouping_list = NULL; } - if(print_fields_list) { + if (print_fields_list) { list_destroy(print_fields_list); print_fields_list = NULL; } - if(grouping_print_fields_list) { + if (grouping_print_fields_list) { list_destroy(grouping_print_fields_list); grouping_print_fields_list = NULL; } diff --git a/src/sreport/resv_reports.c b/src/sreport/resv_reports.c index 39205c64194..a6233ef1820 100644 --- a/src/sreport/resv_reports.c +++ b/src/sreport/resv_reports.c @@ -79,18 +79,18 @@ static int _set_resv_cond(int *start, int argc, char *argv[], time_t start_time, end_time; int command_len = 0; - if(!resv_cond) { + if (!resv_cond) { error("We need an slurmdb_reservation_cond to call this"); return SLURM_ERROR; } resv_cond->with_usage = 1; - if(!resv_cond->cluster_list) + if (!resv_cond->cluster_list) resv_cond->cluster_list = list_create(slurm_destroy_char); for (i=(*start); i<argc; i++) { end = parse_option_end(argv[i]); - if(!end) + if (!end) command_len=strlen(argv[i]); else { command_len=end-1; @@ -99,13 +99,13 @@ static int _set_resv_cond(int *start, int argc, char *argv[], } } - if(!end && !strncasecmp(argv[i], "all_clusters", + if (!end && !strncasecmp(argv[i], "all_clusters", MAX(command_len, 1))) { local_cluster_flag = 1; - } else if(!end + } else if (!end || !strncasecmp (argv[i], "Names", MAX(command_len, 1))) { - if(!resv_cond->name_list) + if (!resv_cond->name_list) resv_cond->name_list = list_create(slurm_destroy_char); slurm_addto_char_list(resv_cond->name_list, @@ -126,19 +126,19 @@ static int _set_resv_cond(int *start, int argc, char *argv[], set = 1; } else if (!strncasecmp (argv[i], "Format", MAX(command_len, 2))) { - if(format_list) + if (format_list) slurm_addto_char_list(format_list, argv[i]+end); } else if (!strncasecmp (argv[i], "Ids", MAX(command_len, 1))) { - if(!resv_cond->id_list) + if (!resv_cond->id_list) resv_cond->id_list = list_create(slurm_destroy_char); slurm_addto_char_list(resv_cond->id_list, argv[i]+end); set = 1; - } else if(!strncasecmp (argv[i], "Nodes", + } else if (!strncasecmp (argv[i], "Nodes", MAX(command_len, 1))) { - if(resv_cond->nodes) { + if (resv_cond->nodes) { error("You already specified nodes '%s' " " combine your request into 1 nodes=.", resv_cond->nodes); @@ -159,9 +159,9 @@ static int _set_resv_cond(int *start, int argc, char *argv[], } (*start) = i; - if(!local_cluster_flag && !list_count(resv_cond->cluster_list)) { + if (!local_cluster_flag && !list_count(resv_cond->cluster_list)) { char *temp = slurm_get_cluster_name(); - if(temp) + if (temp) list_append(resv_cond->cluster_list, temp); } @@ -184,14 +184,14 @@ static int _setup_print_fields_list(List format_list) print_field_t *field = NULL; char *object = NULL; - if(!format_list || !list_count(format_list)) { + if (!format_list || !list_count(format_list)) { exit_code=1; fprintf(stderr, " we need a format list " "to set up the print.\n"); return SLURM_ERROR; } - if(!print_fields_list) + if (!print_fields_list) print_fields_list = list_create(destroy_print_field); itr = list_iterator_create(format_list); @@ -200,7 +200,7 @@ static int _setup_print_fields_list(List format_list) int command_len = 0; int newlen = 0; - if((tmp_char = strstr(object, "\%"))) { + if ((tmp_char = strstr(object, "\%"))) { newlen = atoi(tmp_char+1); tmp_char[0] = '\0'; } @@ -208,85 +208,85 @@ static int _setup_print_fields_list(List format_list) command_len = strlen(object); field = xmalloc(sizeof(print_field_t)); - if(!strncasecmp("allocated", object, + if (!strncasecmp("allocated", object, MAX(command_len, 2))) { field->type = PRINT_RESV_ACPU; field->name = xstrdup("Allocated"); - if(time_format == SLURMDB_REPORT_TIME_SECS_PER + if (time_format == SLURMDB_REPORT_TIME_SECS_PER || time_format == SLURMDB_REPORT_TIME_MINS_PER || time_format == SLURMDB_REPORT_TIME_HOURS_PER) field->len = 20; else field->len = 9; field->print_routine = slurmdb_report_print_time; - } else if(!strncasecmp("Associations", + } else if (!strncasecmp("Associations", object, MAX(command_len, 2))) { field->type = PRINT_RESV_ASSOCS; field->name = xstrdup("Associations"); field->len = 15; field->print_routine = print_fields_str; - } else if(!strncasecmp("Cluster", object, + } else if (!strncasecmp("Cluster", object, MAX(command_len, 2))) { field->type = PRINT_RESV_CLUSTER; field->name = xstrdup("Cluster"); field->len = 9; field->print_routine = print_fields_str; - } else if(!strncasecmp("cpucount", object, + } else if (!strncasecmp("cpucount", object, MAX(command_len, 2))) { field->type = PRINT_RESV_CPUS; field->name = xstrdup("CPU count"); field->len = 9; field->print_routine = print_fields_uint; - } else if(!strncasecmp("down", object, MAX(command_len, 1))) { + } else if (!strncasecmp("down", object, MAX(command_len, 1))) { field->type = PRINT_RESV_DCPU; field->name = xstrdup("Down"); - if(time_format == SLURMDB_REPORT_TIME_SECS_PER + if (time_format == SLURMDB_REPORT_TIME_SECS_PER || time_format == SLURMDB_REPORT_TIME_MINS_PER || time_format == SLURMDB_REPORT_TIME_HOURS_PER) field->len = 20; else field->len = 9; field->print_routine = slurmdb_report_print_time; - } else if(!strncasecmp("idle", object, MAX(command_len, 1))) { + } else if (!strncasecmp("idle", object, MAX(command_len, 1))) { field->type = PRINT_RESV_ICPU; field->name = xstrdup("Idle"); - if(time_format == SLURMDB_REPORT_TIME_SECS_PER + if (time_format == SLURMDB_REPORT_TIME_SECS_PER || time_format == SLURMDB_REPORT_TIME_MINS_PER || time_format == SLURMDB_REPORT_TIME_HOURS_PER) field->len = 20; else field->len = 9; field->print_routine = slurmdb_report_print_time; - } else if(!strncasecmp("Nodes", object, MAX(command_len, 2))) { + } else if (!strncasecmp("Nodes", object, MAX(command_len, 2))) { field->type = PRINT_RESV_NODES; field->name = xstrdup("Nodes"); field->len = 15; field->print_routine = print_fields_str; - } else if(!strncasecmp("Name", object, + } else if (!strncasecmp("Name", object, MAX(command_len, 2))) { field->type = PRINT_RESV_NAME; field->name = xstrdup("Name"); field->len = 9; field->print_routine = print_fields_str; - } else if(!strncasecmp("Start", object, + } else if (!strncasecmp("Start", object, MAX(command_len, 2))) { field->type = PRINT_RESV_START; field->name = xstrdup("Start"); field->len = 19; field->print_routine = print_fields_date; - } else if(!strncasecmp("End", object, + } else if (!strncasecmp("End", object, MAX(command_len, 2))) { field->type = PRINT_RESV_END; field->name = xstrdup("End"); field->len = 19; field->print_routine = print_fields_date; - } else if(!strncasecmp("TotalTime", object, + } else if (!strncasecmp("TotalTime", object, MAX(command_len, 2))) { field->type = PRINT_RESV_TIME; field->name = xstrdup("TotalTime"); field->len = 9; field->print_routine = print_fields_time_from_secs; - } else if(!strncasecmp("CPUTime", object, + } else if (!strncasecmp("CPUTime", object, MAX(command_len, 2))) { field->type = PRINT_RESV_CPUTIME; field->name = xstrdup("CPUTime"); @@ -299,7 +299,7 @@ static int _setup_print_fields_list(List format_list) continue; } - if(newlen) + if (newlen) field->len = newlen; list_append(print_fields_list, field); @@ -322,13 +322,13 @@ static List _get_resv_list(int argc, char *argv[], _set_resv_cond(&i, argc, argv, resv_cond, format_list); resv_list = slurmdb_reservations_get(db_conn, resv_cond); - if(!resv_list) { + if (!resv_list) { exit_code=1; fprintf(stderr, " Problem with resv query.\n"); return NULL; } - if(print_fields_have_header) { + if (print_fields_have_header) { char start_char[20]; char end_char[20]; time_t my_start = resv_cond->time_start; @@ -380,12 +380,12 @@ extern int resv_utilization(int argc, char *argv[]) print_fields_list = list_create(destroy_print_field); - if(!(resv_list = _get_resv_list(argc, argv, + if (!(resv_list = _get_resv_list(argc, argv, "Reservation Utilization", format_list))) goto end_it; - if(!list_count(format_list)) + if (!list_count(format_list)) slurm_addto_char_list(format_list, "Cl,name,start,end,al,i"); @@ -412,7 +412,7 @@ extern int resv_utilization(int argc, char *argv[]) */ while((resv = list_next(itr))) { while((tot_resv = list_next(tot_itr))) { - if(tot_resv->id == resv->id) { + if (tot_resv->id == resv->id) { /* get an average of cpus if the reservation changes we will just get an average. @@ -421,14 +421,14 @@ extern int resv_utilization(int argc, char *argv[]) tot_resv->cpus /= 2; tot_resv->alloc_secs += resv->alloc_secs; tot_resv->down_secs += resv->down_secs; - if(resv->time_start < tot_resv->time_start) + if (resv->time_start < tot_resv->time_start) tot_resv->time_start = resv->time_start; - if(resv->time_end > tot_resv->time_end) + if (resv->time_end > tot_resv->time_end) tot_resv->time_end = resv->time_end; break; } } - if(!tot_resv) + if (!tot_resv) list_append(tot_resv_list, resv); list_iterator_reset(tot_itr); @@ -441,7 +441,7 @@ extern int resv_utilization(int argc, char *argv[]) int curr_inx = 1; total_time = tot_resv->time_end - tot_resv->time_start; - if(total_time <= 0) + if (total_time <= 0) continue; total_reported = (uint64_t)(total_time * tot_resv->cpus); @@ -542,15 +542,15 @@ extern int resv_utilization(int argc, char *argv[]) list_iterator_destroy(itr); end_it: - if(resv_list) { + if (resv_list) { list_destroy(resv_list); resv_list = NULL; } - if(tot_resv_list) { + if (tot_resv_list) { list_destroy(tot_resv_list); tot_resv_list = NULL; } - if(print_fields_list) { + if (print_fields_list) { list_destroy(print_fields_list); print_fields_list = NULL; } diff --git a/src/sreport/sreport.c b/src/sreport/sreport.c index 26e424eb955..f93e53754d8 100644 --- a/src/sreport/sreport.c +++ b/src/sreport/sreport.c @@ -105,7 +105,7 @@ main (int argc, char *argv[]) /* Check to see if we are running a supported accounting plugin */ temp = slurm_get_accounting_storage_type(); - if(strcasecmp(temp, "accounting_storage/slurmdbd") + if (strcasecmp(temp, "accounting_storage/slurmdbd") && strcasecmp(temp, "accounting_storage/mysql")) { fprintf (stderr, "You are not running a supported " "accounting_storage plugin\n(%s).\n" @@ -180,7 +180,7 @@ main (int argc, char *argv[]) db_conn = slurmdb_connection_get(); - if(errno) { + if (errno) { error("Problem talking to the database: %m"); exit(1); } diff --git a/src/sreport/user_reports.c b/src/sreport/user_reports.c index cd54a715336..baefa32becc 100644 --- a/src/sreport/user_reports.c +++ b/src/sreport/user_reports.c @@ -63,40 +63,40 @@ static int _set_cond(int *start, int argc, char *argv[], time_t start_time, end_time; int command_len = 0; - if(!user_cond) { + if (!user_cond) { error("We need an slurmdb_user_cond to call this"); return SLURM_ERROR; } user_cond->with_deleted = 1; user_cond->with_assocs = 1; - if(!user_cond->assoc_cond) { + if (!user_cond->assoc_cond) { user_cond->assoc_cond = xmalloc(sizeof(slurmdb_association_cond_t)); user_cond->assoc_cond->with_usage = 1; } assoc_cond = user_cond->assoc_cond; - if(!assoc_cond->cluster_list) + if (!assoc_cond->cluster_list) assoc_cond->cluster_list = list_create(slurm_destroy_char); for (i=(*start); i<argc; i++) { end = parse_option_end(argv[i]); - if(!end) + if (!end) command_len=strlen(argv[i]); else command_len=end-1; - if(!end && !strncasecmp(argv[i], "all_clusters", + if (!end && !strncasecmp(argv[i], "all_clusters", MAX(command_len, 1))) { local_cluster_flag = 1; continue; } else if (!end && !strncasecmp(argv[i], "group", MAX(command_len, 1))) { group_accts = 1; - } else if(!end + } else if (!end || !strncasecmp (argv[i], "Users", MAX(command_len, 1))) { - if(!assoc_cond->user_list) + if (!assoc_cond->user_list) assoc_cond->user_list = list_create(slurm_destroy_char); slurm_addto_char_list(assoc_cond->user_list, @@ -106,7 +106,7 @@ static int _set_cond(int *start, int argc, char *argv[], MAX(command_len, 2)) || !strncasecmp(argv[i], "Acct", MAX(command_len, 4))) { - if(!assoc_cond->acct_list) + if (!assoc_cond->acct_list) assoc_cond->acct_list = list_create(slurm_destroy_char); slurm_addto_char_list(assoc_cond->acct_list, @@ -122,7 +122,7 @@ static int _set_cond(int *start, int argc, char *argv[], set = 1; } else if (!strncasecmp (argv[i], "Format", MAX(command_len, 1))) { - if(format_list) + if (format_list) slurm_addto_char_list(format_list, argv[i]+end); } else if (!strncasecmp (argv[i], "Start", MAX(command_len, 1))) { @@ -141,9 +141,9 @@ static int _set_cond(int *start, int argc, char *argv[], } (*start) = i; - if(!local_cluster_flag && !list_count(assoc_cond->cluster_list)) { + if (!local_cluster_flag && !list_count(assoc_cond->cluster_list)) { char *temp = slurm_get_cluster_name(); - if(temp) + if (temp) list_append(assoc_cond->cluster_list, temp); } @@ -166,14 +166,14 @@ static int _setup_print_fields_list(List format_list) print_field_t *field = NULL; char *object = NULL; - if(!format_list || !list_count(format_list)) { + if (!format_list || !list_count(format_list)) { exit_code=1; fprintf(stderr, " We need a format list to set up the print.\n"); return SLURM_ERROR; } - if(!print_fields_list) + if (!print_fields_list) print_fields_list = list_create(destroy_print_field); itr = list_iterator_create(format_list); @@ -182,7 +182,7 @@ static int _setup_print_fields_list(List format_list) int command_len = 0; int newlen = 0; - if((tmp_char = strstr(object, "\%"))) { + if ((tmp_char = strstr(object, "\%"))) { newlen = atoi(tmp_char+1); tmp_char[0] = '\0'; } @@ -190,31 +190,31 @@ static int _setup_print_fields_list(List format_list) command_len = strlen(object); field = xmalloc(sizeof(print_field_t)); - if(!strncasecmp("Accounts", object, MAX(command_len, 1))) { + if (!strncasecmp("Accounts", object, MAX(command_len, 1))) { field->type = PRINT_USER_ACCT; field->name = xstrdup("Account"); field->len = 15; field->print_routine = print_fields_str; - } else if(!strncasecmp("Cluster", object, + } else if (!strncasecmp("Cluster", object, MAX(command_len, 1))) { field->type = PRINT_USER_CLUSTER; field->name = xstrdup("Cluster"); field->len = 9; field->print_routine = print_fields_str; - } else if(!strncasecmp("Login", object, MAX(command_len, 1))) { + } else if (!strncasecmp("Login", object, MAX(command_len, 1))) { field->type = PRINT_USER_LOGIN; field->name = xstrdup("Login"); field->len = 9; field->print_routine = print_fields_str; - } else if(!strncasecmp("Proper", object, MAX(command_len, 1))) { + } else if (!strncasecmp("Proper", object, MAX(command_len, 1))) { field->type = PRINT_USER_PROPER; field->name = xstrdup("Proper Name"); field->len = 15; field->print_routine = print_fields_str; - } else if(!strncasecmp("Used", object, MAX(command_len, 1))) { + } else if (!strncasecmp("Used", object, MAX(command_len, 1))) { field->type = PRINT_USER_USED; field->name = xstrdup("Used"); - if(time_format == SLURMDB_REPORT_TIME_SECS_PER + if (time_format == SLURMDB_REPORT_TIME_SECS_PER || time_format == SLURMDB_REPORT_TIME_MINS_PER || time_format == SLURMDB_REPORT_TIME_HOURS_PER) field->len = 18; @@ -228,7 +228,7 @@ static int _setup_print_fields_list(List format_list) continue; } - if(newlen) + if (newlen) field->len = newlen; list_append(print_fields_list, field); @@ -260,19 +260,19 @@ extern int user_top(int argc, char *argv[]) _set_cond(&i, argc, argv, user_cond, format_list); - if(!list_count(format_list)) + if (!list_count(format_list)) slurm_addto_char_list(format_list, "Cl,L,P,A,U"); _setup_print_fields_list(format_list); list_destroy(format_list); - if(!(slurmdb_report_cluster_list = + if (!(slurmdb_report_cluster_list = slurmdb_report_user_top_usage(db_conn, user_cond, group_accts))) { exit_code = 1; goto end_it; } - if(print_fields_have_header) { + if (print_fields_have_header) { char start_char[20]; char end_char[20]; time_t my_start = user_cond->assoc_cond->usage_start; @@ -321,7 +321,7 @@ extern int user_top(int argc, char *argv[]) itr3 = list_iterator_create( slurmdb_report_user->acct_list); while((object = list_next(itr3))) { - if(tmp_char) + if (tmp_char) xstrfmtcat(tmp_char, ", %s", object); @@ -350,10 +350,10 @@ extern int user_top(int argc, char *argv[]) break; case PRINT_USER_PROPER: pwd = getpwnam(slurmdb_report_user->name); - if(pwd) { + if (pwd) { tmp_char = strtok(pwd->pw_gecos, ","); - if(!tmp_char) + if (!tmp_char) tmp_char = pwd->pw_gecos; } @@ -380,7 +380,7 @@ extern int user_top(int argc, char *argv[]) list_iterator_reset(itr2); printf("\n"); count++; - if(count >= top_limit) + if (count >= top_limit) break; } list_iterator_destroy(itr); @@ -393,12 +393,12 @@ end_it: group_accts = 0; slurmdb_destroy_user_cond(user_cond); - if(slurmdb_report_cluster_list) { + if (slurmdb_report_cluster_list) { list_destroy(slurmdb_report_cluster_list); slurmdb_report_cluster_list = NULL; } - if(print_fields_list) { + if (print_fields_list) { list_destroy(print_fields_list); print_fields_list = NULL; } diff --git a/src/srun/srun.c b/src/srun/srun.c index 2f069c8d651..97874681dd1 100644 --- a/src/srun/srun.c +++ b/src/srun/srun.c @@ -305,7 +305,7 @@ static char *_uint16_array_to_str(int array_len, const uint16_t *array) char *sep = ","; /* seperator */ char *str = xstrdup(""); - if(array == NULL) + if (array == NULL) return str; for (i = 0; i < array_len; i++) { diff --git a/src/sshare/sshare.c b/src/sshare/sshare.c index a917b3ca61c..999891934f1 100644 --- a/src/sshare/sshare.c +++ b/src/sshare/sshare.c @@ -107,7 +107,7 @@ main (int argc, char *argv[]) all_users = 1; break; case 'A': - if(!req_msg.acct_list) + if (!req_msg.acct_list) req_msg.acct_list = list_create(slurm_destroy_char); slurm_addto_char_list(req_msg.acct_list, optarg); @@ -121,9 +121,9 @@ main (int argc, char *argv[]) long_flag = 1; break; case 'M': - if(clusters) + if (clusters) list_destroy(clusters); - if(!(clusters = + if (!(clusters = slurmdb_get_info_cluster(optarg))) { error("'%s' can't be reached now, " "or it is an invalid entry for " @@ -146,12 +146,12 @@ main (int argc, char *argv[]) PRINT_FIELDS_PARSABLE_NO_ENDING; break; case 'u': - if(!strcmp(optarg, "-1")) { + if (!strcmp(optarg, "-1")) { all_users = 1; break; } all_users = 0; - if(!req_msg.user_list) + if (!req_msg.user_list) req_msg.user_list = list_create(slurm_destroy_char); _addto_name_char_list(req_msg.user_list, optarg, 0); @@ -182,13 +182,13 @@ main (int argc, char *argv[]) log_alter(opts, 0, NULL); } - if(all_users) { - if(req_msg.user_list + if (all_users) { + if (req_msg.user_list && list_count(req_msg.user_list)) { list_destroy(req_msg.user_list); req_msg.user_list = NULL; } - if(verbosity) + if (verbosity) fprintf(stderr, "Users requested:\n\t: all\n"); } else if (verbosity && req_msg.user_list && list_count(req_msg.user_list)) { @@ -197,40 +197,40 @@ main (int argc, char *argv[]) while((temp = list_next(itr))) fprintf(stderr, "\t: %s\n", temp); list_iterator_destroy(itr); - } else if(!req_msg.user_list || !list_count(req_msg.user_list)) { + } else if (!req_msg.user_list || !list_count(req_msg.user_list)) { struct passwd *pwd = getpwuid(getuid()); - if(!req_msg.user_list) + if (!req_msg.user_list) req_msg.user_list = list_create(slurm_destroy_char); temp = xstrdup(pwd->pw_name); list_append(req_msg.user_list, temp); - if(verbosity) { + if (verbosity) { fprintf(stderr, "Users requested:\n"); fprintf(stderr, "\t: %s\n", temp); } } - if(req_msg.acct_list && list_count(req_msg.acct_list)) { + if (req_msg.acct_list && list_count(req_msg.acct_list)) { fprintf(stderr, "Accounts requested:\n"); ListIterator itr = list_iterator_create(req_msg.acct_list); while((temp = list_next(itr))) fprintf(stderr, "\t: %s\n", temp); list_iterator_destroy(itr); } else { - if(req_msg.acct_list + if (req_msg.acct_list && list_count(req_msg.acct_list)) { list_destroy(req_msg.acct_list); req_msg.acct_list = NULL; } - if(verbosity) + if (verbosity) fprintf(stderr, "Accounts requested:\n\t: all\n"); } error_code = _get_info(&req_msg, &resp_msg); - if(req_msg.acct_list) + if (req_msg.acct_list) list_destroy(req_msg.acct_list); - if(req_msg.user_list) + if (req_msg.user_list) list_destroy(req_msg.user_list); if (error_code) { @@ -291,13 +291,13 @@ static int _addto_name_char_list(List char_list, char *names, bool gid) int quote = 0; int count = 0; - if(!char_list) { + if (!char_list) { error("No list was given to fill in"); return 0; } itr = list_iterator_create(char_list); - if(names) { + if (names) { if (names[i] == '\"' || names[i] == '\'') { quote_c = names[i]; quote = 1; @@ -306,12 +306,12 @@ static int _addto_name_char_list(List char_list, char *names, bool gid) start = i; while(names[i]) { //info("got %d - %d = %d", i, start, i-start); - if(quote && names[i] == quote_c) + if (quote && names[i] == quote_c) break; else if (names[i] == '\"' || names[i] == '\'') names[i] = '`'; - else if(names[i] == ',') { - if((i-start) > 0) { + else if (names[i] == ',') { + if ((i-start) > 0) { name = xmalloc((i-start+1)); memcpy(name, names+start, (i-start)); //info("got %s %d", name, i-start); @@ -323,11 +323,11 @@ static int _addto_name_char_list(List char_list, char *names, bool gid) } while((tmp_char = list_next(itr))) { - if(!strcasecmp(tmp_char, name)) + if (!strcasecmp(tmp_char, name)) break; } - if(!tmp_char) { + if (!tmp_char) { list_append(char_list, name); count++; } else @@ -336,7 +336,7 @@ static int _addto_name_char_list(List char_list, char *names, bool gid) } i++; start = i; - if(!names[i]) { + if (!names[i]) { info("There is a problem with " "your request. It appears you " "have spaces inside your list."); @@ -345,7 +345,7 @@ static int _addto_name_char_list(List char_list, char *names, bool gid) } i++; } - if((i-start) > 0) { + if ((i-start) > 0) { name = xmalloc((i-start)+1); memcpy(name, names+start, (i-start)); @@ -356,11 +356,11 @@ static int _addto_name_char_list(List char_list, char *names, bool gid) } while((tmp_char = list_next(itr))) { - if(!strcasecmp(tmp_char, name)) + if (!strcasecmp(tmp_char, name)) break; } - if(!tmp_char) { + if (!tmp_char) { list_append(char_list, name); count++; } else @@ -375,7 +375,7 @@ static char *_convert_to_name(int id, bool gid) { char *name = NULL; - if(gid) { + if (gid) { struct group *grp; if (!(grp=getgrgid(id))) { fprintf(stderr, "Invalid group id: %s\n", name); diff --git a/src/sstat/print.c b/src/sstat/print.c index 0faea9b83a0..ec02857d961 100644 --- a/src/sstat/print.c +++ b/src/sstat/print.c @@ -51,7 +51,7 @@ char *_elapsed_time(long secs, long usecs) long subsec = 0; char *str = NULL; - if(secs < 0 || secs == NO_VAL) + if ((secs < 0) || (secs == NO_VAL)) return NULL; @@ -59,7 +59,7 @@ char *_elapsed_time(long secs, long usecs) secs++; usecs -= 1E6; } - if(usecs > 0) { + if (usecs > 0) { /* give me 3 significant digits to tack onto the sec */ subsec = (usecs/1000); } -- GitLab