From 5a27bd9c21302181d9871bb71f2cb479e833993e Mon Sep 17 00:00:00 2001
From: Moe Jette <jette1@llnl.gov>
Date: Thu, 16 Dec 2004 17:43:33 +0000
Subject: [PATCH] Modify smap to build on non-BGL system.

---
 src/smap/partition_functions.c | 18 +++++++++++++-----
 src/smap/smap.h                |  1 +
 2 files changed, 14 insertions(+), 5 deletions(-)

diff --git a/src/smap/partition_functions.c b/src/smap/partition_functions.c
index 777b0fa6400..69783a869ea 100644
--- a/src/smap/partition_functions.c
+++ b/src/smap/partition_functions.c
@@ -276,6 +276,7 @@ static char *_part_state_str(rm_partition_state_t state)
 {
 	static char tmp[16];
 
+#ifdef HAVE_BGL_FILES
 	switch (state) {
 		case RM_PARTITION_BUSY: 
 			return "BUSY";
@@ -291,10 +292,11 @@ static char *_part_state_str(rm_partition_state_t state)
 			return "NAV";
 		case RM_PARTITION_READY:
 			return "READY";
-		default:
-			snprintf(tmp, sizeof(tmp), "%d", state);
-			return tmp;
 	}
+#endif
+
+	snprintf(tmp, sizeof(tmp), "%d", state);
+	return tmp;
 }
 
 static int _print_text_part(partition_info_t * part_ptr, 
@@ -787,8 +789,14 @@ static db2_block_info_t *_find_part_db2(char *nodelist)
 	hostlist_destroy(hostlist);
 	return rc;
 #else
-	static db2_block_info_t dummy_block = {"UNKNOWN", "", SELECT_NAV, 
-					       SELECT_NAV_MODE, NULL};
+	static db2_block_info_t dummy_block;
+
+	/* perform block initialization (once) using structure field names */
+	if (dummy_block.bgl_block_name == NULL) {
+		dummy_block.bgl_block_name	= "UNKNOWN";
+		dummy_block.bgl_conn_type	= SELECT_NAV;
+		dummy_block.bgl_node_use	= SELECT_NAV_MODE;
+	}
 
 	return &dummy_block;
 #endif
diff --git a/src/smap/smap.h b/src/smap/smap.h
index 9cb8ac40c95..53c02735480 100644
--- a/src/smap/smap.h
+++ b/src/smap/smap.h
@@ -62,6 +62,7 @@
   typedef char *   pm_partition_id_t; 
   typedef int      rm_connection_type_t;
   typedef int      rm_partition_mode_t;
+  typedef int      rm_partition_state_t;
   typedef uint16_t rm_partition_t;
   typedef char *   rm_BGL_t;
   typedef char *   rm_component_id_t;
-- 
GitLab