fuse
Data Structures | Macros | Enumerations | Functions
fuse_common.h File Reference
#include "fuse_opt.h"
#include <stdint.h>
#include <sys/types.h>

Data Structures

struct  fuse_file_info
 
struct  fuse_conn_info
 
struct  fuse_buf
 
struct  fuse_bufvec
 

Macros

#define FUSE_MAJOR_VERSION   3
 
#define FUSE_MINOR_VERSION   0
 
#define FUSE_CAP_ASYNC_READ   (1 << 0)
 
#define FUSE_IOCTL_COMPAT   (1 << 0)
 

Enumerations

enum  fuse_buf_flags { FUSE_BUF_IS_FD = (1 << 1), FUSE_BUF_FD_SEEK = (1 << 2), FUSE_BUF_FD_RETRY = (1 << 3) }
 
enum  fuse_buf_copy_flags { FUSE_BUF_NO_SPLICE = (1 << 1), FUSE_BUF_FORCE_SPLICE = (1 << 2), FUSE_BUF_SPLICE_MOVE = (1 << 3), FUSE_BUF_SPLICE_NONBLOCK = (1 << 4) }
 

Functions

struct fuse_chan * fuse_mount (const char *mountpoint, struct fuse_args *args)
 
void fuse_unmount (const char *mountpoint, struct fuse_chan *ch)
 
int fuse_parse_cmdline (struct fuse_args *args, char **mountpoint, int *multithreaded, int *foreground)
 
int fuse_daemonize (int foreground)
 
int fuse_version (void)
 
void fuse_pollhandle_destroy (struct fuse_pollhandle *ph)
 
size_t fuse_buf_size (const struct fuse_bufvec *bufv)
 
ssize_t fuse_buf_copy (struct fuse_bufvec *dst, struct fuse_bufvec *src, enum fuse_buf_copy_flags flags)
 
int fuse_set_signal_handlers (struct fuse_session *se)
 
void fuse_remove_signal_handlers (struct fuse_session *se)
 

Macro Definition Documentation

#define FUSE_CAP_ASYNC_READ   (1 << 0)

Capability bits for 'fuse_conn_info.capable' and 'fuse_conn_info.want'

FUSE_CAP_ASYNC_READ: filesystem supports asynchronous read requests FUSE_CAP_POSIX_LOCKS: filesystem supports "remote" locking FUSE_CAP_ATOMIC_O_TRUNC: filesystem handles the O_TRUNC open flag FUSE_CAP_EXPORT_SUPPORT: filesystem handles lookups of "." and ".." FUSE_CAP_BIG_WRITES: filesystem can handle write size larger than 4kB FUSE_CAP_DONT_MASK: don't apply umask to file mode on create operations FUSE_CAP_SPLICE_WRITE: ability to use splice() to write to the fuse device FUSE_CAP_SPLICE_MOVE: ability to move data to the fuse device with splice() FUSE_CAP_SPLICE_READ: ability to use splice() to read from the fuse device FUSE_CAP_IOCTL_DIR: ioctl support on directories

#define FUSE_IOCTL_COMPAT   (1 << 0)

Ioctl flags

FUSE_IOCTL_COMPAT: 32bit compat ioctl on 64bit machine FUSE_IOCTL_UNRESTRICTED: not restricted to well-formed ioctls, retry allowed FUSE_IOCTL_RETRY: retry with new iovecs FUSE_IOCTL_DIR: is a directory

FUSE_IOCTL_MAX_IOV: maximum of in_iovecs + out_iovecs

#define FUSE_MAJOR_VERSION   3

Major version of FUSE library interface

#define FUSE_MINOR_VERSION   0

Minor version of FUSE library interface

Enumeration Type Documentation

Buffer copy flags

Enumerator:
FUSE_BUF_NO_SPLICE 

Don't use splice(2)

Always fall back to using read and write instead of splice(2) to copy data from one file descriptor to another.

If this flag is not set, then only fall back if splice is unavailable.

FUSE_BUF_FORCE_SPLICE 

Force splice

Always use splice(2) to copy data from one file descriptor to another. If splice is not available, return -EINVAL.

FUSE_BUF_SPLICE_MOVE 

Try to move data with splice.

If splice is used, try to move pages from the source to the destination instead of copying. See documentation of SPLICE_F_MOVE in splice(2) man page.

FUSE_BUF_SPLICE_NONBLOCK 

Don't block on the pipe when copying data with splice

Makes the operations on the pipe non-blocking (if the pipe is full or empty). See SPLICE_F_NONBLOCK in the splice(2) man page.

Buffer flags

Enumerator:
FUSE_BUF_IS_FD 

Buffer contains a file descriptor

If this flag is set, the .fd field is valid, otherwise the .mem fields is valid.

FUSE_BUF_FD_SEEK 

Seek on the file descriptor

If this flag is set then the .pos field is valid and is used to seek to the given offset before performing operation on file descriptor.

FUSE_BUF_FD_RETRY 

Retry operation on file descriptor

If this flag is set then retry operation on file descriptor until .size bytes have been copied or an error or EOF is detected.

Function Documentation

ssize_t fuse_buf_copy ( struct fuse_bufvec dst,
struct fuse_bufvec src,
enum fuse_buf_copy_flags  flags 
)

Copy data from one buffer vector to another

Parameters
dstdestination buffer vector
srcsource buffer vector
flagsflags controlling the copy
Returns
actual number of bytes copied or -errno on error
size_t fuse_buf_size ( const struct fuse_bufvec bufv)

Get total size of data in a fuse buffer vector

Parameters
bufvbuffer vector
Returns
size of data
int fuse_daemonize ( int  foreground)

Go into the background

Parameters
foregroundif true, stay in the foreground
Returns
0 on success, -1 on failure
struct fuse_chan* fuse_mount ( const char *  mountpoint,
struct fuse_args args 
)
read

Create a FUSE mountpoint

Returns a control file descriptor suitable for passing to fuse_new()

Parameters
mountpointthe mount point path
argsargument vector
Returns
the communication channel on success, NULL on failure
int fuse_parse_cmdline ( struct fuse_args args,
char **  mountpoint,
int *  multithreaded,
int *  foreground 
)

Parse common options

The following options are parsed:

'-f' foreground '-d' '-odebug' foreground, but keep the debug option '-s' single threaded '-h' '–help' help '-ho' help without header '-ofsname=..' file system name, if not present, then set to the program name

All parameters may be NULL

Parameters
argsargument vector
mountpointthe returned mountpoint, should be freed after use
multithreadedset to 1 unless the '-s' option is present
foregroundset to 1 if one of the relevant options is present
Returns
0 on success, -1 on failure
void fuse_pollhandle_destroy ( struct fuse_pollhandle *  ph)

Destroy poll handle

Parameters
phthe poll handle
void fuse_remove_signal_handlers ( struct fuse_session *  se)

Restore default signal handlers

Resets global session. After this fuse_set_signal_handlers() may be called again.

Parameters
sethe same session as given in fuse_set_signal_handlers()

See also: fuse_set_signal_handlers()

int fuse_set_signal_handlers ( struct fuse_session *  se)

Exit session on HUP, TERM and INT signals and ignore PIPE signal

Stores session in a global variable. May only be called once per process until fuse_remove_signal_handlers() is called.

Once either of the POSIX signals arrives, the exit_handler() in fuse_signals.c is called:

static void exit_handler(int sig)
{
(void) sig;
if (fuse_instance)
fuse_session_exit(fuse_instance);
}
Parameters
sethe session to exit
Returns
0 on success, -1 on failure

See also: fuse_remove_signal_handlers()

void fuse_unmount ( const char *  mountpoint,
struct fuse_chan *  ch 
)

Umount a FUSE mountpoint

Parameters
mountpointthe mount point path
chthe communication channel
int fuse_version ( void  )

Get the version of the library

Returns
the version