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

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