Esempio n. 1
0
static int parse_sb_opt(char *opt, unsigned *flags, char *uopt)
{
	static const struct opt2flag sb_opt2flag[] = {
		{ "rw",		0,		},
		{ "ro",		MS_RDONLY,	},
		{ "sync",	MS_SYNC,	},
		{ "dirsync",	MS_DIRSYNC,	},
		{ "mad",	MS_MANDLOCK,	},
		{ },
	};

	return do_opt2flag(opt, flags, sb_opt2flag, uopt, sb_opt_cb);
}
Esempio n. 2
0
static int parse_mnt_flags(char *opt, unsigned *flags)
{
	const struct opt2flag mnt_opt2flag[] = {
		{ "rw", 0, },
		{ "ro", MS_RDONLY, },
		{ "nosuid", MS_NOSUID, },
		{ "nodev", MS_NODEV, } ,
		{ "noexec", MS_NOEXEC, },
		{ "noatime", MS_NOATIME, },
		{ "nodiratime", MS_NODIRATIME, },
		{ "relatime", MS_RELATIME, },
		{ },
	};

	return do_opt2flag(opt, flags, mnt_opt2flag, NULL);
}
Esempio n. 3
0
static int parse_mnt_flags(char *opt, unsigned *flags)
{
	static const struct opt2flag mnt_opt2flag[] = {
		{ "rw",		0,		},
		{ "ro",		MS_RDONLY,	},
		{ "nosuid",	MS_NOSUID,	},
		{ "nodev",	MS_NODEV,	},
		{ "noexec",	MS_NOEXEC,	},
		{ "noatime",	MS_NOATIME,	},
		{ "nodiratime",	MS_NODIRATIME,	},
		{ "relatime",	MS_RELATIME,	},
		{ },
	};

	if (do_opt2flag(opt, flags, mnt_opt2flag, NULL, NULL))
		return -1;

	/* Otherwise the kernel assumes RELATIME by default */
	if ((*flags & (MS_RELATIME | MS_NOATIME)) == 0)
		*flags = MS_STRICTATIME;

	return 0;
}