From 9d0c2a4ac74f31beca5da10e968ed8fcd84d56ba Mon Sep 17 00:00:00 2001 From: Danny Auble <da@schedmd.com> Date: Tue, 10 Dec 2013 14:39:25 -0800 Subject: [PATCH] Remove unneeded function from the switch plugin --- src/common/switch.c | 10 ----- src/common/switch.h | 7 ---- src/plugins/switch/cray/switch_cray.c | 40 ------------------ src/plugins/switch/generic/switch_generic.c | 39 ----------------- src/plugins/switch/none/switch_none.c | 5 --- src/plugins/switch/nrt/nrt.c | 46 --------------------- src/plugins/switch/nrt/slurm_nrt.h | 1 - src/plugins/switch/nrt/switch_nrt.c | 14 ------- 8 files changed, 162 deletions(-) diff --git a/src/common/switch.c b/src/common/switch.c index 7d234dfdc9f..2bc592a5953 100644 --- a/src/common/switch.c +++ b/src/common/switch.c @@ -65,7 +65,6 @@ typedef struct slurm_switch_ops { int (*build_jobinfo) ( switch_jobinfo_t *jobinfo, slurm_step_layout_t *step_layout, char *network); - switch_jobinfo_t *(*copy_jobinfo) ( switch_jobinfo_t *jobinfo ); void (*free_jobinfo) ( switch_jobinfo_t *jobinfo ); int (*pack_jobinfo) ( switch_jobinfo_t *jobinfo, Buf buffer, @@ -140,7 +139,6 @@ static const char *syms[] = { "switch_p_libstate_restore", "switch_p_alloc_jobinfo", "switch_p_build_jobinfo", - "switch_p_copy_jobinfo", "switch_p_free_jobinfo", "switch_p_pack_jobinfo", "switch_p_unpack_jobinfo", @@ -280,14 +278,6 @@ extern int switch_g_build_jobinfo(switch_jobinfo_t *jobinfo, return (*(ops.build_jobinfo))( jobinfo, step_layout, network ); } -extern switch_jobinfo_t *switch_g_copy_jobinfo(switch_jobinfo_t *jobinfo) -{ - if ( switch_init() < 0 ) - return NULL; - - return (*(ops.copy_jobinfo))( jobinfo ); -} - extern void switch_g_free_jobinfo(switch_jobinfo_t *jobinfo) { if ( switch_init() < 0 ) diff --git a/src/common/switch.h b/src/common/switch.h index abf45579ef2..baad58d2eeb 100644 --- a/src/common/switch.h +++ b/src/common/switch.h @@ -132,13 +132,6 @@ extern int switch_g_build_jobinfo(switch_jobinfo_t *jobinfo, slurm_step_layout_t *step_layout, char *network); -/* copy a switch job credential - * IN jobinfo - the switch job credential to be copied - * RET - the copy - * NOTE: returned value must be freed using g_switch_g_free_jobinfo - */ -extern switch_jobinfo_t *switch_g_copy_jobinfo(switch_jobinfo_t *jobinfo); - /* free storage previously allocated for a switch job credential * IN jobinfo - the switch job credential to be freed */ diff --git a/src/plugins/switch/cray/switch_cray.c b/src/plugins/switch/cray/switch_cray.c index 92d51f5060c..cbc9a1b51d5 100644 --- a/src/plugins/switch/cray/switch_cray.c +++ b/src/plugins/switch/cray/switch_cray.c @@ -434,46 +434,6 @@ int switch_p_build_jobinfo(switch_jobinfo_t *switch_job, return SLURM_SUCCESS; } -switch_jobinfo_t *switch_p_copy_jobinfo(switch_jobinfo_t *switch_job) -{ - int i; - slurm_cray_jobinfo_t *old = (slurm_cray_jobinfo_t *) switch_job; - switch_jobinfo_t *new_init; - slurm_cray_jobinfo_t *new; - size_t sz; - - if (!old || (old->magic == CRAY_NULL_JOBINFO_MAGIC)) { - debug2("(%s: %d: %s) switch_job was NULL", THIS_FILE, __LINE__, - __FUNCTION__); - return NULL; - } - xassert(((slurm_cray_jobinfo_t *)switch_job)->magic - == CRAY_JOBINFO_MAGIC); - - if (switch_p_alloc_jobinfo(&new_init, old->jobid, old->stepid)) { - error("Allocating new jobinfo"); - slurm_seterrno(ENOMEM); - return NULL ; - } - - new = (slurm_cray_jobinfo_t *) new_init; - // Copy over non-malloced memory. - *new = *old; - - new->cookies = (char **) xmalloc(old->num_cookies * sizeof(char **)); - for (i = 0; i < old->num_cookies; i++) { - new->cookies[i] = xstrdup(old->cookies[i]); - } - - sz = sizeof(*(new->cookie_ids)); - new->cookie_ids = xmalloc(old->num_cookies * sz); - memcpy(new->cookie_ids, old->cookie_ids, old->num_cookies * sz); - - new->step_layout = slurm_step_layout_copy(old->step_layout); - - return (switch_jobinfo_t *) new; -} - /* * */ diff --git a/src/plugins/switch/generic/switch_generic.c b/src/plugins/switch/generic/switch_generic.c index e39bd086e07..a7bcfce1a22 100644 --- a/src/plugins/switch/generic/switch_generic.c +++ b/src/plugins/switch/generic/switch_generic.c @@ -438,45 +438,6 @@ int switch_p_build_jobinfo(switch_jobinfo_t *switch_job, return SLURM_SUCCESS; } -switch_jobinfo_t *switch_p_copy_jobinfo(switch_jobinfo_t *switch_job) -{ - sw_gen_step_info_t *old_step_info = (sw_gen_step_info_t *) switch_job; - sw_gen_step_info_t *new_step_info; - sw_gen_node_t *old_node_ptr, *new_node_ptr; - sw_gen_ifa_t *old_ifa_ptr, *new_ifa_ptr; - int i, j; - - if (debug_flags & DEBUG_FLAG_SWITCH) - info("switch_p_copy_jobinfo() starting"); - xassert(old_step_info); - xassert(old_step_info->magic == SW_GEN_STEP_INFO_MAGIC); - new_step_info = xmalloc(sizeof(sw_gen_step_info_t)); - new_step_info->magic = SW_GEN_STEP_INFO_MAGIC; - new_step_info->node_cnt = old_step_info->node_cnt; - new_step_info->node_array = xmalloc(sizeof(sw_gen_node_t *) * - new_step_info->node_cnt); - for (i = 0; i < old_step_info->node_cnt; i++) { - old_node_ptr = old_step_info->node_array[i]; - new_node_ptr = xmalloc(sizeof(sw_gen_node_t)); - new_step_info->node_array[i] = new_node_ptr; - new_node_ptr->node_name = xstrdup(old_node_ptr->node_name); - new_node_ptr->ifa_cnt = old_node_ptr->ifa_cnt; - new_node_ptr->ifa_array = xmalloc(sizeof(sw_gen_node_t *) * - new_node_ptr->ifa_cnt); - for (j = 0; j < old_node_ptr->ifa_cnt; j++) { - old_ifa_ptr = old_node_ptr->ifa_array[j]; - new_ifa_ptr = xmalloc(sizeof(sw_gen_node_t)); - new_node_ptr->ifa_array[j] = new_ifa_ptr; - new_ifa_ptr->ifa_addr = xstrdup(old_ifa_ptr->ifa_addr); - new_ifa_ptr->ifa_family = xstrdup(old_ifa_ptr-> - ifa_family); - new_ifa_ptr->ifa_name = xstrdup(old_ifa_ptr->ifa_name); - } - } - - return NULL; -} - void switch_p_free_jobinfo(switch_jobinfo_t *switch_job) { sw_gen_step_info_t *gen_step_info = (sw_gen_step_info_t *) switch_job; diff --git a/src/plugins/switch/none/switch_none.c b/src/plugins/switch/none/switch_none.c index f46fb774afe..d6bc2d2f2bc 100644 --- a/src/plugins/switch/none/switch_none.c +++ b/src/plugins/switch/none/switch_none.c @@ -132,11 +132,6 @@ int switch_p_build_jobinfo ( switch_jobinfo_t *switch_job, return SLURM_SUCCESS; } -switch_jobinfo_t *switch_p_copy_jobinfo ( switch_jobinfo_t *switch_job ) -{ - return NULL; -} - void switch_p_free_jobinfo ( switch_jobinfo_t *switch_job ) { return; diff --git a/src/plugins/switch/nrt/nrt.c b/src/plugins/switch/nrt/nrt.c index 14750c2057a..b3a8c82bb9e 100644 --- a/src/plugins/switch/nrt/nrt.c +++ b/src/plugins/switch/nrt/nrt.c @@ -3477,52 +3477,6 @@ unpack_error: return SLURM_ERROR; } -/* Used by: all */ -extern slurm_nrt_jobinfo_t * -nrt_copy_jobinfo(slurm_nrt_jobinfo_t *job) -{ - slurm_nrt_jobinfo_t *new; - int i; - int base_size = 0, table_size; - - xassert(job); - xassert(job->magic == NRT_JOBINFO_MAGIC); - - if (nrt_alloc_jobinfo(&new)) { - error("Allocating new jobinfo"); - slurm_seterrno(ENOMEM); - return NULL; - } - memcpy(new, job, sizeof(slurm_nrt_jobinfo_t)); - - new->tableinfo = (nrt_tableinfo_t *) xmalloc(job->tables_per_task * - sizeof(nrt_table_info_t)); - for (i = 0; i < job->tables_per_task; i++) { - if (!job->user_space || - (job->tableinfo->adapter_type == NRT_IPONLY)) { - base_size = sizeof(nrt_ip_task_info_t); - } else if (job->tableinfo->adapter_type == NRT_IB) { - base_size = sizeof(nrt_ib_task_info_t); - } else if (job->tableinfo->adapter_type == NRT_HFI) { - base_size = sizeof(nrt_hfi_task_info_t); - } else if ((job->tableinfo->adapter_type == NRT_HPCE) || - (job->tableinfo->adapter_type == NRT_KMUX)) { - base_size = sizeof(nrt_hpce_task_info_t); - } else { - error("nrt_copy_jobinfo: Missing support for adapter " - "type %s", - _adapter_type_str(job->tableinfo->adapter_type)); - } - new->tableinfo[i].table_length = job->tableinfo[i].table_length; - table_size = base_size * job->tableinfo[i].table_length; - new->tableinfo->table = xmalloc(table_size); - memcpy(new->tableinfo[i].table, job->tableinfo[i].table, - table_size); - } - - return new; -} - /* Used by: all */ extern void nrt_free_jobinfo(slurm_nrt_jobinfo_t *jp) diff --git a/src/plugins/switch/nrt/slurm_nrt.h b/src/plugins/switch/nrt/slurm_nrt.h index 9b0f345736a..7d83764d36c 100644 --- a/src/plugins/switch/nrt/slurm_nrt.h +++ b/src/plugins/switch/nrt/slurm_nrt.h @@ -110,7 +110,6 @@ extern int nrt_pack_jobinfo(slurm_nrt_jobinfo_t *jp, Buf buf, uint16_t protocol_version); extern int nrt_unpack_jobinfo(slurm_nrt_jobinfo_t *jp, Buf buf, uint16_t protocol_version); -extern slurm_nrt_jobinfo_t *nrt_copy_jobinfo(slurm_nrt_jobinfo_t *jp); extern void nrt_free_jobinfo(slurm_nrt_jobinfo_t *jp); extern int nrt_load_table(slurm_nrt_jobinfo_t *jp, int uid, int pid, char *job_name); diff --git a/src/plugins/switch/nrt/switch_nrt.c b/src/plugins/switch/nrt/switch_nrt.c index c0b23fd421b..f77816b8333 100644 --- a/src/plugins/switch/nrt/switch_nrt.c +++ b/src/plugins/switch/nrt/switch_nrt.c @@ -668,20 +668,6 @@ extern int switch_p_build_jobinfo(switch_jobinfo_t *switch_job, return err; } -extern switch_jobinfo_t *switch_p_copy_jobinfo(switch_jobinfo_t *switch_job) -{ - switch_jobinfo_t *j; - - if (debug_flags & DEBUG_FLAG_SWITCH) - info("switch_p_copy_jobinfo()"); - - j = (switch_jobinfo_t *)nrt_copy_jobinfo((slurm_nrt_jobinfo_t *)switch_job); - if (!j) - error("nrt_copy_jobinfo failed"); - - return j; -} - extern void switch_p_free_jobinfo(switch_jobinfo_t *switch_job) { if (debug_flags & DEBUG_FLAG_SWITCH) -- GitLab