diff options
author | helg <helg@cvs.openbsd.org> | 2018-07-08 02:28:43 +0000 |
---|---|---|
committer | helg <helg@cvs.openbsd.org> | 2018-07-08 02:28:43 +0000 |
commit | b50a4b6a7024750de5f190207dc31b0d612c8540 (patch) | |
tree | a0e3d182e1e6b044e1ffd99cbace5112a8894356 /lib/libfuse | |
parent | 1c9cefcd3cfc6bb59eac4842390107a1dd633100 (diff) |
Create separate man pages for each library function.
Diffstat (limited to 'lib/libfuse')
-rw-r--r-- | lib/libfuse/Makefile | 7 | ||||
-rw-r--r-- | lib/libfuse/fuse_chan_fd.3 | 53 | ||||
-rw-r--r-- | lib/libfuse/fuse_daemonize.3 | 59 | ||||
-rw-r--r-- | lib/libfuse/fuse_get_session.3 | 45 | ||||
-rw-r--r-- | lib/libfuse/fuse_loop.3 | 81 | ||||
-rw-r--r-- | lib/libfuse/fuse_main.3 | 170 | ||||
-rw-r--r-- | lib/libfuse/fuse_mount.3 | 115 | ||||
-rw-r--r-- | lib/libfuse/fuse_new.3 | 210 | ||||
-rw-r--r-- | lib/libfuse/fuse_opt.3 | 338 | ||||
-rw-r--r-- | lib/libfuse/fuse_parse_cmd_line.3 | 93 | ||||
-rw-r--r-- | lib/libfuse/fuse_setup.3 | 83 | ||||
-rw-r--r-- | lib/libfuse/fuse_teardown.3 | 55 | ||||
-rw-r--r-- | lib/libfuse/fuse_version.3 | 42 |
13 files changed, 1209 insertions, 142 deletions
diff --git a/lib/libfuse/Makefile b/lib/libfuse/Makefile index f6973ad0eca..be4bd099050 100644 --- a/lib/libfuse/Makefile +++ b/lib/libfuse/Makefile @@ -1,7 +1,10 @@ -# $OpenBSD: Makefile,v 1.14 2018/07/05 10:29:36 helg Exp $ +# $OpenBSD: Makefile,v 1.15 2018/07/08 02:28:42 helg Exp $ LIB= fuse -MAN= fuse_main.3 fuse_set_signal_handlers.3 +MAN= fuse_chan_fd.3 fuse_daemonize.3 fuse_destroy.3 fuse_loop.3 \ + fuse_main.3 fuse_mount.3 fuse_new.3 fuse_opt.3 fuse_parse_cmd_line.3 \ + fuse_set_signal_handlers.3 fuse_setup.3 fuse_teardown.3 \ + fuse_version.3 CFLAGS+= -Wall -Wshadow -Wmissing-prototypes CFLAGS+= -Wstrict-prototypes -Wsign-compare diff --git a/lib/libfuse/fuse_chan_fd.3 b/lib/libfuse/fuse_chan_fd.3 new file mode 100644 index 00000000000..b7cbb813f6b --- /dev/null +++ b/lib/libfuse/fuse_chan_fd.3 @@ -0,0 +1,53 @@ +.\" $OpenBSD: fuse_chan_fd.3,v 1.1 2018/07/08 02:28:42 helg Exp $ +.\" +.\" Copyright (c) 2018 Helg Bredow <helg.bredow@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_CHAN_FD 3 +.Os +.Sh NAME +.Nm fuse_chan_fd +.Nd get the file descriptor for an open FUSE device +.Sh SYNOPSIS +.In fuse.h +.Ft int +.Fn fuse_chan_fd "struct fuse_chan *ch" +.Sh DESCRIPTION +.Fn fuse_chan_fd +will return the file descriptor to the FUSE device opened for reading +and writing by +.Xr fuse_mount 3 . +.Sh RETURN VALUES +If successful, +.Fn fuse_chan_fd +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 fuse 4 +.Sh STANDARDS +The +.Fn +fuse_chan_fd +function conforms to FUSE 2.6. +.Sh HISTORY +The +.Fn fuse_chan_fd +function first appeared in +.Ox 5.4 . +.Sh AUTHORS +.An Sylvestre Gallon Aq Mt ccna.syl@gmail.com diff --git a/lib/libfuse/fuse_daemonize.3 b/lib/libfuse/fuse_daemonize.3 new file mode 100644 index 00000000000..d4a81b32be2 --- /dev/null +++ b/lib/libfuse/fuse_daemonize.3 @@ -0,0 +1,59 @@ +.\" $OpenBSD: fuse_daemonize.3,v 1.1 2018/07/08 02:28:42 helg Exp $ +.\" +.\" Copyright (c) 2018 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_DAEMONIZE 3 +.Os +.Sh NAME +.Nm fuse_daemonize +.Nd run in the background +.Sh SYNOPSIS +.In fuse.h +.Ft int +.Fn fuse_daemonize "int foreground" +.Sh DESCRIPTION +If +.Fa foreground +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. +.Pp +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, +.Fn fuse_daemonize +returns 0; otherwise -1 is returned. +.Sh ERRORS +.Fn fuse_daemonize +can fail for the same reasons as +.Xr daemon 3 . +.Sh SEE ALSO +.Xr daemon 3 , +.Xr fuse_parse_cmd_line 3 +.Sh STANDARDS +The +.Fn fuse_daemonize +function conforms to FUSE 2.6. +.Sh HISTORY +The +.Fn fuse_daemonize +function first appeared in +.Ox 5.4 . +.Sh AUTHORS +.An Sylvestre Gallon Aq Mt ccna.syl@gmail.com diff --git a/lib/libfuse/fuse_get_session.3 b/lib/libfuse/fuse_get_session.3 new file mode 100644 index 00000000000..cd1c4dcb177 --- /dev/null +++ b/lib/libfuse/fuse_get_session.3 @@ -0,0 +1,45 @@ +.\" $OpenBSD: fuse_get_session.3,v 1.1 2018/07/08 02:28:42 helg Exp $ +.\" +.\" Copyright (c) 2018 Helg Bredow <helg.bredow@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_GET_SESSION 3 +.Os +.Sh NAME +.Nm fuse_get_session +.Nd gets the FUSE session associated with a FUSE handle +.Sh SYNOPSIS +.In fuse.h +.Ft struct fuse_session * +.Fn fuse_get_session "struct fuse *f" +.Sh DESCRIPTION +.Fn fuse_get_session +returns the FUSE session associated with the FUSE file handle +.Fa f . +.Sh SEE ALSO +.Xr fuse_remove_signal_handlers 3 , +.Xr fuse_set_signal_handlers 3 +.Sh STANDARDS +The +.Fn +fuse_get_session +function conforms to FUSE 2.6. +.Sh HISTORY +The +.Fn fuse_get_session +function first appeared in +.Ox 5.4 . +.Sh AUTHORS +.An Sylvestre Gallon Aq Mt ccna.syl@gmail.com diff --git a/lib/libfuse/fuse_loop.3 b/lib/libfuse/fuse_loop.3 new file mode 100644 index 00000000000..05f2e3b0729 --- /dev/null +++ b/lib/libfuse/fuse_loop.3 @@ -0,0 +1,81 @@ +.\" $OpenBSD: fuse_loop.3,v 1.1 2018/07/08 02:28:42 helg Exp $ +.\" +.\" Copyright (c) 2018 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_LOOP 3 +.Os +.Sh NAME +.Nm fuse_loop , +.Nm fuse_loop_mt +.Nd Wait for and processes FUSE messages +.Sh SYNOPSIS +.In fuse.h +.Ft int +.Fn fuse_loop "struct fuse *fuse" +.Ft int +.Fn fuse_loop_mt "struct fuse *fuse" +.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 +.Xr fuse_new 3 +or +.Xr fuse_setup 3 +prior to calling +.Fn fuse_loop . +.Pp +.Fn fuse_loop +will return when it reads the FBT_DESTROY message, which indicates that +the file system is being unmounted. +.Pp +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 +.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 . +.Sh RETURN VALUES +.Fn fuse_loop +will return 0 on success and -1 on failure. +.Pp +.Fn fuse_loop_mt +always returns -1. +.Sh SEE ALSO +.Xr fb_queue 9 , +.Xr fuse_main 3 , +.Xr fuse_set_signal_handlers 3 +.Sh STANDARDS +The +.Fn fuse_loop +and +.Fn fuse_loop_mt +functions conform to FUSE 2.6. +.Sh HISTORY +The +.Fn fuse_loop +and +.Fn fuse_loop_mt +functions first appeared in +.Ox 5.4 . +.Sh AUTHORS +.An Sylvestre Gallon Aq Mt ccna.syl@gmail.com +.An Helg Bredow Aq Mt helg@openbsd.org diff --git a/lib/libfuse/fuse_main.3 b/lib/libfuse/fuse_main.3 index 704fd2226fe..7650fb67f55 100644 --- a/lib/libfuse/fuse_main.3 +++ b/lib/libfuse/fuse_main.3 @@ -1,6 +1,7 @@ -.\" $OpenBSD: fuse_main.3,v 1.3 2018/07/05 10:29:36 helg Exp $ +.\" $OpenBSD: fuse_main.3,v 1.4 2018/07/08 02:28:42 helg Exp $ .\" .\" Copyright (c) 2013 Sylvestre Gallon <ccna.syl@gmail.com> +.\" Copyright (c) 2018 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 @@ -14,63 +15,18 @@ .\" 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 5 2018 $ +.Dd $Mdocdate: July 8 2018 $ .Dt FUSE_MAIN 3 .Os .Sh NAME -.Nm fuse_main , -.Nm fuse_version , -.Nm fuse_new , -.Nm fuse_parse_cmdline , -.Nm fuse_mount , -.Nm fuse_get_session , -.Nm fuse_get_context , -.Nm fuse_is_lib_option , -.Nm fuse_loop , -.Nm fuse_loop_mt , -.Nm fuse_chan_fd , -.Nm fuse_unmount , -.Nm fuse_daemonize , -.Nm fuse_destroy , -.Nm fuse_teardown -.Nd FUSE implementation routines +.Nm fuse_main +.Nd FUSE helper function .Sh SYNOPSIS .In fuse.h .Ft int .Fn fuse_main "int argc" "char **argv" "const struct fuse_operations *ops" \ "void *data" -.Ft int -.Fn fuse_version "void" -.Ft struct fuse * -.Fn fuse_new "struct fuse_chan *fc" "struct fuse_args *args" \ - "const struct fuse_operations *ops" "size_t size" "void *userdata" -.Ft int -.Fn fuse_parse_cmdline "struct fuse_args *args" "char **mp" "int *mt" "int *fg" -.Ft struct fuse_chan * -.Fn fuse_mount "const char *dir" "struct fuse_args *args" -.Ft struct fuse_session * -.Fn fuse_get_session "struct fuse *f" -.Ft struct fuse_context * -.Fn fuse_get_context "void" -.Ft int -.Fn fuse_is_lib_option "const char *opt" -.Ft int -.Fn fuse_loop "struct fuse *fuse" -.Ft int -.Fn fuse_loop_mt "struct fuse *fuse" -.Ft int -.Fn fuse_chan_fd "struct fuse_chan *ch" -.Ft void -.Fn fuse_unmount "const char *dir" "struct fuse_chan *ch" -.Ft int -.Fn fuse_daemonize "int foreground" -.Ft void -.Fn fuse_destroy "struct fuse *f" -.Ft void -.Fn fuse_teardown "struct fuse *f" "char *mp" .Sh DESCRIPTION -The FUSE library provides routines to implement a filesystem in userspace. -.Pp There are two ways of implementing a FUSE filesystem: by calling only .Fn fuse_main @@ -78,91 +34,18 @@ and passing this function the .Em ops argument containing all the callbacks of the filesystem, or by using the other functions, -as detailed below. -.Pp -.Fn fuse_version -returns the FUSE version number. -.Pp -.Fn fuse_new -returns a -.Fa struct fuse -that will be needed by -.Fn fuse_loop . -.Pp -.Fn fuse_parse_cmdline -parses the -.Fa struct fuse_args -given by the user and will set -.Fa mp -with a char * containing the mountpoint directory. -.Pp -.Fn fuse_mount -looks for an empty -.Xr fuse 4 -device to create a connection. -If this function finds an available device it will open it for FUSE -communication with the FUSE VFS driver and will mount the filesystem. -This function will return a -.Fa struct fuse_chan -that will be needed by -.Fn fuse_new . +as detailed in +.Xr fuse_loop 3 .Pp -.Fn fuse_get_session -returns a pointer to the structure -.Fa fuse_session -contained in a -.Fa struct fuse . -.Pp -.Fn fuse_get_context -returns a pointer to the structure -.Fa fuse_context . -The returned fuse_context is only available during the lifetime of a FUSE -operation. -.Pp -.Fn fuse_is_lib_option -checks if the string -.Fa opt -is an option handled by libfuse or by the FUSE client. -It returns 1 if it is handled by the lib and 0 otherwise. -.Pp -.Fn fuse_loop_mt -is unsupported. -.Pp -.Fn fuse_loop -is the main loop of a FUSE program. -This function looks for FUSE requests from the kernel and responds to them -using the -.Fa struct fuse_operation -present in the structure -.Fa fuse . -It will return only if something goes wrong -or if the kernel sends a -.Fa FUSE_DESTROY -opcode to libfuse. -.Pp -.Fn fuse_chan_fd -returns the filedescriptor used by the given -.Fa fuse_chan -structure. -.Pp -.Fn fuse_unmount -unmounts the -.Fa dir -mountpoint. -.Pp -.Fn fuse_daemonize -daemonises the FUSE library. -It runs the FUSE program in the background, -whilst continuing to handle kernel filesystem opcodes. -.Pp -.Fn fuse_destroy -is currently undocumented. -.Pp -.Fn fuse_teardown -calls -.Fn fuse_unmount +.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 +file system or those supported by +.Xr fuse_parse_cmd_line 3 , +.Xr fuse_new 3 and -.Fn fuse_destroy . +.Xr fuse_mount 3 . .Sh EXAMPLES Here is a simple example of a FUSE implementation: .Bd -literal @@ -240,14 +123,21 @@ main(int ac, char **av) } .Ed .Sh SEE ALSO -.Xr fuse 4 +.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 .Sh STANDARDS -The original FUSE specification can be found at -.Lk http://libfuse.github.io/doxygen/ . -The original implementation can be found at -.Lk https://github.com/libfuse/libfuse/ . +The +.Fn fuse_main +function conforms to FUSE 2.6. .Sh HISTORY -The FUSE library first appeared in +The +.Fn fuse_main +function first appeared in .Ox 5.4 . -.Sh BUGS -This man page is woefully incomplete. +.Sh AUTHORS +.An Sylvestre Gallon Aq Mt ccna.syl@gmail.com +.An Helg Bredow Aq Mt helg@openbsd.org diff --git a/lib/libfuse/fuse_mount.3 b/lib/libfuse/fuse_mount.3 new file mode 100644 index 00000000000..b5db384a857 --- /dev/null +++ b/lib/libfuse/fuse_mount.3 @@ -0,0 +1,115 @@ +.\" $OpenBSD: fuse_mount.3,v 1.1 2018/07/08 02:28:42 helg Exp $ +.\" +.\" Copyright (c) 2018 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_MOUNT 3 +.Os +.Sh NAME +.Nm fuse_mount , +.Nm fuse_unmount +.Nd Mount or dismount a FUSE file system +.Sh SYNOPSIS +.In fuse.h +.Ft struct fuse_chan * +.Fn fuse_mount "const char *dir" "struct fuse_args *args" +.Ft void +.Fn fuse_unmount "const char *dir" "struct fuse_chan *ch" +.Sh DESCRIPTION +The +.Fn fuse_mount +calls the +.Xr mount 2 +system call to graft the FUSE file system on to the file system tree +at the point +.Fa dir . +.Fa args +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. +.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 +.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. +.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. +.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. +.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. +.It ro +Mount the file system read-only. Can also be specified by itself with +-r. +.El +.Pp +.Fn fuse_unmount +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 +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. +.Pp +Only the super user can mount and unmount FUSE file systems. +.Sh RETURN VALUES +.Fn fuse_main +will return NULL if the file system cannot be mounted. +.Sh ERRORS +.Fn fuse_mount +will fail when one of the following occurs: +.Fa dir +does not exist or is not a directory. +The fuse device cannot be opened for reading and writing. +There was an error parsing the options specified by +.Fa args . +The file system could not be mounted. +.Sh SEE ALSO +.Xr mount 2 , +.Xr fuse_main 3 , +.Xr fuse_setup 3 , +.Xr fuse 4 +.Sh STANDARDS +The +.Fn fuse_mount +and +.Fn fuse_unmount +functions conforms to FUSE 2.6. +.Sh HISTORY +The +.Fn fuse_mount +and +.Fn fuse_unmount +functions first appeared in +.Ox 5.4 . +.Sh AUTHORS +.An Sylvestre Gallon Aq Mt ccna.syl@gmail.com +.An Helg Bredow Aq Mt helg@openbsd.org diff --git a/lib/libfuse/fuse_new.3 b/lib/libfuse/fuse_new.3 new file mode 100644 index 00000000000..067403d87ac --- /dev/null +++ b/lib/libfuse/fuse_new.3 @@ -0,0 +1,210 @@ +.\" $OpenBSD: fuse_new.3,v 1.1 2018/07/08 02:28:42 helg Exp $ +.\" +.\" Copyright (c) 2013 Sylvestre Gallon <ccna.syl@gmail.com> +.\" Copyright (c) 2018 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_NEW 3 +.Os +.Sh NAME +.Nm fuse_new +.Nd FUSE implementation routine to intialise the FUSE connection +.Sh SYNOPSIS +.In fuse.h +.Ft struct fuse * +.Fn fuse_new "struct fuse_chan *fc" "struct fuse_args *args" \ + "const struct fuse_operations *ops" "unused size_t size" \ + "void *userdata" +.Sh DESCRIPTION +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 +a negated errno value (-errno) on failure. +.Pp +All operations are optional but functional file system will want to +implement at least statfs, readdir, open, read and getattr. +.Bd +struct fuse_operations { + int (*getattr)(const char *, struct stat *); + int (*readlink)(const char *, char *, size_t); + int (*getdir)(const char *, fuse_dirh_t, fuse_dirfil_t); + int (*mknod)(const char *, mode_t, dev_t); + int (*mkdir)(const char *, mode_t); + int (*unlink)(const char *); + int (*rmdir)(const char *); + int (*symlink)(const char *, const char *); + int (*rename)(const char *, const char *); + int (*link)(const char *, const char *); + int (*chmod)(const char *, mode_t); + int (*chown)(const char *, uid_t, gid_t); + int (*truncate)(const char *, off_t); + int (*utime)(const char *, struct utimbuf *); + int (*open)(const char *, struct fuse_file_info *); + int (*read)(const char *, char *, size_t, off_t, + struct fuse_file_info *); + int (*write)(const char *, const char *, size_t, off_t, + struct fuse_file_info *); + int (*statfs)(const char *, struct statvfs *); + int (*flush)(const char *, struct fuse_file_info *); + int (*release)(const char *, struct fuse_file_info *); + int (*fsync)(const char *, int, struct fuse_file_info *); + int (*setxattr)(const char *, const char *, const char *, + size_t int); + int (*getxattr)(const char *, const char *, char *, size_t); + int (*listxattr)(const char *, char *, size_t); + int (*removexattr)(const char *, const char *); + int (*opendir)(const char *, struct fuse_file_info *); + int (*readdir)(const char *, void *, fuse_fill_dir_t, off_t, + struct fuse_file_info *); + int (*releasedir)(const char *, struct fuse_file_info *); + int (*fsyncdir)(const char *, int, struct fuse_file_info *); + void *(*init)(struct fuse_conn_info *); + void (*destroy)(void *); + int (*access)(const char *, int); + int (*create)(const char *, mode_t, struct fuse_file_info *); + int (*ftruncate)(const char *, off_t, struct fuse_file_info *); + int (*fgetattr)(const char *, struct stat *, struct + fuse_file_info *); + int (*lock)(const char *, struct fuse_file_info *, int, + struct flock *); + int (*utimens)(const char *, const struct timespec *); + int (*bmap)(const char *, size_t , uint64_t *); +}; +.Ed +.Pp +There order of calls is: +init +... +opendir +readdir +releasedir +open +read +write +... +flush +release +... +destroy +.Pp +.Bl -tag -width Ds +.It access +Not implemented. OpenBSD 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. +In the reference implementation this is an atomic operation that both +creates and opens the file. There is no equivalent in the OpenBSD VFS. +.It getattr +Corresponds to the +.Xr stat 2 +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. +.It getdir +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. +.It mknod +Called on +.Xr open 2 +and +.Xr mknod 2 +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. +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. +.It releasedir +Called when there are no more reference to the directory. +.It setattr +Equivalent to +.Xr chown 2 +and +.Xr chmod 2 +system calls. Setting file flags is not supported. +.It setxattr +Not implemented. +.El +.Pp +Options supported by args are: +.Bl -tag -width Ds +.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. +.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 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 +.It uid=%u +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. +.El +.Sh SEE ALSO +.Xr fuse_mount 3 , +.Xr fuse_main 3 , +.Xr fuse_get_context 3 +.Sh STANDARDS +The +.Fn fuse_new +function conforms to FUSE 2.6. +.Sh HISTORY +The +.Fn fuse_new +function first appeared in +.Ox 5.4 . +.Sh AUTHORS +.An Sylvestre Gallon Aq Mt ccna.syl@gmail.com +.An Helg Bredow Aq Mt helg@openbsd.org diff --git a/lib/libfuse/fuse_opt.3 b/lib/libfuse/fuse_opt.3 new file mode 100644 index 00000000000..8f0db06913f --- /dev/null +++ b/lib/libfuse/fuse_opt.3 @@ -0,0 +1,338 @@ +.\" $OpenBSD: fuse_opt.3,v 1.1 2018/07/08 02:28:42 helg 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 +.Fo FUSE_ARGS_INIT +.Fa "int argc" +.Fa "char argv**" +.Fc +.Ft int +.Fo FUSE_OPT_IS_OPT_KEY +.Fa "fuse_opt *t" +.Fc +.Ft struct fuse_opt +.Fo FUSE_OPT_KEY +.Fa "const char *templ" +.Fa "int key" +.Fc +.Ft int +.Fo fuse_opt_add_arg +.Fa "struct fuse_args *args" +.Fa "const char *arg" +.Fc +.Ft int +.Fo fuse_opt_insert_arg +.Fa "struct fuse_args *args" +.Fa "int pos" +.Fa "const char *opt" +.Fc +.Ft int +.Fo fuse_opt_add_opt +.Fa "char **opts" +.Fa "const char *opt" +.Fc +.Ft int +.Fo fuse_opt_add_opt_escaped +.Fa "char **opts" +.Fa "const char *opt" +.Fc +.Ft void +.Fo fuse_opt_free_args +.Fa "struct fuse_args *args" +.Fc +.Ft int +.Fo fuse_opt_match +.Fa "const struct fuse_opt *opts" +.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 +.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 +.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 +.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 +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 . +.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. +.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 opts . +If +.Fa opt +is an option then it must not include the -o prefix. +.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 +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 +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 +=) +.Pp +foo matches exactly +.Pp +-b or --bar matches the argument +"-b " or "--bar " (trailing space) argument expects a value, that is passed to +.Fa proc +.Pp +-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 +.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 +struct foo_config { + char *foor; + int bar; +}; + +#define FOO_OPT(t, m) {t, offsetof(struct foo_config, m), 1} + +struct fuse_opt opts[] { + FUSE_OPT_KEY("--foo ", KEY_FOO), + FOO_OPT("-b", bar), + FOO_OPT("gid=", set_gid), /* set to 1 if present */ + FOO_OPT("gid=%u", gid), /* set to parsed value of %u */ + FUSE_OPT_END +} + +int +foo_process_proc(void *data, int key, char *val, struct fuse_args *args) +{ + foo_cofig *conf = data; + + switch(key) + { + case KEY_FOO: + /* Do something... */ + conf.foo = val; + return (0); /* discard */ + } + + /* didn't process so keep the option */ + return (1); +} + +int +main(int argc, char *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 +.Xr fuse_main 3 +.Sh STANDARDS +These library functions conform to FUSE 2.6. +.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 +.An Ray Lai Aq Mt ray@raylai.com +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 new file mode 100644 index 00000000000..8c9c5c89c3d --- /dev/null +++ b/lib/libfuse/fuse_parse_cmd_line.3 @@ -0,0 +1,93 @@ +.\" $OpenBSD: fuse_parse_cmd_line.3,v 1.1 2018/07/08 02:28:42 helg Exp $ +.\" +.\" Copyright (c) 2018 Helg Bredow <helg.bredow@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_PARSE_CMD_LINE 3 +.Os +.Sh NAME +.Nm fuse_parse_cmd_line +.Nd FUSE helper function to parse command line arguments +.Sh SYNOPSIS +.In fuse.h +.Ft int +.Fn fuse_parse_cmd_line "struct fuse_args *args" "char **mp" \ + "int *mt" "int *fg" +.Sh DESCRIPTION +.Fn fuse_parse_cmd_line +is a helper function to parse standard FUSE arguments. +.Fa args +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 +Causes debug information for subsequent FUSE library calls to be output to +stderr. Implies -f. +.It -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 +Print usage information for the options supported by +.Fn fuse_parse_cmd_line . +.It -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 +.Fa mt +will always be 0. +.It -V, --version +Print the FUSE library version to stderr. +.El +.Pp +If the first argument not recognised by +.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 +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 , +.Xr fuse_main 3 , +.Xr fuse_setup 3 +.Sh STANDARDS +The +.Fn fuse_parse_cmd_line +function conforms to FUSE 2.6. +.Sh HISTORY +The +.Fn fuse_parse_cmd_line +function first appeared in +.Ox 5.4 . +.Sh AUTHORS +.An Sylvestre Gallon Aq Mt ccna.syl@gmail.com +.An Helg Bredow Aq Mt helg@openbsd.org diff --git a/lib/libfuse/fuse_setup.3 b/lib/libfuse/fuse_setup.3 new file mode 100644 index 00000000000..20e82c060ee --- /dev/null +++ b/lib/libfuse/fuse_setup.3 @@ -0,0 +1,83 @@ +.\" $OpenBSD: fuse_setup.3,v 1.1 2018/07/08 02:28:42 helg Exp $ +.\" +.\" Copyright (c) 2018 Helg Bredow <helg.bredow@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_SETUP 3 +.Os +.Sh NAME +.Nm fuse_setup +.Nd FUSE helper function +.Sh SYNOPSIS +.In fuse.h +.Ft struct fuse * +.Fn fuse_setup "int argc" "char **argv" \ + "const struct fuse_operations *ops" "size_t size" "char **mp" \ + "int *mt" "void *data" +.Sh DESCRIPTION +.Fn fuse_setup +is a helper function that mounts a FUSE file system, creates a new FUSE +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 +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 +.Fa argv . +.Ox +does not currently support multi-threaded operation. +.Pp +The file system will be mounted on +.Fa mp , +which is the directory specified by the first +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 +.Fa size +that contains pointers to FUSE file system operations. See +.Xr fuse_new 3 . +.Sh RETURN VALUES +.Fn fuse_setup +will return NULL on failure. +.Sh SEE ALSO +.Xr fuse_main 3 , +.Xr fuse_mount 3 , +.Xr fuse_new 3 , +.Xr fuse_parse_cmd_line 3 , +.Xr fuse_set_signal_handlers 3 , +.Xr fuse_teardown 3 , +.Xr fuse 4 +.Sh STANDARDS +The +.Fn +fuse_setup +function conforms to FUSE 2.6. +.Sh HISTORY +The +.Fn fuse_setup +function first appeared in +.Ox 5.4 . +.Sh AUTHORS +.An Sylvestre Gallon Aq Mt ccna.syl@gmail.com +.An Helg Bredow Aq Mt helg@openbsd.org diff --git a/lib/libfuse/fuse_teardown.3 b/lib/libfuse/fuse_teardown.3 new file mode 100644 index 00000000000..c5d52a2b833 --- /dev/null +++ b/lib/libfuse/fuse_teardown.3 @@ -0,0 +1,55 @@ +.\" $OpenBSD: fuse_teardown.3,v 1.1 2018/07/08 02:28:42 helg Exp $ +.\" +.\" Copyright (c) 2018 Helg Bredow <helg.bredow@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_TEARDOWN 3 +.Os +.Sh NAME +.Nm fuse_teardown +.Nd FUSE helper function +.Sh SYNOPSIS +.In fuse.h +.Ft void +.Fn fuse_teardown "struct fuse *f" "char *mp" +.Sh DESCRIPTION +.Fn fuse_teardown +is a helper function that removes any signal handlers that were +installed by a previous call to +.Xr fuse_set_signal_handlers 3 +or +.Xr fuse_setup 3 +and unmounts the file system mounted at +.Fa mp . +The FUSE session +.Fa f +is then destroyed. +.Sh SEE ALSO +.Xr fuse_destroy 3 , +.Xr fuse_remove_signal_handlers 3 , +.Xr fuse_unmount 3 +.Sh STANDARDS +The +.Fn +fuse_teardown +function conforms to FUSE 2.6. +.Sh HISTORY +The +.Fn fuse_teardown +function first appeared in +.Ox 5.4 . +.Sh AUTHORS +.An Sylvestre Gallon Aq Mt ccna.syl@gmail.com +.An Helg Bredow Aq Mt helg@openbsd.org diff --git a/lib/libfuse/fuse_version.3 b/lib/libfuse/fuse_version.3 new file mode 100644 index 00000000000..b449b0f88c3 --- /dev/null +++ b/lib/libfuse/fuse_version.3 @@ -0,0 +1,42 @@ +.\" $OpenBSD: fuse_version.3,v 1.1 2018/07/08 02:28:42 helg Exp $ +.\" +.\" Copyright (c) 2018 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_VERSION 3 +.Os +.Sh NAME +.Nm fuse_version +.Nd get the version of the FUSE library +.Sh SYNOPSIS +.In fuse.h +.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. +.Sh SEE ALSO +.Xr fuse_main 3 +.Sh STANDARDS +The +.Fn fuse_version +function conforms to FUSE 2.6. +.Sh HISTORY +The +.Fn fuse_version +function first appeared in +.Ox 5.4 . +.Sh AUTHORS +.An Sylvestre Gallon Aq Mt ccna.syl@gmail.com |