src/lib/libfuse/fuse_setup.3

88 lines
2.6 KiB
Groff

.\" $OpenBSD: fuse_setup.3,v 1.3 2018/11/28 21:19:11 mpi 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: November 28 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
.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 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.
.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_cmdline 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_cmdline 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