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

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