Blame SOURCES/autofs-5.1.5-add-mount_verbose-configuration-option.patch

304803
autofs-5.1.5 - add mount_verbose configuration option
304803
304803
From: Lars R. Damerow <lars@pixar.com>
304803
304803
This option makes automount pass the -v flag to mount(8).
304803
304803
Signed-off-by: Lars R.  Damerow <lars@pixar.com>
304803
Signed-off-by: Ian Kent <raven@themaw.net>
304803
---
304803
 CHANGELOG                      |    1 +
304803
 daemon/spawn.c                 |   20 ++++++++++++--------
304803
 include/defaults.h             |    2 ++
304803
 lib/defaults.c                 |   17 +++++++++++++++++
304803
 man/autofs.conf.5.in           |    4 ++++
304803
 redhat/autofs.conf.default.in  |    4 ++++
304803
 samples/autofs.conf.default.in |    4 ++++
304803
 7 files changed, 44 insertions(+), 8 deletions(-)
304803
304803
--- autofs-5.0.7.orig/CHANGELOG
304803
+++ autofs-5.0.7/CHANGELOG
304803
@@ -319,6 +319,7 @@
304803
 - support strictexpire mount option.
304803
 - add NULL check for get_addr_string() return.
304803
 - use malloc(3) in spawn.c.
304803
+- add mount_verbose configuration option.
304803
 
304803
 25/07/2012 autofs-5.0.7
304803
 =======================
304803
--- autofs-5.0.7.orig/daemon/spawn.c
304803
+++ autofs-5.0.7/daemon/spawn.c
304803
@@ -537,12 +537,14 @@ int spawn_mount(unsigned logopt, ...)
304803
 	char prog[] = PATH_MOUNT;
304803
 	char arg0[] = PATH_MOUNT;
304803
 	char argn[] = "-n";
304803
+	char argvr[] = "-v";
304803
 	/* In case we need to use the fake option to mount */
304803
 	char arg_fake[] = "-f";
304803
 	unsigned int options;
304803
 	unsigned int retries = MTAB_LOCK_RETRIES;
304803
 	int update_mtab = 1, ret, printed = 0;
304803
 	unsigned int wait = defaults_get_mount_wait();
304803
+	int verbose = defaults_get_mount_verbose();
304803
 	char buf[PATH_MAX + 1];
304803
 	unsigned int argv_len;
304803
 
304803
@@ -569,8 +571,10 @@ int spawn_mount(unsigned logopt, ...)
304803
 		}
304803
 	}
304803
 
304803
-	/* Alloc 1 extra slot in case we need to use the "-f" option */
304803
-	argv_len = sizeof(char *) * (argc + 2);
304803
+	/* Alloc 2 extra slots in case we need to use the "-f" or "-v" options
304803
+	 * plus the NULL slot for end of args.
304803
+	 */
304803
+	argv_len = sizeof(char *) * (argc + 3);
304803
 	argv = malloc(argv_len);
304803
 	if (!argv) {
304803
 		char buf[MAX_ERR_BUF];
304803
@@ -583,12 +587,12 @@ int spawn_mount(unsigned logopt, ...)
304803
 	argv[0] = arg0;
304803
 
304803
 	va_start(arg, logopt);
304803
-	if (update_mtab)
304803
-		p = argv + 1;
304803
-	else {
304803
-		argv[1] = argn;
304803
-		p = argv + 2;
304803
-	}
304803
+	p = argv + 1;
304803
+	if (!update_mtab)
304803
+		*(p++) = argn;
304803
+	if (verbose)
304803
+		*(p++) = argvr;
304803
+
304803
 	while ((*p = va_arg(arg, char *))) {
304803
 		if (options == SPAWN_OPT_OPEN && !strcmp(*p, "-t")) {
304803
 			*(++p) = va_arg(arg, char *);
304803
--- autofs-5.0.7.orig/include/defaults.h
304803
+++ autofs-5.0.7/include/defaults.h
304803
@@ -27,6 +27,7 @@
304803
 #define DEFAULT_TIMEOUT			"600"
304803
 #define DEFAULT_MASTER_WAIT		"10"
304803
 #define DEFAULT_NEGATIVE_TIMEOUT	"60"
304803
+#define DEFAULT_MOUNT_VERBOSE		"0"
304803
 #define DEFAULT_MOUNT_WAIT		"-1"
304803
 #define DEFAULT_UMOUNT_WAIT		"12"
304803
 #define DEFAULT_BROWSE_MODE		"1"
304803
@@ -166,6 +167,7 @@ unsigned int defaults_get_ldap_timeout(v
304803
 unsigned int defaults_get_ldap_network_timeout(void);
304803
 unsigned int defaults_get_mount_nfs_default_proto(void);
304803
 unsigned int defaults_get_append_options(void);
304803
+unsigned int defaults_get_mount_verbose(void);
304803
 unsigned int defaults_get_mount_wait(void);
304803
 unsigned int defaults_get_umount_wait(void);
304803
 const char *defaults_get_auth_conf_file(void);
304803
--- autofs-5.0.7.orig/lib/defaults.c
304803
+++ autofs-5.0.7/lib/defaults.c
304803
@@ -67,6 +67,7 @@
304803
 
304803
 #define NAME_MOUNT_NFS_DEFAULT_PROTOCOL	"mount_nfs_default_protocol"
304803
 #define NAME_APPEND_OPTIONS		"append_options"
304803
+#define NAME_MOUNT_VERBOSE		"mount_verbose"
304803
 #define NAME_MOUNT_WAIT			"mount_wait"
304803
 #define NAME_UMOUNT_WAIT		"umount_wait"
304803
 #define NAME_AUTH_CONF_FILE		"auth_conf_file"
304803
@@ -327,6 +328,11 @@ static int conf_load_autofs_defaults(voi
304803
 	if (ret == CFG_FAIL)
304803
 		goto error;
304803
 
304803
+	ret = conf_update(sec, NAME_MOUNT_VERBOSE,
304803
+			  DEFAULT_MOUNT_VERBOSE, CONF_ENV);
304803
+	if (ret == CFG_FAIL)
304803
+		goto error;
304803
+
304803
 	ret = conf_update(sec, NAME_MOUNT_WAIT,
304803
 			  DEFAULT_MOUNT_WAIT, CONF_ENV);
304803
 	if (ret == CFG_FAIL)
304803
@@ -1779,6 +1785,17 @@ unsigned int defaults_get_append_options
304803
 
304803
 	return res;
304803
 }
304803
+
304803
+unsigned int defaults_get_mount_verbose(void)
304803
+{
304803
+	long res;
304803
+
304803
+	res = conf_get_yesno(autofs_gbl_sec, NAME_MOUNT_VERBOSE);
304803
+	if (res < 0)
304803
+		res = atoi(DEFAULT_MOUNT_VERBOSE);
304803
+
304803
+	return res;
304803
+}
304803
 
304803
 unsigned int defaults_get_mount_wait(void)
304803
 {
304803
--- autofs-5.0.7.orig/man/autofs.conf.5.in
304803
+++ autofs-5.0.7/man/autofs.conf.5.in
304803
@@ -41,6 +41,10 @@ Set the default timeout for caching fail
304803
 60). If the equivalent command line option is given it will override this
304803
 setting.
304803
 .TP
304803
+.B mount_verbose
304803
+.br
304803
+Use the verbose flag when spawning mount(8) (program default "no").
304803
+.TP
304803
 .B mount_wait
304803
 .br
304803
 Set the default time to wait for a response from a spawned mount(8)
304803
--- autofs-5.0.7.orig/redhat/autofs.conf.default.in
304803
+++ autofs-5.0.7/redhat/autofs.conf.default.in
304803
@@ -26,6 +26,10 @@ timeout = 300
304803
 #
304803
 #negative_timeout = 60
304803
 #
304803
+# mount_verbose - use the -v flag when calling mount(8).
304803
+#
304803
+#mount_verbose = no
304803
+#
304803
 # mount_wait - time to wait for a response from mount(8).
304803
 # 	       Setting this timeout can cause problems when
304803
 # 	       mount would otherwise wait for a server that
304803
--- autofs-5.0.7.orig/samples/autofs.conf.default.in
304803
+++ autofs-5.0.7/samples/autofs.conf.default.in
304803
@@ -26,6 +26,10 @@ timeout = 300
304803
 #
304803
 #negative_timeout = 60
304803
 #
304803
+# mount_verbose - use the -v flag when calling mount(8).
304803
+#
304803
+#mount_verbose = no
304803
+#
304803
 # mount_wait - time to wait for a response from mount(8).
304803
 # 	       Setting this timeout can cause problems when
304803
 # 	       mount would otherwise wait for a server that