#include "fuse_common.h"#include <utime.h>#include <fcntl.h>#include <sys/types.h>#include <sys/stat.h>#include <sys/statvfs.h>#include <sys/uio.h>#include "fuse_lowlevel_compat.h"Data Structures | |
| struct | fuse_entry_param |
| struct | fuse_ctx |
| struct | fuse_lowlevel_ops |
| struct | fuse_session_ops |
| struct | fuse_chan_ops |
Defines | |
| #define | FUSE_ROOT_ID 1 |
Typedefs | |
| typedef unsigned long | fuse_ino_t |
| typedef struct fuse_req * | fuse_req_t |
| typedef void(* | fuse_interrupt_func_t )(fuse_req_t req, void *data) |
Functions | |
| int | fuse_reply_err (fuse_req_t req, int err) |
| void | fuse_reply_none (fuse_req_t req) |
| int | fuse_reply_entry (fuse_req_t req, const struct fuse_entry_param *e) |
| int | fuse_reply_create (fuse_req_t req, const struct fuse_entry_param *e, const struct fuse_file_info *fi) |
| int | fuse_reply_attr (fuse_req_t req, const struct stat *attr, double attr_timeout) |
| int | fuse_reply_readlink (fuse_req_t req, const char *link) |
| int | fuse_reply_open (fuse_req_t req, const struct fuse_file_info *fi) |
| int | fuse_reply_write (fuse_req_t req, size_t count) |
| int | fuse_reply_buf (fuse_req_t req, const char *buf, size_t size) |
| int | fuse_reply_iov (fuse_req_t req, const struct iovec *iov, int count) |
| int | fuse_reply_statfs (fuse_req_t req, const struct statvfs *stbuf) |
| int | fuse_reply_xattr (fuse_req_t req, size_t count) |
| int | fuse_reply_lock (fuse_req_t req, struct flock *lock) |
| int | fuse_reply_bmap (fuse_req_t req, uint64_t idx) |
| size_t | fuse_add_direntry (fuse_req_t req, char *buf, size_t bufsize, const char *name, const struct stat *stbuf, off_t off) |
| int | fuse_reply_ioctl_retry (fuse_req_t req, const struct iovec *in_iov, size_t in_count, const struct iovec *out_iov, size_t out_count) |
| int | fuse_reply_ioctl (fuse_req_t req, int result, const void *buf, size_t size) |
| int | fuse_reply_poll (fuse_req_t req, unsigned revents) |
| int | fuse_lowlevel_notify_poll (struct fuse_pollhandle *ph) |
| void * | fuse_req_userdata (fuse_req_t req) |
| struct fuse_ctx * | fuse_req_ctx (fuse_req_t req) |
| void | fuse_req_interrupt_func (fuse_req_t req, fuse_interrupt_func_t func, void *data) |
| int | fuse_req_interrupted (fuse_req_t req) |
| struct fuse_session * | fuse_lowlevel_new (struct fuse_args *args, const struct fuse_lowlevel_ops *op, size_t op_size, void *userdata) |
| struct fuse_session * | fuse_session_new (struct fuse_session_ops *op, void *data) |
| void | fuse_session_add_chan (struct fuse_session *se, struct fuse_chan *ch) |
| void | fuse_session_remove_chan (struct fuse_chan *ch) |
| struct fuse_chan * | fuse_session_next_chan (struct fuse_session *se, struct fuse_chan *ch) |
| void | fuse_session_process (struct fuse_session *se, const char *buf, size_t len, struct fuse_chan *ch) |
| void | fuse_session_destroy (struct fuse_session *se) |
| void | fuse_session_exit (struct fuse_session *se) |
| void | fuse_session_reset (struct fuse_session *se) |
| int | fuse_session_exited (struct fuse_session *se) |
| int | fuse_session_loop (struct fuse_session *se) |
| int | fuse_session_loop_mt (struct fuse_session *se) |
| struct fuse_chan * | fuse_chan_new (struct fuse_chan_ops *op, int fd, size_t bufsize, void *data) |
| int | fuse_chan_fd (struct fuse_chan *ch) |
| size_t | fuse_chan_bufsize (struct fuse_chan *ch) |
| void * | fuse_chan_data (struct fuse_chan *ch) |
| struct fuse_session * | fuse_chan_session (struct fuse_chan *ch) |
| int | fuse_chan_recv (struct fuse_chan **ch, char *buf, size_t size) |
| int | fuse_chan_send (struct fuse_chan *ch, const struct iovec iov[], size_t count) |
| void | fuse_chan_destroy (struct fuse_chan *ch) |
IMPORTANT: you should define FUSE_USE_VERSION before including this header. To use the newest API define it to 26 (recommended for any new application), to use the old API define it to 24 (default) or 25
| #define FUSE_ROOT_ID 1 |
The node ID of the root inode
| typedef unsigned long fuse_ino_t |
Inode number type
| typedef void(* fuse_interrupt_func_t)(fuse_req_t req, void *data) |
Callback function for an interrupt
| req | interrupted request | |
| data | user data |
| typedef struct fuse_req* fuse_req_t |
Request pointer type
| size_t fuse_add_direntry | ( | fuse_req_t | req, | |
| char * | buf, | |||
| size_t | bufsize, | |||
| const char * | name, | |||
| const struct stat * | stbuf, | |||
| off_t | off | |||
| ) |
Add a directory entry to the buffer
Buffer needs to be large enough to hold the entry. Of it's not, then the entry is not filled in but the size of the entry is still returned. The caller can check this by comparing the bufsize parameter with the returned entry size. If the entry size is larger than the buffer size, the operation failed.
From the 'stbuf' argument the st_ino field and bits 12-15 of the st_mode field are used. The other fields are ignored.
Note: offsets do not necessarily represent physical offsets, and could be any marker, that enables the implementation to find a specific point in the directory stream.
| req | request handle | |
| buf | the point where the new entry will be added to the buffer | |
| bufsize | remaining size of the buffer | |
| name | the name of the entry | |
| stbuf | the file attributes | |
| off | the offset of the next entry |
| size_t fuse_chan_bufsize | ( | struct fuse_chan * | ch | ) |
Query the minimal receive buffer size
| ch | the channel |
| void* fuse_chan_data | ( | struct fuse_chan * | ch | ) |
| void fuse_chan_destroy | ( | struct fuse_chan * | ch | ) |
Destroy a channel
| ch | the channel |
| int fuse_chan_fd | ( | struct fuse_chan * | ch | ) |
Query the file descriptor of the channel
| ch | the channel |
| struct fuse_chan* fuse_chan_new | ( | struct fuse_chan_ops * | op, | |
| int | fd, | |||
| size_t | bufsize, | |||
| void * | data | |||
| ) | [read] |
Create a new channel
| op | channel operations | |
| fd | file descriptor of the channel | |
| bufsize | the minimal receive buffer size | |
| data | user data |
| int fuse_chan_recv | ( | struct fuse_chan ** | ch, | |
| char * | buf, | |||
| size_t | size | |||
| ) |
Receive a raw request
A return value of -ENODEV means, that the filesystem was unmounted
| ch | pointer to the channel | |
| buf | the buffer to store the request in | |
| size | the size of the buffer |
| int fuse_chan_send | ( | struct fuse_chan * | ch, | |
| const struct iovec | iov[], | |||
| size_t | count | |||
| ) |
Send a raw reply
A return value of -ENOENT means, that the request was interrupted, and the reply was discarded
| ch | the channel | |
| iov | vector of blocks | |
| count | the number of blocks in vector |
| struct fuse_session* fuse_chan_session | ( | struct fuse_chan * | ch | ) | [read] |
Query the session to which this channel is assigned
| ch | the channel |
| struct fuse_session* fuse_lowlevel_new | ( | struct fuse_args * | args, | |
| const struct fuse_lowlevel_ops * | op, | |||
| size_t | op_size, | |||
| void * | userdata | |||
| ) | [read] |
Create a low level session
| args | argument vector | |
| op | the low level filesystem operations | |
| op_size | sizeof(struct fuse_lowlevel_ops) | |
| userdata | user data |
| int fuse_lowlevel_notify_poll | ( | struct fuse_pollhandle * | ph | ) |
Notify IO readiness event
For more information, please read comment for poll operation.
| ph | poll handle to notify IO readiness event for |
| int fuse_reply_attr | ( | fuse_req_t | req, | |
| const struct stat * | attr, | |||
| double | attr_timeout | |||
| ) |
Reply with attributes
Possible requests: getattr, setattr
| req | request handle | |
| attr | the attributes | |
| attr_timeout | validity timeout (in seconds) for the attributes |
| int fuse_reply_bmap | ( | fuse_req_t | req, | |
| uint64_t | idx | |||
| ) |
Reply with block index
Possible requests: bmap
| req | request handle | |
| idx | block index within device |
| int fuse_reply_buf | ( | fuse_req_t | req, | |
| const char * | buf, | |||
| size_t | size | |||
| ) |
Reply with data
Possible requests: read, readdir, getxattr, listxattr
| req | request handle | |
| buf | buffer containing data | |
| size | the size of data in bytes |
| int fuse_reply_create | ( | fuse_req_t | req, | |
| const struct fuse_entry_param * | e, | |||
| const struct fuse_file_info * | fi | |||
| ) |
Reply with a directory entry and open parameters
currently the following members of 'fi' are used: fh, direct_io, keep_cache
Possible requests: create
| req | request handle | |
| e | the entry parameters | |
| fi | file information |
| int fuse_reply_entry | ( | fuse_req_t | req, | |
| const struct fuse_entry_param * | e | |||
| ) |
Reply with a directory entry
Possible requests: lookup, mknod, mkdir, symlink, link
| req | request handle | |
| e | the entry parameters |
| int fuse_reply_err | ( | fuse_req_t | req, | |
| int | err | |||
| ) |
Reply with an error code or success
Possible requests: all except forget
unlink, rmdir, rename, flush, release, fsync, fsyncdir, setxattr, removexattr and setlk may send a zero code
| req | request handle | |
| err | the positive error value, or zero for success |
| int fuse_reply_ioctl | ( | fuse_req_t | req, | |
| int | result, | |||
| const void * | buf, | |||
| size_t | size | |||
| ) |
Reply to finish ioctl
Possible requests: ioctl
| req | request handle | |
| result | result to be passed to the caller | |
| buf | buffer containing output data | |
| size | length of output data |
| int fuse_reply_ioctl_retry | ( | fuse_req_t | req, | |
| const struct iovec * | in_iov, | |||
| size_t | in_count, | |||
| const struct iovec * | out_iov, | |||
| size_t | out_count | |||
| ) |
Reply to ask for data fetch and output buffer preparation. ioctl will be retried with the specified input data fetched and output buffer prepared.
Possible requests: ioctl
| req | request handle | |
| in_iov | iovec specifying data to fetch from the caller | |
| in_count | number of entries in in_iov | |
| out_iov | iovec specifying addresses to write output to | |
| out_count | number of entries in out_iov |
| int fuse_reply_iov | ( | fuse_req_t | req, | |
| const struct iovec * | iov, | |||
| int | count | |||
| ) |
Reply with data vector
Possible requests: read, readdir, getxattr, listxattr
| req | request handle | |
| iov | the vector containing the data | |
| count | the size of vector |
| int fuse_reply_lock | ( | fuse_req_t | req, | |
| struct flock * | lock | |||
| ) |
Reply with file lock information
Possible requests: getlk
| req | request handle | |
| lock | the lock information |
| void fuse_reply_none | ( | fuse_req_t | req | ) |
Don't send reply
Possible requests: forget
| req | request handle |
| int fuse_reply_open | ( | fuse_req_t | req, | |
| const struct fuse_file_info * | fi | |||
| ) |
Reply with open parameters
currently the following members of 'fi' are used: fh, direct_io, keep_cache
Possible requests: open, opendir
| req | request handle | |
| fi | file information |
| int fuse_reply_poll | ( | fuse_req_t | req, | |
| unsigned | revents | |||
| ) |
Reply with poll result event mask
| req | request handle | |
| revents | poll result event mask |
| int fuse_reply_readlink | ( | fuse_req_t | req, | |
| const char * | link | |||
| ) |
Reply with the contents of a symbolic link
Possible requests: readlink
| req | request handle | |
| link | symbolic link contents |
| int fuse_reply_statfs | ( | fuse_req_t | req, | |
| const struct statvfs * | stbuf | |||
| ) |
Reply with filesystem statistics
Possible requests: statfs
| req | request handle | |
| stbuf | filesystem statistics |
| int fuse_reply_write | ( | fuse_req_t | req, | |
| size_t | count | |||
| ) |
Reply with number of bytes written
Possible requests: write
| req | request handle | |
| count | the number of bytes written |
| int fuse_reply_xattr | ( | fuse_req_t | req, | |
| size_t | count | |||
| ) |
Reply with needed buffer size
Possible requests: getxattr, listxattr
| req | request handle | |
| count | the buffer size needed in bytes |
| struct fuse_ctx* fuse_req_ctx | ( | fuse_req_t | req | ) | [read] |
Get the context from the request
The pointer returned by this function will only be valid for the request's lifetime
| req | request handle |
| void fuse_req_interrupt_func | ( | fuse_req_t | req, | |
| fuse_interrupt_func_t | func, | |||
| void * | data | |||
| ) |
Register/unregister callback for an interrupt
If an interrupt has already happened, then the callback function is called from within this function, hence it's not possible for interrupts to be lost.
| req | request handle | |
| func | the callback function or NULL for unregister | |
| data | user data passed to the callback function |
| int fuse_req_interrupted | ( | fuse_req_t | req | ) |
Check if a request has already been interrupted
| req | request handle |
| void* fuse_req_userdata | ( | fuse_req_t | req | ) |
Get the userdata from the request
| req | request handle |
| void fuse_session_add_chan | ( | struct fuse_session * | se, | |
| struct fuse_chan * | ch | |||
| ) |
Assign a channel to a session
Note: currently only a single channel may be assigned. This may change in the future
If a session is destroyed, the assigned channel is also destroyed
| se | the session | |
| ch | the channel |
| void fuse_session_destroy | ( | struct fuse_session * | se | ) |
Destroy a session
| se | the session |
| void fuse_session_exit | ( | struct fuse_session * | se | ) |
Exit a session
| se | the session |
| int fuse_session_exited | ( | struct fuse_session * | se | ) |
Query the exited status of a session
| se | the session |
| int fuse_session_loop | ( | struct fuse_session * | se | ) |
Enter a single threaded event loop
| se | the session |
| int fuse_session_loop_mt | ( | struct fuse_session * | se | ) |
Enter a multi-threaded event loop
| se | the session |
| struct fuse_session* fuse_session_new | ( | struct fuse_session_ops * | op, | |
| void * | data | |||
| ) | [read] |
Create a new session
| op | session operations | |
| data | user data |
| struct fuse_chan* fuse_session_next_chan | ( | struct fuse_session * | se, | |
| struct fuse_chan * | ch | |||
| ) | [read] |
Iterate over the channels assigned to a session
The iterating function needs to start with a NULL channel, and after that needs to pass the previously returned channel to the function.
| se | the session | |
| ch | the previous channel, or NULL |
| void fuse_session_process | ( | struct fuse_session * | se, | |
| const char * | buf, | |||
| size_t | len, | |||
| struct fuse_chan * | ch | |||
| ) |
Process a raw request
| se | the session | |
| buf | buffer containing the raw request | |
| len | request length | |
| ch | channel on which the request was received |
| void fuse_session_remove_chan | ( | struct fuse_chan * | ch | ) |
Remove a channel from a session
If the channel is not assigned to a session, then this is a no-op
| ch | the channel to remove |
| void fuse_session_reset | ( | struct fuse_session * | se | ) |
Reset the exited status of a session
| se | the session |
1.5.6