Blame SOURCES/autofs-5.1.5-add-ignore-mount-option.patch

304803
autofs-5.1.5 - add ignore mount option
304803
304803
From: Ian Kent <raven@themaw.net>
304803
304803
Add mount option "ignore", if the kernel supports it, as an
304803
indicator to applications to ignore the mount entry.
304803
304803
Signed-off-by: Ian Kent <raven@themaw.net>
304803
---
304803
 CHANGELOG           |    1 +
304803
 daemon/direct.c     |   10 ++++++++++
304803
 daemon/indirect.c   |   10 ++++++++++
304803
 include/automount.h |    3 +++
304803
 lib/master.c        |    4 ++--
304803
 5 files changed, 26 insertions(+), 2 deletions(-)
304803
304803
--- autofs-5.0.7.orig/daemon/direct.c
304803
+++ autofs-5.0.7/daemon/direct.c
304803
@@ -423,6 +423,16 @@ int do_mount_autofs_direct(struct autofs
304803
 				mp->options = tmp;
304803
 			}
304803
 		}
304803
+
304803
+		if ((ap->flags & MOUNT_FLAG_IGNORE) &&
304803
+		    ((get_kver_major() == 5 && get_kver_minor() > 4) ||
304803
+		     (get_kver_major() > 5))) {
304803
+			char *tmp = realloc(mp->options, strlen(mp->options) + 7);
304803
+			if (tmp) {
304803
+				strcat(tmp, ",ignore");
304803
+				mp->options = tmp;
304803
+			}
304803
+		}
304803
 	}
304803
 
304803
 	/* In case the directory doesn't exist, try to mkdir it */
304803
--- autofs-5.0.7.orig/daemon/indirect.c
304803
+++ autofs-5.0.7/daemon/indirect.c
304803
@@ -132,6 +132,16 @@ static int do_mount_autofs_indirect(stru
304803
 		}
304803
 	}
304803
 
304803
+	if ((ap->flags & MOUNT_FLAG_IGNORE) &&
304803
+	    ((get_kver_major() == 5 && get_kver_minor() > 4) ||
304803
+	     (get_kver_major() > 5))) {
304803
+		char *tmp = realloc(options, strlen(options) + 7);
304803
+		if (tmp) {
304803
+			strcat(tmp, ",ignore");
304803
+			options = tmp;
304803
+		}
304803
+	}
304803
+
304803
 	/* In case the directory doesn't exist, try to mkdir it */
304803
 	if (mkdir_path(root, 0555) < 0) {
304803
 		if (errno != EEXIST && errno != EROFS) {
304803
--- autofs-5.0.7.orig/include/automount.h
304803
+++ autofs-5.0.7/include/automount.h
304803
@@ -541,6 +541,9 @@ struct kernel_mod_version {
304803
 /* Use strict expire semantics if requested and kernel supports it */
304803
 #define MOUNT_FLAG_STRICTEXPIRE		0x0400
304803
 
304803
+/* Indicator for applications to ignore the mount entry */
304803
+#define MOUNT_FLAG_IGNORE		0x0800
304803
+
304803
 struct autofs_point {
304803
 	pthread_t thid;
304803
 	char *path;			/* Mount point name */
304803
--- autofs-5.0.7.orig/lib/master.c
304803
+++ autofs-5.0.7/lib/master.c
304803
@@ -101,9 +101,9 @@ int master_add_autofs_point(struct maste
304803
 		ap->negative_timeout = global_negative_timeout;
304803
 	ap->exp_timeout = defaults_get_timeout();
304803
 	ap->exp_runfreq = 0;
304803
-	ap->flags = 0;
304803
+	ap->flags = MOUNT_FLAG_IGNORE;
304803
 	if (ghost)
304803
-		ap->flags = MOUNT_FLAG_GHOST;
304803
+		ap->flags |= MOUNT_FLAG_GHOST;
304803
 
304803
 	if (nobind)
304803
 		ap->flags |= MOUNT_FLAG_NOBIND;
304803
--- autofs-5.0.7.orig/CHANGELOG
304803
+++ autofs-5.0.7/CHANGELOG
304803
@@ -334,6 +334,7 @@
304803
 - remove a couple of old debug messages.
304803
 - fix amd entry memory leak.
304803
 - fix unlink_mount_tree() not umounting mounts.
304803
+- add ignore mount option.
304803
 
304803
 25/07/2012 autofs-5.0.7
304803
 =======================