Blame SOURCES/autofs-5.1.2-capture-cache-option-and-its-settings-during-parsing.patch

304803
autofs-5.1.2 - capture cache option and its settings during parsing
304803
304803
From: Ian Kent <raven@themaw.net>
304803
304803
The amd map format parser was not aware of the optional sync
304803
parameter of the cache option.
304803
304803
Make the parser aware of the sync option and capture the cache
304803
option and its settings during map parsing.
304803
304803
Signed-off-by: Ian Kent <raven@themaw.net>
304803
---
304803
 CHANGELOG           |    1 +
304803
 include/parse_amd.h |    7 +++++++
304803
 modules/amd_parse.y |   12 +++++++++---
304803
 modules/amd_tok.l   |    2 +-
304803
 4 files changed, 18 insertions(+), 4 deletions(-)
304803
304803
--- autofs-5.0.7.orig/CHANGELOG
304803
+++ autofs-5.0.7/CHANGELOG
304803
@@ -230,6 +230,7 @@
304803
 - include amd mount sections mounts in master mounts list.
304803
 - check for conflicting amd section mounts.
304803
 - add function conf_get_map_options().
304803
+- capture cache option and its settings during parsing.
304803
 
304803
 25/07/2012 autofs-5.0.7
304803
 =======================
304803
--- autofs-5.0.7.orig/include/parse_amd.h
304803
+++ autofs-5.0.7/include/parse_amd.h
304803
@@ -39,9 +39,16 @@
304803
 #define AMD_DEFAULTS_RESET	0x02000000
304803
 #define AMD_DEFAULTS_MASK	0xff000000
304803
 
304803
+#define AMD_CACHE_OPTION_NONE	0x0000
304803
+#define AMD_CACHE_OPTION_INC	0x0001
304803
+#define AMD_CACHE_OPTION_ALL	0x0002
304803
+#define AMD_CACHE_OPTION_REGEXP	0x0004
304803
+#define AMD_CACHE_OPTION_SYNC	0x8000
304803
+
304803
 struct amd_entry {
304803
 	char *path;
304803
 	unsigned long flags;
304803
+	unsigned int cache_opts;
304803
 	char *type;
304803
 	char *map_type;
304803
 	char *pref;
304803
--- autofs-5.0.7.orig/modules/amd_parse.y
304803
+++ autofs-5.0.7/modules/amd_parse.y
304803
@@ -424,9 +424,14 @@ option_assignment: MAP_OPTION OPTION_ASS
304803
 	}
304803
 	| MAP_OPTION OPTION_ASSIGN CACHE_OPTION
304803
 	{
304803
-		sprintf(msg_buf, "option %s is not used, autofs "
304803
-				 "default caching is always used", $1);
304803
-		amd_info(msg_buf);
304803
+		if (strncmp($3, "inc", 3))
304803
+			entry.cache_opts = AMD_CACHE_OPTION_INC;
304803
+		else if (strncmp($3, "all", 3))
304803
+			entry.cache_opts = AMD_CACHE_OPTION_ALL;
304803
+		else if (strncmp($3, "re", 2))
304803
+			entry.cache_opts = AMD_CACHE_OPTION_REGEXP;
304803
+		if (strstr($3, "sync"))
304803
+			entry.cache_opts |= AMD_CACHE_OPTION_SYNC;
304803
 	}
304803
 	;
304803
 
304803
@@ -534,6 +539,7 @@ static int amd_msg(const char *s)
304803
 static void local_init_vars(void)
304803
 {
304803
 	memset(&entry, 0, sizeof(entry));
304803
+	entry.cache_opts = AMD_CACHE_OPTION_NONE;
304803
 	memset(opts, 0, sizeof(opts));
304803
 }
304803
 
304803
--- autofs-5.0.7.orig/modules/amd_tok.l
304803
+++ autofs-5.0.7/modules/amd_tok.l
304803
@@ -101,7 +101,7 @@ NOPT		({SSTR}|(({IP4ADDR}(\/{V4MASK})?)|
304803
 MAPOPT		(fs|type|maptype|pref|sublink|cache)
304803
 MNTOPT		(opts|addopts|remopts)
304803
 FSOPTS		(rhost|rfs|dev|cachedir|mount|unmount|umount|delay)
304803
-CHEOPT		(mapdefault|none|inc|re|regexp|all)
304803
+CHEOPT		((mapdefault|none|inc|re|regexp|all)(,sync)?)
304803
 MAPTYPE		(file|nis|nisplus|ldap|hesiod|exec|ndbm|passwd|union)
304803
 FSTYPE_LOCAL	(link|linkx|lofs|ufs|ext2|ext3|ext4|xfs|jfs|cdfs|cachefs)
304803
 FSTYPE_NET	(nfs|nfsx|nfsl|host)