Blame SOURCES/autofs-5.0.9-amd-lookup-use-flags-in-map_source-for-format.patch

304803
autofs-5.0.9 - amd lookup use flags in map_source for format
304803
304803
From: Ian Kent <raven@themaw.net>
304803
304803
We will need to check the map format several times so add a flags
304803
field to the map_source struct so we don't need to use strcmp()
304803
every time.
304803
---
304803
 daemon/lookup.c  |    2 ++
304803
 include/master.h |    3 +++
304803
 lib/master.c     |    4 ++++
304803
 3 files changed, 9 insertions(+)
304803
304803
--- autofs-5.0.7.orig/daemon/lookup.c
304803
+++ autofs-5.0.7/daemon/lookup.c
304803
@@ -476,6 +476,7 @@ static enum nsswitch_status read_map_sou
304803
 	}
304803
 
304803
 	this->source[4] = '\0';
304803
+	tmap.flags = map->flags;
304803
 	tmap.type = this->source;
304803
 	tmap.format = map->format;
304803
 	tmap.lookup = map->lookup;
304803
@@ -879,6 +880,7 @@ static enum nsswitch_status lookup_map_n
304803
 	}
304803
 
304803
 	this->source[4] = '\0';
304803
+	tmap.flags = map->flags;
304803
 	tmap.type = this->source;
304803
 	tmap.format = map->format;
304803
 	tmap.mc = map->mc;
304803
--- autofs-5.0.7.orig/include/master.h
304803
+++ autofs-5.0.7/include/master.h
304803
@@ -20,7 +20,10 @@
304803
 #ifndef MASTER_H
304803
 #define MASTER_H
304803
 
304803
+#define MAP_FLAG_FORMAT_AMD	0x0001
304803
+
304803
 struct map_source {
304803
+	unsigned int flags;
304803
 	char *type;
304803
 	char *format;
304803
 	time_t exp_timeout;		/* Timeout for expiring mounts */
304803
--- autofs-5.0.7.orig/lib/master.c
304803
+++ autofs-5.0.7/lib/master.c
304803
@@ -178,6 +178,8 @@ master_add_map_source(struct master_mape
304803
 			return NULL;
304803
 		}
304803
 		source->format = nformat;
304803
+		if (!strcmp(nformat, "amd"))
304803
+			source->flags |= MAP_FLAG_FORMAT_AMD;
304803
 	}
304803
 
304803
 	source->age = age;
304803
@@ -430,6 +432,8 @@ master_add_source_instance(struct map_so
304803
 			return NULL;
304803
 		}
304803
 		new->format = nformat;
304803
+		if (!strcmp(nformat, "amd"))
304803
+			new->flags |= MAP_FLAG_FORMAT_AMD;
304803
 	}
304803
 
304803
 	new->age = age;