VFS_GETOPT(9)
πΈ NAME πΈ β VFS_GETOPT(9), Kernel Developer's Manual
okay so this page is VFS_GETOPT(9) from the Kernel Developer's Manual, and it's all about the mount-option besties: vfs_getopt, vfs_getopts, vfs_flagopt, vfs_scanopt, vfs_copyopt, vfs_filteropt, vfs_setopt, vfs_setopt_part, and vfs_setopts. their whole group-chat purpose is to manipulate mount options and their values, periodt π
β¨ SYNOPSIS β¨
the required includes are exactly these, no cap:
#include <sys/param.h>
#include <sys/mount.h>
and the function signatures are:
int
vfs_getopt(struct vfsoptlist *opts, const char *name, void **buf,
int *len);
char *
vfs_getopts(struct vfsoptlist *opts, const char *name, int *error);
int
vfs_flagopt(struct vfsoptlist *opts, const char *name, uint64_t *flags,
uint64_t flag);
int
vfs_scanopt(struct vfsoptlist *opts, const char *name, const char *fmt,
...);
int
vfs_copyopt(struct vfsoptlist *opts, const char *name, void *dest,
int len);
int
vfs_filteropt(struct vfsoptlist *opts, const char **legal);
int
vfs_setopt(struct vfsoptlist *opts, const char *name, void *value,
int len);
int
vfs_setopt_part(struct vfsoptlist *opts, const char *name, void *value,
int len);
int
vfs_setopts(struct vfsoptlist *opts, const char *name,
const char *value);
π DESCRIPTION π
okay so here's the vibe check per function, bestie π«Ά
vfs_getopt()β setsbufto point to the value of the named mount option, and setslento the length of the value if it is notNULL. thebufargument will point to the actual value, and does not need to be freed or released (and probably should not be modified). yes, literally, that's the whole thing πvfs_getopts()β returns the value of the specified option if it is a string (i.e., NUL terminated). easy peasy πΈvfs_flagopt()β determines if an option exists. if the option does exist, andflagsis notNULL,flagis added to those already set inflags. if the option does not exist, andflagsis notNULL,flagis removed from those already set inflags. an example of typical usage is:
if (vfs_flagopt(mp->mnt_optnew, "wormlike", NULL, 0))
vfs_flagopt(mp->mnt_optnew, "appendok", &(mp->flags), F_APPENDOK);
vfs_scanopt()β performs avsscanf(3)with the option's value, using the given format, into the specified variable arguments. the value must be a string (i.e., NUL terminated). π¦vfs_copyopt()β creates a copy of the option's value. thelenargument must match the length of the option's value exactly (i.e., a larger buffer will still causevfs_copyout()to fail withEINVAL). yes, the page saysvfs_copyout()right there β iykyk πvfs_filteropt()β ensures that no unknown options were specified. an option is valid if its name matches one of the names in the list of legal names. an option may be prefixed with'no', and still be considered valid. iconic filtering behavior, honestly β¨vfs_setopt()andvfs_setopt_part()β copy new data into the option's value. invfs_setopt(), thelenargument must match the length of the option's value exactly (i.e., a larger buffer will still causevfs_copyout()to fail withEINVAL). πvfs_setopts()β copies a new string into the option's value. the string, including NUL byte, must be no longer than the option's length. π
π«Ά RETURN VALUES π«Ά
vfs_getopt()β returns0if the option was found; otherwise,ENOENTis returned.vfs_getopts()β returns the specified option if it is found, and is NUL terminated. if the option was found, but is not NUL terminated,erroris set toEINVALandNULLis returned. if the option was not found,erroris set to0, andNULLis returned.vfs_flagopt()β returns1if the option was found, and0if it was not.vfs_scanopt()β returns0if the option was not found, or was not NUL terminated; otherwise, the return value ofvsscanf(3)is returned. ifvsscanf(3)returns0, it will be returned unchanged; therefore, a return value of0does not always mean the option does not exist, or is not a valid string.vfs_copyopt()andvfs_setopt()β return0if the copy was successful,EINVALif the option was found but the lengths did not match, andENOENTif the option was not found.vfs_filteropt()β returns0if all of the options are legal; otherwise,EINVALis returned.vfs_setopts()β returns0if the copy was successful,EINVALif the option was found but the string was too long, andENOENTif the option was not found.
π AUTHORS π
this manual page was written by Chad David <davidc@FreeBSD.org> and Ruslan Ermilov <ru@FreeBSD.org>. slay, and thank you for your service π«‘π
okay that's the whole VFS_GETOPT(9) moment from the Debian side, dated May 19, 2024 β bye bestie, go manipulate those mount options responsibly π
β¨π¦
π¦ where this page comes from
- freebsd 14.5: base 14.5
- freebsd 15.1: base 15.1
- nixpkgs unstable: source
- Copyright (C) 2007 Chad David <davidc@acns.ab.ca>. All rights reserved
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms