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

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