Option maps

Option maps — description for mount options

Synopsis

const struct libmnt_optmap * mnt_get_builtin_optmap     (int id);
#define             MNT_INVERT
#define             MNT_NOMTAB
#define             MNT_PREFIX
#define             MNT_NOHLPS

Description

The mount(2) linux syscall uses two arguments for mount options:

mountflags: (see MS_* macros in linux/fs.h)

mountdata: (usully a comma separated string of options)

The libmount uses options-map(s) to describe mount options.

The option description (map entry) includes:

name: and argument name

id: (in the map unique identifier or a mountflags, e.g MS_RDONLY)

mask: (MNT_INVERT, MNT_NOMTAB)

The option argument value is defined by:

"=" -- required argument, e.g "comment="

"[=]" -- optional argument, e.g. "loop[=]"

Example:

1
2
3
4
5
6
7
8
9
#define MY_MS_FOO   (1 << 1)
#define MY_MS_BAR   (1 << 2)

libmnt_optmap myoptions[] = {
  { "foo",   MY_MS_FOO },
  { "nofoo", MY_MS_FOO | MNT_INVERT },
  { "bar=",  MY_MS_BAR },
  { NULL }
};

The libmount defines two basic built-in options maps:

MNT_LINUX_MAP: fs-independent kernel mount options (usually MS_* flags)

MNT_USERSPACE_MAP: userspace specific mount options (e.g. "user", "loop")

For more details about option map struct see "struct mnt_optmap" in mount/mount.h.

Details

mnt_get_builtin_optmap ()

const struct libmnt_optmap * mnt_get_builtin_optmap     (int id);

MNT_INVERT

#define MNT_INVERT (1 << 1) /* invert the mountflag */

MNT_NOMTAB

#define MNT_NOMTAB (1 << 2) /* skip in the mtab option string */

MNT_PREFIX

#define MNT_PREFIX (1 << 3) /* prefix used for some options (e.g. "x-foo") */

MNT_NOHLPS

#define MNT_NOHLPS (1 << 4) /* don't add the option to mount.<type> helpers command line */