Blame SOURCES/autofs-5.1.2-add-config-option-to-use-mount-request-log-id.patch

4d476f
autofs-5.1.2 - add config option to use mount request log id
4d476f
4d476f
From: Ian Kent <raven@themaw.net>
4d476f
4d476f
Add a configuration option to control whether request ids are added to
4d476f
mount request log entries. It's default value is to not include the
4d476f
additional id.
4d476f
4d476f
Signed-off-by: Ian Kent <raven@themaw.net>
4d476f
---
4d476f
 CHANGELOG                      |    1 +
4d476f
 daemon/automount.c             |    3 +++
4d476f
 include/defaults.h             |    3 +++
4d476f
 lib/defaults.c                 |   18 ++++++++++++++++++
4d476f
 man/autofs.conf.5.in           |    6 ++++++
4d476f
 redhat/autofs.conf.default.in  |    7 +++++++
4d476f
 samples/autofs.conf.default.in |    7 +++++++
4d476f
 7 files changed, 45 insertions(+)
4d476f
4d476f
--- autofs-5.0.7.orig/CHANGELOG
4d476f
+++ autofs-5.0.7/CHANGELOG
4d476f
@@ -239,6 +239,7 @@
4d476f
 - create thread-local ID for mount attempts.
4d476f
 - log functions to prefix messages with attempt_id if available.
4d476f
 - factor out set_thread_mount_request_log_id().
4d476f
+- add config option to use mount request log id.
4d476f
 
4d476f
 25/07/2012 autofs-5.0.7
4d476f
 =======================
4d476f
--- autofs-5.0.7.orig/daemon/automount.c
4d476f
+++ autofs-5.0.7/daemon/automount.c
4d476f
@@ -116,6 +116,9 @@ void set_thread_mount_request_log_id(str
4d476f
 	unsigned long *attempt_id;
4d476f
 	int status;
4d476f
 
4d476f
+	if (!defaults_get_use_mount_request_log_id())
4d476f
+		return;
4d476f
+
4d476f
 	attempt_id = pthread_getspecific(key_thread_attempt_id);
4d476f
 	if (attempt_id == NULL) {
4d476f
 		attempt_id = (unsigned long *) calloc(1, sizeof(unsigned long));
4d476f
--- autofs-5.0.7.orig/include/defaults.h
4d476f
+++ autofs-5.0.7/include/defaults.h
4d476f
@@ -51,6 +51,8 @@
4d476f
 #define DEFAULT_USE_HOSTNAME_FOR_MOUNTS  "0"
4d476f
 #define DEFAULT_DISABLE_NOT_FOUND_MESSAGE "0"
4d476f
 
4d476f
+#define DEFAULT_USE_MOUNT_REQUEST_LOG_ID "0"
4d476f
+
4d476f
 /* Config entry flags */
4d476f
 #define CONF_NONE			0x00000000
4d476f
 #define CONF_ENV			0x00000001
4d476f
@@ -169,6 +171,7 @@ const char *defaults_get_auth_conf_file(
4d476f
 unsigned int defaults_get_map_hash_table_size(void);
4d476f
 unsigned int defaults_use_hostname_for_mounts(void);
4d476f
 unsigned int defaults_disable_not_found_message(void);
4d476f
+unsigned int defaults_get_use_mount_request_log_id(void);
4d476f
 
4d476f
 unsigned int conf_amd_mount_section_exists(const char *);
4d476f
 char **conf_amd_get_mount_paths(void);
4d476f
--- autofs-5.0.7.orig/lib/defaults.c
4d476f
+++ autofs-5.0.7/lib/defaults.c
4d476f
@@ -76,6 +76,8 @@
4d476f
 #define NAME_USE_HOSTNAME_FOR_MOUNTS	"use_hostname_for_mounts"
4d476f
 #define NAME_DISABLE_NOT_FOUND_MESSAGE	"disable_not_found_message"
4d476f
 
4d476f
+#define NAME_USE_MOUNT_REQUEST_LOG_ID	"use_mount_request_log_id"
4d476f
+
4d476f
 #define NAME_AMD_ARCH				"arch"
4d476f
 #define NAME_AMD_AUTO_ATTRCACHE			"auto_attrcache"
4d476f
 #define NAME_AMD_AUTO_DIR			"auto_dir"
4d476f
@@ -354,6 +356,11 @@ static int conf_load_autofs_defaults(voi
4d476f
 	if (ret == CFG_FAIL)
4d476f
 		goto error;
4d476f
 
4d476f
+	ret = conf_update(sec, NAME_USE_MOUNT_REQUEST_LOG_ID,
4d476f
+			  DEFAULT_USE_MOUNT_REQUEST_LOG_ID, CONF_ENV);
4d476f
+	if (ret == CFG_FAIL)
4d476f
+		goto error;
4d476f
+
4d476f
 	/* LDAP_URI and SEARCH_BASE can occur multiple times */
4d476f
 	while ((co = conf_lookup(sec, NAME_LDAP_URI)))
4d476f
 		conf_delete(co->section, co->name);
4d476f
@@ -1832,6 +1839,17 @@ unsigned int defaults_disable_not_found_
4d476f
 
4d476f
 	return res;
4d476f
 }
4d476f
+
4d476f
+unsigned int defaults_get_use_mount_request_log_id(void)
4d476f
+{
4d476f
+	int res;
4d476f
+
4d476f
+	res = conf_get_yesno(autofs_gbl_sec, NAME_USE_MOUNT_REQUEST_LOG_ID);
4d476f
+	if (res < 0)
4d476f
+		res = atoi(DEFAULT_USE_MOUNT_REQUEST_LOG_ID);
4d476f
+
4d476f
+	return res;
4d476f
+}
4d476f
 
4d476f
 unsigned int conf_amd_mount_section_exists(const char *section)
4d476f
 {
4d476f
--- autofs-5.0.7.orig/man/autofs.conf.5.in
4d476f
+++ autofs-5.0.7/man/autofs.conf.5.in
4d476f
@@ -141,6 +141,12 @@ The original request to add this log mes
4d476f
 That produces, IMHO, unnecessary noise in the log so a configuration option
4d476f
 has been added to provide the ability to turn it off. The default is "no"
4d476f
 to maintain the current behaviour.
4d476f
+.TP
4d476f
+.B use_mount_request_log_id
4d476f
+.br
4d476f
+Set whether to use a mount request log id so that log entries for specific
4d476f
+mount requests can be easily identified in logs that have multiple conncurrent
4d476f
+requests. Default is don't use mount request log ids.
4d476f
 .SS LDAP Configuration
4d476f
 .P
4d476f
 Configuration settings available are:
4d476f
--- autofs-5.0.7.orig/redhat/autofs.conf.default.in
4d476f
+++ autofs-5.0.7/redhat/autofs.conf.default.in
4d476f
@@ -71,6 +71,13 @@ mount_nfs_default_protocol = 4
4d476f
 #
4d476f
 # force_standard_program_map_env = no
4d476f
 #
4d476f
+# use_mount_request_log_id - Set whether to use a mount request log
4d476f
+#			id so that log entries for specific mount
4d476f
+#			requests can be easily identified in logs
4d476f
+#			that have multiple conncurrent requests.
4d476f
+#
4d476f
+#use_mount_request_log_id = no
4d476f
+#
4d476f
 # Define base dn for map dn lookup.
4d476f
 #
4d476f
 # Define server URIs
4d476f
--- autofs-5.0.7.orig/samples/autofs.conf.default.in
4d476f
+++ autofs-5.0.7/samples/autofs.conf.default.in
4d476f
@@ -70,6 +70,13 @@ browse_mode = no
4d476f
 #
4d476f
 # force_standard_program_map_env = no
4d476f
 #
4d476f
+# use_mount_request_log_id - Set whether to use a mount request log
4d476f
+#			id so that log entries for specific mount
4d476f
+#			requests can be easily identified in logs
4d476f
+#			that have multiple conncurrent requests.
4d476f
+#
4d476f
+#use_mount_request_log_id = no
4d476f
+#
4d476f
 # Define base dn for map dn lookup.
4d476f
 #
4d476f
 # Define server URIs