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

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