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

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