From a9adee69b01c7d6c9201f35a0dd10ed38d0ef6cf Mon Sep 17 00:00:00 2001
From: Moe Jette <jette1@llnl.gov>
Date: Tue, 2 Nov 2004 22:56:53 +0000
Subject: [PATCH] Change slurm code (outside of plugin) to use SELECT_MESH, etc
 instead of RM_MESH to avoid multiple definitions for these values (one in
 slurm/slurm.h and the other in bgl/rm_api.h.

---
 slurm/slurm.h.in                              | 10 +++++-----
 src/common/node_select.c                      |  6 +++---
 src/partition_allocator/graph_solver.c        |  6 +++---
 src/partition_allocator/graph_structs.c       |  4 ++--
 src/partition_allocator/partition_allocator.c | 10 ++++++----
 src/plugins/select/bluegene/bluegene.c        | 14 ++++++++------
 src/plugins/select/bluegene/bluegene.h        |  1 -
 src/plugins/select/bluegene/partition_sys.c   |  7 ++++---
 src/plugins/select/bluegene/partition_sys.h   |  2 +-
 src/scontrol/scontrol.c                       | 10 +++++-----
 src/slurmctld/job_mgr.c                       |  4 ++--
 src/slurmctld/sched_upcalls.c                 |  1 -
 src/srun/opt.c                                | 10 +++++-----
 13 files changed, 44 insertions(+), 41 deletions(-)

diff --git a/slurm/slurm.h.in b/slurm/slurm.h.in
index a21be1fcdbc..daedc351623 100644
--- a/slurm/slurm.h.in
+++ b/slurm/slurm.h.in
@@ -161,14 +161,14 @@ enum job_wait_reason {
 #endif
 
 enum connection_type {
-	RM_MESH, 		/* nodes wired in mesh */
-	RM_TORUS, 		/* nodes wired in torus */
-	RM_NAV			/* nodes wired in torus else mesh */
+	SELECT_MESH, 		/* nodes wired in mesh */
+	SELECT_TORUS, 		/* nodes wired in torus */
+	SELECT_NAV		/* nodes wired in torus else mesh */
 };
 
 enum node_use_type {
-	RM_PARTITION_COPROCESSOR_MODE, /* use extra processor for communications */
-	RM_PARTITION_VIRTUAL_NODE_MODE	/* application uses both processors */
+	SELECT_COPROCESSOR_MODE,/* use extra processor for communications */
+	SELECT_VIRTUAL_NODE_MODE/* application uses both processors */
 };
 
 enum select_data_type {
diff --git a/src/common/node_select.c b/src/common/node_select.c
index ec8d6293acd..4f2cb5b7c84 100644
--- a/src/common/node_select.c
+++ b/src/common/node_select.c
@@ -341,9 +341,9 @@ extern int select_g_job_fini(struct job_record *job_ptr)
 #ifdef HAVE_BGL		/* node selection specific logic */
 static char *_job_conn_type_string(uint16_t inx)
 {
-	if (inx == RM_TORUS)
+	if (inx == SELECT_TORUS)
 		return "torus";
-	else if (inx == RM_MESH)
+	else if (inx == SELECT_MESH)
 		return "mesh";
 	else
 		return "nav";
@@ -351,7 +351,7 @@ static char *_job_conn_type_string(uint16_t inx)
 
 static char *_job_node_use_string(uint16_t inx)
 {
-	if (inx == RM_PARTITION_COPROCESSOR_MODE)
+	if (inx == SELECT_COPROCESSOR_MODE)
 		return "coprocessor";
 	else
 		return "virtual";
diff --git a/src/partition_allocator/graph_solver.c b/src/partition_allocator/graph_solver.c
index ad69266d38e..7ac6e30352e 100644
--- a/src/partition_allocator/graph_solver.c
+++ b/src/partition_allocator/graph_solver.c
@@ -622,11 +622,11 @@ void _insert_results(List conf_result_list, List result_partitions, List current
 		part_size = list_count(part->node_list);
 		if (part_size >= LARGE_PART){
 			has_large_part = true;
-			if (part->conn_type == RM_TORUS){
+			if (part->conn_type == SELECT_TORUS){
 				found_torus = true;
 			}
 		}
-		if (part_size == 1 && part->conn_type != RM_TORUS){
+		if (part_size == 1 && part->conn_type != SELECT_TORUS){
 			p1_all_toroidal = false;
 			break;
 		}
@@ -1422,7 +1422,7 @@ void _init_local_partition(List result_partitions)
 	part_itr = list_iterator_create(global_sys->partition_list);
 	while ((old_part = (partition_t*) list_next(part_itr))){
 		copy_partition(old_part, &new_part);
-		new_part->conn_type = RM_TORUS;
+		new_part->conn_type = SELECT_TORUS;
 		list_append(result_partitions, new_part);
 	}
 	list_iterator_destroy(part_itr);
diff --git a/src/partition_allocator/graph_structs.c b/src/partition_allocator/graph_structs.c
index f30820d0ba5..7b39e0f15b2 100644
--- a/src/partition_allocator/graph_structs.c
+++ b/src/partition_allocator/graph_structs.c
@@ -605,12 +605,12 @@ int add_connection_to_partition(connection_t* conn, partition_t* part)
 		if (conn->place == INTERNAL){
 			if (conn->ep0->conn_ext == NULL || 
 			    conn->ep1->conn_ext == NULL) {
-				part->conn_type = RM_MESH;
+				part->conn_type = SELECT_MESH;
 			}
 		} else {
 			if (conn->ep0->conn_int == NULL || 
 			    conn->ep1->conn_int == NULL) {
-				part->conn_type = RM_MESH;
+				part->conn_type = SELECT_MESH;
 			}
 		}
 	} 
diff --git a/src/partition_allocator/partition_allocator.c b/src/partition_allocator/partition_allocator.c
index ab7feeaa6c2..2b2e765b20b 100644
--- a/src/partition_allocator/partition_allocator.c
+++ b/src/partition_allocator/partition_allocator.c
@@ -1088,7 +1088,7 @@ int _find_smallest_dim(int size, int dim)
  * IN - elongate: if true, will try to fit different geometries of
  *      same size requests
  * IN - contig: enforce contiguous regions constraint
- * IN - conn_type: connection type of request (RM_TORUS or RM_MESH)
+ * IN - conn_type: connection type of request (SELECT_TORUS or SELECT_MESH)
  * 
  * return SUCCESS of operation.
  */
@@ -1164,7 +1164,7 @@ int new_pa_request(pa_request_t* pa_request,
 				if(size2<=1) 
 					break;
 				
-				(int)sz = size2%DIM_SIZE[i];
+				sz = size2%DIM_SIZE[i];
 				if(!sz) {
 					pa_request->geometry[i] = DIM_SIZE[i];	
 					size2 /= DIM_SIZE[i];
@@ -1537,9 +1537,11 @@ int main(int argc, char** argv)
 		for (i=0; i<PA_SYSTEM_DIMENSIONS; i++){
 			geo[i] = atoi(argv[i+1]);
 		}
-		new_pa_request(request, geo, -1, rotate, elongate, force_contig, RM_TORUS);
+		new_pa_request(request, geo, -1, rotate, elongate, 
+			force_contig, SELECT_TORUS);
 	} else if (argc == 2) {
-		new_pa_request(request, geo, atoi(argv[1]), rotate, elongate, force_contig, RM_TORUS);
+		new_pa_request(request, geo, atoi(argv[1]), rotate, 
+			elongate, force_contig, SELECT_TORUS);
 	} else {
 		printf(" usage: partition_allocator dimX dimY dimZ\n");
 		printf("    or: partition_allocator size\n");
diff --git a/src/plugins/select/bluegene/bluegene.c b/src/plugins/select/bluegene/bluegene.c
index f2384790279..d755a5523c3 100644
--- a/src/plugins/select/bluegene/bluegene.c
+++ b/src/plugins/select/bluegene/bluegene.c
@@ -534,26 +534,28 @@ error("DIM=%d, loc=%d i=%d", SYSTEM_DIMENSIONS, loc, i);
 /* Initialize all plugin variables */
 extern int init_bgl(void)
 {
-#ifdef USE_BGL_FILES
+#ifdef HAVE_BGL_FILES
 	int rc;
-	
-	// FIXME, this needs to be read in from conf file.
+
+#if 0	
+	/* FIXME: this needs to be read in from conf file. */
 	rc = rm_set_serial("BGL");
 	if (rc != STATUS_OK){
-		error("init_bgl: rm_set_serial failed");
+		error("init_bgl: rm_set_serial failed, errno=%d", rc);
 		return SLURM_ERROR;
 	}
+#endif
 
 	rc = rm_get_BGL(&bgl);
 	if (rc != STATUS_OK){
-		error("init_bgl: rm_get_BGL failed");
+		error("init_bgl: rm_get_BGL failed, errno=%d", rc);
 		return SLURM_ERROR;
 	}
 #endif
 	/** global variable */
 	bgl_conf_list = (List) list_create(_destroy_bgl_conf_record);
 
-	// for testing purposes
+	/* for testing purposes */
 	init_bgl_partition_num();
 
 	return SLURM_SUCCESS;
diff --git a/src/plugins/select/bluegene/bluegene.h b/src/plugins/select/bluegene/bluegene.h
index 4be41304d4c..06f5c0bf3e7 100644
--- a/src/plugins/select/bluegene/bluegene.h
+++ b/src/plugins/select/bluegene/bluegene.h
@@ -46,7 +46,6 @@
 
 #else
   typedef char *   pm_partition_id_t;
-  typedef uint16_t rm_connection_type_t;
   typedef uint16_t rm_partition_t;
   typedef uint16_t rm_partition_mode_t;
   typedef char *   rm_BGL_t;
diff --git a/src/plugins/select/bluegene/partition_sys.c b/src/plugins/select/bluegene/partition_sys.c
index 79610ebf91e..8095d4c6fb9 100755
--- a/src/plugins/select/bluegene/partition_sys.c
+++ b/src/plugins/select/bluegene/partition_sys.c
@@ -41,7 +41,7 @@
 
 /****************************/
 /*   for testing purposes   */
-uint16_t BGL_PARTITION_NUMBER;
+uint16_t bgl_partition_number;
 /****************************/
 
 #ifdef _UNIT_TEST_
@@ -1025,7 +1025,8 @@ extern void debug(const char *fmt, ...)
 }
 #endif
 
-void init_bgl_partition_num()
+extern void init_bgl_partition_num(void)
 {
-	BGL_PARTITION_NUMBER = 0;
+	bgl_partition_number = 0;
 }
+
diff --git a/src/plugins/select/bluegene/partition_sys.h b/src/plugins/select/bluegene/partition_sys.h
index acd42cc7a07..b19813a91e2 100644
--- a/src/plugins/select/bluegene/partition_sys.h
+++ b/src/plugins/select/bluegene/partition_sys.h
@@ -69,6 +69,6 @@ extern int int_array_size(ushort* part_geometry);
 extern void sort_int_array_by_dec_size(List configs);
 extern void sort_partitions_by_inc_size(List partitions);
 extern void sort_partitions_by_dec_size(List partitions);
-extern void init_bgl_partition_num();
+extern void init_bgl_partition_num(void);
 
 #endif /* _PARTITION_SYS_H_ */
diff --git a/src/scontrol/scontrol.c b/src/scontrol/scontrol.c
index 77b0fc4f0a7..c94c2632f7b 100644
--- a/src/scontrol/scontrol.c
+++ b/src/scontrol/scontrol.c
@@ -1477,11 +1477,11 @@ _update_job (int argc, char *argv[])
 		}
 		else if (strncasecmp(argv[i], "Connection=", 11) == 0) {
 			if (strcasecmp(&argv[i][11], "torus") == 0)
-				job_msg.conn_type = RM_TORUS;
+				job_msg.conn_type = SELECT_TORUS;
 			else if (strcasecmp(&argv[i][11], "mesh") == 0)
-				job_msg.conn_type = RM_MESH;
+				job_msg.conn_type = SELECT_MESH;
 			else if (strcasecmp(&argv[i][11], "nav") == 0)
-				job_msg.conn_type = RM_NAV;
+				job_msg.conn_type = SELECT_NAV;
 			else
 				job_msg.conn_type = 
 					(uint16_t) strtol(&argv[i][11], 
@@ -1489,9 +1489,9 @@ _update_job (int argc, char *argv[])
 		}
 		else if (strncasecmp(argv[i], "NodeUse=", 8) == 0) {
 			if (strcasecmp(&argv[i][8], "virtual") == 0)
-				job_msg.node_use = RM_PARTITION_VIRTUAL_NODE_MODE;
+				job_msg.node_use = SELECT_VIRTUAL_NODE_MODE;
 			else if (strcasecmp(&argv[i][8], "coprocessor") == 0)
-				job_msg.node_use = RM_PARTITION_COPROCESSOR_MODE;
+				job_msg.node_use = SELECT_COPROCESSOR_MODE;
 			else
 				job_msg.node_use = 
 					(uint16_t) strtol(&argv[i][8], 
diff --git a/src/slurmctld/job_mgr.c b/src/slurmctld/job_mgr.c
index 5a13f71b61b..f77ade30356 100644
--- a/src/slurmctld/job_mgr.c
+++ b/src/slurmctld/job_mgr.c
@@ -2296,9 +2296,9 @@ static int _validate_job_desc(job_desc_msg_t * job_desc_msg, int allocate,
 	}
 #endif
 	if (job_desc_msg->conn_type == (uint16_t) NO_VAL)
-		job_desc_msg->conn_type = RM_NAV;  /* try TORUS, then MESH */
+		job_desc_msg->conn_type = SELECT_NAV;  /* try TORUS, then MESH */
 	if (job_desc_msg->node_use == (uint16_t) NO_VAL)
-		job_desc_msg->node_use = RM_PARTITION_COPROCESSOR_MODE;
+		job_desc_msg->node_use = SELECT_COPROCESSOR_MODE;
 	if (job_desc_msg->rotate == (uint16_t) NO_VAL)
 		job_desc_msg->rotate = true;    /* default to allow rotate */
 
diff --git a/src/slurmctld/sched_upcalls.c b/src/slurmctld/sched_upcalls.c
index a4e298118e7..d85c172bf69 100644
--- a/src/slurmctld/sched_upcalls.c
+++ b/src/slurmctld/sched_upcalls.c
@@ -657,7 +657,6 @@ sched_get_job_user_id( sched_obj_list_t job_data,
 		       char *type )
 {
 	// * This is probably not thread-safe.	
-	struct passwd *pwent;
 	if ( type ) *type = 's';
 
 	return uid_to_string( (uid_t) ( (struct job_record *)job_data->data )[ idx ].user_id );
diff --git a/src/srun/opt.c b/src/srun/opt.c
index e10d4c77d8b..da7e256d5c8 100644
--- a/src/srun/opt.c
+++ b/src/srun/opt.c
@@ -238,11 +238,11 @@ static int _verify_conn_type(const char *arg)
 	int len = strlen(arg);
 
 	if (!strncasecmp(arg, "MESH", len))
-		return RM_MESH;
+		return SELECT_MESH;
 	else if (!strncasecmp(arg, "TORUS", len))
-		return RM_TORUS;
+		return SELECT_TORUS;
 	else if (!strncasecmp(arg, "NAV", len))
-		return RM_NAV;
+		return SELECT_NAV;
 
 	error("invalid --conn-type argument %s ignored.", arg);
 	return -1;
@@ -257,9 +257,9 @@ static int _verify_node_use(const char *arg)
 	int len = strlen(arg);
 
 	if (!strncasecmp(arg, "VIRTUAL", len))
-		return RM_PARTITION_VIRTUAL_NODE_MODE;
+		return SELECT_VIRTUAL_NODE_MODE;
 	else if (!strncasecmp(arg, "COPROCESSOR", len))
-		return RM_PARTITION_COPROCESSOR_MODE;
+		return SELECT_COPROCESSOR_MODE;
 
 	error("invalid --node-use argument %s ignored.", arg);
 	return -1;
-- 
GitLab