From 6d40e072e0cb90d1240e36c569bca102c9863ee1 Mon Sep 17 00:00:00 2001 From: Morris Jette <jette@schedmd.com> Date: Wed, 2 Aug 2017 10:00:45 -0600 Subject: [PATCH] Cosmetic changes, no change in logic --- slurm/slurmdb.h | 5 +- src/common/slurm_protocol_defs.c | 37 +++++++----- src/common/slurmdb_defs.c | 4 +- src/common/slurmdb_pack.c | 2 +- .../filetxt/filetxt_jobacct_process.c | 40 ++++++------- .../slurmdbd/accounting_storage_slurmdbd.c | 9 +-- .../jobcomp/filetxt/filetxt_jobcomp_process.c | 6 +- .../jobcomp/mysql/mysql_jobcomp_process.c | 8 +-- src/sacct/options.c | 58 +++++++++---------- src/sacct/print.c | 16 ++--- src/sstat/options.c | 2 +- 11 files changed, 97 insertions(+), 90 deletions(-) diff --git a/slurm/slurmdb.h b/slurm/slurmdb.h index f6c2d44ff92..d5be8bd7ebf 100644 --- a/slurm/slurmdb.h +++ b/slurm/slurmdb.h @@ -740,8 +740,8 @@ typedef struct { uint32_t jobid; char *jobname; uint32_t lft; - char *partition; char *nodes; + char *partition; uint32_t priority; uint32_t qosid; uint32_t req_cpus; @@ -961,8 +961,7 @@ typedef struct { } slurmdb_reservation_rec_t; typedef struct { - uint32_t array_task_id; /* task_id of a job array of NO_VAL - * if N/A */ + uint32_t array_task_id; /* task_id of a job array or NO_VAL */ uint32_t jobid; uint32_t stepid; } slurmdb_selected_step_t; diff --git a/src/common/slurm_protocol_defs.c b/src/common/slurm_protocol_defs.c index 0a228890893..54ca3abd4ab 100644 --- a/src/common/slurm_protocol_defs.c +++ b/src/common/slurm_protocol_defs.c @@ -529,7 +529,7 @@ static int _addto_step_list_internal(List step_list, char *names, int start, int end) { int count = 0; - char *dot = NULL, *name; + char *dot, *name, *plus, *under; slurmdb_selected_step_t *selected_step = NULL; if ((end-start) <= 0) @@ -546,10 +546,7 @@ static int _addto_step_list_internal(List step_list, char *names, selected_step = xmalloc(sizeof(slurmdb_selected_step_t)); - if (!(dot = strstr(name, "."))) { - debug2("No jobstep requested"); - selected_step->stepid = NO_VAL; - } else { + if ((dot = strstr(name, "."))) { *dot++ = 0; /* can't use NO_VAL since that means all */ if (!xstrcmp(dot, "batch")) @@ -558,20 +555,32 @@ static int _addto_step_list_internal(List step_list, char *names, selected_step->stepid = atoi(dot); else fatal("Bad step specified: %s", name); + } else { + debug2("No jobstep requested"); + selected_step->stepid = NO_VAL; } - if (!(dot = strstr(name, "_"))) { - debug2("No jobarray requested"); - selected_step->array_task_id = NO_VAL; - } else { - *dot++ = 0; + if ((under = strstr(name, "_"))) { + *under++ = 0; /* INFINITE means give me all the tasks of the array */ - if (!dot) + if (!under) selected_step->array_task_id = INFINITE; - else if (isdigit(*dot)) - selected_step->array_task_id = atoi(dot); + else if (isdigit(*under)) + selected_step->array_task_id = atoi(under); else fatal("Bad job array element specified: %s", name); + selected_step->pack_job_offset = NO_VAL; + } else if ((plus = strstr(name, "+"))) { + selected_step->array_task_id = NO_VAL; + *plus++ = 0; + if (isdigit(*plus)) + selected_step->pack_job_offset = atoi(plus); + else + fatal("Bad pack job offset specified: %s", name); + } else { + debug2("No jobarray or pack job requested"); + selected_step->array_task_id = NO_VAL; + selected_step->pack_job_offset = NO_VAL; } selected_step->jobid = atoi(name); @@ -591,7 +600,7 @@ static int _addto_step_list_internal(List step_list, char *names, /* returns number of objects added to list */ extern int slurm_addto_step_list(List step_list, char *names) { - int i=0, start=0; + int i = 0, start = 0; char quote_c = '\0'; int quote = 0; int count = 0; diff --git a/src/common/slurmdb_defs.c b/src/common/slurmdb_defs.c index 2e47698d470..a3419453432 100644 --- a/src/common/slurmdb_defs.c +++ b/src/common/slurmdb_defs.c @@ -1293,9 +1293,7 @@ extern void slurmdb_destroy_hierarchical_rec(void *object) extern void slurmdb_destroy_selected_step(void *object) { slurmdb_selected_step_t *step = (slurmdb_selected_step_t *)object; - if (step) { - xfree(step); - } + xfree(step); } extern void slurmdb_destroy_report_job_grouping(void *object) diff --git a/src/common/slurmdb_pack.c b/src/common/slurmdb_pack.c index e908f821456..9b736588fa3 100644 --- a/src/common/slurmdb_pack.c +++ b/src/common/slurmdb_pack.c @@ -4358,7 +4358,7 @@ extern int slurmdb_unpack_job_cond(void **object, uint16_t protocol_version, if (count != NO_VAL) { object_ptr->resv_list = list_create(slurm_destroy_char); - for (i=0; i<count; i++) { + for (i = 0; i < count; i++) { safe_unpackstr_xmalloc(&tmp_info, &uint32_tmp, buffer); list_append(object_ptr->resv_list, diff --git a/src/plugins/accounting_storage/filetxt/filetxt_jobacct_process.c b/src/plugins/accounting_storage/filetxt/filetxt_jobacct_process.c index 41f97123797..a8cc8562c70 100644 --- a/src/plugins/accounting_storage/filetxt/filetxt_jobacct_process.c +++ b/src/plugins/accounting_storage/filetxt/filetxt_jobacct_process.c @@ -293,7 +293,7 @@ static slurmdb_job_rec_t *_slurmdb_create_job_rec( && list_count(job_cond->state_list)) { char *object = NULL; itr = list_iterator_create(job_cond->state_list); - while((object = list_next(itr))) { + while ((object = list_next(itr))) { if (atoi(object) == filetxt_job->status) { list_iterator_destroy(itr); goto foundstate; @@ -340,7 +340,7 @@ no_cond: slurmdb_job->steps = list_create(slurmdb_destroy_step_rec); if (filetxt_job->steps) { itr = list_iterator_create(filetxt_job->steps); - while((filetxt_step = list_next(itr))) { + while ((filetxt_step = list_next(itr))) { slurmdb_step_rec_t *step = _slurmdb_create_step_rec(filetxt_step); if (step) { @@ -499,7 +499,7 @@ static filetxt_job_rec_t *_find_job_record(List job_list, filetxt_job_rec_t *job = NULL; ListIterator itr = list_iterator_create(job_list); - while((job = (filetxt_job_rec_t *)list_next(itr)) != NULL) { + while ((job = (filetxt_job_rec_t *)list_next(itr)) != NULL) { if (job->header.jobnum == header.jobnum) { if (job->header.job_submit == 0 && type == JOB_START) { list_remove(itr); @@ -541,7 +541,7 @@ static filetxt_step_rec_t *_find_step_record(filetxt_job_rec_t *job, return step; itr = list_iterator_create(job->steps); - while((step = (filetxt_step_rec_t *)list_next(itr)) != NULL) { + while ((step = (filetxt_step_rec_t *)list_next(itr)) != NULL) { if (step->stepnum == stepnum) break; } @@ -570,7 +570,7 @@ static int _parse_line(char *f[], void **data, int len) filetxt_header_t header; _parse_header(f, &header); - switch(i) { + switch (i) { case JOB_START: *job = _create_filetxt_job_rec(header); (*job)->jobname = xstrdup(f[F_JOBNAME]); @@ -975,7 +975,7 @@ extern List filetxt_jobacct_process_get_jobs(slurmdb_job_cond_t *job_cond) if (job_cond->userid_list && list_count(job_cond->userid_list)) { itr = list_iterator_create(job_cond->userid_list); - while((object = list_next(itr))) { + while ((object = list_next(itr))) { if (atoi(object) == uid) { list_iterator_destroy(itr); goto founduid; @@ -989,7 +989,7 @@ extern List filetxt_jobacct_process_get_jobs(slurmdb_job_cond_t *job_cond) if (job_cond->groupid_list && list_count(job_cond->groupid_list)) { itr = list_iterator_create(job_cond->groupid_list); - while((object = list_next(itr))) { + while ((object = list_next(itr))) { if (atoi(object) == gid) { list_iterator_destroy(itr); goto foundgid; @@ -1003,7 +1003,7 @@ extern List filetxt_jobacct_process_get_jobs(slurmdb_job_cond_t *job_cond) if ((rec_type == JOB_START) && job_cond->jobname_list && list_count(job_cond->jobname_list)) { itr = list_iterator_create(job_cond->jobname_list); - while((object = list_next(itr))) { + while ((object = list_next(itr))) { if (!xstrcasecmp(f[F_JOBNAME], object)) { list_iterator_destroy(itr); goto foundjobname; @@ -1017,7 +1017,7 @@ extern List filetxt_jobacct_process_get_jobs(slurmdb_job_cond_t *job_cond) if (job_cond->step_list && list_count(job_cond->step_list)) { itr = list_iterator_create(job_cond->step_list); - while((selected_step = list_next(itr))) { + while ((selected_step = list_next(itr))) { if (selected_step->jobid != job_id) continue; /* job matches; does the step? */ @@ -1042,7 +1042,7 @@ extern List filetxt_jobacct_process_get_jobs(slurmdb_job_cond_t *job_cond) if ((rec_type == JOB_START) && job_cond->partition_list && list_count(job_cond->partition_list)) { itr = list_iterator_create(job_cond->partition_list); - while((object = list_next(itr))) + while ((object = list_next(itr))) if (!xstrcasecmp(f[F_PARTITION], object)) { list_iterator_destroy(itr); goto foundp; @@ -1055,7 +1055,7 @@ extern List filetxt_jobacct_process_get_jobs(slurmdb_job_cond_t *job_cond) no_cond: /* Build suitable tables with all the data */ - switch(rec_type) { + switch (rec_type) { case JOB_START: if (i < F_JOB_ACCOUNT) { error("Bad data on a Job Start"); @@ -1101,14 +1101,14 @@ extern List filetxt_jobacct_process_get_jobs(slurmdb_job_cond_t *job_cond) itr = list_iterator_create(job_list); - while((filetxt_job = list_next(itr))) { + while ((filetxt_job = list_next(itr))) { slurmdb_job_rec_t *slurmdb_job = _slurmdb_create_job_rec(filetxt_job, job_cond); if (slurmdb_job) { slurmdb_job_rec_t *curr_job = NULL; if (itr2) { list_iterator_reset(itr2); - while((curr_job = list_next(itr2))) { + while ((curr_job = list_next(itr2))) { if (curr_job->jobid == slurmdb_job->jobid) { list_delete_item(itr2); @@ -1252,7 +1252,7 @@ extern int filetxt_jobacct_process_archive(slurmdb_archive_cond_t *arch_cond) && list_count(job_cond->partition_list)) { itr = list_iterator_create( job_cond->partition_list); - while((object = list_next(itr))) + while ((object = list_next(itr))) if (!xstrcasecmp(f[F_PARTITION], object)) break; @@ -1319,16 +1319,16 @@ extern int filetxt_jobacct_process_archive(slurmdb_archive_cond_t *arch_cond) /* if (params->opt_verbose > 2) { */ /* error("--- contents of exp_list ---"); */ /* itr = list_iterator_create(exp_list); */ -/* while((exp_rec = list_next(itr))) */ +/* while ((exp_rec = list_next(itr))) */ /* error("%d", exp_rec->job); */ /* error("---- end of exp_list ---"); */ /* list_iterator_destroy(itr); */ /* } */ /* write the expired file */ itr = list_iterator_create(exp_list); - while((exp_rec = list_next(itr))) { + while ((exp_rec = list_next(itr))) { itr2 = list_iterator_create(other_list); - while((exp_rec2 = list_next(itr2))) { + while ((exp_rec2 = list_next(itr2))) { if ((exp_rec2->job != exp_rec->job) || (exp_rec2->job_submit != exp_rec->job_submit)) continue; @@ -1355,9 +1355,9 @@ extern int filetxt_jobacct_process_archive(slurmdb_archive_cond_t *arch_cond) /* write the new log */ itr = list_iterator_create(keep_list); - while((exp_rec = list_next(itr))) { + while ((exp_rec = list_next(itr))) { itr2 = list_iterator_create(other_list); - while((exp_rec2 = list_next(itr2))) { + while ((exp_rec2 = list_next(itr2))) { if (exp_rec2->job != exp_rec->job) continue; if (fputs(exp_rec2->line, new_logfile)<0) { @@ -1380,7 +1380,7 @@ extern int filetxt_jobacct_process_archive(slurmdb_archive_cond_t *arch_cond) /* write records in other_list to new log */ itr = list_iterator_create(other_list); - while((exp_rec = list_next(itr))) { + while ((exp_rec = list_next(itr))) { if (fputs(exp_rec->line, new_logfile)<0) { perror("writing keep_logfile"); list_iterator_destroy(itr); diff --git a/src/plugins/accounting_storage/slurmdbd/accounting_storage_slurmdbd.c b/src/plugins/accounting_storage/slurmdbd/accounting_storage_slurmdbd.c index fa854c5adf0..9102f0496f6 100644 --- a/src/plugins/accounting_storage/slurmdbd/accounting_storage_slurmdbd.c +++ b/src/plugins/accounting_storage/slurmdbd/accounting_storage_slurmdbd.c @@ -2553,10 +2553,11 @@ extern int jobacct_storage_p_job_start(void *db_conn, */ if ((req.db_index && !IS_JOB_RESIZING(job_ptr)) || (!req.db_index && IS_JOB_FINISHED(job_ptr))) { - /* This is to ensure we don't do this multiple times for the - same job. This can happen when an account is being - deleted and hense the associations dealing with it. - */ + /* + * This is to ensure we don't do this multiple times for the + * same job. This can happen when an account is being + * deleted and hense the associations dealing with it. + */ if (!req.db_index) job_ptr->db_index = NO_VAL64; diff --git a/src/plugins/jobcomp/filetxt/filetxt_jobcomp_process.c b/src/plugins/jobcomp/filetxt/filetxt_jobcomp_process.c index 379893c8d2b..657ae341897 100644 --- a/src/plugins/jobcomp/filetxt/filetxt_jobcomp_process.c +++ b/src/plugins/jobcomp/filetxt/filetxt_jobcomp_process.c @@ -198,7 +198,7 @@ extern List filetxt_jobcomp_process_get_jobs(slurmdb_job_cond_t *job_cond) jobid = 0; partition = NULL; job_info_list = list_create(_destroy_filetxt_jobcomp_info); - while(fptr) { + while (fptr) { jobcomp_info = xmalloc(sizeof(filetxt_jobcomp_info_t)); list_append(job_info_list, jobcomp_info); @@ -233,7 +233,7 @@ extern List filetxt_jobcomp_process_get_jobs(slurmdb_job_cond_t *job_cond) if (!jobid) continue; itr = list_iterator_create(job_cond->step_list); - while((selected_step = list_next(itr))) { + while ((selected_step = list_next(itr))) { if (selected_step->jobid == jobid) continue; /* job matches */ @@ -250,7 +250,7 @@ extern List filetxt_jobcomp_process_get_jobs(slurmdb_job_cond_t *job_cond) if (!partition) continue; itr = list_iterator_create(job_cond->partition_list); - while((selected_part = list_next(itr))) + while ((selected_part = list_next(itr))) if (!xstrcasecmp(selected_part, partition)) { list_iterator_destroy(itr); goto foundp; diff --git a/src/plugins/jobcomp/mysql/mysql_jobcomp_process.c b/src/plugins/jobcomp/mysql/mysql_jobcomp_process.c index 8f9c92aa98c..04fdbc363e5 100644 --- a/src/plugins/jobcomp/mysql/mysql_jobcomp_process.c +++ b/src/plugins/jobcomp/mysql/mysql_jobcomp_process.c @@ -69,10 +69,10 @@ extern List mysql_jobcomp_process_get_jobs(slurmdb_job_cond_t *job_cond) set = 0; xstrcat(extra, " where ("); itr = list_iterator_create(job_cond->step_list); - while((selected_step = list_next(itr))) { + while ((selected_step = list_next(itr))) { if (set) xstrcat(extra, " || "); - tmp = xstrdup_printf("jobid=%d", + tmp = xstrdup_printf("jobid=%u", selected_step->jobid); xstrcat(extra, tmp); set = 1; @@ -90,7 +90,7 @@ extern List mysql_jobcomp_process_get_jobs(slurmdb_job_cond_t *job_cond) xstrcat(extra, " where ("); itr = list_iterator_create(job_cond->partition_list); - while((selected_part = list_next(itr))) { + while ((selected_part = list_next(itr))) { if (set) xstrcat(extra, " || "); tmp = xstrdup_printf("`partition`='%s'", @@ -104,7 +104,7 @@ extern List mysql_jobcomp_process_get_jobs(slurmdb_job_cond_t *job_cond) } i = 0; - while(jobcomp_table_fields[i].name) { + while (jobcomp_table_fields[i].name) { if (i) xstrcat(tmp, ", "); xstrfmtcat(tmp, "`%s`", jobcomp_table_fields[i].name); diff --git a/src/sacct/options.c b/src/sacct/options.c index 695e9db8c6b..376fd1a69ab 100644 --- a/src/sacct/options.c +++ b/src/sacct/options.c @@ -57,10 +57,10 @@ #define JOB_HASH_SIZE 1000 -void _help_fields_msg(void); -void _help_msg(void); -void _usage(void); -void _init_params(void); +static void _help_fields_msg(void); +static void _help_msg(void); +static void _init_params(void); +static void _usage(void); List selected_parts = NULL; List selected_steps = NULL; @@ -72,7 +72,7 @@ int field_count = 0; List g_qos_list = NULL; List g_tres_list = NULL; -List _build_cluster_list(slurmdb_federation_rec_t *fed) +static List _build_cluster_list(slurmdb_federation_rec_t *fed) { slurmdb_cluster_rec_t *cluster; ListIterator iter; @@ -87,7 +87,7 @@ List _build_cluster_list(slurmdb_federation_rec_t *fed) return cluster_list; } -void _help_fields_msg(void) +static void _help_fields_msg(void) { int i; @@ -147,7 +147,7 @@ static int _addto_id_char_list(List char_list, char *names, bool gid) i++; } start = i; - while(names[i]) { + while (names[i]) { //info("got %d - %d = %d", i, start, i-start); if (quote && names[i] == quote_c) break; @@ -160,7 +160,7 @@ static int _addto_id_char_list(List char_list, char *names, bool gid) //info("got %s %d", name, i-start); name = _convert_to_id( name, gid ); - while((tmp_char = list_next(itr))) { + while ((tmp_char = list_next(itr))) { if (!xstrcasecmp(tmp_char, name)) break; @@ -189,7 +189,7 @@ static int _addto_id_char_list(List char_list, char *names, bool gid) memcpy(name, names+start, (i-start)); name = _convert_to_id(name, gid); - while((tmp_char = list_next(itr))) { + while ((tmp_char = list_next(itr))) { if (!xstrcasecmp(tmp_char, name)) break; } @@ -246,7 +246,7 @@ static int _addto_state_char_list(List char_list, char *names) xfree(name); name = xstrdup_printf("%d", c); - while((tmp_char = list_next(itr))) { + while ((tmp_char = list_next(itr))) { if (!xstrcasecmp(tmp_char, name)) break; @@ -295,7 +295,7 @@ static int _addto_state_char_list(List char_list, char *names) return count; } -void _help_msg(void) +static void _help_msg(void) { printf("\ sacct [<OPTION>] \n \ @@ -440,12 +440,12 @@ sacct [<OPTION>] \n \ return; } -void _usage(void) +static void _usage(void) { printf("Usage: sacct [options]\n\tUse --help for help\n"); } -void _init_params(void) +static void _init_params(void) { memset(¶ms, 0, sizeof(sacct_parameters_t)); params.job_cond = xmalloc(sizeof(slurmdb_job_cond_t)); @@ -506,7 +506,7 @@ static void _remove_duplicate_fed_jobs(List jobs) list_sort(jobs, _sort_asc_submit_time); itr = list_iterator_create(jobs); - while((job = list_next(itr))) { + while ((job = list_next(itr))) { found = false; hash_inx = job->jobid % JOB_HASH_SIZE; @@ -547,7 +547,7 @@ static void _remove_duplicate_fed_jobs(List jobs) xfree(hash_job); } -int get_data(void) +extern int get_data(void) { slurmdb_job_rec_t *job = NULL; slurmdb_step_rec_t *step = NULL; @@ -573,7 +573,7 @@ int get_data(void) _remove_duplicate_fed_jobs(jobs); itr = list_iterator_create(jobs); - while((job = list_next(itr))) { + while ((job = list_next(itr))) { if (job->user) { struct passwd *pw = NULL; @@ -585,7 +585,7 @@ int get_data(void) continue; itr_step = list_iterator_create(job->steps); - while((step = list_next(itr_step)) != NULL) { + while ((step = list_next(itr_step)) != NULL) { /* now aggregate the aggregatable */ if (step->state < JOB_COMPLETE) @@ -611,7 +611,7 @@ int get_data(void) return SLURM_SUCCESS; } -void parse_command_line(int argc, char **argv) +extern void parse_command_line(int argc, char **argv) { extern int optind; int c, i, optionIndex = 0; @@ -1122,7 +1122,7 @@ void parse_command_line(int argc, char **argv) if (job_cond->groupid_list && list_count(job_cond->groupid_list)) { debug2("Groupids requested:"); itr = list_iterator_create(job_cond->groupid_list); - while((start = list_next(itr))) + while ((start = list_next(itr))) debug2("\t: %s", start); list_iterator_destroy(itr); } @@ -1131,7 +1131,7 @@ void parse_command_line(int argc, char **argv) if (job_cond->partition_list && list_count(job_cond->partition_list)) { debug2("Partitions requested:"); itr = list_iterator_create(job_cond->partition_list); - while((start = list_next(itr))) + while ((start = list_next(itr))) debug2("\t: %s", start); list_iterator_destroy(itr); } @@ -1147,7 +1147,7 @@ void parse_command_line(int argc, char **argv) if (job_cond->step_list && list_count(job_cond->step_list)) { debug2("Jobs requested:"); itr = list_iterator_create(job_cond->step_list); - while((selected_step = list_next(itr))) { + while ((selected_step = list_next(itr))) { char id[FORMAT_STRING_SIZE]; debug2("\t: %s", slurmdb_get_selected_step_id( @@ -1160,7 +1160,7 @@ void parse_command_line(int argc, char **argv) if (job_cond->state_list && list_count(job_cond->state_list)) { debug2("States requested:"); itr = list_iterator_create(job_cond->state_list); - while((start = list_next(itr))) { + while ((start = list_next(itr))) { debug2("\t: %s", job_state_string(atoi(start))); } @@ -1170,7 +1170,7 @@ void parse_command_line(int argc, char **argv) if (job_cond->wckey_list && list_count(job_cond->wckey_list)) { debug2("Wckeys requested:"); itr = list_iterator_create(job_cond->wckey_list); - while((start = list_next(itr))) + while ((start = list_next(itr))) debug2("\t: %s\n", start); list_iterator_destroy(itr); } @@ -1192,7 +1192,7 @@ void parse_command_line(int argc, char **argv) if (job_cond->jobname_list && list_count(job_cond->jobname_list)) { debug2("Jobnames requested:"); itr = list_iterator_create(job_cond->jobname_list); - while((start = list_next(itr))) { + while ((start = list_next(itr))) { debug2("\t: %s", start); } list_iterator_destroy(itr); @@ -1284,7 +1284,7 @@ void parse_command_line(int argc, char **argv) return; } -void do_help(void) +extern void do_help(void) { switch (params.opt_help) { case 1: @@ -1319,7 +1319,7 @@ static inline bool _test_local_job(uint32_t job_id) * At this point, we have already selected the desired data, * so we just need to print it for the user. */ -void do_list(void) +extern void do_list(void) { ListIterator itr = NULL; ListIterator itr_step = NULL; @@ -1373,7 +1373,7 @@ void do_list(void) * At this point, we have already selected the desired data, * so we just need to print it for the user. */ -void do_list_completion(void) +extern void do_list_completion(void) { ListIterator itr = NULL; jobcomp_job_rec_t *job = NULL; @@ -1388,14 +1388,14 @@ void do_list_completion(void) list_iterator_destroy(itr); } -void sacct_init(void) +extern void sacct_init(void) { _init_params(); print_fields_list = list_create(NULL); print_fields_itr = list_iterator_create(print_fields_list); } -void sacct_fini(void) +extern void sacct_fini(void) { if (print_fields_itr) list_iterator_destroy(print_fields_itr); diff --git a/src/sacct/print.c b/src/sacct/print.c index e8ba9371e62..f5d0bfc4875 100644 --- a/src/sacct/print.c +++ b/src/sacct/print.c @@ -196,9 +196,8 @@ static void _xlate_task_str(slurmdb_job_rec_t *job_ptr) job_ptr->array_task_str = out_buf; } -void print_fields(type_t type, void *object) +extern void print_fields(type_t type, void *object) { - slurmdb_job_rec_t *job = (slurmdb_job_rec_t *)object; slurmdb_step_rec_t *step = (slurmdb_step_rec_t *)object; jobcomp_job_rec_t *job_comp = (jobcomp_job_rec_t *)object; @@ -222,10 +221,11 @@ void print_fields(type_t type, void *object) step = NULL; 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. - */ + /* + * set this to avoid printing out info for things that + * don't mean anything. Like an allocation that never + * ran anything. + */ if (!step) job->track_steps = 1; else @@ -275,7 +275,7 @@ void print_fields(type_t type, void *object) step_cpu_tres_rec_count = 0; list_iterator_reset(print_fields_itr); - while((field = list_next(print_fields_itr))) { + while ((field = list_next(print_fields_itr))) { char *tmp_char = NULL, id[FORMAT_STRING_SIZE]; int exit_code, tmp_int = NO_VAL, tmp_int2 = NO_VAL; double tmp_dub = (double)NO_VAL; /* don't use NO_VAL64 @@ -287,7 +287,7 @@ void print_fields(type_t type, void *object) uint64_t tmp_uint64 = NO_VAL64; memset(&outbuf, 0, sizeof(outbuf)); - switch(field->type) { + switch (field->type) { case PRINT_ALLOC_CPUS: switch(type) { case JOB: diff --git a/src/sstat/options.c b/src/sstat/options.c index 9a888b18565..0ebe96165a3 100644 --- a/src/sstat/options.c +++ b/src/sstat/options.c @@ -143,7 +143,7 @@ void _init_params() /* returns number of objects added to list */ static int _addto_job_list(List job_list, char *names) { - int i=0, start=0; + int i = 0, start = 0; char *name = NULL, *dot = NULL; slurmdb_selected_step_t *selected_step = NULL; slurmdb_selected_step_t *curr_step = NULL; -- GitLab