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

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