diff options
author | Karel Zak | 2011-04-21 14:53:23 +0200 |
---|---|---|
committer | Karel Zak | 2011-04-21 14:53:23 +0200 |
commit | 699abc838104ff18e0883d42cfdac60a7c9f03ab (patch) | |
tree | d0b69568262d46de76372e578772cee3fe5f4f9a /shlibs/mount/src/optmap.c | |
parent | tests: don't run mount/regfile test on old kernel (diff) | |
download | kernel-qcow2-util-linux-699abc838104ff18e0883d42cfdac60a7c9f03ab.tar.gz kernel-qcow2-util-linux-699abc838104ff18e0883d42cfdac60a7c9f03ab.tar.xz kernel-qcow2-util-linux-699abc838104ff18e0883d42cfdac60a7c9f03ab.zip |
libmount: add support for x-* mount comments
The current way how add any comment or extra information to /etc/fstab
is to use comment="" mount option. This is not too elegant and readable
if you want to add more than one comment.
It seems better to add any generic prefix that will be used for all
3rd-party userspace mount options.
Expected syntax is:
x-<application>-<options>[=<data>]
For example:
x-systemd-bar=managed
All x-* options (as well as comment=) are ignored by libmount and not
stored to the mtab file.
Requested-by: Lennart Poettering <lennart@poettering.net>
Signed-off-by: Karel Zak <kzak@redhat.com>
Diffstat (limited to 'shlibs/mount/src/optmap.c')
-rw-r--r-- | shlibs/mount/src/optmap.c | 15 |
1 files changed, 12 insertions, 3 deletions
diff --git a/shlibs/mount/src/optmap.c b/shlibs/mount/src/optmap.c index acd76173f..7db6d0314 100644 --- a/shlibs/mount/src/optmap.c +++ b/shlibs/mount/src/optmap.c @@ -133,7 +133,7 @@ static const struct libmnt_optmap userspace_opts_map[] = { "auto", MNT_MS_NOAUTO, MNT_INVERT | MNT_NOMTAB }, /* Can be mounted using -a */ { "noauto", MNT_MS_NOAUTO, MNT_NOMTAB }, /* Can only be mounted explicitly */ - { "user[=]", MNT_MS_USER }, /* Allow ordinary user to mount (mtab) */ + { "user[=]", MNT_MS_USER }, /* Allow ordinary user to mount (mtab) */ { "nouser", MNT_MS_USER, MNT_INVERT | MNT_NOMTAB }, /* Forbid ordinary user to mount */ { "users", MNT_MS_USERS, MNT_NOMTAB }, /* Allow ordinary users to mount */ @@ -147,9 +147,10 @@ static const struct libmnt_optmap userspace_opts_map[] = { "_netdev", MNT_MS_NETDEV }, /* Device requires network */ - { "comment=", MNT_MS_COMMENT, MNT_NOMTAB }, /* fstab comment only */ + { "comment=", MNT_MS_COMMENT, MNT_NOMTAB }, /* fstab comment only */ + { "x-", MNT_MS_XCOMMENT, MNT_NOMTAB | MNT_PREFIX }, /* x- options */ - { "loop[=]", MNT_MS_LOOP }, /* use the loop device */ + { "loop[=]", MNT_MS_LOOP }, /* use the loop device */ { "nofail", MNT_MS_NOFAIL, MNT_NOMTAB }, /* Do not fail if ENOENT on dev */ @@ -210,6 +211,14 @@ const struct libmnt_optmap *mnt_optmap_get_entry( const char *p; for (ent = map; ent && ent->name; ent++) { + if (ent->mask & MNT_PREFIX) { + if (startswith(name, ent->name)) { + if (mapent) + *mapent = ent; + return map; + } + continue; + } if (strncmp(ent->name, name, namelen)) continue; p = ent->name + namelen; |