From 1a0dc71c0265808f05d383dbd9bac8201b22fb1d Mon Sep 17 00:00:00 2001 From: jce <jce@unknown> Date: Fri, 28 Jun 2002 00:58:40 +0000 Subject: [PATCH] Changed slurm_allocate_resources to accept a ** instead of a *. --- src/api/allocate.c | 21 ++++++++++----------- src/api/slurm.h | 4 ++-- 2 files changed, 12 insertions(+), 13 deletions(-) diff --git a/src/api/allocate.c b/src/api/allocate.c index 2156afae88a..ab03a8e0254 100644 --- a/src/api/allocate.c +++ b/src/api/allocate.c @@ -20,7 +20,7 @@ /* slurm_allocate_resources - allocated resources for a job request */ int -slurm_allocate_resources (job_desc_msg_t * job_desc_msg , resource_allocation_response_msg_t * job_alloc_resp_msg, int immediate ) +slurm_allocate_resources (job_desc_msg_t * job_desc_msg , resource_allocation_response_msg_t ** slurm_alloc_msg, int immediate ) { int msg_size ; int rc ; @@ -28,7 +28,6 @@ slurm_allocate_resources (job_desc_msg_t * job_desc_msg , resource_allocation_re slurm_msg_t request_msg ; slurm_msg_t response_msg ; return_code_msg_t * slurm_rc_msg ; - resource_allocation_response_msg_t * slurm_alloc_msg; /* init message connection for message communication with controller */ if ( ( sockfd = slurm_open_controller_conn ( ) ) == SLURM_SOCKET_ERROR ) @@ -62,13 +61,15 @@ slurm_allocate_resources (job_desc_msg_t * job_desc_msg , resource_allocation_re { case RESPONSE_SLURM_RC: slurm_rc_msg = ( return_code_msg_t * ) response_msg . data ; - return (int) slurm_rc_msg->return_code; + rc = slurm_rc_msg->return_code; + slurm_free_return_code_msg( slurm_rc_msg ); + return rc; break ; case RESPONSE_RESOURCE_ALLOCATION: case RESPONSE_IMMEDIATE_RESOURCE_ALLOCATION: - slurm_alloc_msg = ( resource_allocation_response_msg_t * ) response_msg . data ; - job_desc_msg->job_id = slurm_alloc_msg->job_id; - return 0; + /* Calling methos is responsible to free this memory */ + *slurm_alloc_msg = ( resource_allocation_response_msg_t * ) response_msg . data ; + return SLURM_SUCCESS; break ; default: return SLURM_UNEXPECTED_MSG_ERROR ; @@ -78,7 +79,7 @@ slurm_allocate_resources (job_desc_msg_t * job_desc_msg , resource_allocation_re return SLURM_SUCCESS ; } -int slurm_job_will_run (job_desc_msg_t * job_desc_msg , resource_allocation_response_msg_t * job_alloc_resp_msg ) +int slurm_job_will_run (job_desc_msg_t * job_desc_msg , resource_allocation_response_msg_t ** slurm_alloc_msg) { int msg_size ; int rc ; @@ -86,7 +87,6 @@ int slurm_job_will_run (job_desc_msg_t * job_desc_msg , resource_allocation_resp slurm_msg_t request_msg ; slurm_msg_t response_msg ; return_code_msg_t * slurm_rc_msg ; - resource_allocation_response_msg_t * slurm_alloc_msg; /* init message connection for message communication with controller */ if ( ( sockfd = slurm_open_controller_conn ( ) ) == SLURM_SOCKET_ERROR ) @@ -113,9 +113,8 @@ int slurm_job_will_run (job_desc_msg_t * job_desc_msg , resource_allocation_resp return (int) slurm_rc_msg->return_code; break ; case RESPONSE_JOB_WILL_RUN: - slurm_alloc_msg = ( resource_allocation_response_msg_t * ) response_msg . data ; - job_desc_msg->job_id = slurm_alloc_msg->job_id; - return 0; + *slurm_alloc_msg = ( resource_allocation_response_msg_t * ) response_msg . data ; + return SLURM_SUCCESS; break ; default: return SLURM_UNEXPECTED_MSG_ERROR ; diff --git a/src/api/slurm.h b/src/api/slurm.h index 59251163302..c6db2d00fce 100644 --- a/src/api/slurm.h +++ b/src/api/slurm.h @@ -75,7 +75,7 @@ enum node_states { * TotalProcs=<count> * NOTE: the calling function must free the allocated storage at node_list[0] */ -extern int slurm_allocate_resources (job_desc_msg_t * job_desc_msg , resource_allocation_response_msg_t * job_alloc_resp_msg, int immediate ) ; +extern int slurm_allocate_resources (job_desc_msg_t * job_desc_msg , resource_allocation_response_msg_t ** job_alloc_resp_msg, int immediate ) ; /* * slurm_cancel - cancel the specified job @@ -208,7 +208,7 @@ extern int slurm_submit_batch_job (job_desc_msg_t * job_desc_msg ); * Shared=<YES|NO> TimeLimit=<minutes> TotalNodes=<count> * TotalProcs=<count> */ -extern int slurm_will_run (char *spec); +extern int slurm_job_will_run (job_desc_msg_t * job_desc_msg , resource_allocation_response_msg_t ** job_alloc_resp_msg ); /* * parse_node_name - parse the node name for regular expressions and return a sprintf format -- GitLab