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

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