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

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