From 6537bb5786d94820a19d64b1e688a886a20e012f Mon Sep 17 00:00:00 2001
From: Morris Jette <jette@schedmd.com>
Date: Fri, 8 Jan 2016 13:41:22 -0800
Subject: [PATCH] Node features variable renaming

Change names of some variables and structures used to manage node
  features. No change in logic
---
 src/common/node_conf.c                  | 53 ++++++++++---------
 src/common/node_conf.h                  | 13 +++--
 src/plugins/sched/backfill/backfill.c   | 17 +++----
 src/plugins/slurmctld/nonstop/do_work.c | 10 ++--
 src/slurmctld/job_scheduler.c           | 29 ++++++-----
 src/slurmctld/node_mgr.c                |  6 +--
 src/slurmctld/node_scheduler.c          | 67 +++++++++++++------------
 src/slurmctld/read_config.c             |  2 +-
 src/slurmctld/reservation.c             |  6 +--
 src/slurmctld/slurmctld.h               |  4 +-
 src/slurmctld/step_mgr.c                |  7 +--
 11 files changed, 109 insertions(+), 105 deletions(-)

diff --git a/src/common/node_conf.c b/src/common/node_conf.c
index 4ad05a64eb1..4340c21a866 100644
--- a/src/common/node_conf.c
+++ b/src/common/node_conf.c
@@ -8,6 +8,7 @@
  *****************************************************************************
  *  Copyright (C) 2002-2007 The Regents of the University of California.
  *  Copyright (C) 2008-2010 Lawrence Livermore National Security.
+ *  Copyright (C) 2010-2016 SchedMD LLC.
  *  Produced at Lawrence Livermore National Laboratory (cf, DISCLAIMER).
  *  Written by Morris Jette <jette1@llnl.gov> et. al.
  *  CODE-OCEC-09-009. All rights reserved.
@@ -81,7 +82,8 @@
 
 /* Global variables */
 List config_list  = NULL;	/* list of config_record entries */
-List feature_list = NULL;	/* list of features_record entries */
+List active_feature_list;	/* list of currently active features_records */
+List avail_feature_list;	/* list of available features_records */
 List front_end_list = NULL;	/* list of slurm_conf_frontend_t entries */
 time_t last_node_update = (time_t) 0;	/* time of last update */
 struct node_record *node_record_table_ptr = NULL;	/* node records */
@@ -110,14 +112,13 @@ static int	_list_find_feature (void *feature_entry, void *key);
 
 static void _add_config_feature(char *feature, bitstr_t *node_bitmap)
 {
-	struct features_record *feature_ptr;
+	node_feature_t *feature_ptr;
 	ListIterator feature_iter;
 	bool match = false;
 
-	/* If feature already exists in feature_list, just update the bitmap */
-	feature_iter = list_iterator_create(feature_list);
-	while ((feature_ptr = (struct features_record *)
-			list_next(feature_iter))) {
+	/* If feature already in avail_feature_list, just update the bitmap */
+	feature_iter = list_iterator_create(avail_feature_list);
+	while ((feature_ptr = (node_feature_t *) list_next(feature_iter))) {
 		if (strcmp(feature, feature_ptr->name))
 			continue;
 		bit_or(feature_ptr->node_bitmap, node_bitmap);
@@ -126,12 +127,12 @@ static void _add_config_feature(char *feature, bitstr_t *node_bitmap)
 	}
 	list_iterator_destroy(feature_iter);
 
-	if (!match) {	/* Need to create new feature_list record */
-		feature_ptr = xmalloc(sizeof(struct features_record));
+	if (!match) {	/* Need to create new avail_feature_list record */
+		feature_ptr = xmalloc(sizeof(node_feature_t));
 		feature_ptr->magic = FEATURE_MAGIC;
 		feature_ptr->name = xstrdup(feature);
 		feature_ptr->node_bitmap = bit_copy(node_bitmap);
-		list_append(feature_list, feature_ptr);
+		list_append(avail_feature_list, feature_ptr);
 	}
 }
 
@@ -317,9 +318,10 @@ cleanup:
 static int _delete_config_record (void)
 {
 	last_node_update = time (NULL);
-	(void) list_delete_all (config_list,    &_list_find_config,  NULL);
-	(void) list_delete_all (feature_list,   &_list_find_feature, NULL);
-	(void) list_delete_all (front_end_list, &list_find_frontend, NULL);
+	(void) list_delete_all(config_list,    &_list_find_config,  NULL);
+	(void) list_delete_all(active_feature_list,  &_list_find_feature, NULL);
+	(void) list_delete_all(avail_feature_list,   &_list_find_feature, NULL);
+	(void) list_delete_all(front_end_list, &list_find_frontend, NULL);
 	return SLURM_SUCCESS;
 }
 
@@ -420,7 +422,7 @@ static void _list_delete_config (void *config_entry)
 	xfree(config_ptr->cpu_spec_list);
 	xfree(config_ptr->feature);
 	xfree(config_ptr->gres);
-	build_config_feature_list(config_ptr);
+	build_avail_feature_list(config_ptr);
 	xfree (config_ptr->nodes);
 	FREE_NULL_BITMAP (config_ptr->node_bitmap);
 	xfree (config_ptr);
@@ -430,8 +432,7 @@ static void _list_delete_config (void *config_entry)
  *	see list.h for documentation */
 static void _list_delete_feature (void *feature_entry)
 {
-	struct features_record *feature_ptr = (struct features_record *)
-					     feature_entry;
+	node_feature_t *feature_ptr = (node_feature_t *) feature_entry;
 
 	xassert(feature_ptr);
 	xassert(feature_ptr->magic == FEATURE_MAGIC);
@@ -530,12 +531,12 @@ char * bitmap2node_name (bitstr_t *bitmap)
  */
 static int _list_find_feature (void *feature_entry, void *key)
 {
-	struct features_record *feature_ptr;
+	node_feature_t *feature_ptr;
 
 	if (key == NULL)
 		return 1;
 
-	feature_ptr = (struct features_record *) feature_entry;
+	feature_ptr = (node_feature_t *) feature_entry;
 	if (strcmp(feature_ptr->name, (char *) key) == 0)
 		return 1;
 	return 0;
@@ -691,19 +692,19 @@ extern int build_all_nodeline_info (bool set_bitmap)
 	return max_rc;
 }
 
-/* Given a config_record with it's bitmap already set, update feature_list */
-extern void  build_config_feature_list(struct config_record *config_ptr)
+/* Given a config_record with it's bitmap already set,
+ * build avail_feature_list */
+extern void  build_avail_feature_list(struct config_record *config_ptr)
 {
-	struct features_record *feature_ptr;
+	node_feature_t *feature_ptr;
 	ListIterator feature_iter;
 	char *tmp_str, *token, *last = NULL;
 
 	/* Clear these nodes from the feature_list record,
 	 * then restore as needed */
-	feature_iter = list_iterator_create(feature_list);
+	feature_iter = list_iterator_create(avail_feature_list);
 	bit_not(config_ptr->node_bitmap);
-	while ((feature_ptr = (struct features_record *)
-			list_next(feature_iter))) {
+	while ((feature_ptr = (node_feature_t *) list_next(feature_iter))) {
 		bit_and(feature_ptr->node_bitmap, config_ptr->node_bitmap);
 	}
 	list_iterator_destroy(feature_iter);
@@ -922,7 +923,8 @@ extern int init_node_conf (void)
 		(void) _delete_config_record ();
 	else {
 		config_list    = list_create (_list_delete_config);
-		feature_list   = list_create (_list_delete_feature);
+		active_feature_list = list_create (_list_delete_feature);
+		avail_feature_list = list_create (_list_delete_feature);
 		front_end_list = list_create (destroy_frontend);
 	}
 
@@ -938,7 +940,8 @@ extern void node_fini2 (void)
 
 	if (config_list) {
 		FREE_NULL_LIST(config_list);
-		FREE_NULL_LIST(feature_list);
+		FREE_NULL_LIST(active_feature_list);
+		FREE_NULL_LIST(avail_feature_list);
 		FREE_NULL_LIST(front_end_list);
 	}
 
diff --git a/src/common/node_conf.h b/src/common/node_conf.h
index d9311b651ba..bef76371e69 100644
--- a/src/common/node_conf.h
+++ b/src/common/node_conf.h
@@ -4,6 +4,7 @@
  *****************************************************************************
  *  Copyright (C) 2002-2007 The Regents of the University of California.
  *  Copyright (C) 2008-2010 Lawrence Livermore National Security.
+ *  Copyright (C) 2010-2016 SchedMD LLC.
  *  Produced at Lawrence Livermore National Laboratory (cf, DISCLAIMER).
  *  Written by Morris Jette <jette1@llnl.gov> et. al.
  *  CODE-OCEC-09-009. All rights reserved.
@@ -88,12 +89,13 @@ extern List config_list;	/* list of config_record entries */
 
 extern List front_end_list;	/* list of slurm_conf_frontend_t entries */
 
-struct features_record {
+typedef struct node_features {
 	uint32_t magic;		/* magic cookie to test data integrity */
 	char *name;		/* name of a feature */
 	bitstr_t *node_bitmap;	/* bitmap of nodes with this feature */
-};
-extern List feature_list;	/* list of features_record entries */
+} node_feature_t;
+extern List active_feature_list;/* list of currently active node features */
+extern List avail_feature_list;	/* list of available node features */
 
 struct node_record {
 	uint32_t magic;			/* magic cookie for data integrity */
@@ -238,8 +240,9 @@ extern int build_all_nodeline_info (bool set_bitmap);
  */
 extern int build_all_frontend_info (bool is_slurmd_context);
 
-/* Given a config_record with it's bitmap already set, update feature_list */
-extern void  build_config_feature_list (struct config_record *config_ptr);
+/* Given a config_record with it's bitmap already set,
+ * build avail_feature_list */
+extern void  build_avail_feature_list(struct config_record *config_ptr);
 
 /*
  * create_config_record - create a config_record entry and set is values to
diff --git a/src/plugins/sched/backfill/backfill.c b/src/plugins/sched/backfill/backfill.c
index 0a65a3f2316..aec3f727b6f 100644
--- a/src/plugins/sched/backfill/backfill.c
+++ b/src/plugins/sched/backfill/backfill.c
@@ -243,13 +243,13 @@ static int _num_feature_count(struct job_record *job_ptr, bool *has_xor)
 	struct job_details *detail_ptr = job_ptr->details;
 	int rc = 0;
 	ListIterator feat_iter;
-	struct feature_record *feat_ptr;
+	job_feature_t *feat_ptr;
 
 	if (detail_ptr->feature_list == NULL)	/* no constraints */
 		return rc;
 
 	feat_iter = list_iterator_create(detail_ptr->feature_list);
-	while ((feat_ptr = (struct feature_record *) list_next(feat_iter))) {
+	while ((feat_ptr = (job_feature_t *) list_next(feat_iter))) {
 		if (feat_ptr->count)
 			rc++;
 		if (feat_ptr->op_code == FEATURE_OP_XOR)
@@ -278,7 +278,7 @@ static int  _try_sched(struct job_record *job_ptr, bitstr_t **avail_bitmap,
 	List preemptee_candidates = NULL;
 	List preemptee_job_list = NULL;
 	ListIterator feat_iter;
-	struct feature_record *feat_ptr;
+	job_feature_t *feat_ptr;
 
 	if (feat_cnt) {
 		/* Ideally schedule the job feature by feature,
@@ -295,8 +295,7 @@ static int  _try_sched(struct job_record *job_ptr, bitstr_t **avail_bitmap,
 		list_size = list_count(detail_ptr->feature_list);
 		feat_cnt_orig = xmalloc(sizeof(uint16_t) * list_size);
 		feat_iter = list_iterator_create(detail_ptr->feature_list);
-		while ((feat_ptr =
-			(struct feature_record *) list_next(feat_iter))) {
+		while ((feat_ptr = (job_feature_t *) list_next(feat_iter))) {
 			high_cnt = MAX(high_cnt, feat_ptr->count);
 			feat_cnt_orig[i++] = feat_ptr->count;
 			feat_ptr->count = 0;
@@ -322,8 +321,7 @@ static int  _try_sched(struct job_record *job_ptr, bitstr_t **avail_bitmap,
 		/* Restore the feature counts */
 		i = 0;
 		feat_iter = list_iterator_create(detail_ptr->feature_list);
-		while ((feat_ptr =
-			(struct feature_record *) list_next(feat_iter))) {
+		while ((feat_ptr = (job_feature_t *) list_next(feat_iter))) {
 			feat_ptr->count = feat_cnt_orig[i++];
 		}
 		list_iterator_destroy(feat_iter);
@@ -331,7 +329,7 @@ static int  _try_sched(struct job_record *job_ptr, bitstr_t **avail_bitmap,
 	} else if (has_xor) {
 		/* Cache the feature information and test the individual
 		 * features, one at a time */
-		struct feature_record feature_base;
+		job_feature_t feature_base;
 		List feature_cache = detail_ptr->feature_list;
 		time_t low_start = 0;
 
@@ -342,8 +340,7 @@ static int  _try_sched(struct job_record *job_ptr, bitstr_t **avail_bitmap,
 
 		tmp_bitmap = bit_copy(*avail_bitmap);
 		feat_iter = list_iterator_create(feature_cache);
-		while ((feat_ptr =
-		       (struct feature_record *) list_next(feat_iter))) {
+		while ((feat_ptr = (job_feature_t *) list_next(feat_iter))) {
 			feature_base.name = feat_ptr->name;
 			if ((job_req_node_filter(job_ptr, *avail_bitmap) ==
 			      SLURM_SUCCESS) &&
diff --git a/src/plugins/slurmctld/nonstop/do_work.c b/src/plugins/slurmctld/nonstop/do_work.c
index 2f36d3df309..671789d03e2 100644
--- a/src/plugins/slurmctld/nonstop/do_work.c
+++ b/src/plugins/slurmctld/nonstop/do_work.c
@@ -869,8 +869,8 @@ fini:	slurm_mutex_unlock(&job_fail_mutex);
 static char *_job_node_features(struct job_record *job_ptr,
 				struct node_record *node_ptr)
 {
-	struct features_record *node_feat_ptr;
-	struct feature_record  *job_feat_ptr;
+	node_feature_t *node_feat_ptr;
+	job_feature_t *job_feat_ptr;
 	ListIterator job_iter, node_iter;
 	char *req_feat = NULL;
 	int node_inx;
@@ -881,9 +881,9 @@ static char *_job_node_features(struct job_record *job_ptr,
 
 	node_inx = node_ptr - node_record_table_ptr;
 	job_iter = list_iterator_create(job_ptr->details->feature_list);
-	while ((job_feat_ptr = (struct feature_record *) list_next(job_iter))) {
-		node_iter = list_iterator_create(feature_list);
-		while ((node_feat_ptr = (struct features_record *)
+	while ((job_feat_ptr = (job_feature_t *) list_next(job_iter))) {
+		node_iter = list_iterator_create(avail_feature_list);
+		while ((node_feat_ptr = (node_feature_t *)
 					list_next(node_iter))) {
 			if (!job_feat_ptr->name  ||
 			    !node_feat_ptr->name ||
diff --git a/src/slurmctld/job_scheduler.c b/src/slurmctld/job_scheduler.c
index b7fe608f9c2..701cdfda64b 100644
--- a/src/slurmctld/job_scheduler.c
+++ b/src/slurmctld/job_scheduler.c
@@ -3599,7 +3599,7 @@ extern void prolog_running_decr(struct job_record *job_ptr)
  */
 extern List feature_list_copy(List feature_list_src)
 {
-	struct feature_record *feat_src, *feat_dest;
+	job_feature_t *feat_src, *feat_dest;
 	ListIterator iter;
 	List feature_list_dest = NULL;
 
@@ -3608,9 +3608,9 @@ extern List feature_list_copy(List feature_list_src)
 
 	feature_list_dest = list_create(_feature_list_delete);
 	iter = list_iterator_create(feature_list_src);
-	while ((feat_src = (struct feature_record *) list_next(iter))) {
-		feat_dest = xmalloc(sizeof(struct feature_record));
-		memcpy(feat_dest, feat_src, sizeof(struct feature_record));
+	while ((feat_src = (job_feature_t *) list_next(iter))) {
+		feat_dest = xmalloc(sizeof(job_feature_t));
+		memcpy(feat_dest, feat_src, sizeof(job_feature_t));
 		feat_dest->name = xstrdup(feat_src->name);
 		list_append(feature_list_dest, feat_dest);
 	}
@@ -3630,7 +3630,7 @@ extern int build_feature_list(struct job_record *job_ptr)
 	char *tmp_requested, *str_ptr, *feature = NULL;
 	int bracket = 0, count = 0, i;
 	bool have_count = false, have_or = false;
-	struct feature_record *feat;
+	job_feature_t *feat;
 
 	if (!detail_ptr || !detail_ptr->features)	/* no constraints */
 		return SLURM_SUCCESS;
@@ -3659,7 +3659,7 @@ extern int build_feature_list(struct job_record *job_ptr)
 				xfree(tmp_requested);
 				return ESLURM_INVALID_FEATURE;
 			}
-			feat = xmalloc(sizeof(struct feature_record));
+			feat = xmalloc(sizeof(job_feature_t));
 			feat->name = xstrdup(feature);
 			feat->count = count;
 			if (bracket)
@@ -3678,7 +3678,7 @@ extern int build_feature_list(struct job_record *job_ptr)
 				xfree(tmp_requested);
 				return ESLURM_INVALID_FEATURE;
 			}
-			feat = xmalloc(sizeof(struct feature_record));
+			feat = xmalloc(sizeof(job_feature_t));
 			feat->name = xstrdup(feature);
 			feat->count = count;
 			if (bracket)
@@ -3708,7 +3708,7 @@ extern int build_feature_list(struct job_record *job_ptr)
 			bracket = 0;
 		} else if (tmp_requested[i] == '\0') {
 			if (feature) {
-				feat = xmalloc(sizeof(struct feature_record));
+				feat = xmalloc(sizeof(job_feature_t));
 				feat->name = xstrdup(feature);
 				feat->count = count;
 				feat->op_code = FEATURE_OP_END;
@@ -3736,7 +3736,7 @@ extern int build_feature_list(struct job_record *job_ptr)
 
 static void _feature_list_delete(void *x)
 {
-	struct feature_record *feature = (struct feature_record *)x;
+	job_feature_t *feature = (job_feature_t *)x;
 	xfree(feature->name);
 	xfree(feature);
 }
@@ -3744,7 +3744,7 @@ static void _feature_list_delete(void *x)
 static int _valid_feature_list(uint32_t job_id, List feature_list)
 {
 	ListIterator feat_iter;
-	struct feature_record *feat_ptr;
+	job_feature_t *feat_ptr;
 	char *buf = NULL, tmp[16];
 	int bracket = 0;
 	int rc = SLURM_SUCCESS;
@@ -3755,7 +3755,7 @@ static int _valid_feature_list(uint32_t job_id, List feature_list)
 	}
 
 	feat_iter = list_iterator_create(feature_list);
-	while ((feat_ptr = (struct feature_record *)list_next(feat_iter))) {
+	while ((feat_ptr = (job_feature_t *)list_next(feat_iter))) {
 		if ((feat_ptr->op_code == FEATURE_OP_XOR) ||
 		    (feat_ptr->op_code == FEATURE_OP_XAND)) {
 			if (bracket == 0)
@@ -3794,14 +3794,13 @@ static int _valid_feature_list(uint32_t job_id, List feature_list)
 static int _valid_node_feature(char *feature)
 {
 	int rc = ESLURM_INVALID_FEATURE;
-	struct features_record *feature_ptr;
+	node_feature_t *feature_ptr;
 	ListIterator feature_iter;
 
 	/* Clear these nodes from the feature_list record,
 	 * then restore as needed */
-	feature_iter = list_iterator_create(feature_list);
-	while ((feature_ptr = (struct features_record *)
-			list_next(feature_iter))) {
+	feature_iter = list_iterator_create(avail_feature_list);
+	while ((feature_ptr = (node_feature_t *)list_next(feature_iter))) {
 		if (strcmp(feature_ptr->name, feature))
 			continue;
 		rc = SLURM_SUCCESS;
diff --git a/src/slurmctld/node_mgr.c b/src/slurmctld/node_mgr.c
index 02b9f30de26..d76bda53087 100644
--- a/src/slurmctld/node_mgr.c
+++ b/src/slurmctld/node_mgr.c
@@ -1762,7 +1762,7 @@ static int _update_node_weight(char *node_names, uint32_t weight)
 			new_config_ptr->node_bitmap = bit_copy(tmp_bitmap);
 			new_config_ptr->nodes = bitmap2node_name(tmp_bitmap);
 
-			build_config_feature_list(new_config_ptr);
+			build_avail_feature_list(new_config_ptr);
 			_update_config_ptr(tmp_bitmap, new_config_ptr);
 
 			/* Update remaining records */
@@ -1823,7 +1823,7 @@ static int _update_node_features(char *node_names, char *features)
 			xfree(config_ptr->feature);
 			if (features && features[0])
 				config_ptr->feature = xstrdup(features);
-			build_config_feature_list(config_ptr);
+			build_avail_feature_list(config_ptr);
 		} else {
 			/* partial update, split config_record */
 			new_config_ptr = _dup_config(config_ptr);
@@ -1835,7 +1835,7 @@ static int _update_node_features(char *node_names, char *features)
 			new_config_ptr->node_bitmap = bit_copy(tmp_bitmap);
 			new_config_ptr->nodes = bitmap2node_name(tmp_bitmap);
 
-			build_config_feature_list(new_config_ptr);
+			build_avail_feature_list(new_config_ptr);
 			_update_config_ptr(tmp_bitmap, new_config_ptr);
 
 			/* Update remaining records */
diff --git a/src/slurmctld/node_scheduler.c b/src/slurmctld/node_scheduler.c
index 3b85a5b7ab2..b381b633de5 100644
--- a/src/slurmctld/node_scheduler.c
+++ b/src/slurmctld/node_scheduler.c
@@ -628,12 +628,12 @@ extern void deallocate_nodes(struct job_record *job_ptr, bool timeout,
  */
 static int _match_feature(char *seek, struct node_set *node_set_ptr)
 {
-	struct features_record *feat_ptr;
+	node_feature_t *feat_ptr;
 
 	if (seek == NULL)
 		return 1;	/* nothing to look for */
 
-	feat_ptr = list_find_first(feature_list, list_find_feature,
+	feat_ptr = list_find_first(avail_feature_list, list_find_feature,
 				   (void *) seek);
 	if (feat_ptr == NULL)
 		return 0;	/* no such feature */
@@ -920,11 +920,10 @@ _get_req_features(struct node_set *node_set_ptr, int node_set_size,
 	if (job_ptr->details->feature_list &&
 	    (job_ptr->details->req_node_layout == NULL)) {
 		ListIterator feat_iter;
-		struct feature_record *feat_ptr;
+		job_feature_t *feat_ptr;
 		feat_iter = list_iterator_create(
 				job_ptr->details->feature_list);
-		while ((feat_ptr = (struct feature_record *)
-				list_next(feat_iter))) {
+		while ((feat_ptr = (job_feature_t *) list_next(feat_iter))) {
 			if (feat_ptr->count == 0)
 				continue;
 			tmp_node_set_size = 0;
@@ -2495,12 +2494,12 @@ static int _fill_in_gres_fields(struct job_record *job_ptr)
  */
 extern int list_find_feature(void *feature_entry, void *key)
 {
-	struct features_record *feature_ptr;
+	node_feature_t *feature_ptr;
 
 	if (key == NULL)
 		return 1;
 
-	feature_ptr = (struct features_record *) feature_entry;
+	feature_ptr = (node_feature_t *) feature_entry;
 	if (strcmp(feature_ptr->name, (char *) key) == 0)
 		return 1;
 	return 0;
@@ -2517,8 +2516,8 @@ static bool _valid_feature_counts(struct job_details *detail_ptr,
 				  bitstr_t *node_bitmap, bool *has_xor)
 {
 	ListIterator job_feat_iter;
-	struct feature_record *job_feat_ptr;
-	struct features_record *feat_ptr;
+	job_feature_t *job_feat_ptr;
+	node_feature_t *node_feat_ptr;
 	int have_count = false, last_op = FEATURE_OP_AND;
 	bitstr_t *feature_bitmap, *tmp_bitmap;
 	bool rc = true;
@@ -2533,18 +2532,21 @@ static bool _valid_feature_counts(struct job_details *detail_ptr,
 
 	feature_bitmap = bit_copy(node_bitmap);
 	job_feat_iter = list_iterator_create(detail_ptr->feature_list);
-	while ((job_feat_ptr = (struct feature_record *)
-			list_next(job_feat_iter))) {
-		feat_ptr = list_find_first(feature_list, list_find_feature,
-					   (void *) job_feat_ptr->name);
-		if (feat_ptr) {
-			if (last_op == FEATURE_OP_AND)
-				bit_and(feature_bitmap, feat_ptr->node_bitmap);
-			else if (last_op == FEATURE_OP_OR)
-				bit_or(feature_bitmap, feat_ptr->node_bitmap);
-			else {	/* FEATURE_OP_XOR or FEATURE_OP_XAND */
+	while ((job_feat_ptr = (job_feature_t *) list_next(job_feat_iter))) {
+		node_feat_ptr = list_find_first(avail_feature_list,
+					list_find_feature,
+					(void *) job_feat_ptr->name);
+		if (node_feat_ptr) {
+			if (last_op == FEATURE_OP_AND) {
+				bit_and(feature_bitmap,
+					node_feat_ptr->node_bitmap);
+			} else if (last_op == FEATURE_OP_OR) {
+				bit_or(feature_bitmap,
+				       node_feat_ptr->node_bitmap);
+			} else {	/* FEATURE_OP_XOR or FEATURE_OP_XAND */
 				*has_xor = true;
-				bit_or(feature_bitmap, feat_ptr->node_bitmap);
+				bit_or(feature_bitmap,
+				       node_feat_ptr->node_bitmap);
 			}
 		} else {	/* feature not found */
 			if (last_op == FEATURE_OP_AND) {
@@ -2561,19 +2563,19 @@ static bool _valid_feature_counts(struct job_details *detail_ptr,
 	if (have_count) {
 		job_feat_iter = list_iterator_create(detail_ptr->
 						     feature_list);
-		while ((job_feat_ptr = (struct feature_record *)
+		while ((job_feat_ptr = (job_feature_t *)
 				list_next(job_feat_iter))) {
 			if (job_feat_ptr->count == 0)
 				continue;
-			feat_ptr = list_find_first(feature_list,
-						   list_find_feature,
-						   (void *)job_feat_ptr->name);
-			if (!feat_ptr) {
+			node_feat_ptr = list_find_first(avail_feature_list,
+						list_find_feature,
+						(void *)job_feat_ptr->name);
+			if (!node_feat_ptr) {
 				rc = false;
 				break;
 			}
 			tmp_bitmap = bit_copy(feature_bitmap);
-			bit_and(tmp_bitmap, feat_ptr->node_bitmap);
+			bit_and(tmp_bitmap, node_feat_ptr->node_bitmap);
 			if (bit_set_count(tmp_bitmap) < job_feat_ptr->count)
 				rc = false;
 			FREE_NULL_BITMAP(tmp_bitmap);
@@ -3198,8 +3200,8 @@ static bitstr_t *_valid_features(struct job_details *details_ptr,
 {
 	bitstr_t *result_bits = (bitstr_t *) NULL;
 	ListIterator feat_iter;
-	struct feature_record *job_feat_ptr;
-	struct features_record *feat_ptr;
+	job_feature_t *job_feat_ptr;
+	node_feature_t *node_feat_ptr;
 	int last_op = FEATURE_OP_AND, position = 0;
 
 	result_bits = bit_alloc(MAX_FEATURES);
@@ -3209,18 +3211,17 @@ static bitstr_t *_valid_features(struct job_details *details_ptr,
 	}
 
 	feat_iter = list_iterator_create(details_ptr->feature_list);
-	while ((job_feat_ptr = (struct feature_record *)
-			list_next(feat_iter))) {
+	while ((job_feat_ptr = (job_feature_t *) list_next(feat_iter))) {
 		if ((job_feat_ptr->op_code == FEATURE_OP_XAND) ||
 		    (job_feat_ptr->op_code == FEATURE_OP_XOR)  ||
 		    (last_op == FEATURE_OP_XAND) ||
 		    (last_op == FEATURE_OP_XOR)) {
-			feat_ptr = list_find_first(feature_list,
+			node_feat_ptr = list_find_first(avail_feature_list,
 						   list_find_feature,
 						   (void *)job_feat_ptr->name);
-			if (feat_ptr &&
+			if (node_feat_ptr &&
 			    bit_super_set(config_ptr->node_bitmap,
-					  feat_ptr->node_bitmap)) {
+					  node_feat_ptr->node_bitmap)) {
 				bit_set(result_bits, position);
 			}
 			position++;
diff --git a/src/slurmctld/read_config.c b/src/slurmctld/read_config.c
index da8dbe3736e..196eff948f0 100644
--- a/src/slurmctld/read_config.c
+++ b/src/slurmctld/read_config.c
@@ -369,7 +369,7 @@ static int _build_bitmaps(void)
 	config_iterator = list_iterator_create(config_list);
 	while ((config_ptr = (struct config_record *)
 				      list_next(config_iterator))) {
-		build_config_feature_list(config_ptr);
+		build_avail_feature_list(config_ptr);
 	}
 	list_iterator_destroy(config_iterator);
 
diff --git a/src/slurmctld/reservation.c b/src/slurmctld/reservation.c
index 452932761ab..5d48cd5fabc 100644
--- a/src/slurmctld/reservation.c
+++ b/src/slurmctld/reservation.c
@@ -3813,7 +3813,7 @@ static int  _select_nodes(resv_desc_msg_t *resv_desc_ptr,
 		char *features = xstrdup(resv_desc_ptr->features);
 		char *sep_ptr, *token = features;
 		bitstr_t *feature_bitmap = bit_copy(node_bitmap);
-		struct features_record *feature_ptr;
+		node_feature_t *feature_ptr;
 		ListIterator feature_iter;
 		bool match;
 
@@ -3837,8 +3837,8 @@ static int  _select_nodes(resv_desc_msg_t *resv_desc_ptr,
 			}
 
 			match = false;
-			feature_iter = list_iterator_create(feature_list);
-			while ((feature_ptr = (struct features_record *)
+			feature_iter = list_iterator_create(avail_feature_list);
+			while ((feature_ptr = (node_feature_t *)
 					list_next(feature_iter))) {
 				if (strcmp(token, feature_ptr->name))
 					continue;
diff --git a/src/slurmctld/slurmctld.h b/src/slurmctld/slurmctld.h
index f74ab41fcdd..c524d971a09 100644
--- a/src/slurmctld/slurmctld.h
+++ b/src/slurmctld/slurmctld.h
@@ -449,11 +449,11 @@ extern time_t last_job_update;	/* time of last update to job records */
 #define FEATURE_OP_XOR  2
 #define FEATURE_OP_XAND 3
 #define FEATURE_OP_END  4		/* last entry lacks separator */
-struct feature_record {
+typedef struct job_feature {
 	char *name;			/* name of feature */
 	uint16_t count;			/* count of nodes with this feature */
 	uint8_t op_code;		/* separator, see FEATURE_OP_ above */
-};
+} job_feature_t;
 
 /* job_details - specification of a job's constraints,
  * can be purged after initiation */
diff --git a/src/slurmctld/step_mgr.c b/src/slurmctld/step_mgr.c
index ad6bd514994..d584cf0f71d 100644
--- a/src/slurmctld/step_mgr.c
+++ b/src/slurmctld/step_mgr.c
@@ -934,9 +934,10 @@ _pick_step_nodes (struct job_record  *job_ptr,
 	bit_and (nodes_avail, up_node_bitmap);
 	if (step_spec->features) {
 		/* We only select for a single feature name here.
-		 * Add support for AND, OR, etc. here if desired */
-		struct features_record *feat_ptr;
-		feat_ptr = list_find_first(feature_list, list_find_feature,
+		 * FIXME: Add support for AND, OR, etc. here if desired */
+		node_feature_t *feat_ptr;
+		feat_ptr = list_find_first(avail_feature_list,
+					   list_find_feature,
 					   (void *) step_spec->features);
 		if (feat_ptr && feat_ptr->node_bitmap)
 			bit_and(nodes_avail, feat_ptr->node_bitmap);
-- 
GitLab