Blob Blame History Raw
autofs-5.1.5 - add ignore mount option

From: Ian Kent <raven@themaw.net>

Add mount option "ignore", if the kernel supports it, as an
indicator to applications to ignore the mount entry.

Signed-off-by: Ian Kent <raven@themaw.net>
---
 CHANGELOG           |    1 +
 daemon/direct.c     |   10 ++++++++++
 daemon/indirect.c   |   10 ++++++++++
 include/automount.h |    3 +++
 lib/master.c        |    4 ++--
 5 files changed, 26 insertions(+), 2 deletions(-)

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