diff options
author | jamie <jamie@FreeBSD.org> | 2009-03-02 23:26:30 +0000 |
---|---|---|
committer | jamie <jamie@FreeBSD.org> | 2009-03-02 23:26:30 +0000 |
commit | 63f98fcc6a46518f1e430026c32dd9c31dff0a84 (patch) | |
tree | b070bef8a4d0b9e895916c453fb1a0a0f82434c0 /share | |
parent | 12e34d9850ea5157971c208839b4af421d679674 (diff) | |
download | FreeBSD-src-63f98fcc6a46518f1e430026c32dd9c31dff0a84.zip FreeBSD-src-63f98fcc6a46518f1e430026c32dd9c31dff0a84.tar.gz |
Extend the "vfsopt" mount options for more general use. Make struct
vfsopt and the vfs_buildopts function public, and add some new fields
to struct vfsopt (pos and seen), and new functions vfs_getopt_pos and
vfs_opterror.
Further extend the interface to allow reading options from the kernel
in addition to sending them to the kernel, with vfs_setopt and related
functions.
While this allows the "name=value" option interface to be used for more
than just FS mounts (planned use is for jails), it retains the current
"vfsopt" name and <sys/mount.h> requirement.
Approved by: bz (mentor)
Diffstat (limited to 'share')
-rw-r--r-- | share/man/man9/Makefile | 5 | ||||
-rw-r--r-- | share/man/man9/vfs_getopt.9 | 59 |
2 files changed, 57 insertions, 7 deletions
diff --git a/share/man/man9/Makefile b/share/man/man9/Makefile index b632778..e70ca9c 100644 --- a/share/man/man9/Makefile +++ b/share/man/man9/Makefile @@ -1243,7 +1243,10 @@ MLINKS+=vfs_getopt.9 vfs_copyopt.9 \ vfs_getopt.9 vfs_filteropt.9 \ vfs_getopt.9 vfs_flagopt.9 \ vfs_getopt.9 vfs_getopts.9 \ - vfs_getopt.9 vfs_scanopt.9 + vfs_getopt.9 vfs_scanopt.9 \ + vfs_getopt.9 vfs_setopt.9 \ + vfs_getopt.9 vfs_setopt_part.9 \ + vfs_getopt.9 vfs_setopts.9 MLINKS+=VFS_LOCK_GIANT.9 VFS_UNLOCK_GIANT.9 MLINKS+=vgone.9 vgonel.9 MLINKS+=vhold.9 vdrop.9 \ diff --git a/share/man/man9/vfs_getopt.9 b/share/man/man9/vfs_getopt.9 index c393209..8d8d3b3 100644 --- a/share/man/man9/vfs_getopt.9 +++ b/share/man/man9/vfs_getopt.9 @@ -26,7 +26,7 @@ .\" .\" $FreeBSD$ .\" -.Dd February 28, 2007 +.Dd March 2, 2009 .Dt VFS_GETOPT 9 .Os .Sh NAME @@ -35,7 +35,10 @@ .Nm vfs_flagopt , .Nm vfs_scanopt , .Nm vfs_copyopt , -.Nm vfs_filteropt +.Nm vfs_filteropt , +.Nm vfs_setopt , +.Nm vfs_setopt_part , +.Nm vfs_setopts .Nd "manipulate mount options and their values" .Sh SYNOPSIS .In sys/param.h @@ -62,6 +65,18 @@ .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 .Sh DESCRIPTION The .Fn vfs_getopt @@ -111,7 +126,7 @@ The .Fn vfs_scanopt function performs a .Xr vsscanf 3 -with the options value, using the given format, +with the option's value, using the given format, into the specified variable arguments. The value must be a string (i.e., .Dv NUL @@ -119,10 +134,10 @@ terminated). .Pp The .Fn vfs_copyopt -function creates a copy of the options value. +function creates a copy of the option's value. The .Fa len -argument must match the length of the options value exactly +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 @@ -134,6 +149,28 @@ 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. +.Pp +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 ) . +.Pp +The +.Fn vfs_setopts +function copies a new string into the option's value. +The string, including +.Dv NUL +byte, must be no longer than the option's length. .Sh RETURN VALUES The .Fn vfs_getopt @@ -179,7 +216,9 @@ not always mean the option does not exist, or is not a valid string. .Pp The .Fn vfs_copyopt -function returns 0 if the copy was successful, +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 @@ -190,6 +229,14 @@ The function returns 0 if all of the options are legal; otherwise, .Er EINVAL is returned. +.Pp +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. .Sh AUTHORS .An -nosplit This manual page was written by |