{ "group", MNT_MS_GROUP, MNT_NOMTAB }, /* Let the group of the device mount */
{ "nogroup", MNT_MS_GROUP, MNT_INVERT | MNT_NOMTAB }, /* Device group has no special privs */
+ /*
+ * Note that traditional init scripts assume _netdev option in /etc/mtab to
+ * umount network block devices on shutdown.
+ */
{ "_netdev", MNT_MS_NETDEV }, /* Device requires network */
{ "comment=", MNT_MS_COMMENT, MNT_NOHLPS | MNT_NOMTAB },/* fstab comment only */
int skip; /* skip in mtab option string */
int inv; /* true if flag value should be inverted */
int mask; /* flag mask value */
+ int cmask; /* comments mask */
};
/* Custom mount options for our own purposes. */
#define MS_COMMENT 0x02000000
#define MS_LOOP 0x00010000
+#define MS_COMMENT_NOFAIL (1 << 1)
+#define MS_COMMENT_NETDEV (1 << 2)
+
/* Options that we keep the mount system call from seeing. */
#define MS_NOSYS (MS_NOAUTO|MS_USERS|MS_USER|MS_COMMENT|MS_LOOP)
{ "noowner", 0, 1, MS_OWNER }, /* Device owner has no special privs */
{ "group", 0, 0, MS_GROUP }, /* Let the group of the device mount */
{ "nogroup", 0, 1, MS_GROUP }, /* Device group has no special privs */
- { "_netdev", 0, 0, MS_COMMENT}, /* Device requires network */
+ { "_netdev", 0, 0, MS_COMMENT, MS_COMMENT_NETDEV }, /* Device requires network */
{ "comment", 0, 0, MS_COMMENT}, /* fstab comment only (kudzu,_netdev)*/
/* add new options here */
{ "strictatime", 0, 0, MS_STRICTATIME }, /* Strict atime semantics */
{ "nostrictatime", 0, 1, MS_STRICTATIME }, /* kernel default atime */
#endif
- { "nofail", 0, 0, MS_COMMENT}, /* Do not fail if ENOENT on dev */
+ { "nofail", 0, 0, MS_COMMENT, MS_COMMENT_NOFAIL }, /* Do not fail if ENOENT on dev */
{ NULL, 0, 0, 0 }
};
static int opt_nofail;
static int invuser_flags;
+static int comment_flags;
static const char *opt_loopdev, *opt_vfstype, *opt_offset, *opt_sizelimit,
*opt_encryption, *opt_speed, *opt_comment, *opt_uhelper, *opt_helper;
static void
clear_flags_opts(void) {
invuser_flags = 0;
+ comment_flags = 0;
opt_nofail = 0;
}
verbose = 0;
}
#endif
- if (streq(opt, "nofail"))
- opt_nofail = 1;
+ if (om->mask == MS_COMMENT) {
+ comment_flags |= om->cmask;
+ if (om->cmask == MS_COMMENT_NOFAIL)
+ opt_nofail = 1;
+ }
return;
}
continue;
if (om->inv || !om->mask || (flags & om->mask) != om->mask)
continue;
+ if (om->mask == MS_COMMENT && !(comment_flags & om->cmask))
+ continue;
new_opts = append_opt(new_opts, om->opt, NULL);
flags &= ~om->mask;
}