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

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