diff options
Diffstat (limited to 'lib')
-rw-r--r-- | lib/libfuse/fuse_chan_fd.3 | 10 | ||||
-rw-r--r-- | lib/libfuse/fuse_daemonize.3 | 10 | ||||
-rw-r--r-- | lib/libfuse/fuse_destroy.3 | 7 | ||||
-rw-r--r-- | lib/libfuse/fuse_get_session.3 | 7 | ||||
-rw-r--r-- | lib/libfuse/fuse_loop.3 | 24 | ||||
-rw-r--r-- | lib/libfuse/fuse_main.3 | 11 | ||||
-rw-r--r-- | lib/libfuse/fuse_mount.3 | 62 | ||||
-rw-r--r-- | lib/libfuse/fuse_new.3 | 100 | ||||
-rw-r--r-- | lib/libfuse/fuse_opt.3 | 467 | ||||
-rw-r--r-- | lib/libfuse/fuse_parse_cmd_line.3 | 39 | ||||
-rw-r--r-- | lib/libfuse/fuse_setup.3 | 22 | ||||
-rw-r--r-- | lib/libfuse/fuse_teardown.3 | 5 | ||||
-rw-r--r-- | lib/libfuse/fuse_version.3 | 6 |
13 files changed, 403 insertions, 367 deletions
diff --git a/lib/libfuse/fuse_chan_fd.3 b/lib/libfuse/fuse_chan_fd.3 index b7cbb813f6b..dc00b04ef03 100644 --- a/lib/libfuse/fuse_chan_fd.3 +++ b/lib/libfuse/fuse_chan_fd.3 @@ -1,4 +1,4 @@ -.\" $OpenBSD: fuse_chan_fd.3,v 1.1 2018/07/08 02:28:42 helg Exp $ +.\" $OpenBSD: fuse_chan_fd.3,v 1.2 2018/07/08 06:17:10 jmc Exp $ .\" .\" Copyright (c) 2018 Helg Bredow <helg.bredow@openbsd.org> .\" @@ -32,17 +32,17 @@ and writing by .Sh RETURN VALUES If successful, .Fn fuse_chan_fd -returns a non-negative integer, termed a file descriptor. If +returns a non-negative integer, termed a file descriptor. +If .Fa ch is NULL a value of -1 is returned. .Sh SEE ALSO -.Xr open 3 , .Xr fuse_mount 3 , +.Xr open 3 , .Xr fuse 4 .Sh STANDARDS The -.Fn -fuse_chan_fd +.Fn fuse_chan_fd function conforms to FUSE 2.6. .Sh HISTORY The diff --git a/lib/libfuse/fuse_daemonize.3 b/lib/libfuse/fuse_daemonize.3 index d4a81b32be2..d71ef4c353d 100644 --- a/lib/libfuse/fuse_daemonize.3 +++ b/lib/libfuse/fuse_daemonize.3 @@ -1,4 +1,4 @@ -.\" $OpenBSD: fuse_daemonize.3,v 1.1 2018/07/08 02:28:42 helg Exp $ +.\" $OpenBSD: fuse_daemonize.3,v 1.2 2018/07/08 06:17:10 jmc Exp $ .\" .\" Copyright (c) 2018 Helg Bredow <helg@openbsd.org> .\" @@ -30,13 +30,13 @@ If is 1, .Fn fuse_daemonize will detach from the controlling terminal and run in the background as a -system daemon. Otherwise, the process will continue to run in the -foreground. +system daemon. +Otherwise, the process will continue to run in the foreground. .Pp -The current working directory is changed to the root (/) and standard input, +The current working directory is changed to the root (/) and standard input; standard output and standard error are redirected to /dev/null. .Sh RETURN VALUES -Upon success, +Upon success, .Fn fuse_daemonize returns 0; otherwise -1 is returned. .Sh ERRORS diff --git a/lib/libfuse/fuse_destroy.3 b/lib/libfuse/fuse_destroy.3 index fd8aff15605..3a8b43622b3 100644 --- a/lib/libfuse/fuse_destroy.3 +++ b/lib/libfuse/fuse_destroy.3 @@ -1,4 +1,4 @@ -.\" $OpenBSD: fuse_destroy.3,v 1.1 2018/07/08 02:49:38 helg Exp $ +.\" $OpenBSD: fuse_destroy.3,v 1.2 2018/07/08 06:17:10 jmc Exp $ .\" .\" Copyright (c) 2018 Helg Bredow <helg.bredow@openbsd.org> .\" @@ -19,7 +19,7 @@ .Os .Sh NAME .Nm fuse_destroy -.Nd frees memory associated with a FUSE handle +.Nd free memory associated with a FUSE handle .Sh SYNOPSIS .In fuse.h .Ft void @@ -40,8 +40,7 @@ before calling this function. .Xr fuse_unmount 3 .Sh STANDARDS The -.Fn -fuse_destroy +.Fn fuse_destroy function conforms to FUSE 2.6. .Sh HISTORY The diff --git a/lib/libfuse/fuse_get_session.3 b/lib/libfuse/fuse_get_session.3 index cd1c4dcb177..99a074af01b 100644 --- a/lib/libfuse/fuse_get_session.3 +++ b/lib/libfuse/fuse_get_session.3 @@ -1,4 +1,4 @@ -.\" $OpenBSD: fuse_get_session.3,v 1.1 2018/07/08 02:28:42 helg Exp $ +.\" $OpenBSD: fuse_get_session.3,v 1.2 2018/07/08 06:17:10 jmc Exp $ .\" .\" Copyright (c) 2018 Helg Bredow <helg.bredow@openbsd.org> .\" @@ -19,7 +19,7 @@ .Os .Sh NAME .Nm fuse_get_session -.Nd gets the FUSE session associated with a FUSE handle +.Nd get the FUSE session associated with a FUSE handle .Sh SYNOPSIS .In fuse.h .Ft struct fuse_session * @@ -33,8 +33,7 @@ returns the FUSE session associated with the FUSE file handle .Xr fuse_set_signal_handlers 3 .Sh STANDARDS The -.Fn -fuse_get_session +.Fn fuse_get_session function conforms to FUSE 2.6. .Sh HISTORY The diff --git a/lib/libfuse/fuse_loop.3 b/lib/libfuse/fuse_loop.3 index 05f2e3b0729..e86b5067a6a 100644 --- a/lib/libfuse/fuse_loop.3 +++ b/lib/libfuse/fuse_loop.3 @@ -1,4 +1,4 @@ -.\" $OpenBSD: fuse_loop.3,v 1.1 2018/07/08 02:28:42 helg Exp $ +.\" $OpenBSD: fuse_loop.3,v 1.2 2018/07/08 06:17:10 jmc Exp $ .\" .\" Copyright (c) 2018 Helg Bredow <helg@openbsd.org> .\" @@ -20,7 +20,7 @@ .Sh NAME .Nm fuse_loop , .Nm fuse_loop_mt -.Nd Wait for and processes FUSE messages +.Nd wait for and process FUSE messages .Sh SYNOPSIS .In fuse.h .Ft int @@ -30,9 +30,9 @@ .Sh DESCRIPTION .Fn fuse_loop reads from the FUSE device and blocks, waiting for the -kernel to send it fbuf messages. Each of these specifies a FUSE file -system operation to execute. The callbacks to invoke are specified by -calling +kernel to send it fbuf messages. +Each of these specifies a FUSE file system operation to execute. +The callbacks to invoke are specified by calling .Xr fuse_new 3 or .Xr fuse_setup 3 @@ -46,13 +46,15 @@ the file system is being unmounted. If FUSE signaler handlers have been installed and either SIGHUP, SIGINT or SIGTERM is received then .Fn fuse_loop -will attempt to unmount the file system. See +will attempt to unmount the file system. +See .Xr fuse_set_signal_handlers 3 . .Pp .Fn fuse_loop_mt -Is a multi-threaded variant that allows the file system to process -multiple file system operations in parallel. This is not implemented on -.Os . +is a multi-threaded variant that allows the file system to process +multiple file system operations in parallel. +This is not implemented on +.Ox . .Sh RETURN VALUES .Fn fuse_loop will return 0 on success and -1 on failure. @@ -60,9 +62,9 @@ will return 0 on success and -1 on failure. .Fn fuse_loop_mt always returns -1. .Sh SEE ALSO -.Xr fb_queue 9 , .Xr fuse_main 3 , -.Xr fuse_set_signal_handlers 3 +.Xr fuse_set_signal_handlers 3 , +.Xr fb_queue 9 .Sh STANDARDS The .Fn fuse_loop diff --git a/lib/libfuse/fuse_main.3 b/lib/libfuse/fuse_main.3 index 7650fb67f55..6b449379da8 100644 --- a/lib/libfuse/fuse_main.3 +++ b/lib/libfuse/fuse_main.3 @@ -1,4 +1,4 @@ -.\" $OpenBSD: fuse_main.3,v 1.4 2018/07/08 02:28:42 helg Exp $ +.\" $OpenBSD: fuse_main.3,v 1.5 2018/07/08 06:17:10 jmc Exp $ .\" .\" Copyright (c) 2013 Sylvestre Gallon <ccna.syl@gmail.com> .\" Copyright (c) 2018 Helg Bredow <helg@openbsd.org> @@ -34,13 +34,14 @@ and passing this function the .Em ops argument containing all the callbacks of the filesystem, or by using the other functions, -as detailed in +as detailed in .Xr fuse_loop 3 .Pp .Fa argv is the list of arguments supplied to the program's main method and must at a minimum specify the directory on which the file system is to -be mounted. The other arguments can be custom arguments specific to the +be mounted. +The other arguments can be custom arguments specific to the file system or those supported by .Xr fuse_parse_cmd_line 3 , .Xr fuse_new 3 @@ -123,12 +124,12 @@ main(int ac, char **av) } .Ed .Sh SEE ALSO -.Xr fuse 4 , .Xr fuse_loop 3 , .Xr fuse_mount 3 , .Xr fuse_new 3 , .Xr fuse_parse_cmd_line 3 , -.Xr fuse_setup 3 +.Xr fuse_setup 3 , +.Xr fuse 4 .Sh STANDARDS The .Fn fuse_main diff --git a/lib/libfuse/fuse_mount.3 b/lib/libfuse/fuse_mount.3 index b5db384a857..5e8e928c3b8 100644 --- a/lib/libfuse/fuse_mount.3 +++ b/lib/libfuse/fuse_mount.3 @@ -1,4 +1,4 @@ -.\" $OpenBSD: fuse_mount.3,v 1.1 2018/07/08 02:28:42 helg Exp $ +.\" $OpenBSD: fuse_mount.3,v 1.2 2018/07/08 06:17:10 jmc Exp $ .\" .\" Copyright (c) 2018 Helg Bredow <helg@openbsd.org> .\" @@ -19,7 +19,7 @@ .Sh NAME .Nm fuse_mount , .Nm fuse_unmount -.Nd Mount or dismount a FUSE file system +.Nd mount or dismount a FUSE file system .Sh SYNOPSIS .In fuse.h .Ft struct fuse_chan * @@ -29,7 +29,7 @@ .Sh DESCRIPTION The .Fn fuse_mount -calls the +function calls the .Xr mount 2 system call to graft the FUSE file system on to the file system tree at the point @@ -39,33 +39,40 @@ are FUSE specific mount options as documented by .Xr mount 2 . .Pp The following mount options can be specified by preceding them with --o, either individually or together separated by a comma. +.Fl o , +either individually or together separated by a comma. .Bl -tag -width Ds .It allow_other -Allow other users to access the file system. By default, FUSE will -prevent other users from accessing the file system or to +Allow other users to access the file system. +By default, FUSE will prevent other users from accessing the file system or to .Xr statfs 2 -the file system. This security measure is particularly important for -network file system that may expose private files. It also guards against -system processes being blocked indefinitely if the file system stops -responding. +the file system. +This security measure is particularly important for +network file system that may expose private files. +It also guards against system processes being blocked indefinitely +if the file system stops responding. .It default_permissions -Request that the kernel enforce file access permissions. -Alternatively, FUSE file systems can choose to implement access -checks internally. On OpenBSD, this option is always set. +Request that the kernel enforce file access permissions. +Alternatively, FUSE file systems can choose to implement access +checks internally. +On +.Ox , +this option is always set. .It kernel_cache -Enables buffering of files in the kernel. Not recommended for file -systems that can be updated external to FUSE, such as network file -systems. Not implemented. +Enables buffering of files in the kernel. +Not recommended for file systems that can be updated external to FUSE, +such as network file systems. +Not implemented. .It max_read=%u -Specify the maximum size of read operations. Note that the kernel -limits this to FUSEBUFMAXSIZE. This option should not be -specified on the command line. The correct (or optimum) value depends -on the filesystem implementation and should thus be specified by the -filesystem internally. +Specify the maximum size of read operations. +Note that the kernel limits this to FUSEBUFMAXSIZE. +This option should not be specified on the command line. +The correct (or optimum) value depends on the filesystem implementation +and should thus be specified by the filesystem internally. .It ro -Mount the file system read-only. Can also be specified by itself with --r. +Mount the file system read-only. +Can also be specified by itself with +.Fl r . .El .Pp .Fn fuse_unmount @@ -73,11 +80,12 @@ will attempt to unmount the file system mounted at .Fa dir by calling the .Xr unmount 2 -system call. If this is successful, the kernel will send the +system call. +If this is successful, the kernel will send the FBT_DESTROY message to the file system, causing -.Xr fuse_loop 2 -to terminate. There is no way to determine whether this call was -successful. +.Xr fuse_loop 3 +to terminate. +There is no way to determine whether this call was successful. .Pp Only the super user can mount and unmount FUSE file systems. .Sh RETURN VALUES diff --git a/lib/libfuse/fuse_new.3 b/lib/libfuse/fuse_new.3 index 067403d87ac..d640805490b 100644 --- a/lib/libfuse/fuse_new.3 +++ b/lib/libfuse/fuse_new.3 @@ -1,4 +1,4 @@ -.\" $OpenBSD: fuse_new.3,v 1.1 2018/07/08 02:28:42 helg Exp $ +.\" $OpenBSD: fuse_new.3,v 1.2 2018/07/08 06:17:10 jmc Exp $ .\" .\" Copyright (c) 2013 Sylvestre Gallon <ccna.syl@gmail.com> .\" Copyright (c) 2018 Helg Bredow <helg@openbsd.org> @@ -31,16 +31,14 @@ Initialises the FUSE library on the channel returned by .Xr fuse_mount 3 . .Pp -and passing this function the -.Em ops -argument containing all the callbacks of the filesystem. FUSE operations work in the same way as their UNIX file system -counterparts. A major exception is that these routines return +counterparts. +A major exception is that these routines return a negated errno value (-errno) on failure. .Pp -All operations are optional but functional file system will want to +All operations are optional but a functional file system will want to implement at least statfs, readdir, open, read and getattr. -.Bd +.Bd -literal struct fuse_operations { int (*getattr)(const char *, struct stat *); int (*readlink)(const char *, char *, size_t); @@ -89,53 +87,63 @@ struct fuse_operations { }; .Ed .Pp -There order of calls is: +The order of calls is: +.Bd -literal -offset indent init -... +\&... opendir readdir releasedir open read write -... +\&... flush release -... +\&... destroy -.Pp -.Bl -tag -width Ds +.Ed +.Bl -tag -width "releasedir" .It access -Not implemented. OpenBSD always behaves as if the default_permissions -mount option was specified. See +Not implemented. +.Ox +always behaves as if the default_permissions mount option was specified. +See .Xr fuse_mount 3 . .It chmod Called when file access permissions are changed. .It chown Called when either the file owner or group is changed. .It create -Not implemented on OpenBSD. File systems must implement mknod instead. +Not implemented on +.Ox . +File systems must implement mknod instead. In the reference implementation this is an atomic operation that both -creates and opens the file. There is no equivalent in the OpenBSD VFS. +creates and opens the file. +There is no equivalent in the +.Ox +VFS. .It getattr Corresponds to the .Xr stat 2 -system call. flags and extended attributes are ignored. This operation -is mandatory. +system call. +Flags and extended attributes are ignored. +This operation is mandatory. .It getxattr Not implemented. .It flush Called when the file is closed by the .Xr close 2 -system call. This is the only way for a file system to return an error -on close. +system call. +This is the only way for a file system to return an error on close. .It getdir -Deprecated. File system should implement readdir instead. +Deprecated. +File system should implement readdir instead. .It flush Called when the file is closed by the .Xr close 2 -system call. This is the only way for a file system to return an error -on close. +system call. +This is the only way for a file system to return an error on close. .It mknod Called on .Xr open 2 @@ -145,57 +153,65 @@ to create regular files, pipes and device special files. .It open Called on .Xr open 2 . -Due to the difference between FUSE and the OpenBSD VFS, open will only -be called once for each file for every different combination of flags -provided to -.Xr open 2. +Due to the difference between FUSE and the +.Ox +VFS, +open will only be called once for each file +for every different combination of flags provided to +.Xr open 2 . The O_CREAT and O_TRUNC flags are never passed from the kernel to open, the mknod and truncate operations are invoked before open instead. .It opendir Called when a directory is opened for reading. .It release -Called when there are no more reference to the file. +Called when there are no more references to the file. .It releasedir -Called when there are no more reference to the directory. +Called when there are no more references to the directory. .It setattr Equivalent to .Xr chown 2 and .Xr chmod 2 -system calls. Setting file flags is not supported. +system calls. +Setting file flags is not supported. .It setxattr Not implemented. .El .Pp Options supported by args are: -.Bl -tag -width Ds +.Bl -tag -width "readdir_ino" .It debug, -d Print debug information to stdout. .It gid=%u -The gid that will be reported as the group for all files by getattr. +The GID that will be reported as the group for all files by getattr. .It hard_remove Immediately delete a file even if it's currently open by a process. Otherwise FUSE will temporarily rename the file and only delete it when -if is no longer reference. This is to avoid the file system having to -deal with this situation. This is always set on OpenBSD. +it is no longer referenced. +This is to avoid the file system having to deal with this situation. +This is always set on +.Ox . .It readdir_ino Similar to use_ino but the file system's inode number is only reported -for readdir. This is always set on OpenBSD since it's needed by +for readdir. +This is always set on +.Ox . .It uid=%u -The uid that will be reported as the owner for all files by getattr. +The UID that will be reported as the owner for all files by getattr. .It umask=%o The file mode mask applied to the permission for all files by getattr. -.Xr getcwd 3 . .It use_ino By default, FUSE will return an internal inode number for getattr and readdir and this will be different every time the file system is -mounted. If this is set the file system's own inode number will be -reported instead. Useful only for file system that have inode numbers. +mounted. +If this is set the file system's own inode number will be +reported instead. +Useful only for file system that have inode numbers. .El .Sh SEE ALSO -.Xr fuse_mount 3 , +.Xr fuse_get_context 3 , .Xr fuse_main 3 , -.Xr fuse_get_context 3 +.Xr fuse_mount 3 .Sh STANDARDS The .Fn fuse_new diff --git a/lib/libfuse/fuse_opt.3 b/lib/libfuse/fuse_opt.3 index 8f0db06913f..8bb5ea1283d 100644 --- a/lib/libfuse/fuse_opt.3 +++ b/lib/libfuse/fuse_opt.3 @@ -1,249 +1,251 @@ -.\" $OpenBSD: fuse_opt.3,v 1.1 2018/07/08 02:28:42 helg Exp $ -.\" -.\" Copyright (c) Ray Lai <ray@raylai.com> +.\" $OpenBSD: fuse_opt.3,v 1.2 2018/07/08 06:17:10 jmc Exp $ +.\" +.\" Copyright (c) Ray Lai <ray@raylai.com> .\" Copyright (c) Helg Bredow <helg@openbsd.org> -.\" -.\" Permission to use, copy, modify, and distribute this software for any -.\" purpose with or without fee is hereby granted, provided that the above -.\" copyright notice and this permission notice appear in all copies. -.\" -.\" THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES -.\" WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF -.\" MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR -.\" ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES -.\" WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN -.\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF -.\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. -.\" -.Dd $Mdocdate: July 8 2018 $ -.Dt FUSE_OPT 3 -.Os -.Sh NAME -.Nm FUSE_ARGS_INIT , -.Nm FUSE_OPT_IS_OPT_KEY , -.Nm FUSE_OPT_KEY , -.Nm fuse_opt_add_arg , -.Nm fuse_opt_insert_arg , -.Nm fuse_opt_free_args , -.Nm fuse_opt_add_opt , -.Nm fuse_opt_add_opt_escaped , -.Nm fuse_opt_match , -.Nm fuse_opt_parse -.Nd FUSE argument and option parser -.Sh SYNOPSIS -.In fuse_opt.h -.Ft struct fuse_args +.\" +.\" Permission to use, copy, modify, and distribute this software for any +.\" purpose with or without fee is hereby granted, provided that the above +.\" copyright notice and this permission notice appear in all copies. +.\" +.\" THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES +.\" WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF +.\" MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR +.\" ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES +.\" WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN +.\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF +.\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. +.\" +.Dd $Mdocdate: July 8 2018 $ +.Dt FUSE_OPT 3 +.Os +.Sh NAME +.Nm FUSE_ARGS_INIT , +.Nm FUSE_OPT_IS_OPT_KEY , +.Nm FUSE_OPT_KEY , +.Nm fuse_opt_add_arg , +.Nm fuse_opt_insert_arg , +.Nm fuse_opt_add_opt , +.Nm fuse_opt_add_opt_escaped , +.Nm fuse_opt_free_args , +.Nm fuse_opt_match , +.Nm fuse_opt_parse +.Nd FUSE argument and option parser +.Sh SYNOPSIS +.In fuse_opt.h +.Ft struct fuse_args .Fo FUSE_ARGS_INIT .Fa "int argc" -.Fa "char argv**" +.Fa "char argv**" .Fc -.Ft int +.Ft int .Fo FUSE_OPT_IS_OPT_KEY -.Fa "fuse_opt *t" +.Fa "fuse_opt *t" .Fc -.Ft struct fuse_opt +.Ft struct fuse_opt .Fo FUSE_OPT_KEY .Fa "const char *templ" -.Fa "int key" +.Fa "int key" .Fc -.Ft int +.Ft int .Fo fuse_opt_add_arg .Fa "struct fuse_args *args" -.Fa "const char *arg" +.Fa "const char *arg" .Fc -.Ft int +.Ft int .Fo fuse_opt_insert_arg .Fa "struct fuse_args *args" .Fa "int pos" -.Fa "const char *opt" +.Fa "const char *opt" .Fc -.Ft int +.Ft int .Fo fuse_opt_add_opt .Fa "char **opts" -.Fa "const char *opt" +.Fa "const char *opt" .Fc -.Ft int +.Ft int .Fo fuse_opt_add_opt_escaped .Fa "char **opts" -.Fa "const char *opt" +.Fa "const char *opt" .Fc -.Ft void +.Ft void .Fo fuse_opt_free_args -.Fa "struct fuse_args *args" +.Fa "struct fuse_args *args" .Fc -.Ft int +.Ft int .Fo fuse_opt_match .Fa "const struct fuse_opt *opts" -.Fa "const char *opt" +.Fa "const char *opt" +.Fc +.Ft int +.Fo fuse_opt_parse +.Fa "struct fuse_args *args" +.Fa "void *data" +.Fa "const struct fuse_opt *opts" +.Fa "fuse_opt_proc_t proc" .Fc -.Ft int -.Fo fuse_opt_parse -.Fa "struct fuse_args *args" -.Fa "void *data" -.Fa "const struct fuse_opt *opts" -.Fa "fuse_opt_proc_t proc" -.Fc -.Sh DESCRIPTION +.Sh DESCRIPTION These FUSE library functions and macros provide support for complex -argument and option parsing. These are typically entered on the command -line but may also be passed by file systems to the -.Xr fuse_mount 3 -and +argument and option parsing. +These are typically entered on the command line +but may also be passed by file systems to the +.Xr fuse_mount 3 +and .Xr fuse_new 3 functions. -.Ft struct fuse_args -holds string options in an array: -.Bd -literal -offset indent -struct fuse_args { - int argc; /* argument count */ - char **argv; /* NULL-terminated array of arguments */ - int allocated; /* argv was allocated and must be freed */ -}; -.Ed -.Pp +.Ft struct fuse_args +holds string options in an array: +.Bd -literal -offset indent +struct fuse_args { + int argc; /* argument count */ + char **argv; /* NULL-terminated array of arguments */ + int allocated; /* argv was allocated and must be freed */ +}; +.Ed +.Pp .Bl -tag -width Ds -compact .It Fn FUSE_OPT_KEY templ key -returns a -.Fa struct fuse_opt -template that matches an argument or option -.Fa templ -with option key -.Fa key . -This macro is used as an element in -.Fa struct fuse_opt -arrays to create a template that is processed by a fuse_opt_proc_t. The -special constants FUSE_OPT_KEEP and FUSE_OPT_DISCARD can be specified if +returns a +.Fa struct fuse_opt +template that matches an argument or option +.Fa templ +with option key +.Fa key . +This macro is used as an element in +.Fa struct fuse_opt +arrays to create a template that is processed by a fuse_opt_proc_t. +The special constants FUSE_OPT_KEEP and FUSE_OPT_DISCARD can be specified if proc does not need to handle this option or argument; proc is not called in this case. .Pp .It Fn FUSE_OPT_IS_OPT_KEY templ -checks if -.Fa templ -is an option key. -.Pp -The last element of the -.Fa opts -.Ft struct fuse_opt -option array must be -.Dv FUSE_OPT_END . -.Pp -.Fa proc -points to a function with the following signature: -.Ft int (*fuse_opt_proc_t) -.Fo proc -.Fa "void *data" -.Fa "const char *arg" -.Fa "int key" -.Fa "struct fuse_args *outargs" -.Fc -.Pp -Special key values: -.Bd -literal -offset indent -FUSE_OPT_KEY_OPT /* no match */ -FUSE_OPT_KEY_NONOPT /* non-option */ -FUSE_OPT_KEY_KEEP /* don't process; return 1 */ -FUSE_OPT_KEY_DISCARD /* don't process; return 0 */ -.Ed -.It Fn FUSE_ARGS_INIT -initializes a -.Ft struct fuse_args -with -.Fa argc -and -.Fa argv , -which which are usually obtained from -.Fn main . -.Fa argv -is NULL-terminated, and is suitable for use with -.Xr execvp 3 . +checks if +.Fa templ +is an option key. +.Pp +The last element of the +.Fa opts +.Ft struct fuse_opt +option array must be +.Dv FUSE_OPT_END . +.Pp +.Fa proc +points to a function with the following signature: +.Ft int (*fuse_opt_proc_t) +.Fo proc +.Fa "void *data" +.Fa "const char *arg" +.Fa "int key" +.Fa "struct fuse_args *outargs" +.Fc +.Pp +Special key values: +.Bd -literal -offset indent +FUSE_OPT_KEY_OPT /* no match */ +FUSE_OPT_KEY_NONOPT /* non-option */ +FUSE_OPT_KEY_KEEP /* don't process; return 1 */ +FUSE_OPT_KEY_DISCARD /* don't process; return 0 */ +.Ed +.Pp +.It Fn FUSE_ARGS_INIT +initializes a +.Ft struct fuse_args +with +.Fa argc +and +.Fa argv , +which are usually obtained from +.Fn main . +.Fa argv +is NULL-terminated, and is suitable for use with +.Xr execvp 3 . .Fa argv -is used directly and -.Fa allocated -is set to 0. -.Pp -.It Fn fuse_opt_add_arg -adds a single option to the end of -.Fa args . -If -.Fa args->allocated -is 0, -.Fa args->argv -is copied to the heap and -.Fa args->allocated -is set to a non-zero value. -.Pp -.It Fn fuse_opt_insert_arg -inserts a single argument at position -.Fa pos -into -.Fa args , -shifting -.Fa args->argv -as needed. -.Pp -.It Fn fuse_opt_add_opt -adds an option -.Fa opt -to a comma-separated string of options -.Fa opts . -.Fa *opts -can be NULL, which is typically used when adding the first option. +is used directly and +.Fa allocated +is set to 0. .Pp -.It Fn fuse_opt_add_opt_escaped -escapes any -.Sq "," -and -.Sq "\\" -characters in -.Fa opt -before adding it to -.Fa opts . -.Pp -.It Fn fuse_opt_free_args -frees -.Fa args->argv -if it was allocated -.Fa args -and initializes everything to 0. -.Pp -.It Fn fuse_opt_match +.It Fn fuse_opt_add_arg +adds a single option to the end of +.Fa args . +If +.Fa args->allocated +is 0, +.Fa args->argv +is copied to the heap and +.Fa args->allocated +is set to a non-zero value. +.Pp +.It Fn fuse_opt_insert_arg +inserts a single argument at position +.Fa pos +into +.Fa args , +shifting +.Fa args->argv +as needed. +.Pp +.It Fn fuse_opt_add_opt +adds an option +.Fa opt +to a comma-separated string of options +.Fa opts . +.Fa *opts +can be NULL, which is typically used when adding the first option. +.Pp +.It Fn fuse_opt_add_opt_escaped +escapes any +.Sq "," +and +.Sq "\\" +characters in +.Fa opt +before adding it to +.Fa opts . +.Pp +.It Fn fuse_opt_free_args +frees +.Fa args->argv +if it was allocated +.Fa args +and initializes everything to 0. +.Pp +.It Fn fuse_opt_match tests if the argument or option -.Fa opt -appears in the list of templates +.Fa opt +appears in the list of templates .Fa opts . -If -.Fa opt +If +.Fa opt is an option then it must not include the -o prefix. -.Pp -.It Fn fuse_opt_parse +.Pp +.It Fn fuse_opt_parse parses options, setting any members of -.Fa data -automatically depending on the format of the template. If -.Fa proc +.Fa data +automatically depending on the format of the template. +If +.Fa proc is not NULL, then this is called for any argument that matches a template with that has .Fa val -= FUSE_OPT_KEY. -.Fa opts -is an array of -.Ft struct fuse_opt , -each of which describes actions for each option: -.Bd -literal -offset indent -struct fuse_opt { - const char *templ; /* template for option */ - unsigned long off; /* data offset */ - int val; /* key value */ -}; -.Ed -.Pp += FUSE_OPT_KEY. +.Fa opts +is an array of +.Ft struct fuse_opt , +each of which describes actions for each option: +.Bd -literal -offset indent +struct fuse_opt { + const char *templ; /* template for option */ + unsigned long off; /* data offset */ + int val; /* key value */ +}; +.Ed +.Pp The following templates are supported. foo= .Pp foo=%u %u can be any format that can be parsed by -.Fn sscanf 3 -. If this is %s then a copy of the string is allocated. -foo=bar matches the option exactly (treated the same as if it didn't have an -=) +.Fn sscanf 3 . +If this is %s then a copy of the string is allocated. +foo=bar matches the option exactly (treated the same as if it didn't have an =). .Pp foo matches exactly .Pp @@ -254,25 +256,24 @@ foo matches exactly -b %u or:w --bar %u Treated the same as foo=%u above .Pp -Each argument or option is matched against every template. This allows more -than one member of -.Fa data -to be set by a single argument or option. (see example for gid below) -.Pp +Each argument or option is matched against every template. +This allows more than one member of +.Fa data +to be set by a single argument or option (see example for gid below). .El -.Sh RETURN VALUES -.Fn fuse_opt_add_arg , -.Fn fuse_opt_insert_arg , -.Fn fuse_opt_add_opt , -.Fn fuse_opt_add_opt_escaped , -and -.Fn fuse_opt_parse -return 0 on success, -1 on error. -.Pp -.Fn fuse_opt_match -returns 1 on match, 0 if no match. -.Sh EXAMPLES -.Bd -literal -offset indent +.Sh RETURN VALUES +.Fn fuse_opt_add_arg , +.Fn fuse_opt_insert_arg , +.Fn fuse_opt_add_opt , +.Fn fuse_opt_add_opt_escaped , +and +.Fn fuse_opt_parse +return 0 on success, -1 on error. +.Pp +.Fn fuse_opt_match +returns 1 on match, 0 if no match. +.Sh EXAMPLES +.Bd -literal -offset indent struct foo_config { char *foor; int bar; @@ -308,31 +309,31 @@ foo_process_proc(void *data, int key, char *val, struct fuse_args *args) int main(int argc, char *argv[]) { - struct fuse_args args = FUSE_ARGS_INIT(argc, argv); + struct fuse_args args = FUSE_ARGS_INIT(argc, argv); if (fuse_opt_parse(opts, config, foo_process_proc) != 0) { ... -.Ed -.Sh ERRORS -.Fn fuse_opt_add_arg , -.Fn fuse_opt_insert_arg , -.Fn fuse_opt_add_opt , -and -.Fn fuse_opt_add_opt_escaped -can run out of memory and set -.Va errno . -.Sh SEE ALSO +.Ed +.Sh ERRORS +.Fn fuse_opt_add_arg , +.Fn fuse_opt_insert_arg , +.Fn fuse_opt_add_opt , +and +.Fn fuse_opt_add_opt_escaped +can run out of memory and set +.Va errno . +.Sh SEE ALSO .Xr fuse_main 3 -.Sh STANDARDS +.Sh STANDARDS These library functions conform to FUSE 2.6. -.Sh HISTORY -These functions first appeared in -.Ox 5.4 . -.Sh AUTHORS +.Sh HISTORY +These functions first appeared in +.Ox 5.4 . +.Sh AUTHORS .An Sylvestre Gallon Aq Mt ccna.syl@gmail.com .An Helg Bredow Aq Mt xx404@msn.com .Pp -This manual was written by +This manual was written by .An Ray Lai Aq Mt ray@raylai.com -and updated by +and updated by .An Helg Bredow Aq Mt xx404@msn.com diff --git a/lib/libfuse/fuse_parse_cmd_line.3 b/lib/libfuse/fuse_parse_cmd_line.3 index 8c9c5c89c3d..4679703cb23 100644 --- a/lib/libfuse/fuse_parse_cmd_line.3 +++ b/lib/libfuse/fuse_parse_cmd_line.3 @@ -1,4 +1,4 @@ -.\" $OpenBSD: fuse_parse_cmd_line.3,v 1.1 2018/07/08 02:28:42 helg Exp $ +.\" $OpenBSD: fuse_parse_cmd_line.3,v 1.2 2018/07/08 06:17:10 jmc Exp $ .\" .\" Copyright (c) 2018 Helg Bredow <helg.bredow@openbsd.org> .\" @@ -29,51 +29,58 @@ .Fn fuse_parse_cmd_line is a helper function to parse standard FUSE arguments. .Fa args -can be constructed using the +can be constructed using the .Xr FUSE_ARGS_INIT 3 macro. .Pp .Fn fuse_parse_cmd_line supports the following arguments. .Bl -tag -width Ds -.It -d, -odebug +.It Fl d , Fl odebug Causes debug information for subsequent FUSE library calls to be output to -stderr. Implies -f. -.It -f +stderr. +Implies +.Fl f . +.It Fl f If this is specified then .Fa fg -will be set to 1 on success. This flag indicates that the file system -should not detach from the controlling terminal and run in the -foreground. -.It -h, --help, -ho +will be set to 1 on success. +This flag indicates that the file system +should not detach from the controlling terminal and run in the foreground. +.It Fl h , Fl -help , Fl ho Print usage information for the options supported by .Fn fuse_parse_cmd_line . -.It -s +.It Fl s If this is specified then .Fa mt -will be set to 0 on success. This flag indicates that the file system -should be run in multi-threaded mode. -s is currently ignored and +will be set to 0 on success. +This flag indicates that the file system +should be run in multi-threaded mode. +.Fl s +is currently ignored and .Fa mt will always be 0. -.It -V, --version +.It Fl V , Fl -version Print the FUSE library version to stderr. .El .Pp If the first argument not recognised by -.Fn fuse_parse_cmd_line . +.Fn fuse_parse_cmd_line is a valid directory then .Fa mp will be set to the canonicalized absolute pathname of this directory. .Sh RETURN VALUES The .Fn fuse_parse_cmd_line -function will return 0 on success and -1 if -h, --help, -ho, -v or --version +function will return 0 on success and -1 if +.Fl h , Fl -help , Fl ho , Fl v +or +.Fl -version are included in .Fa argv or .Fa mp does not exist or is not a directory. -.El .Sh SEE ALSO .Xr FUSE_ARGS_INIT 3 , .Xr fuse_daemonize 3 , diff --git a/lib/libfuse/fuse_setup.3 b/lib/libfuse/fuse_setup.3 index 20e82c060ee..bc4d05015ee 100644 --- a/lib/libfuse/fuse_setup.3 +++ b/lib/libfuse/fuse_setup.3 @@ -1,4 +1,4 @@ -.\" $OpenBSD: fuse_setup.3,v 1.1 2018/07/08 02:28:42 helg Exp $ +.\" $OpenBSD: fuse_setup.3,v 1.2 2018/07/08 06:17:10 jmc Exp $ .\" .\" Copyright (c) 2018 Helg Bredow <helg.bredow@openbsd.org> .\" @@ -33,15 +33,19 @@ session and installs signal handlers that will try to unmount the file system on SIGINT, SIGTERM or SIGHUP. .Pp .Fn fuse_setup -will parse the arguments specified by argv and if neither the -f, -d or --odebug options were specified, detach from the controlling terminal +will parse the arguments specified by argv and if neither the +.Fl f , Fl d +or +.Fl odebug +options were specified, detach from the controlling terminal and run in the background. On success, .Fa mt will be 1 if the file system operations will be invoked in parallel (multi-threaded) or 0 if file system operations are serialized. -File system that do not support multi-threaded operation must include -the -s argument in +File systems that do not support multi-threaded operation must include the +.Fl s +argument in .Fa argv . .Ox does not currently support multi-threaded operation. @@ -53,9 +57,10 @@ argument that does not match one of the options recognised by .Xr fuse_parse_cmd_line 3 . .Pp .Fa fuse_operations -is a struct of size +is a struct of size .Fa size -that contains pointers to FUSE file system operations. See +that contains pointers to FUSE file system operations. +See .Xr fuse_new 3 . .Sh RETURN VALUES .Fn fuse_setup @@ -70,8 +75,7 @@ will return NULL on failure. .Xr fuse 4 .Sh STANDARDS The -.Fn -fuse_setup +.Fn fuse_setup function conforms to FUSE 2.6. .Sh HISTORY The diff --git a/lib/libfuse/fuse_teardown.3 b/lib/libfuse/fuse_teardown.3 index c5d52a2b833..b731bc69113 100644 --- a/lib/libfuse/fuse_teardown.3 +++ b/lib/libfuse/fuse_teardown.3 @@ -1,4 +1,4 @@ -.\" $OpenBSD: fuse_teardown.3,v 1.1 2018/07/08 02:28:42 helg Exp $ +.\" $OpenBSD: fuse_teardown.3,v 1.2 2018/07/08 06:17:10 jmc Exp $ .\" .\" Copyright (c) 2018 Helg Bredow <helg.bredow@openbsd.org> .\" @@ -42,8 +42,7 @@ is then destroyed. .Xr fuse_unmount 3 .Sh STANDARDS The -.Fn -fuse_teardown +.Fn fuse_teardown function conforms to FUSE 2.6. .Sh HISTORY The diff --git a/lib/libfuse/fuse_version.3 b/lib/libfuse/fuse_version.3 index b449b0f88c3..26f8c4b3309 100644 --- a/lib/libfuse/fuse_version.3 +++ b/lib/libfuse/fuse_version.3 @@ -1,4 +1,4 @@ -.\" $OpenBSD: fuse_version.3,v 1.1 2018/07/08 02:28:42 helg Exp $ +.\" $OpenBSD: fuse_version.3,v 1.2 2018/07/08 06:17:10 jmc Exp $ .\" .\" Copyright (c) 2018 Helg Bredow <helg@openbsd.org> .\" @@ -25,8 +25,8 @@ .Ft int .Fn fuse_version "void" .Sh DESCRIPTION -Gets the version of the FUSE library as a whole number. e.g. Version 2.6 -is returned as 26. +Gets the version of the FUSE library as a whole number. +For example, Version 2.6 is returned as 26. .Sh SEE ALSO .Xr fuse_main 3 .Sh STANDARDS |