Skip to contentSkip to conversation

libmount/context: ignore fstab entries with fstype "ignore"

PATCH In review Dave Reisner 2 participants 2 messages Jun 17, 2012 – Jun 19, 2012 Util-Linux package

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 libmount/context: ignore fstab entries with fstype "ignore"

This is documented in fstab(5) as being a valid option for fstype, and should be left alone when iterating via mount -a, similar to "noauto" in the option string.

---
 libmount/src/context_mount.c |    8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)
libmount/src/context_mount.c +6 -2
index 36dc414..04a34c0 100644
@@ -831,7 +831,7 @@ int mnt_context_next_mount(struct libmnt_context *cxt,
 			   int *ignored)
 {
 	struct libmnt_table *fstab, *mtab;
-	const char *o, *tgt;
+	const char *o, *tgt, *fstype;
 	int rc, mounted = 0;
 
 	if (ignored)
@@ -857,6 +857,7 @@ int mnt_context_next_mount(struct libmnt_context *cxt,
 
 	o = mnt_fs_get_user_options(*fs);
 	tgt = mnt_fs_get_target(*fs);
+	fstype = mnt_fs_get_fstype(*fs);
 
 	DBG(CXT, mnt_debug_h(cxt, "next-mount: trying %s", tgt));
 
@@ -869,6 +870,9 @@ int mnt_context_next_mount(struct libmnt_context *cxt,
 	/* ignore noauto filesystems */
 	   (o && mnt_optstr_get_option(o, "noauto", NULL, NULL) == 0) ||
 
+	/* ignore filesystems declared with fstype "ignore" */
+	   (strcmp(fstype, "ignore") == 0) ||
+
 	/* ignore filesystems not match with options patterns */
 	   (cxt->fstype_pattern && !mnt_fs_match_fstype(*fs,
 					cxt->fstype_pattern)) ||
@@ -880,7 +884,7 @@ int mnt_context_next_mount(struct libmnt_context *cxt,
 			*ignored = 1;
 		DBG(CXT, mnt_debug_h(cxt, "next-mount: not-match "
 				"[fstype: %s, t-pattern: %s, options: %s, O-pattern: %s]",
-				mnt_fs_get_fstype(*fs),
+				fstype,
 				cxt->fstype_pattern,
 				mnt_fs_get_options(*fs),
 				cxt->optstr_pattern));
Signature · 1 line
1.7.10.4
maintainer
#1 lore raw
Quoted 3 lines · Dave Reisner

This is documented in fstab(5) as being a valid option for fstype, and should be left alone when iterating via mount -a, similar to "noauto" in the option string.

(also discussed on IRC)

I have removed the 'ignore' from documentation. We will not support this silly feature in the new mount util.

The supported (and commonly used) solutions are "noauto" mount option and '#' to comment out fstab entries.

Karel

Signature · 2 lines
 Karel Zak  <[email protected]>
 http://karelzak.blogspot.com