From 30ecfdb328ff0862f882e096501ea76957ea1dbf Mon Sep 17 00:00:00 2001
From: tewk <tewk@unknown>
Date: Mon, 22 Jul 2002 22:13:40 +0000
Subject: [PATCH] changed %s/launch_tasks_msg_t/launch_tasks_request_msg_t/g

---
 src/common/slurm_protocol_defs.c              | 13 +++++-
 src/common/slurm_protocol_defs.h              | 13 ++++--
 src/common/slurm_protocol_pack.c              | 46 +++++++++++++++----
 src/common/slurm_protocol_pack.h              |  7 ++-
 src/slurmd/slurmd.c                           |  4 +-
 src/slurmd/task_mgr.c                         | 12 ++---
 src/slurmd/task_mgr.h                         |  4 +-
 .../slurm_unit/slurmd/task_launch-test.c      |  2 +-
 testsuite/slurm_unit/slurmd/task_mgr-test.c   |  2 +-
 9 files changed, 76 insertions(+), 27 deletions(-)

diff --git a/src/common/slurm_protocol_defs.c b/src/common/slurm_protocol_defs.c
index 6cb3c0cb6a4..ffb18810546 100644
--- a/src/common/slurm_protocol_defs.c
+++ b/src/common/slurm_protocol_defs.c
@@ -311,7 +311,18 @@ void slurm_free_job_step_create_response_msg ( job_step_create_response_msg_t *
 
 }
 
-void slurm_free_launch_tasks_msg ( launch_tasks_msg_t * msg )
+void slurm_free_launch_tasks_response_msg ( launch_tasks_response_msg_t * msg )
+{
+	int i ;
+	if ( msg )
+	{
+		if ( msg -> node_name )
+			xfree ( msg -> node_name );
+		xfree ( msg ) ;
+	}
+} 
+
+void slurm_free_launch_tasks_request_msg ( launch_tasks_request_msg_t * msg )
 {
 	int i ;
 	if ( msg )
diff --git a/src/common/slurm_protocol_defs.h b/src/common/slurm_protocol_defs.h
index cb263ff08b6..71490397663 100644
--- a/src/common/slurm_protocol_defs.h
+++ b/src/common/slurm_protocol_defs.h
@@ -249,7 +249,7 @@ typedef struct job_step_create_response_msg
 	
 } job_step_create_response_msg_t; 
 
-typedef struct launch_tasks_msg
+typedef struct launch_tasks_request_msg
 {
 	uint32_t job_id ;
 	uint32_t job_step_id ;
@@ -263,7 +263,13 @@ typedef struct launch_tasks_msg
 	slurm_addr response_addr ;
 	slurm_addr * streams;
 	uint32_t * global_task_ids;
-} launch_tasks_msg_t ;
+} launch_tasks_request_msg_t ;
+
+typedef struct launch_tasks_response_msg
+{
+	uint32_t return_code;
+	char * node_name ;
+} launch_tasks_response_msg_t ;
 
 typedef struct reattach_tasks_streams_msg
 {
@@ -470,7 +476,8 @@ void inline slurm_free_update_node_msg ( update_node_msg_t * msg ) ;
 void inline slurm_free_update_part_msg ( update_part_msg_t * msg ) ;
 void inline slurm_free_job_step_create_request_msg ( job_step_create_request_msg_t * msg );
 void inline slurm_free_job_step_create_response_msg ( job_step_create_response_msg_t * msg );
-void inline slurm_free_launch_tasks_msg ( launch_tasks_msg_t * msg ) ;
+void inline slurm_free_launch_tasks_request_msg ( launch_tasks_request_msg_t * msg ) ;
+void inline slurm_free_launch_tasks_response_msg ( launch_tasks_response_msg_t * msg ) ;
 void inline slurm_free_kill_tasks_msg ( kill_tasks_msg_t * msg ) ;
 
 extern char *job_dist_string(uint16_t inx);
diff --git a/src/common/slurm_protocol_pack.c b/src/common/slurm_protocol_pack.c
index ae0f7873ff0..32513a717dd 100644
--- a/src/common/slurm_protocol_pack.c
+++ b/src/common/slurm_protocol_pack.c
@@ -156,7 +156,7 @@ int pack_msg ( slurm_msg_t const * msg , char ** buffer , uint32_t * buf_len )
 			pack_reattach_tasks_streams_msg ( ( reattach_tasks_streams_msg_t * ) msg->data , ( void ** ) buffer , buf_len ) ;
 			break ;
 		case REQUEST_LAUNCH_TASKS :
-			pack_launch_tasks_msg ( ( launch_tasks_msg_t * ) msg->data , ( void ** ) buffer , buf_len ) ;
+			pack_launch_tasks_request_msg ( ( launch_tasks_request_msg_t * ) msg->data , ( void ** ) buffer , buf_len ) ;
 			break ;
 		case REQUEST_KILL_TASKS :
 			pack_cancel_tasks_msg ( ( kill_tasks_msg_t * ) msg->data , ( void ** ) buffer , buf_len ) ;
@@ -285,7 +285,7 @@ int unpack_msg ( slurm_msg_t * msg , char ** buffer , uint32_t * buf_len )
 				( void ** ) buffer ,  buf_len ) ;
 			break ;
 		case REQUEST_LAUNCH_TASKS :
-			unpack_launch_tasks_msg ( ( launch_tasks_msg_t ** ) & ( msg->data ) , 
+			unpack_launch_tasks_request_msg ( ( launch_tasks_request_msg_t ** ) & ( msg->data ) , 
 				( void ** ) buffer , buf_len ) ;
 			break ; 
 		case REQUEST_REATTACH_TASKS_STREAMS :
@@ -1098,7 +1098,7 @@ int unpack_reattach_tasks_streams_msg ( reattach_tasks_streams_msg_t ** msg_ptr
 	uint16_t uint16_tmp;
 	reattach_tasks_streams_msg_t * msg ;
 
-	msg = xmalloc ( sizeof ( job_desc_msg_t ) ) ;
+	msg = xmalloc ( sizeof ( reattach_tasks_streams_msg_t ) ) ;
 	if (msg == NULL) 
 	{
 		*msg_ptr = NULL ;
@@ -1116,7 +1116,31 @@ int unpack_reattach_tasks_streams_msg ( reattach_tasks_streams_msg_t ** msg_ptr
 	return 0 ;
 }
 
-void pack_launch_tasks_msg ( launch_tasks_msg_t * msg , void ** buffer , uint32_t * length )
+void pack_launch_tasks_response_msg ( launch_tasks_response_msg_t * msg , void ** buffer , uint32_t * length )
+{
+	pack32 ( msg -> return_code , buffer , length ) ;
+	packstr ( msg -> node_name , buffer , length ) ;
+}
+
+int unpack_launch_tasks_msg ( launch_tasks_response_msg_t ** msg_ptr , void ** buffer , uint32_t * length )
+{
+	uint16_t uint16_tmp;
+	launch_tasks_response_msg_t * msg ;
+
+	msg = xmalloc ( sizeof ( launch_tasks_response_msg_t ) ) ;
+	if (msg == NULL) 
+	{
+		*msg_ptr = NULL ;
+		return ENOMEM ;
+	}
+
+	unpack32 ( & msg -> return_code , buffer , length ) ;
+	unpackstr_xmalloc ( & msg -> node_name , & uint16_tmp , buffer , length ) ;
+	*msg_ptr = msg ;
+	return 0 ;
+}
+
+void pack_launch_tasks_request_msg ( launch_tasks_request_msg_t * msg , void ** buffer , uint32_t * length )
 {
 	pack32 ( msg -> job_id , buffer , length ) ;
 	pack32 ( msg -> job_step_id , buffer , length ) ;
@@ -1131,12 +1155,12 @@ void pack_launch_tasks_msg ( launch_tasks_msg_t * msg , void ** buffer , uint32_
 	pack32_array ( msg -> global_task_ids , ( uint16_t ) msg -> tasks_to_launch , buffer , length ) ;
 }
 
-int unpack_launch_tasks_msg ( launch_tasks_msg_t ** msg_ptr , void ** buffer , uint32_t * length )
+int unpack_launch_tasks_request_msg ( launch_tasks_request_msg_t ** msg_ptr , void ** buffer , uint32_t * length )
 {
 	uint16_t uint16_tmp;
-	launch_tasks_msg_t * msg ;
+	launch_tasks_request_msg_t * msg ;
 
-	msg = xmalloc ( sizeof ( job_desc_msg_t ) ) ;
+	msg = xmalloc ( sizeof ( launch_tasks_request_msg_t ) ) ;
 	if (msg == NULL) 
 	{
 		*msg_ptr = NULL ;
@@ -1169,7 +1193,7 @@ int unpack_cancel_tasks_msg ( kill_tasks_msg_t ** msg_ptr , void ** buffer , uin
 {
 	kill_tasks_msg_t * msg ;
 
-	msg = xmalloc ( sizeof ( job_desc_msg_t ) ) ;
+	msg = xmalloc ( sizeof ( kill_tasks_msg_t ) ) ;
 	if ( msg == NULL) 
 	{
 		*msg_ptr = NULL ;
@@ -1209,6 +1233,8 @@ int unpack_cancel_job_step_msg ( job_step_id_msg_t ** msg_ptr , void ** buffer ,
 /* template 
 void pack_ ( * msg , void ** buffer , uint32_t * length )
 {
+	assert ( msg != NULL );
+
 	pack16 ( msg -> , buffer , length ) ;
 	pack32 ( msg -> , buffer , length ) ;
 	packstr ( msg -> , buffer , length ) ;
@@ -1219,7 +1245,9 @@ void unpack_ ( ** msg_ptr , void ** buffer , uint32_t * length )
 	uint16_t uint16_tmp;
 	* msg ;
 
-	msg = xmalloc ( sizeof ( job_desc_msg_t ) ) ;
+	assert ( msg_ptr != NULL );
+
+	msg = xmalloc ( sizeof ( ) ) ;
 	if (msg == NULL) 
 	{
 		*msg_ptr = NULL ;
diff --git a/src/common/slurm_protocol_pack.h b/src/common/slurm_protocol_pack.h
index 29da1d961b5..0ef94d65409 100644
--- a/src/common/slurm_protocol_pack.h
+++ b/src/common/slurm_protocol_pack.h
@@ -90,8 +90,11 @@ int unpack_partition_table_msg ( partition_desc_msg_t **  msg_ptr , void ** buff
 void pack_update_partition_msg ( update_part_msg_t * msg , void ** buffer, uint32_t * length  );
 int unpack_update_partition_msg ( update_part_msg_t ** msg_ptr , void ** buffer, uint32_t * length  );
 
-void pack_launch_tasks_msg ( launch_tasks_msg_t * msg , void ** buffer , uint32_t * length );
-int unpack_launch_tasks_msg ( launch_tasks_msg_t ** msg_ptr , void ** buffer , uint32_t * length );
+void pack_launch_tasks_request_msg ( launch_tasks_request_msg_t * msg , void ** buffer , uint32_t * length );
+int unpack_launch_tasks_request_msg ( launch_tasks_request_msg_t ** msg_ptr , void ** buffer , uint32_t * length );
+
+void pack_launch_tasks_response_msg ( launch_tasks_response_msg_t * msg , void ** buffer , uint32_t * length );
+int unpack_launch_tasks_response_msg ( launch_tasks_response_msg_t ** msg_ptr , void ** buffer , uint32_t * length );
 
 void pack_kill_tasks_msg ( kill_tasks_msg_t * msg , void ** buffer , uint32_t * length );
 int unpack_kill_tasks_msg ( kill_tasks_msg_t ** msg_ptr , void ** buffer , uint32_t * length );
diff --git a/src/slurmd/slurmd.c b/src/slurmd/slurmd.c
index 97ada61d961..44486af8177 100644
--- a/src/slurmd/slurmd.c
+++ b/src/slurmd/slurmd.c
@@ -228,7 +228,7 @@ void slurmd_req ( slurm_msg_t * msg )
 	{	
 		case REQUEST_LAUNCH_TASKS:
 			slurm_rpc_launch_tasks ( msg ) ;
-			slurm_free_launch_tasks_msg ( msg -> data ) ;
+			slurm_free_launch_tasks_request_msg ( msg -> data ) ;
 			break;
 		case REQUEST_KILL_TASKS:
 			slurm_rpc_kill_tasks ( msg ) ;
@@ -253,7 +253,7 @@ void slurm_rpc_launch_tasks ( slurm_msg_t * msg )
 	/* init */
 	int error_code;
 	clock_t start_time;
-	launch_tasks_msg_t * task_desc = ( launch_tasks_msg_t * ) msg->data ;
+	launch_tasks_request_msg_t * task_desc = ( launch_tasks_request_msg_t * ) msg->data ;
 
 	start_time = clock ();
 	info ("slurmd_req: launch tasks message received");
diff --git a/src/slurmd/task_mgr.c b/src/slurmd/task_mgr.c
index 7156198ea54..212c55be779 100644
--- a/src/slurmd/task_mgr.c
+++ b/src/slurmd/task_mgr.c
@@ -45,8 +45,8 @@ global variables
 /* prototypes */
 void slurm_free_task ( void * _task ) ;
 int kill_task ( task_t * task ) ;
-int interconnect_init ( launch_tasks_msg_t * launch_msg );
-int fan_out_task_launch ( launch_tasks_msg_t * launch_msg );
+int interconnect_init ( launch_tasks_request_msg_t * launch_msg );
+int fan_out_task_launch ( launch_tasks_request_msg_t * launch_msg );
 void * task_exec_thread ( void * arg ) ;
 int init_parent_pipes ( int * pipes ) ;
 void setup_parent_pipes ( int * pipes ) ; 
@@ -68,19 +68,19 @@ int setup_task_env  (task_start_t * task_start ) ;
 
 /* exported module funtion to launch tasks */
 /*launch_tasks should really be named launch_job_step*/
-int launch_tasks ( launch_tasks_msg_t * launch_msg )
+int launch_tasks ( launch_tasks_request_msg_t * launch_msg )
 {
 	return interconnect_init ( launch_msg );
 }
 
 /* Contains interconnect specific setup instructions and then calls 
  * fan_out_task_launch */
-int interconnect_init ( launch_tasks_msg_t * launch_msg )
+int interconnect_init ( launch_tasks_request_msg_t * launch_msg )
 {
 	return fan_out_task_launch ( launch_msg ) ;
 }
 
-int fan_out_task_launch ( launch_tasks_msg_t * launch_msg )
+int fan_out_task_launch ( launch_tasks_request_msg_t * launch_msg )
 {
 	int i ;
 	int rc ;
@@ -452,7 +452,7 @@ void * stderr_io_pipe_thread ( void * arg )
 void * task_exec_thread ( void * arg )
 {
 	task_start_t * task_start = ( task_start_t * ) arg ;
-	launch_tasks_msg_t * launch_msg = task_start -> launch_msg ;
+	launch_tasks_request_msg_t * launch_msg = task_start -> launch_msg ;
 	int * pipes = task_start->pipes ;
 	int rc ;
 	int cpid ;
diff --git a/src/slurmd/task_mgr.h b/src/slurmd/task_mgr.h
index ffe75bfabf8..26d764bba1c 100644
--- a/src/slurmd/task_mgr.h
+++ b/src/slurmd/task_mgr.h
@@ -22,7 +22,7 @@
 #define SLURMD_IO_MAX_BUFFER_SIZE 4096
 
 /* function prototypes */
-int launch_tasks ( launch_tasks_msg_t * launch_msg ) ;
+int launch_tasks ( launch_tasks_request_msg_t * launch_msg ) ;
 int kill_tasks ( kill_tasks_msg_t * kill_task_msg ) ;
 int reattach_tasks_streams ( reattach_tasks_streams_msg_t * req_msg ) ;
 
@@ -37,7 +37,7 @@ typedef struct task_start
 	/*io threads ids*/
 	pthread_t		io_pthread_id[SLURMD_NUMBER_OF_IO_THREADS];
 	int			io_thread_return[SLURMD_NUMBER_OF_IO_THREADS];
-	launch_tasks_msg_t * 	launch_msg;
+	launch_tasks_request_msg_t * 	launch_msg;
 	int			pipes[6];
 	int			sockets[2];
 	int			local_task_id;
diff --git a/testsuite/slurm_unit/slurmd/task_launch-test.c b/testsuite/slurm_unit/slurmd/task_launch-test.c
index 83d7d877242..f0b53fd01d5 100644
--- a/testsuite/slurm_unit/slurmd/task_launch-test.c
+++ b/testsuite/slurm_unit/slurmd/task_launch-test.c
@@ -4,7 +4,7 @@ int main ( int argc , char* argv[] )
 {
 	slurm_msg_t request_msg ;
 	slurm_msg_t response_msg ;
-        launch_tasks_msg_t launch_tasks_msg ;
+        launch_tasks_request_msg_t launch_tasks_msg ;
 	slurm_addr      io_pipe_addrs[2] ;
 	slurm_addr      slurmd_addr ;
 	int             gids[1] ;
diff --git a/testsuite/slurm_unit/slurmd/task_mgr-test.c b/testsuite/slurm_unit/slurmd/task_mgr-test.c
index d2ddce8ca6d..e658a5526dc 100644
--- a/testsuite/slurm_unit/slurmd/task_mgr-test.c
+++ b/testsuite/slurm_unit/slurmd/task_mgr-test.c
@@ -5,7 +5,7 @@
 int main ( int argc , char ** argv )
 {
 	
-	launch_tasks_msg_t launch_tasks_msg ;
+	launch_tasks_request_msg_t launch_tasks_msg ;
 	slurm_addr	io_pipe_addrs[2] ;
 	int		gids[1] ;
 	gids[1] = 9999 ;
-- 
GitLab