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

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