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

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