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

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