vfs_setopt_part(9) manipulate mount options and their values

Other Alias

vfs_getopt, vfs_getopts, vfs_flagopt, vfs_scanopt, vfs_copyopt, vfs_filteropt, vfs_setopt, vfs_setopts

SYNOPSIS

In sys/param.h In sys/mount.h Ft int Fo vfs_getopt Fa struct vfsoptlist *opts const char *name void **buf int *len Fc Ft char * Fn vfs_getops struct vfsoptlist *opts const char *name int *error Ft int Fo vfs_flagopt Fa struct vfsoptlist *opts const char *name uint64_t *flags uint64_t flag Fc Ft int Fo vfs_scanopt Fa struct vfsoptlist *opts const char *name const char *fmt ... Fc Ft int Fo vfs_copyopt Fa struct vfsoptlist *opts const char *name void *dest int len Fc Ft int Fo vfs_filteropt Fa struct vfsoptlist *opts const char **legal Fc Ft int Fo vfs_setopt Fa struct vfsoptlist *opts const char *name void *value int len Fc Ft int Fo vfs_setopt_part Fa struct vfsoptlist *opts const char *name void *value int len Fc Ft int Fo vfs_setopts Fa struct vfsoptlist *opts const char *name const char *value Fc

DESCRIPTION

The Fn vfs_getopt function sets Fa buf to point to the value of the named mount option, and sets Fa len to the length of the value if it is not NULL The Fa buf argument will point to the actual value, and does not need to be freed or released (and probably should not be modified).

The Fn vfs_getopts function returns the value of the specified option if it is a string (i.e., NUL terminated).

The Fn vfs_flagopt function determines if an option exists. If the option does exist, and Fa flags is not NULL Fa flag is added to those already set in Fa flags . If the option does not exist, and Fa flags is not NULL Fa flag is removed from those already set in Fa flags . 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);

The Fn vfs_scanopt function performs a vsscanf(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).

The Fn vfs_copyopt function creates a copy of the option's value. The Fa len argument must match the length of the option's value exactly (i.e., a larger buffer will still cause Fn vfs_copyout to fail with Er EINVAL ) .

The Fn vfs_filteropt function ensures that no unknown options were specified. A 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.

The Fn vfs_setopt and Fn vfs_setopt_part functions copy new data into the option's value. In Fn vfs_setopt , the Fa len argument must match the length of the option's value exactly (i.e., a larger buffer will still cause Fn vfs_copyout to fail with Er EINVAL ) .

The Fn vfs_setopts function 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

The Fn vfs_getopt function returns 0 if the option was found; otherwise, Er ENOENT is returned.

The Fn vfs_getops function returns the specified option if it is found, and is NUL terminated. If the option was found, but is not NUL terminated, Fa error is set to Er EINVAL and NULL is returned. If the option was not found, Fa error is set to 0, and NULL is returned.

The Fn vfs_flagopt function returns 1 if the option was found, and 0 if it was not.

The Fn vfs_scanopt function returns 0 if the option was not found, or was not NUL terminated; otherwise, the return value of vsscanf(3) is returned. If vsscanf(3) returns 0, it will be returned unchanged; therefore, a return value of 0 does not always mean the option does not exist, or is not a valid string.

The Fn vfs_copyopt and Fn vfs_setopt functions return 0 if the copy was successful, Er EINVAL if the option was found but the lengths did not match, and Er ENOENT if the option was not found.

The Fn vfs_filteropt function returns 0 if all of the options are legal; otherwise, Er EINVAL is returned.

The Fn vfs_setopts function returns 0 if the copy was successful, Er EINVAL if the option was found but the string was too long, and Er ENOENT if the option was not found.

AUTHORS

An -nosplit This manual page was written by An Chad David Aq [email protected] and An Ruslan Ermilov Aq [email protected] .