Browse Source

libfuse cleanup: extern cplusplus cleanup

pull/809/head
Antonio SJ Musumeci 4 years ago
parent
commit
a925fbe59c
  1. 9
      libfuse/include/extern_c.h
  2. 237
      libfuse/include/fuse.h
  3. 106
      libfuse/include/fuse_common.h
  4. 351
      libfuse/include/fuse_lowlevel.h
  5. 72
      libfuse/include/fuse_opt.h
  6. 24
      libfuse/include/ulockmgr.h

9
libfuse/include/extern_c.h

@ -0,0 +1,9 @@
#pragma once
#ifdef __cplusplus
#define EXTERN_C_BEGIN extern "C" {
#define EXTERN_C_END }
#else
#define EXTERN_C_BEGIN
#define EXTERN_C_END
#endif

237
libfuse/include/fuse.h

@ -23,6 +23,7 @@
#define FUSE_USE_VERSION 21
#endif
#include "extern_c.h"
#include "fuse_common.h"
#include "fuse_dirents.h"
@ -34,21 +35,19 @@
#include <sys/statvfs.h>
#include <sys/uio.h>
#ifdef __cplusplus
extern "C" {
#endif
EXTERN_C_BEGIN
/* ----------------------------------------------------------- *
/* ----------------------------------------------------------- *
* Basic FUSE API *
* ----------------------------------------------------------- */
/** Handle for a FUSE filesystem */
struct fuse;
/** Handle for a FUSE filesystem */
struct fuse;
/** Structure containing a raw command */
struct fuse_cmd;
/** Structure containing a raw command */
struct fuse_cmd;
/**
/**
* The file system operations:
*
* Most of these should work very similarly to the well known UNIX
@ -70,8 +69,8 @@ extern "C" {
* See http://fuse.sourceforge.net/wiki/ for more information. There
* is also a snapshot of the relevant wiki pages in the doc/ folder.
*/
struct fuse_operations
{
struct fuse_operations
{
/** Get file attributes.
*
* Similar to stat(). The 'st_dev' and 'st_blksize' fields are
@ -576,15 +575,15 @@ extern "C" {
off_t offset_out,
size_t size,
int flags);
};
};
/** Extra context that may be needed by some filesystems
/** Extra context that may be needed by some filesystems
*
* The uid, gid and pid fields are not filled in case of a writepage
* operation.
*/
struct fuse_context
{
struct fuse_context
{
/** Pointer to the fuse object */
struct fuse *fuse;
@ -602,9 +601,9 @@ extern "C" {
/** Umask of the calling process (introduced in version 2.8) */
mode_t umask;
};
};
/**
/**
* Main function of FUSE.
*
* This is for the lazy. This is all that has to be called from the
@ -627,18 +626,18 @@ extern "C" {
* @param user_data user data supplied in the context during the init() method
* @return 0 on success, nonzero on failure
*/
/*
/*
int fuse_main(int argc, char *argv[], const struct fuse_operations *op,
void *user_data);
*/
*/
#define fuse_main(argc, argv, op, user_data) \
fuse_main_real(argc, argv, op, sizeof(*(op)), user_data)
/* ----------------------------------------------------------- *
/* ----------------------------------------------------------- *
* More detailed API *
* ----------------------------------------------------------- */
/**
/**
* Create a new FUSE filesystem.
*
* @param ch the communication channel
@ -648,11 +647,11 @@ extern "C" {
* @param user_data user data supplied in the context during the init() method
* @return the created FUSE handle
*/
struct fuse *fuse_new(struct fuse_chan *ch, struct fuse_args *args,
struct fuse *fuse_new(struct fuse_chan *ch, struct fuse_args *args,
const struct fuse_operations *op, size_t op_size,
void *user_data);
/**
/**
* Destroy the FUSE handle.
*
* The communication channel attached to the handle is also destroyed.
@ -662,18 +661,18 @@ extern "C" {
*
* @param f the FUSE handle
*/
void fuse_destroy(struct fuse *f);
void fuse_destroy(struct fuse *f);
/**
/**
* Exit from event loop
*
* @param f the FUSE handle
*/
void fuse_exit(struct fuse *f);
void fuse_exit(struct fuse *f);
int fuse_config_num_threads(const struct fuse *fuse_);
int fuse_config_num_threads(const struct fuse *fuse_);
/**
/**
* FUSE event loop with multiple threads
*
* Requests from the kernel are processed, and the appropriate
@ -686,9 +685,9 @@ extern "C" {
* @param f the FUSE handle
* @return 0 if no error occurred, -1 otherwise
*/
int fuse_loop_mt(struct fuse *f);
int fuse_loop_mt(struct fuse *f);
/**
/**
* Get the current context
*
* The context is only valid for the duration of a filesystem
@ -696,51 +695,51 @@ extern "C" {
*
* @return the context
*/
struct fuse_context *fuse_get_context(void);
struct fuse_context *fuse_get_context(void);
/**
/**
* Check if the current request has already been interrupted
*
* @return 1 if the request has been interrupted, 0 otherwise
*/
int fuse_interrupted(void);
int fuse_interrupted(void);
/**
/**
* Obsolete, doesn't do anything
*
* @return -EINVAL
*/
int fuse_invalidate(struct fuse *f, const char *path);
int fuse_invalidate(struct fuse *f, const char *path);
/* Deprecated, don't use */
int fuse_is_lib_option(const char *opt);
/* Deprecated, don't use */
int fuse_is_lib_option(const char *opt);
/**
/**
* The real main function
*
* Do not call this directly, use fuse_main()
*/
int fuse_main_real(int argc, char *argv[], const struct fuse_operations *op,
int fuse_main_real(int argc, char *argv[], const struct fuse_operations *op,
size_t op_size, void *user_data);
/**
/**
* Start the cleanup thread when using option "remember".
*
* This is done automatically by fuse_loop_mt()
* @param fuse struct fuse pointer for fuse instance
* @return 0 on success and -1 on error
*/
int fuse_start_cleanup_thread(struct fuse *fuse);
int fuse_start_cleanup_thread(struct fuse *fuse);
/**
/**
* Stop the cleanup thread when using option "remember".
*
* This is done automatically by fuse_loop_mt()
* @param fuse struct fuse pointer for fuse instance
*/
void fuse_stop_cleanup_thread(struct fuse *fuse);
void fuse_stop_cleanup_thread(struct fuse *fuse);
/**
/**
* Iterate over cache removing stale entries
* use in conjunction with "-oremember"
*
@ -749,20 +748,20 @@ extern "C" {
* @param fuse struct fuse pointer for fuse instance
* @return the number of seconds until the next cleanup
*/
int fuse_clean_cache(struct fuse *fuse);
int fuse_clean_cache(struct fuse *fuse);
/*
/*
* Stacking API
*/
/**
/**
* Fuse filesystem object
*
* This is opaque object represents a filesystem layer
*/
struct fuse_fs;
struct fuse_fs;
/*
/*
* These functions call the relevant filesystem operation, and return
* the result.
*
@ -771,101 +770,101 @@ extern "C" {
* fuse_fs_releasedir and fuse_fs_statfs, which return 0.
*/
int fuse_fs_getattr(struct fuse_fs *fs,
int fuse_fs_getattr(struct fuse_fs *fs,
const char *path,
struct stat *buf,
fuse_timeouts_t *timeout);
int fuse_fs_fgetattr(struct fuse_fs *fs,
int fuse_fs_fgetattr(struct fuse_fs *fs,
struct stat *buf,
struct fuse_file_info *fi,
fuse_timeouts_t *timeout);
int fuse_fs_rename(struct fuse_fs *fs, const char *oldpath,
int fuse_fs_rename(struct fuse_fs *fs, const char *oldpath,
const char *newpath);
int fuse_fs_unlink(struct fuse_fs *fs, const char *path);
int fuse_fs_rmdir(struct fuse_fs *fs, const char *path);
int fuse_fs_symlink(struct fuse_fs *fs, const char *linkname,
int fuse_fs_unlink(struct fuse_fs *fs, const char *path);
int fuse_fs_rmdir(struct fuse_fs *fs, const char *path);
int fuse_fs_symlink(struct fuse_fs *fs, const char *linkname,
const char *path);
int fuse_fs_link(struct fuse_fs *fs, const char *oldpath, const char *newpath);
int fuse_fs_release(struct fuse_fs *fs,
int fuse_fs_link(struct fuse_fs *fs, const char *oldpath, const char *newpath);
int fuse_fs_release(struct fuse_fs *fs,
struct fuse_file_info *fi);
int fuse_fs_open(struct fuse_fs *fs, const char *path,
int fuse_fs_open(struct fuse_fs *fs, const char *path,
struct fuse_file_info *fi);
int fuse_fs_read(struct fuse_fs *fs, char *buf, size_t size,
int fuse_fs_read(struct fuse_fs *fs, char *buf, size_t size,
off_t off, struct fuse_file_info *fi);
int fuse_fs_read_buf(struct fuse_fs *fs,
int fuse_fs_read_buf(struct fuse_fs *fs,
struct fuse_bufvec **bufp, size_t size, off_t off,
struct fuse_file_info *fi);
int fuse_fs_write(struct fuse_fs *fs, const char *buf,
int fuse_fs_write(struct fuse_fs *fs, const char *buf,
size_t size, off_t off, struct fuse_file_info *fi);
int fuse_fs_write_buf(struct fuse_fs *fs,
int fuse_fs_write_buf(struct fuse_fs *fs,
struct fuse_bufvec *buf, off_t off,
struct fuse_file_info *fi);
int fuse_fs_fsync(struct fuse_fs *fs, int datasync,
int fuse_fs_fsync(struct fuse_fs *fs, int datasync,
struct fuse_file_info *fi);
int fuse_fs_flush(struct fuse_fs *fs,
int fuse_fs_flush(struct fuse_fs *fs,
struct fuse_file_info *fi);
int fuse_fs_statfs(struct fuse_fs *fs, const char *path, struct statvfs *buf);
int fuse_fs_opendir(struct fuse_fs *fs, const char *path,
int fuse_fs_statfs(struct fuse_fs *fs, const char *path, struct statvfs *buf);
int fuse_fs_opendir(struct fuse_fs *fs, const char *path,
struct fuse_file_info *fi);
int fuse_fs_readdir(struct fuse_fs *fs,
int fuse_fs_readdir(struct fuse_fs *fs,
struct fuse_file_info *fi,
fuse_dirents_t *buf);
int fuse_fs_fsyncdir(struct fuse_fs *fs, int datasync,
int fuse_fs_fsyncdir(struct fuse_fs *fs, int datasync,
struct fuse_file_info *fi);
int fuse_fs_releasedir(struct fuse_fs *fs,
int fuse_fs_releasedir(struct fuse_fs *fs,
struct fuse_file_info *fi);
int fuse_fs_create(struct fuse_fs *fs, const char *path, mode_t mode,
int fuse_fs_create(struct fuse_fs *fs, const char *path, mode_t mode,
struct fuse_file_info *fi);
int fuse_fs_lock(struct fuse_fs *fs,
int fuse_fs_lock(struct fuse_fs *fs,
struct fuse_file_info *fi, int cmd, struct flock *lock);
int fuse_fs_flock(struct fuse_fs *fs,
int fuse_fs_flock(struct fuse_fs *fs,
struct fuse_file_info *fi, int op);
int fuse_fs_chmod(struct fuse_fs *fs, const char *path, mode_t mode);
int fuse_fs_chown(struct fuse_fs *fs, const char *path, uid_t uid, gid_t gid);
int fuse_fs_truncate(struct fuse_fs *fs, const char *path, off_t size);
int fuse_fs_ftruncate(struct fuse_fs *fs, off_t size,
int fuse_fs_chmod(struct fuse_fs *fs, const char *path, mode_t mode);
int fuse_fs_chown(struct fuse_fs *fs, const char *path, uid_t uid, gid_t gid);
int fuse_fs_truncate(struct fuse_fs *fs, const char *path, off_t size);
int fuse_fs_ftruncate(struct fuse_fs *fs, off_t size,
struct fuse_file_info *fi);
int fuse_fs_utimens(struct fuse_fs *fs, const char *path,
int fuse_fs_utimens(struct fuse_fs *fs, const char *path,
const struct timespec tv[2]);
int fuse_fs_access(struct fuse_fs *fs, const char *path, int mask);
int fuse_fs_readlink(struct fuse_fs *fs, const char *path, char *buf,
int fuse_fs_access(struct fuse_fs *fs, const char *path, int mask);
int fuse_fs_readlink(struct fuse_fs *fs, const char *path, char *buf,
size_t len);
int fuse_fs_mknod(struct fuse_fs *fs, const char *path, mode_t mode,
int fuse_fs_mknod(struct fuse_fs *fs, const char *path, mode_t mode,
dev_t rdev);
int fuse_fs_mkdir(struct fuse_fs *fs, const char *path, mode_t mode);
int fuse_fs_setxattr(struct fuse_fs *fs, const char *path, const char *name,
int fuse_fs_mkdir(struct fuse_fs *fs, const char *path, mode_t mode);
int fuse_fs_setxattr(struct fuse_fs *fs, const char *path, const char *name,
const char *value, size_t size, int flags);
int fuse_fs_getxattr(struct fuse_fs *fs, const char *path, const char *name,
int fuse_fs_getxattr(struct fuse_fs *fs, const char *path, const char *name,
char *value, size_t size);
int fuse_fs_listxattr(struct fuse_fs *fs, const char *path, char *list,
int fuse_fs_listxattr(struct fuse_fs *fs, const char *path, char *list,
size_t size);
int fuse_fs_removexattr(struct fuse_fs *fs, const char *path,
int fuse_fs_removexattr(struct fuse_fs *fs, const char *path,
const char *name);
int fuse_fs_bmap(struct fuse_fs *fs, const char *path, size_t blocksize,
int fuse_fs_bmap(struct fuse_fs *fs, const char *path, size_t blocksize,
uint64_t *idx);
int fuse_fs_ioctl(struct fuse_fs *fs, unsigned long cmd, void *arg,
int fuse_fs_ioctl(struct fuse_fs *fs, unsigned long cmd, void *arg,
struct fuse_file_info *fi, unsigned int flags,
void *data, uint32_t *out_bufsz);
int fuse_fs_poll(struct fuse_fs *fs,
int fuse_fs_poll(struct fuse_fs *fs,
struct fuse_file_info *fi, struct fuse_pollhandle *ph,
unsigned *reventsp);
int fuse_fs_fallocate(struct fuse_fs *fs, int mode,
int fuse_fs_fallocate(struct fuse_fs *fs, int mode,
off_t offset, off_t length, struct fuse_file_info *fi);
void fuse_fs_init(struct fuse_fs *fs, struct fuse_conn_info *conn);
void fuse_fs_destroy(struct fuse_fs *fs);
void fuse_fs_init(struct fuse_fs *fs, struct fuse_conn_info *conn);
void fuse_fs_destroy(struct fuse_fs *fs);
int fuse_fs_prepare_hide(struct fuse_fs *fs, const char *path, uint64_t *fh);
int fuse_fs_free_hide(struct fuse_fs *fs, uint64_t fh);
ssize_t fuse_fs_copy_file_range(struct fuse_fs *fs,
int fuse_fs_prepare_hide(struct fuse_fs *fs, const char *path, uint64_t *fh);
int fuse_fs_free_hide(struct fuse_fs *fs, uint64_t fh);
ssize_t fuse_fs_copy_file_range(struct fuse_fs *fs,
struct fuse_file_info *fi_in, off_t off_in,
struct fuse_file_info *fi_out, off_t off_out,
size_t len, int flags);
int fuse_notify_poll(struct fuse_pollhandle *ph);
int fuse_notify_poll(struct fuse_pollhandle *ph);
/**
/**
* Create a new fuse filesystem object
*
* This is usually called from the factory of a fuse module to create
@ -876,50 +875,48 @@ extern "C" {
* @param user_data user data supplied in the context during the init() method
* @return a new filesystem object
*/
struct fuse_fs *fuse_fs_new(const struct fuse_operations *op, size_t op_size,
struct fuse_fs *fuse_fs_new(const struct fuse_operations *op, size_t op_size,
void *user_data);
/* ----------------------------------------------------------- *
/* ----------------------------------------------------------- *
* Advanced API for event handling, don't worry about this... *
* ----------------------------------------------------------- */
/* NOTE: the following functions are deprecated, and will be removed
/* NOTE: the following functions are deprecated, and will be removed
from the 3.0 API. Use the lowlevel session functions instead */
/** Function type used to process commands */
typedef void (*fuse_processor_t)(struct fuse *, struct fuse_cmd *, void *);
/** Function type used to process commands */
typedef void (*fuse_processor_t)(struct fuse *, struct fuse_cmd *, void *);
/** This is the part of fuse_main() before the event loop */
struct fuse *fuse_setup(int argc, char *argv[],
/** This is the part of fuse_main() before the event loop */
struct fuse *fuse_setup(int argc, char *argv[],
const struct fuse_operations *op, size_t op_size,
char **mountpoint,
void *user_data);
/** This is the part of fuse_main() after the event loop */
void fuse_teardown(struct fuse *fuse, char *mountpoint);
/** This is the part of fuse_main() after the event loop */
void fuse_teardown(struct fuse *fuse, char *mountpoint);
/** Read a single command. If none are read, return NULL */
struct fuse_cmd *fuse_read_cmd(struct fuse *f);
/** Read a single command. If none are read, return NULL */
struct fuse_cmd *fuse_read_cmd(struct fuse *f);
/** Process a single command */
void fuse_process_cmd(struct fuse *f, struct fuse_cmd *cmd);
/** Process a single command */
void fuse_process_cmd(struct fuse *f, struct fuse_cmd *cmd);
/** Multi threaded event loop, which calls the custom command
/** Multi threaded event loop, which calls the custom command
processor function */
int fuse_loop_mt_proc(struct fuse *f, fuse_processor_t proc, void *data);
int fuse_loop_mt_proc(struct fuse *f, fuse_processor_t proc, void *data);
/** Return the exited flag, which indicates if fuse_exit() has been
/** Return the exited flag, which indicates if fuse_exit() has been
called */
int fuse_exited(struct fuse *f);
int fuse_exited(struct fuse *f);
/** This function is obsolete and implemented as a no-op */
void fuse_set_getcontext_func(struct fuse_context *(*func)(void));
/** This function is obsolete and implemented as a no-op */
void fuse_set_getcontext_func(struct fuse_context *(*func)(void));
/** Get session from fuse object */
struct fuse_session *fuse_get_session(struct fuse *f);
/** Get session from fuse object */
struct fuse_session *fuse_get_session(struct fuse *f);
#ifdef __cplusplus
}
#endif
EXTERN_C_END
#endif /* _FUSE_H_ */

106
libfuse/include/fuse_common.h

@ -15,8 +15,10 @@
#ifndef _FUSE_COMMON_H_
#define _FUSE_COMMON_H_
#include "extern_c.h"
#include "fuse_opt.h"
#include "fuse_timeouts.h"
#include <stdint.h>
#include <sys/types.h>
@ -37,18 +39,16 @@
#define FUSE_DEFAULT_MAX_PAGES_PER_REQ 32
#define FUSE_MAX_MAX_PAGES 256
#ifdef __cplusplus
extern "C" {
#endif
EXTERN_C_BEGIN
/**
/**
* Information about open files
*
* Changed in version 2.5
*/
struct
fuse_file_info
{
struct
fuse_file_info
{
/** Open flags. Available in open() and release() */
int flags;
@ -90,9 +90,9 @@ extern "C" {
/** Lock owner id. Available in locking operations and flush */
uint64_t lock_owner;
};
};
/**
/**
* Capability bits for 'fuse_conn_info.capable' and 'fuse_conn_info.want'
*
* FUSE_CAP_ASYNC_READ: filesystem supports asynchronous read requests
@ -127,7 +127,7 @@ extern "C" {
#define FUSE_CAP_CACHE_SYMLINKS (1 << 20)
#define FUSE_CAP_MAX_PAGES (1 << 21)
/**
/**
* Ioctl flags
*
* FUSE_IOCTL_COMPAT: 32bit compat ioctl on 64bit machine
@ -144,14 +144,14 @@ extern "C" {
#define FUSE_IOCTL_MAX_IOV 256
/**
/**
* Connection information, passed to the ->init() method
*
* Some of the elements are read-write, these can be changed to
* indicate the value requested by the filesystem. The requested
* value must usually be smaller than the indicated value.
*/
struct fuse_conn_info {
struct fuse_conn_info {
/**
* Major version of the protocol (read-only)
*/
@ -201,13 +201,13 @@ extern "C" {
* For future use.
*/
unsigned reserved[22];
};
};
struct fuse_session;
struct fuse_chan;
struct fuse_pollhandle;
struct fuse_session;
struct fuse_chan;
struct fuse_pollhandle;
/**
/**
* Create a FUSE mountpoint
*
* Returns a control file descriptor suitable for passing to
@ -217,18 +217,18 @@ extern "C" {
* @param args argument vector
* @return the communication channel on success, NULL on failure
*/
struct fuse_chan *fuse_mount(const char *mountpoint,
struct fuse_chan *fuse_mount(const char *mountpoint,
struct fuse_args *args);
/**
/**
* Umount a FUSE mountpoint
*
* @param mountpoint the mount point path
* @param ch the communication channel
*/
void fuse_unmount(const char *mountpoint, struct fuse_chan *ch);
void fuse_unmount(const char *mountpoint, struct fuse_chan *ch);
/**
/**
* Parse common options
*
* The following options are parsed:
@ -247,40 +247,40 @@ extern "C" {
* @param foreground set to 1 if one of the relevant options is present
* @return 0 on success, -1 on failure
*/
int fuse_parse_cmdline(struct fuse_args *args,
int fuse_parse_cmdline(struct fuse_args *args,
char **mountpoint,
int *foreground);
/**
/**
* Go into the background
*
* @param foreground if true, stay in the foreground
* @return 0 on success, -1 on failure
*/
int fuse_daemonize(int foreground);
int fuse_daemonize(int foreground);
/**
/**
* Get the version of the library
*
* @return the version
*/
int fuse_version(void);
int fuse_version(void);
/**
/**
* Destroy poll handle
*
* @param ph the poll handle
*/
void fuse_pollhandle_destroy(struct fuse_pollhandle *ph);
void fuse_pollhandle_destroy(struct fuse_pollhandle *ph);
/* ----------------------------------------------------------- *
/* ----------------------------------------------------------- *
* Data buffer *
* ----------------------------------------------------------- */
/**
/**
* Buffer flags
*/
enum fuse_buf_flags {
enum fuse_buf_flags {
/**
* Buffer contains a file descriptor
*
@ -306,12 +306,12 @@ extern "C" {
* detected.
*/
FUSE_BUF_FD_RETRY = (1 << 3),
};
};
/**
/**
* Buffer copy flags
*/
enum fuse_buf_copy_flags {
enum fuse_buf_copy_flags {
/**
* Don't use splice(2)
*
@ -348,15 +348,15 @@ extern "C" {
* man page.
*/
FUSE_BUF_SPLICE_NONBLOCK= (1 << 4),
};
};
/**
/**
* Single data buffer
*
* Generic data buffer for I/O, extended attributes, etc... Data may
* be supplied as a memory pointer or as a file descriptor
*/
struct fuse_buf {
struct fuse_buf {
/**
* Size of data in bytes
*/
@ -387,9 +387,9 @@ extern "C" {
* Used if FUSE_BUF_FD_SEEK flag is set.
*/
off_t pos;
};
};
/**
/**
* Data buffer vector
*
* An array of data buffers, each containing a memory pointer or a
@ -397,7 +397,7 @@ extern "C" {
*
* Allocate dynamically to add more than one buffer.
*/
struct fuse_bufvec {
struct fuse_bufvec {
/**
* Number of buffers in the array
*/
@ -417,9 +417,9 @@ extern "C" {
* Array of buffers
*/
struct fuse_buf buf[1];
};
};
/* Initialize bufvec with a single buffer of given size */
/* Initialize bufvec with a single buffer of given size */
#define FUSE_BUFVEC_INIT(size__) \
((struct fuse_bufvec) { \
/* .count= */ 1, \
@ -434,15 +434,15 @@ extern "C" {
} } \
} )
/**
/**
* Get total size of data in a fuse buffer vector
*
* @param bufv buffer vector
* @return size of data
*/
size_t fuse_buf_size(const struct fuse_bufvec *bufv);
size_t fuse_buf_size(const struct fuse_bufvec *bufv);
/**
/**
* Copy data from one buffer vector to another
*
* @param dst destination buffer vector
@ -450,14 +450,14 @@ extern "C" {
* @param flags flags controlling the copy
* @return actual number of bytes copied or -errno on error
*/
ssize_t fuse_buf_copy(struct fuse_bufvec *dst, struct fuse_bufvec *src,
ssize_t fuse_buf_copy(struct fuse_bufvec *dst, struct fuse_bufvec *src,
enum fuse_buf_copy_flags flags);
/* ----------------------------------------------------------- *
/* ----------------------------------------------------------- *
* Signal handling *
* ----------------------------------------------------------- */
/**
/**
* Exit session on HUP, TERM and INT signals and ignore PIPE signal
*
* Stores session in a global variable. May only be called once per
@ -466,9 +466,9 @@ extern "C" {
* @param se the session to exit
* @return 0 on success, -1 on failure
*/
int fuse_set_signal_handlers(struct fuse_session *se);
int fuse_set_signal_handlers(struct fuse_session *se);
/**
/**
* Restore default signal handlers
*
* Resets global session. After this fuse_set_signal_handlers() may
@ -476,10 +476,8 @@ extern "C" {
*
* @param se the same session as given in fuse_set_signal_handlers()
*/
void fuse_remove_signal_handlers(struct fuse_session *se);
void fuse_remove_signal_handlers(struct fuse_session *se);
#ifdef __cplusplus
}
#endif
EXTERN_C_END
#endif /* _FUSE_COMMON_H_ */

351
libfuse/include/fuse_lowlevel.h

@ -23,6 +23,7 @@
#define FUSE_USE_VERSION 24
#endif
#include "extern_c.h"
#include "fuse_common.h"
#include <fcntl.h>
@ -33,51 +34,49 @@
#include <sys/uio.h>
#include <utime.h>
#ifdef __cplusplus
extern "C" {
#endif
EXTERN_C_BEGIN
/* ----------------------------------------------------------- *
/* ----------------------------------------------------------- *
* Miscellaneous definitions *
* ----------------------------------------------------------- */
/** The node ID of the root inode */
/** The node ID of the root inode */
#define FUSE_ROOT_ID 1
/** Inode number type */
typedef uint64_t fuse_ino_t;
/** Inode number type */
typedef uint64_t fuse_ino_t;
/** Request pointer type */
typedef struct fuse_req *fuse_req_t;
/** Request pointer type */
typedef struct fuse_req *fuse_req_t;
/**
/**
* Session
*
* This provides hooks for processing requests, and exiting
*/
struct fuse_session;
struct fuse_session;
/**
/**
* Channel
*
* A communication channel, providing hooks for sending and receiving
* messages
*/
struct fuse_chan;
struct fuse_chan;
/** Directory entry parameters supplied to fuse_reply_entry() */
struct fuse_entry_param
{
/** Unique inode number
/** Directory entry parameters supplied to fuse_reply_entry() */
struct fuse_entry_param
{
/** Unique inode number
*
* In lookup, zero means negative entry (from version 2.5)
* Returning ENOENT also means negative entry, but by setting zero
* ino the kernel may cache negative entries for entry_timeout
* seconds.
*/
fuse_ino_t ino;
fuse_ino_t ino;
/** Generation number for this entry.
/** Generation number for this entry.
*
* If the file system will be exported over NFS, the
* ino/generation pairs need to be unique over the file
@ -90,48 +89,48 @@ extern "C" {
* it as an error.
*
*/
uint64_t generation;
uint64_t generation;
/** Inode attributes.
/** Inode attributes.
*
* Even if attr_timeout == 0, attr must be correct. For example,
* for open(), FUSE uses attr.st_size from lookup() to determine
* how many bytes to request. If this value is not correct,
* incorrect data will be returned.
*/
struct stat attr;
struct stat attr;
fuse_timeouts_t timeout;
};
fuse_timeouts_t timeout;
};
/** Additional context associated with requests */
struct fuse_ctx
{
/** User ID of the calling process */
uid_t uid;
/** Additional context associated with requests */
struct fuse_ctx
{
/** User ID of the calling process */
uid_t uid;
/** Group ID of the calling process */
gid_t gid;
/** Group ID of the calling process */
gid_t gid;
/** Thread ID of the calling process */
pid_t pid;
/** Thread ID of the calling process */
pid_t pid;
/** Umask of the calling process (introduced in version 2.8) */
mode_t umask;
};
/** Umask of the calling process (introduced in version 2.8) */
mode_t umask;
};
struct fuse_forget_data
{
fuse_ino_t ino;
uint64_t nlookup;
};
struct fuse_forget_data
{
fuse_ino_t ino;
uint64_t nlookup;
};
/* ----------------------------------------------------------- *
/* ----------------------------------------------------------- *
* Request methods and replies *
* ----------------------------------------------------------- */
/**
/**
* Low level filesystem operations
*
* Most of the methods (with the exception of init and destroy)
@ -152,9 +151,9 @@ extern "C" {
* fuse_reply_open() return -ENOENT means, that the release method for
* this file will not be called.
*/
struct fuse_lowlevel_ops
{
/**
struct fuse_lowlevel_ops
{
/**
* Initialize filesystem
*
* Called before any other filesystem method
@ -163,9 +162,9 @@ extern "C" {
*
* @param userdata the user data passed to fuse_lowlevel_new()
*/
void (*init) (void *userdata, struct fuse_conn_info *conn);
void (*init) (void *userdata, struct fuse_conn_info *conn);
/**
/**
* Clean up filesystem
*
* Called on filesystem exit
@ -174,9 +173,9 @@ extern "C" {
*
* @param userdata the user data passed to fuse_lowlevel_new()
*/
void (*destroy) (void *userdata);
void (*destroy) (void *userdata);
/**
/**
* Look up a directory entry by name and get its attributes.
*
* Valid replies:
@ -187,9 +186,9 @@ extern "C" {
* @param parent inode number of the parent directory
* @param name the name to look up
*/
void (*lookup) (fuse_req_t req, fuse_ino_t parent, const char *name);
void (*lookup) (fuse_req_t req, fuse_ino_t parent, const char *name);
/**
/**
* Forget about an inode
*
* This function is called when the kernel removes an inode
@ -1063,9 +1062,9 @@ extern "C" {
struct fuse_file_info *fi_out,
size_t len,
int flags);
};
};
/**
/**
* Reply with an error code or success
*
* Possible requests:
@ -1078,9 +1077,9 @@ extern "C" {
* @param err the positive error value, or zero for success
* @return zero for success, -errno for failure to send reply
*/
int fuse_reply_err(fuse_req_t req, int err);
int fuse_reply_err(fuse_req_t req, int err);
/**
/**
* Don't send reply
*
* Possible requests:
@ -1088,9 +1087,9 @@ extern "C" {
*
* @param req request handle
*/
void fuse_reply_none(fuse_req_t req);
void fuse_reply_none(fuse_req_t req);
/**
/**
* Reply with a directory entry
*
* Possible requests:
@ -1103,9 +1102,9 @@ extern "C" {
* @param e the entry parameters
* @return zero for success, -errno for failure to send reply
*/
int fuse_reply_entry(fuse_req_t req, const struct fuse_entry_param *e);
int fuse_reply_entry(fuse_req_t req, const struct fuse_entry_param *e);
/**
/**
* Reply with a directory entry and open parameters
*
* currently the following members of 'fi' are used:
@ -1122,10 +1121,10 @@ extern "C" {
* @param fi file information
* @return zero for success, -errno for failure to send reply
*/
int fuse_reply_create(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);
/**
/**
* Reply with attributes
*
* Possible requests:
@ -1136,11 +1135,11 @@ extern "C" {
* @param attr_timeout validity timeout (in seconds) for the attributes
* @return zero for success, -errno for failure to send reply
*/
int fuse_reply_attr(fuse_req_t req,
int fuse_reply_attr(fuse_req_t req,
const struct stat *attr,
const uint64_t timeout);
/**
/**
* Reply with the contents of a symbolic link
*
* Possible requests:
@ -1150,9 +1149,9 @@ extern "C" {
* @param link symbolic link contents
* @return zero for success, -errno for failure to send reply
*/
int fuse_reply_readlink(fuse_req_t req, const char *link);
int fuse_reply_readlink(fuse_req_t req, const char *link);
/**
/**
* Reply with open parameters
*
* currently the following members of 'fi' are used:
@ -1165,9 +1164,9 @@ extern "C" {
* @param fi file information
* @return zero for success, -errno for failure to send reply
*/
int fuse_reply_open(fuse_req_t req, const struct fuse_file_info *fi);
int fuse_reply_open(fuse_req_t req, const struct fuse_file_info *fi);
/**
/**
* Reply with number of bytes written
*
* Possible requests:
@ -1177,9 +1176,9 @@ extern "C" {
* @param count the number of bytes written
* @return zero for success, -errno for failure to send reply
*/
int fuse_reply_write(fuse_req_t req, size_t count);
int fuse_reply_write(fuse_req_t req, size_t count);
/**
/**
* Reply with data
*
* Possible requests:
@ -1190,9 +1189,9 @@ extern "C" {
* @param size the size of data in bytes
* @return zero for success, -errno for failure to send reply
*/
int fuse_reply_buf(fuse_req_t req, const char *buf, size_t size);
int fuse_reply_buf(fuse_req_t req, const char *buf, size_t size);
/**
/**
* Reply with data copied/moved from buffer(s)
*
* Possible requests:
@ -1203,10 +1202,10 @@ extern "C" {
* @param flags flags controlling the copy
* @return zero for success, -errno for failure to send reply
*/
int fuse_reply_data(fuse_req_t req, struct fuse_bufvec *bufv,
int fuse_reply_data(fuse_req_t req, struct fuse_bufvec *bufv,
enum fuse_buf_copy_flags flags);
/**
/**
* Reply with data vector
*
* Possible requests:
@ -1217,9 +1216,9 @@ extern "C" {
* @param count the size of vector
* @return zero for success, -errno for failure to send reply
*/
int fuse_reply_iov(fuse_req_t req, const struct iovec *iov, int count);
int fuse_reply_iov(fuse_req_t req, const struct iovec *iov, int count);
/**
/**
* Reply with filesystem statistics
*
* Possible requests:
@ -1229,9 +1228,9 @@ extern "C" {
* @param stbuf filesystem statistics
* @return zero for success, -errno for failure to send reply
*/
int fuse_reply_statfs(fuse_req_t req, const struct statvfs *stbuf);
int fuse_reply_statfs(fuse_req_t req, const struct statvfs *stbuf);
/**
/**
* Reply with needed buffer size
*
* Possible requests:
@ -1241,9 +1240,9 @@ extern "C" {
* @param count the buffer size needed in bytes
* @return zero for success, -errno for failure to send reply
*/
int fuse_reply_xattr(fuse_req_t req, size_t count);
int fuse_reply_xattr(fuse_req_t req, size_t count);
/**
/**
* Reply with file lock information
*
* Possible requests:
@ -1253,9 +1252,9 @@ extern "C" {
* @param lock the lock information
* @return zero for success, -errno for failure to send reply
*/
int fuse_reply_lock(fuse_req_t req, const struct flock *lock);
int fuse_reply_lock(fuse_req_t req, const struct flock *lock);
/**
/**
* Reply with block index
*
* Possible requests:
@ -1265,9 +1264,9 @@ extern "C" {
* @param idx block index within device
* @return zero for success, -errno for failure to send reply
*/
int fuse_reply_bmap(fuse_req_t req, uint64_t idx);
int fuse_reply_bmap(fuse_req_t req, uint64_t idx);
/**
/**
* Reply to ask for data fetch and output buffer preparation. ioctl
* will be retried with the specified input data fetched and output
* buffer prepared.
@ -1282,11 +1281,11 @@ extern "C" {
* @param out_count number of entries in out_iov
* @return zero for success, -errno for failure to send reply
*/
int fuse_reply_ioctl_retry(fuse_req_t req,
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 finish ioctl
*
* Possible requests:
@ -1297,9 +1296,9 @@ extern "C" {
* @param buf buffer containing output data
* @param size length of output data
*/
int fuse_reply_ioctl(fuse_req_t req, int result, const void *buf, uint32_t size);
int fuse_reply_ioctl(fuse_req_t req, int result, const void *buf, uint32_t size);
/**
/**
* Reply to finish ioctl with iov buffer
*
* Possible requests:
@ -1310,31 +1309,31 @@ extern "C" {
* @param iov the vector containing the data
* @param count the size of vector
*/
int fuse_reply_ioctl_iov(fuse_req_t req, int result, const struct iovec *iov,
int fuse_reply_ioctl_iov(fuse_req_t req, int result, const struct iovec *iov,
int count);
/**
/**
* Reply with poll result event mask
*
* @param req request handle
* @param revents poll result event mask
*/
int fuse_reply_poll(fuse_req_t req, unsigned revents);
int fuse_reply_poll(fuse_req_t req, unsigned revents);
/* ----------------------------------------------------------- *
/* ----------------------------------------------------------- *
* Notification *
* ----------------------------------------------------------- */
/**
/**
* Notify IO readiness event
*
* For more information, please read comment for poll operation.
*
* @param ph poll handle to notify IO readiness event for
*/
int fuse_lowlevel_notify_poll(struct fuse_pollhandle *ph);
int fuse_lowlevel_notify_poll(struct fuse_pollhandle *ph);
/**
/**
* Notify to invalidate cache for an inode
*
* @param ch the channel through which to send the invalidation
@ -1344,10 +1343,10 @@ extern "C" {
* @param len the amount of cache to invalidate or 0 for all
* @return zero for success, -errno for failure
*/
int fuse_lowlevel_notify_inval_inode(struct fuse_chan *ch, fuse_ino_t ino,
int fuse_lowlevel_notify_inval_inode(struct fuse_chan *ch, fuse_ino_t ino,
off_t off, off_t len);
/**
/**
* Notify to invalidate parent attributes and the dentry matching
* parent/name
*
@ -1361,10 +1360,10 @@ extern "C" {
* @param namelen strlen() of file name
* @return zero for success, -errno for failure
*/
int fuse_lowlevel_notify_inval_entry(struct fuse_chan *ch, fuse_ino_t parent,
int fuse_lowlevel_notify_inval_entry(struct fuse_chan *ch, fuse_ino_t parent,
const char *name, size_t namelen);
/**
/**
* Notify to invalidate parent attributes and delete the dentry matching
* parent/name if the dentry's inode number matches child (otherwise it
* will invalidate the matching dentry).
@ -1380,11 +1379,11 @@ extern "C" {
* @param namelen strlen() of file name
* @return zero for success, -errno for failure
*/
int fuse_lowlevel_notify_delete(struct fuse_chan *ch,
int fuse_lowlevel_notify_delete(struct fuse_chan *ch,
fuse_ino_t parent, fuse_ino_t child,
const char *name, size_t namelen);
/**
/**
* Store data to the kernel buffers
*
* Synchronously store data in the kernel buffers belonging to the
@ -1405,10 +1404,10 @@ extern "C" {
* @param flags flags controlling the copy
* @return zero for success, -errno for failure
*/
int fuse_lowlevel_notify_store(struct fuse_chan *ch, fuse_ino_t ino,
int fuse_lowlevel_notify_store(struct fuse_chan *ch, fuse_ino_t ino,
off_t offset, struct fuse_bufvec *bufv,
enum fuse_buf_copy_flags flags);
/**
/**
* Retrieve data from the kernel buffers
*
* Retrieve data in the kernel buffers belonging to the given inode.
@ -1433,23 +1432,23 @@ extern "C" {
* @param cookie user data to supply to the reply callback
* @return zero for success, -errno for failure
*/
int fuse_lowlevel_notify_retrieve(struct fuse_chan *ch, fuse_ino_t ino,
int fuse_lowlevel_notify_retrieve(struct fuse_chan *ch, fuse_ino_t ino,
size_t size, off_t offset, void *cookie);
/* ----------------------------------------------------------- *
/* ----------------------------------------------------------- *
* Utility functions *
* ----------------------------------------------------------- */
/**
/**
* Get the userdata from the request
*
* @param req request handle
* @return the user data passed to fuse_lowlevel_new()
*/
void *fuse_req_userdata(fuse_req_t req);
void *fuse_req_userdata(fuse_req_t req);
/**
/**
* Get the context from the request
*
* The pointer returned by this function will only be valid for the
@ -1458,9 +1457,9 @@ extern "C" {
* @param req request handle
* @return the context structure
*/
const struct fuse_ctx *fuse_req_ctx(fuse_req_t req);
const struct fuse_ctx *fuse_req_ctx(fuse_req_t req);
/**
/**
* Get the current supplementary group IDs for the specified request
*
* Similar to the getgroups(2) system call, except the return value is
@ -1479,17 +1478,17 @@ extern "C" {
* @param list array of group IDs to be filled in
* @return the total number of supplementary group IDs or -errno on failure
*/
int fuse_req_getgroups(fuse_req_t req, int size, gid_t list[]);
int fuse_req_getgroups(fuse_req_t req, int size, gid_t list[]);
/**
/**
* Callback function for an interrupt
*
* @param req interrupted request
* @param data user data
*/
typedef void (*fuse_interrupt_func_t)(fuse_req_t req, void *data);
typedef void (*fuse_interrupt_func_t)(fuse_req_t req, void *data);
/**
/**
* Register/unregister callback for an interrupt
*
* If an interrupt has already happened, then the callback function is
@ -1500,25 +1499,25 @@ extern "C" {
* @param func the callback function or NULL for unregister
* @param data user data passed to the callback function
*/
void fuse_req_interrupt_func(fuse_req_t req, fuse_interrupt_func_t func,
void fuse_req_interrupt_func(fuse_req_t req, fuse_interrupt_func_t func,
void *data);
/**
/**
* Check if a request has already been interrupted
*
* @param req request handle
* @return 1 if the request has been interrupted, 0 otherwise
*/
int fuse_req_interrupted(fuse_req_t req);
int fuse_req_interrupted(fuse_req_t req);
/* ----------------------------------------------------------- *
/* ----------------------------------------------------------- *
* Filesystem setup *
* ----------------------------------------------------------- */
/* Deprecated, don't use */
int fuse_lowlevel_is_lib_option(const char *opt);
/* Deprecated, don't use */
int fuse_lowlevel_is_lib_option(const char *opt);
/**
/**
* Create a low level session
*
* @param args argument vector
@ -1527,21 +1526,21 @@ extern "C" {
* @param userdata user data
* @return the created session object, or NULL on failure
*/
struct fuse_session *fuse_lowlevel_new(struct fuse_args *args,
struct fuse_session *fuse_lowlevel_new(struct fuse_args *args,
const struct fuse_lowlevel_ops *op,
size_t op_size, void *userdata);
/* ----------------------------------------------------------- *
/* ----------------------------------------------------------- *
* Session interface *
* ----------------------------------------------------------- */
/**
/**
* Session operations
*
* This is used in session creation
*/
struct fuse_session_ops
{
struct fuse_session_ops
{
/**
* Hook to process a request (mandatory)
*
@ -1575,18 +1574,18 @@ extern "C" {
* @param data user data passed to fuse_session_new()
*/
void (*destroy) (void *data);
};
};
/**
/**
* Create a new session
*
* @param op session operations
* @param data user data
* @return new session object, or NULL on failure
*/
struct fuse_session *fuse_session_new(struct fuse_session_ops *op, void *data);
struct fuse_session *fuse_session_new(struct fuse_session_ops *op, void *data);
/**
/**
* Assign a channel to a session
*
* Note: currently only a single channel may be assigned. This may
@ -1597,18 +1596,18 @@ extern "C" {
* @param se the session
* @param ch the channel
*/
void fuse_session_add_chan(struct fuse_session *se, struct fuse_chan *ch);
void fuse_session_add_chan(struct fuse_session *se, 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
*
* @param ch the channel to remove
*/
void fuse_session_remove_chan(struct fuse_chan *ch);
void fuse_session_remove_chan(struct fuse_chan *ch);
/**
/**
* Iterate over the channels assigned to a session
*
* The iterating function needs to start with a NULL channel, and
@ -1619,10 +1618,10 @@ extern "C" {
* @param ch the previous channel, or NULL
* @return the next channel, or NULL if no more channels exist
*/
struct fuse_chan *fuse_session_next_chan(struct fuse_session *se,
struct fuse_chan *fuse_session_next_chan(struct fuse_session *se,
struct fuse_chan *ch);
/**
/**
* Process a raw request
*
* @param se the session
@ -1630,10 +1629,10 @@ extern "C" {
* @param len request length
* @param ch channel on which the request was received
*/
void fuse_session_process(struct fuse_session *se, const char *buf, size_t len,
void fuse_session_process(struct fuse_session *se, const char *buf, size_t len,
struct fuse_chan *ch);
/**
/**
* Process a raw request supplied in a generic buffer
*
* This is a more generic version of fuse_session_process(). The
@ -1643,10 +1642,10 @@ extern "C" {
* @param buf the fuse_buf containing the request
* @param ch channel on which the request was received
*/
void fuse_session_process_buf(struct fuse_session *se,
void fuse_session_process_buf(struct fuse_session *se,
const struct fuse_buf *buf, struct fuse_chan *ch);
/**
/**
* Receive a raw request supplied in a generic buffer
*
* This is a more generic version of fuse_chan_recv(). The fuse_buf
@ -1658,65 +1657,65 @@ extern "C" {
* @param chp pointer to the channel
* @return the actual size of the raw request, or -errno on error
*/
int fuse_session_receive_buf(struct fuse_session *se, struct fuse_buf *buf,
int fuse_session_receive_buf(struct fuse_session *se, struct fuse_buf *buf,
struct fuse_chan **chp);
/**
/**
* Destroy a session
*
* @param se the session
*/
void fuse_session_destroy(struct fuse_session *se);
void fuse_session_destroy(struct fuse_session *se);
/**
/**
* Exit a session
*
* @param se the session
*/
void fuse_session_exit(struct fuse_session *se);
void fuse_session_exit(struct fuse_session *se);
/**
/**
* Reset the exited status of a session
*
* @param se the session
*/
void fuse_session_reset(struct fuse_session *se);
void fuse_session_reset(struct fuse_session *se);
/**
/**
* Query the exited status of a session
*
* @param se the session
* @return 1 if exited, 0 if not exited
*/
int fuse_session_exited(struct fuse_session *se);
int fuse_session_exited(struct fuse_session *se);
/**
/**
* Get the user data provided to the session
*
* @param se the session
* @return the user data
*/
void *fuse_session_data(struct fuse_session *se);
void *fuse_session_data(struct fuse_session *se);
/**
/**
* Enter a multi-threaded event loop
*
* @param se the session
* @return 0 on success, -1 on error
*/
int fuse_session_loop_mt(struct fuse_session *se, const int threads);
int fuse_session_loop_mt(struct fuse_session *se, const int threads);
/* ----------------------------------------------------------- *
/* ----------------------------------------------------------- *
* Channel interface *
* ----------------------------------------------------------- */
/**
/**
* Channel operations
*
* This is used in channel creation
*/
struct fuse_chan_ops
{
struct fuse_chan_ops
{
/**
* Hook for receiving a raw request
*
@ -1747,9 +1746,9 @@ extern "C" {
* @param ch the channel
*/
void (*destroy)(struct fuse_chan *ch);
};
};
/**
/**
* Create a new channel
*
* @param op channel operations
@ -1758,42 +1757,42 @@ extern "C" {
* @param data user data
* @return the new channel object, or NULL on failure
*/
struct fuse_chan *fuse_chan_new(struct fuse_chan_ops *op, int fd,
struct fuse_chan *fuse_chan_new(struct fuse_chan_ops *op, int fd,
size_t bufsize, void *data);
/**
/**
* Query the file descriptor of the channel
*
* @param ch the channel
* @return the file descriptor passed to fuse_chan_new()
*/
int fuse_chan_fd(struct fuse_chan *ch);
int fuse_chan_fd(struct fuse_chan *ch);
/**
/**
* Query the minimal receive buffer size
*
* @param ch the channel
* @return the buffer size passed to fuse_chan_new()
*/
size_t fuse_chan_bufsize(struct fuse_chan *ch);
size_t fuse_chan_bufsize(struct fuse_chan *ch);
/**
/**
* Query the user data
*
* @param ch the channel
* @return the user data passed to fuse_chan_new()
*/
void *fuse_chan_data(struct fuse_chan *ch);
void *fuse_chan_data(struct fuse_chan *ch);
/**
/**
* Query the session to which this channel is assigned
*
* @param ch the channel
* @return the session, or NULL if the channel is not assigned
*/
struct fuse_session *fuse_chan_session(struct fuse_chan *ch);
struct fuse_session *fuse_chan_session(struct fuse_chan *ch);
/**
/**
* Receive a raw request
*
* A return value of -ENODEV means, that the filesystem was unmounted
@ -1803,9 +1802,9 @@ extern "C" {
* @param size the size of the buffer
* @return the actual size of the raw request, or -errno on error
*/
int fuse_chan_recv(struct fuse_chan **ch, char *buf, size_t size);
int fuse_chan_recv(struct fuse_chan **ch, char *buf, size_t size);
/**
/**
* Send a raw reply
*
* A return value of -ENOENT means, that the request was
@ -1816,18 +1815,16 @@ extern "C" {
* @param count the number of blocks in vector
* @return zero on success, -errno on failure
*/
int fuse_chan_send(struct fuse_chan *ch, const struct iovec iov[],
int fuse_chan_send(struct fuse_chan *ch, const struct iovec iov[],
size_t count);
/**
/**
* Destroy a channel
*
* @param ch the channel
*/
void fuse_chan_destroy(struct fuse_chan *ch);
void fuse_chan_destroy(struct fuse_chan *ch);
#ifdef __cplusplus
}
#endif
EXTERN_C_END
#endif /* _FUSE_LOWLEVEL_H_ */

72
libfuse/include/fuse_opt.h

@ -9,16 +9,16 @@
#ifndef _FUSE_OPT_H_
#define _FUSE_OPT_H_
#include "extern_c.h"
/** @file
*
* This file defines the option parsing interface of FUSE
*/
#ifdef __cplusplus
extern "C" {
#endif
EXTERN_C_BEGIN
/**
/**
* Option description
*
* This structure describes a single option, and action associated
@ -73,8 +73,8 @@ extern "C" {
* If the format is "%s", memory is allocated for the string unlike
* with scanf().
*/
struct fuse_opt
{
struct fuse_opt
{
/** Matching template and optional parameter formatting */
const char *templ;
@ -89,25 +89,25 @@ extern "C" {
* processing function. Ignored if template has a format
*/
int value;
};
};
/**
/**
* Key option. In case of a match, the processing function will be
* called with the specified key.
*/
#define FUSE_OPT_KEY(templ, key) { templ, -1U, key }
/**
/**
* Last option. An array of 'struct fuse_opt' must end with a NULL
* template value
*/
#define FUSE_OPT_END { NULL, 0, 0 }
/**
/**
* Argument list
*/
struct fuse_args
{
struct fuse_args
{
/** Argument count */
int argc;
@ -116,20 +116,20 @@ extern "C" {
/** Is 'argv' allocated? */
int allocated;
};
};
/**
/**
* Initializer for 'struct fuse_args'
*/
#define FUSE_ARGS_INIT(argc, argv) { argc, argv, 0 }
/**
/**
* Key value passed to the processing function if an option did not
* match any template
*/
#define FUSE_OPT_KEY_OPT -1
/**
/**
* Key value passed to the processing function for all non-options
*
* Non-options are the arguments beginning with a character other than
@ -137,7 +137,7 @@ extern "C" {
*/
#define FUSE_OPT_KEY_NONOPT -2
/**
/**
* Special key value for options to keep
*
* Argument is not passed to processing function, but behave as if the
@ -145,7 +145,7 @@ extern "C" {
*/
#define FUSE_OPT_KEY_KEEP -3
/**
/**
* Special key value for options to discard
*
* Argument is not passed to processing function, but behave as if the
@ -153,7 +153,7 @@ extern "C" {
*/
#define FUSE_OPT_KEY_DISCARD -4
/**
/**
* Processing function
*
* This function is called if
@ -178,10 +178,10 @@ extern "C" {
* @param outargs the current output argument list
* @return -1 on error, 0 if arg is to be discarded, 1 if arg should be kept
*/
typedef int (*fuse_opt_proc_t)(void *data, const char *arg, int key,
typedef int (*fuse_opt_proc_t)(void *data, const char *arg, int key,
struct fuse_args *outargs);
/**
/**
* Option parsing function
*
* If 'args' was returned from a previous call to fuse_opt_parse() or
@ -201,37 +201,37 @@ extern "C" {
* @param proc is the processing function
* @return -1 on error, 0 on success
*/
int fuse_opt_parse(struct fuse_args *args, void *data,
int fuse_opt_parse(struct fuse_args *args, void *data,
const struct fuse_opt opts[], fuse_opt_proc_t proc);
/**
/**
* Add an option to a comma separated option list
*
* @param opts is a pointer to an option list, may point to a NULL value
* @param opt is the option to add
* @return -1 on allocation error, 0 on success
*/
int fuse_opt_add_opt(char **opts, const char *opt);
int fuse_opt_add_opt(char **opts, const char *opt);
/**
/**
* Add an option, escaping commas, to a comma separated option list
*
* @param opts is a pointer to an option list, may point to a NULL value
* @param opt is the option to add
* @return -1 on allocation error, 0 on success
*/
int fuse_opt_add_opt_escaped(char **opts, const char *opt);
int fuse_opt_add_opt_escaped(char **opts, const char *opt);
/**
/**
* Add an argument to a NULL terminated argument vector
*
* @param args is the structure containing the current argument list
* @param arg is the new argument to add
* @return -1 on allocation error, 0 on success
*/
int fuse_opt_add_arg(struct fuse_args *args, const char *arg);
int fuse_opt_add_arg(struct fuse_args *args, const char *arg);
/**
/**
* Add an argument at the specified position in a NULL terminated
* argument vector
*
@ -244,29 +244,27 @@ extern "C" {
* @param arg is the new argument to add
* @return -1 on allocation error, 0 on success
*/
int fuse_opt_insert_arg(struct fuse_args *args, int pos, const char *arg);
int fuse_opt_insert_arg(struct fuse_args *args, int pos, const char *arg);
/**
/**
* Free the contents of argument list
*
* The structure itself is not freed
*
* @param args is the structure containing the argument list
*/
void fuse_opt_free_args(struct fuse_args *args);
void fuse_opt_free_args(struct fuse_args *args);
/**
/**
* Check if an option matches
*
* @param opts is the option description array
* @param opt is the option to match
* @return 1 if a match is found, 0 if not
*/
int fuse_opt_match(const struct fuse_opt opts[], const char *opt);
int fuse_opt_match(const struct fuse_opt opts[], const char *opt);
#ifdef __cplusplus
}
#endif
EXTERN_C_END
#endif /* _FUSE_OPT_H_ */

24
libfuse/include/ulockmgr.h

@ -1,24 +0,0 @@
/*
libulockmgr: Userspace Lock Manager Library
Copyright (C) 2006 Miklos Szeredi <miklos@szeredi.hu>
This program can be distributed under the terms of the GNU LGPLv2.
See the file COPYING.LIB.
*/
#include <stdint.h>
#include <fcntl.h>
#include <sys/types.h>
/**
* Perform POSIX locking operation
*
* @param fd the file descriptor
* @param cmd the locking command (F_GETFL, F_SETLK or F_SETLKW)
* @param lock the lock parameters
* @param owner the lock owner ID cookie
* @param owner_len length of the lock owner ID cookie
* @return 0 on success -errno on error
*/
int ulockmgr_op(int fd, int cmd, struct flock *lock, const void *owner,
size_t owner_len);
Loading…
Cancel
Save