mirror of
https://github.com/trapexit/mergerfs.git
synced 2025-06-05 01:24:44 +08:00
libfuse cleanup: reindent
This commit is contained in:
@ -28,17 +28,17 @@ extern "C" {
|
||||
|
||||
#define CUSE_UNRESTRICTED_IOCTL (1 << 0) /* use unrestricted ioctl */
|
||||
|
||||
struct fuse_session;
|
||||
struct fuse_session;
|
||||
|
||||
struct cuse_info {
|
||||
struct cuse_info {
|
||||
unsigned dev_major;
|
||||
unsigned dev_minor;
|
||||
unsigned dev_info_argc;
|
||||
const char **dev_info_argv;
|
||||
unsigned flags;
|
||||
};
|
||||
};
|
||||
|
||||
/*
|
||||
/*
|
||||
* Most ops behave almost identically to the matching fuse_lowlevel
|
||||
* ops except that they don't take @ino.
|
||||
*
|
||||
@ -46,7 +46,7 @@ struct cuse_info {
|
||||
* read/write : always direct IO, simultaneous operations allowed
|
||||
* ioctl : might be in unrestricted mode depending on ci->flags
|
||||
*/
|
||||
struct cuse_lowlevel_ops {
|
||||
struct cuse_lowlevel_ops {
|
||||
void (*init) (void *userdata, struct fuse_conn_info *conn);
|
||||
void (*init_done) (void *userdata);
|
||||
void (*destroy) (void *userdata);
|
||||
@ -63,21 +63,21 @@ struct cuse_lowlevel_ops {
|
||||
const void *in_buf, size_t in_bufsz, size_t out_bufsz);
|
||||
void (*poll) (fuse_req_t req, struct fuse_file_info *fi,
|
||||
struct fuse_pollhandle *ph);
|
||||
};
|
||||
};
|
||||
|
||||
struct fuse_session *cuse_lowlevel_new(struct fuse_args *args,
|
||||
struct fuse_session *cuse_lowlevel_new(struct fuse_args *args,
|
||||
const struct cuse_info *ci,
|
||||
const struct cuse_lowlevel_ops *clop,
|
||||
void *userdata);
|
||||
|
||||
struct fuse_session *cuse_lowlevel_setup(int argc, char *argv[],
|
||||
struct fuse_session *cuse_lowlevel_setup(int argc, char *argv[],
|
||||
const struct cuse_info *ci,
|
||||
const struct cuse_lowlevel_ops *clop,
|
||||
int *multithreaded, void *userdata);
|
||||
|
||||
void cuse_lowlevel_teardown(struct fuse_session *se);
|
||||
void cuse_lowlevel_teardown(struct fuse_session *se);
|
||||
|
||||
int cuse_lowlevel_main(int argc, char *argv[], const struct cuse_info *ci,
|
||||
int cuse_lowlevel_main(int argc, char *argv[], const struct cuse_info *ci,
|
||||
const struct cuse_lowlevel_ops *clop, void *userdata);
|
||||
|
||||
#ifdef __cplusplus
|
||||
|
@ -38,17 +38,17 @@
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/* ----------------------------------------------------------- *
|
||||
/* ----------------------------------------------------------- *
|
||||
* 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,7 +70,8 @@ struct fuse_cmd;
|
||||
* 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
|
||||
@ -560,16 +561,14 @@ struct fuse_operations {
|
||||
* Copy a range of data from one file to another
|
||||
*
|
||||
* Performs an optimized copy between two file descriptors without
|
||||
* the
|
||||
* additional cost of transferring data through the FUSE kernel
|
||||
* module
|
||||
* to user space (glibc) and then back into the FUSE filesystem
|
||||
* the additional cost of transferring data through the FUSE kernel
|
||||
* module to user space (glibc) and then back into the FUSE filesystem
|
||||
* again.
|
||||
*
|
||||
* In case this method is not implemented, glibc falls back to
|
||||
* reading
|
||||
* data from the source and writing to the destination. Effectively
|
||||
* doing an inefficient copy of the data.
|
||||
* reading data from the source and writing to the
|
||||
* destination. Effectively doing an inefficient copy of the
|
||||
* data.
|
||||
*/
|
||||
ssize_t (*copy_file_range)(struct fuse_file_info *fi_in,
|
||||
off_t offset_in,
|
||||
@ -577,14 +576,15 @@ struct fuse_operations {
|
||||
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 +602,9 @@ struct fuse_context {
|
||||
|
||||
/** 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 +627,18 @@ struct fuse_context {
|
||||
* @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 +648,11 @@ struct fuse_context {
|
||||
* @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,9 +662,9 @@ struct fuse *fuse_new(struct fuse_chan *ch, struct fuse_args *args,
|
||||
*
|
||||
* @param f the FUSE handle
|
||||
*/
|
||||
void fuse_destroy(struct fuse *f);
|
||||
void fuse_destroy(struct fuse *f);
|
||||
|
||||
/**
|
||||
/**
|
||||
* FUSE event loop.
|
||||
*
|
||||
* Requests from the kernel are processed, and the appropriate
|
||||
@ -673,28 +673,18 @@ void fuse_destroy(struct fuse *f);
|
||||
* @param f the FUSE handle
|
||||
* @return 0 if no error occurred, -1 otherwise
|
||||
*/
|
||||
int fuse_loop(struct fuse *f);
|
||||
int fuse_loop(struct fuse *f);
|
||||
|
||||
/**
|
||||
/**
|
||||
* Exit from event loop
|
||||
*
|
||||
* @param f the FUSE handle
|
||||
*/
|
||||
void fuse_exit(struct fuse *f);
|
||||
void fuse_exit(struct fuse *f);
|
||||
|
||||
void fuse_config_set_entry_timeout(struct fuse *fuse_,
|
||||
const double entry_timeout_);
|
||||
void fuse_config_set_negative_entry_timeout(struct fuse *fuse_,
|
||||
const double entry_timeout_);
|
||||
void fuse_config_set_attr_timeout(struct fuse *fuse_,
|
||||
const double attr_timeout_);
|
||||
int fuse_config_num_threads(const struct fuse *fuse_);
|
||||
|
||||
int fuse_config_num_threads(const struct fuse *fuse_);
|
||||
double fuse_config_get_entry_timeout(const struct fuse *fuse_);
|
||||
double fuse_config_get_negative_entry_timeout(const struct fuse *fuse_);
|
||||
double fuse_config_get_attr_timeout(const struct fuse *fuse_);
|
||||
|
||||
/**
|
||||
/**
|
||||
* FUSE event loop with multiple threads
|
||||
*
|
||||
* Requests from the kernel are processed, and the appropriate
|
||||
@ -707,9 +697,9 @@ double fuse_config_get_attr_timeout(const struct fuse *fuse_);
|
||||
* @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
|
||||
@ -717,71 +707,51 @@ int fuse_loop_mt(struct fuse *f);
|
||||
*
|
||||
* @return the context
|
||||
*/
|
||||
struct fuse_context *fuse_get_context(void);
|
||||
struct fuse_context *fuse_get_context(void);
|
||||
|
||||
/**
|
||||
* Get the current supplementary group IDs for the current request
|
||||
*
|
||||
* Similar to the getgroups(2) system call, except the return value is
|
||||
* always the total number of group IDs, even if it is larger than the
|
||||
* specified size.
|
||||
*
|
||||
* The current fuse kernel module in linux (as of 2.6.30) doesn't pass
|
||||
* the group list to userspace, hence this function needs to parse
|
||||
* "/proc/$TID/task/$TID/status" to get the group IDs.
|
||||
*
|
||||
* This feature may not be supported on all operating systems. In
|
||||
* such a case this function will return -ENOSYS.
|
||||
*
|
||||
* @param size size of given array
|
||||
* @param list array of group IDs to be filled in
|
||||
* @return the total number of supplementary group IDs or -errno on failure
|
||||
*/
|
||||
int fuse_getgroups(int size, gid_t list[]);
|
||||
|
||||
/**
|
||||
/**
|
||||
* 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"
|
||||
*
|
||||
@ -790,20 +760,20 @@ void fuse_stop_cleanup_thread(struct fuse *fuse);
|
||||
* @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.
|
||||
*
|
||||
@ -812,101 +782,101 @@ struct fuse_fs;
|
||||
* 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
|
||||
@ -917,110 +887,49 @@ int fuse_notify_poll(struct fuse_pollhandle *ph);
|
||||
* @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);
|
||||
|
||||
/**
|
||||
* Filesystem module
|
||||
*
|
||||
* Filesystem modules are registered with the FUSE_REGISTER_MODULE()
|
||||
* macro.
|
||||
*
|
||||
* If the "-omodules=modname:..." option is present, filesystem
|
||||
* objects are created and pushed onto the stack with the 'factory'
|
||||
* function.
|
||||
*/
|
||||
struct fuse_module {
|
||||
/**
|
||||
* Name of filesystem
|
||||
*/
|
||||
const char *name;
|
||||
|
||||
/**
|
||||
* Factory for creating filesystem objects
|
||||
*
|
||||
* The function may use and remove options from 'args' that belong
|
||||
* to this module.
|
||||
*
|
||||
* For now the 'fs' vector always contains exactly one filesystem.
|
||||
* This is the filesystem which will be below the newly created
|
||||
* filesystem in the stack.
|
||||
*
|
||||
* @param args the command line arguments
|
||||
* @param fs NULL terminated filesystem object vector
|
||||
* @return the new filesystem object
|
||||
*/
|
||||
struct fuse_fs *(*factory)(struct fuse_args *args,
|
||||
struct fuse_fs *fs[]);
|
||||
|
||||
struct fuse_module *next;
|
||||
struct fusemod_so *so;
|
||||
int ctr;
|
||||
};
|
||||
|
||||
/**
|
||||
* Register a filesystem module
|
||||
*
|
||||
* This function is used by FUSE_REGISTER_MODULE and there's usually
|
||||
* no need to call it directly
|
||||
*/
|
||||
void fuse_register_module(struct fuse_module *mod);
|
||||
|
||||
/**
|
||||
* Register filesystem module
|
||||
*
|
||||
* For the parameters, see description of the fields in 'struct
|
||||
* fuse_module'
|
||||
*/
|
||||
#define FUSE_REGISTER_MODULE(name_, factory_) \
|
||||
static __attribute__((constructor)) void name_ ## _register(void) \
|
||||
{ \
|
||||
static struct fuse_module mod = \
|
||||
{ #name_, factory_, NULL, NULL, 0 }; \
|
||||
fuse_register_module(&mod); \
|
||||
}
|
||||
|
||||
|
||||
/* ----------------------------------------------------------- *
|
||||
/* ----------------------------------------------------------- *
|
||||
* 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, int *multithreaded,
|
||||
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);
|
||||
|
||||
/* ----------------------------------------------------------- *
|
||||
/* ----------------------------------------------------------- *
|
||||
* Compatibility stuff *
|
||||
* ----------------------------------------------------------- */
|
||||
|
||||
|
@ -16,6 +16,7 @@
|
||||
#define _FUSE_COMMON_H_
|
||||
|
||||
#include "fuse_opt.h"
|
||||
#include "fuse_timeouts.h"
|
||||
#include <stdint.h>
|
||||
#include <sys/types.h>
|
||||
|
||||
@ -40,21 +41,14 @@
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
typedef struct fuse_timeouts_s fuse_timeouts_t;
|
||||
struct fuse_timeouts_s
|
||||
{
|
||||
uint64_t entry;
|
||||
uint64_t attr;
|
||||
};
|
||||
|
||||
/**
|
||||
/**
|
||||
* 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;
|
||||
|
||||
@ -96,9 +90,9 @@ fuse_file_info
|
||||
|
||||
/** 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
|
||||
@ -133,7 +127,7 @@ fuse_file_info
|
||||
#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
|
||||
@ -150,14 +144,14 @@ fuse_file_info
|
||||
|
||||
#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)
|
||||
*/
|
||||
@ -207,13 +201,13 @@ struct fuse_conn_info {
|
||||
* 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
|
||||
@ -223,18 +217,18 @@ struct fuse_pollhandle;
|
||||
* @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:
|
||||
@ -255,39 +249,39 @@ void fuse_unmount(const char *mountpoint, struct fuse_chan *ch);
|
||||
* @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, char **mountpoint,
|
||||
int fuse_parse_cmdline(struct fuse_args *args, char **mountpoint,
|
||||
int *multithreaded, 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
|
||||
*
|
||||
@ -313,12 +307,12 @@ enum fuse_buf_flags {
|
||||
* 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)
|
||||
*
|
||||
@ -355,15 +349,15 @@ enum fuse_buf_copy_flags {
|
||||
* 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
|
||||
*/
|
||||
@ -394,9 +388,9 @@ struct fuse_buf {
|
||||
* 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
|
||||
@ -404,7 +398,7 @@ struct fuse_buf {
|
||||
*
|
||||
* Allocate dynamically to add more than one buffer.
|
||||
*/
|
||||
struct fuse_bufvec {
|
||||
struct fuse_bufvec {
|
||||
/**
|
||||
* Number of buffers in the array
|
||||
*/
|
||||
@ -424,9 +418,9 @@ struct fuse_bufvec {
|
||||
* 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, \
|
||||
@ -441,15 +435,15 @@ struct fuse_bufvec {
|
||||
} } \
|
||||
} )
|
||||
|
||||
/**
|
||||
/**
|
||||
* 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
|
||||
@ -457,14 +451,14 @@ size_t fuse_buf_size(const struct fuse_bufvec *bufv);
|
||||
* @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
|
||||
@ -473,9 +467,9 @@ ssize_t fuse_buf_copy(struct fuse_bufvec *dst, struct fuse_bufvec *src,
|
||||
* @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
|
||||
@ -483,9 +477,9 @@ int fuse_set_signal_handlers(struct fuse_session *se);
|
||||
*
|
||||
* @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);
|
||||
|
||||
/* ----------------------------------------------------------- *
|
||||
/* ----------------------------------------------------------- *
|
||||
* Compatibility stuff *
|
||||
* ----------------------------------------------------------- */
|
||||
|
||||
|
@ -9,7 +9,8 @@
|
||||
/* these definitions provide source compatibility to prior versions.
|
||||
Do not include this file directly! */
|
||||
|
||||
struct fuse_file_info_compat {
|
||||
struct fuse_file_info_compat
|
||||
{
|
||||
int flags;
|
||||
unsigned long fh;
|
||||
int writepage;
|
||||
|
@ -9,7 +9,8 @@
|
||||
/* these definitions provide source compatibility to prior versions.
|
||||
Do not include this file directly! */
|
||||
|
||||
struct fuse_operations_compat25 {
|
||||
struct fuse_operations_compat25
|
||||
{
|
||||
int (*getattr) (const char *, struct stat *);
|
||||
int (*readlink) (const char *, char *, size_t);
|
||||
int (*mknod) (const char *, mode_t, dev_t);
|
||||
|
@ -18,9 +18,9 @@
|
||||
|
||||
#pragma once
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
#include "extern_c.h"
|
||||
|
||||
EXTERN_C_BEGIN
|
||||
|
||||
#include "kvec.h"
|
||||
#include "fuse_dirent.h"
|
||||
@ -36,11 +36,11 @@ extern "C" {
|
||||
#include <unistd.h>
|
||||
|
||||
enum fuse_dirents_type_e
|
||||
{
|
||||
{
|
||||
UNSET = 0,
|
||||
NORMAL,
|
||||
PLUS
|
||||
};
|
||||
};
|
||||
typedef enum fuse_dirents_type_e fuse_dirents_type_t;
|
||||
|
||||
typedef struct fuse_dirents_s fuse_dirents_t;
|
||||
@ -79,6 +79,4 @@ void *fuse_dirents_find(fuse_dirents_t *d,
|
||||
|
||||
int fuse_dirents_convert_plus2normal(fuse_dirents_t *d);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
EXTERN_C_END
|
||||
|
@ -37,36 +37,37 @@
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/* ----------------------------------------------------------- *
|
||||
/* ----------------------------------------------------------- *
|
||||
* 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 {
|
||||
/** 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)
|
||||
@ -102,10 +103,11 @@ struct fuse_entry_param {
|
||||
struct stat attr;
|
||||
|
||||
fuse_timeouts_t timeout;
|
||||
};
|
||||
};
|
||||
|
||||
/** Additional context associated with requests */
|
||||
struct fuse_ctx {
|
||||
/** Additional context associated with requests */
|
||||
struct fuse_ctx
|
||||
{
|
||||
/** User ID of the calling process */
|
||||
uid_t uid;
|
||||
|
||||
@ -117,18 +119,19 @@ struct fuse_ctx {
|
||||
|
||||
/** Umask of the calling process (introduced in version 2.8) */
|
||||
mode_t umask;
|
||||
};
|
||||
};
|
||||
|
||||
struct fuse_forget_data {
|
||||
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)
|
||||
@ -149,7 +152,8 @@ struct fuse_forget_data {
|
||||
* 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
|
||||
*
|
||||
@ -1059,9 +1063,9 @@ struct fuse_lowlevel_ops {
|
||||
struct fuse_file_info *fi_out,
|
||||
size_t len,
|
||||
int flags);
|
||||
};
|
||||
};
|
||||
|
||||
/**
|
||||
/**
|
||||
* Reply with an error code or success
|
||||
*
|
||||
* Possible requests:
|
||||
@ -1074,9 +1078,9 @@ struct fuse_lowlevel_ops {
|
||||
* @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:
|
||||
@ -1084,9 +1088,9 @@ int fuse_reply_err(fuse_req_t req, int err);
|
||||
*
|
||||
* @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:
|
||||
@ -1099,9 +1103,9 @@ void fuse_reply_none(fuse_req_t req);
|
||||
* @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:
|
||||
@ -1118,10 +1122,10 @@ int fuse_reply_entry(fuse_req_t req, const struct fuse_entry_param *e);
|
||||
* @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:
|
||||
@ -1132,11 +1136,11 @@ int fuse_reply_create(fuse_req_t req, const struct fuse_entry_param *e,
|
||||
* @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:
|
||||
@ -1146,9 +1150,9 @@ int fuse_reply_attr(fuse_req_t req,
|
||||
* @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:
|
||||
@ -1161,9 +1165,9 @@ int fuse_reply_readlink(fuse_req_t req, const char *link);
|
||||
* @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:
|
||||
@ -1173,9 +1177,9 @@ int fuse_reply_open(fuse_req_t req, const struct fuse_file_info *fi);
|
||||
* @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:
|
||||
@ -1186,9 +1190,9 @@ int fuse_reply_write(fuse_req_t req, size_t count);
|
||||
* @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:
|
||||
@ -1199,10 +1203,10 @@ int fuse_reply_buf(fuse_req_t req, const char *buf, size_t size);
|
||||
* @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:
|
||||
@ -1213,9 +1217,9 @@ int fuse_reply_data(fuse_req_t req, struct fuse_bufvec *bufv,
|
||||
* @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:
|
||||
@ -1225,9 +1229,9 @@ int fuse_reply_iov(fuse_req_t req, const struct iovec *iov, int count);
|
||||
* @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:
|
||||
@ -1237,9 +1241,9 @@ int fuse_reply_statfs(fuse_req_t req, const struct statvfs *stbuf);
|
||||
* @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:
|
||||
@ -1249,9 +1253,9 @@ int fuse_reply_xattr(fuse_req_t req, size_t count);
|
||||
* @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:
|
||||
@ -1261,9 +1265,9 @@ int fuse_reply_lock(fuse_req_t req, const struct flock *lock);
|
||||
* @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.
|
||||
@ -1278,11 +1282,11 @@ int fuse_reply_bmap(fuse_req_t req, uint64_t idx);
|
||||
* @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:
|
||||
@ -1293,9 +1297,9 @@ int fuse_reply_ioctl_retry(fuse_req_t req,
|
||||
* @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:
|
||||
@ -1306,31 +1310,31 @@ int fuse_reply_ioctl(fuse_req_t req, int result, const void *buf, uint32_t size)
|
||||
* @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
|
||||
@ -1340,10 +1344,10 @@ int fuse_lowlevel_notify_poll(struct fuse_pollhandle *ph);
|
||||
* @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
|
||||
*
|
||||
@ -1357,10 +1361,10 @@ int fuse_lowlevel_notify_inval_inode(struct fuse_chan *ch, fuse_ino_t ino,
|
||||
* @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).
|
||||
@ -1376,11 +1380,11 @@ int fuse_lowlevel_notify_inval_entry(struct fuse_chan *ch, fuse_ino_t parent,
|
||||
* @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
|
||||
@ -1401,10 +1405,10 @@ int fuse_lowlevel_notify_delete(struct fuse_chan *ch,
|
||||
* @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.
|
||||
@ -1429,23 +1433,23 @@ int fuse_lowlevel_notify_store(struct fuse_chan *ch, fuse_ino_t ino,
|
||||
* @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
|
||||
@ -1454,9 +1458,9 @@ void *fuse_req_userdata(fuse_req_t req);
|
||||
* @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
|
||||
@ -1475,17 +1479,17 @@ const struct fuse_ctx *fuse_req_ctx(fuse_req_t req);
|
||||
* @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
|
||||
@ -1496,25 +1500,25 @@ typedef void (*fuse_interrupt_func_t)(fuse_req_t req, void *data);
|
||||
* @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
|
||||
@ -1523,20 +1527,21 @@ int fuse_lowlevel_is_lib_option(const char *opt);
|
||||
* @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)
|
||||
*
|
||||
@ -1570,18 +1575,18 @@ struct fuse_session_ops {
|
||||
* @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
|
||||
@ -1592,18 +1597,18 @@ struct fuse_session *fuse_session_new(struct fuse_session_ops *op, void *data);
|
||||
* @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
|
||||
@ -1614,10 +1619,10 @@ void fuse_session_remove_chan(struct fuse_chan *ch);
|
||||
* @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
|
||||
@ -1625,10 +1630,10 @@ struct fuse_chan *fuse_session_next_chan(struct fuse_session *se,
|
||||
* @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
|
||||
@ -1638,10 +1643,10 @@ void fuse_session_process(struct fuse_session *se, const char *buf, size_t len,
|
||||
* @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
|
||||
@ -1653,72 +1658,73 @@ void fuse_session_process_buf(struct fuse_session *se,
|
||||
* @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 single threaded event loop
|
||||
*
|
||||
* @param se the session
|
||||
* @return 0 on success, -1 on error
|
||||
*/
|
||||
int fuse_session_loop(struct fuse_session *se);
|
||||
int fuse_session_loop(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
|
||||
*
|
||||
@ -1749,9 +1755,9 @@ struct fuse_chan_ops {
|
||||
* @param ch the channel
|
||||
*/
|
||||
void (*destroy)(struct fuse_chan *ch);
|
||||
};
|
||||
};
|
||||
|
||||
/**
|
||||
/**
|
||||
* Create a new channel
|
||||
*
|
||||
* @param op channel operations
|
||||
@ -1760,42 +1766,42 @@ struct fuse_chan_ops {
|
||||
* @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
|
||||
@ -1805,9 +1811,9 @@ struct fuse_session *fuse_chan_session(struct fuse_chan *ch);
|
||||
* @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
|
||||
@ -1818,17 +1824,17 @@ int fuse_chan_recv(struct fuse_chan **ch, char *buf, size_t size);
|
||||
* @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);
|
||||
|
||||
/* ----------------------------------------------------------- *
|
||||
/* ----------------------------------------------------------- *
|
||||
* Compatibility stuff *
|
||||
* ----------------------------------------------------------- */
|
||||
|
||||
|
@ -9,7 +9,8 @@
|
||||
/* these definitions provide source compatibility to prior versions.
|
||||
Do not include this file directly! */
|
||||
|
||||
struct fuse_lowlevel_ops_compat25 {
|
||||
struct fuse_lowlevel_ops_compat25
|
||||
{
|
||||
void (*init) (void *userdata);
|
||||
void (*destroy) (void *userdata);
|
||||
void (*lookup) (fuse_req_t req, fuse_ino_t parent, const char *name);
|
||||
@ -76,7 +77,8 @@ char *fuse_add_dirent(char *buf, const char *name, const struct stat *stbuf,
|
||||
|
||||
#include <sys/statfs.h>
|
||||
|
||||
struct fuse_lowlevel_ops_compat {
|
||||
struct fuse_lowlevel_ops_compat
|
||||
{
|
||||
void (*init) (void *userdata);
|
||||
void (*destroy) (void *userdata);
|
||||
void (*lookup) (fuse_req_t req, fuse_ino_t parent, const char *name);
|
||||
|
@ -18,7 +18,7 @@
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/**
|
||||
/**
|
||||
* Option description
|
||||
*
|
||||
* This structure describes a single option, and action associated
|
||||
@ -73,7 +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;
|
||||
|
||||
@ -88,24 +89,25 @@ struct fuse_opt {
|
||||
* 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;
|
||||
|
||||
@ -114,20 +116,20 @@ struct fuse_args {
|
||||
|
||||
/** 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
|
||||
@ -135,7 +137,7 @@ struct fuse_args {
|
||||
*/
|
||||
#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
|
||||
@ -143,7 +145,7 @@ struct fuse_args {
|
||||
*/
|
||||
#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
|
||||
@ -151,7 +153,7 @@ struct fuse_args {
|
||||
*/
|
||||
#define FUSE_OPT_KEY_DISCARD -4
|
||||
|
||||
/**
|
||||
/**
|
||||
* Processing function
|
||||
*
|
||||
* This function is called if
|
||||
@ -176,10 +178,10 @@ struct fuse_args {
|
||||
* @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
|
||||
@ -199,37 +201,37 @@ typedef int (*fuse_opt_proc_t)(void *data, const char *arg, int key,
|
||||
* @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
|
||||
*
|
||||
@ -242,26 +244,26 @@ int fuse_opt_add_arg(struct fuse_args *args, const char *arg);
|
||||
* @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
|
||||
}
|
||||
|
10
libfuse/include/fuse_timeouts.h
Normal file
10
libfuse/include/fuse_timeouts.h
Normal file
@ -0,0 +1,10 @@
|
||||
#pragma once
|
||||
|
||||
#include <stdint.h>
|
||||
|
||||
typedef struct fuse_timeouts_s fuse_timeouts_t;
|
||||
struct fuse_timeouts_s
|
||||
{
|
||||
uint64_t entry;
|
||||
uint64_t attr;
|
||||
};
|
@ -331,11 +331,11 @@ struct fuse_session *cuse_lowlevel_setup(int argc, char *argv[],
|
||||
|
||||
return se;
|
||||
|
||||
err_sig:
|
||||
err_sig:
|
||||
fuse_remove_signal_handlers(se);
|
||||
err_se:
|
||||
err_se:
|
||||
fuse_session_destroy(se);
|
||||
err_args:
|
||||
err_args:
|
||||
fuse_opt_free_args(&args);
|
||||
return NULL;
|
||||
}
|
||||
|
@ -54,7 +54,8 @@
|
||||
|
||||
#define NODE_TABLE_MIN_SIZE 8192
|
||||
|
||||
struct fuse_config {
|
||||
struct fuse_config
|
||||
{
|
||||
unsigned int uid;
|
||||
unsigned int gid;
|
||||
unsigned int umask;
|
||||
@ -70,14 +71,16 @@ struct fuse_config {
|
||||
int threads;
|
||||
};
|
||||
|
||||
struct fuse_fs {
|
||||
struct fuse_fs
|
||||
{
|
||||
struct fuse_operations op;
|
||||
void *user_data;
|
||||
int compat;
|
||||
int debug;
|
||||
};
|
||||
|
||||
struct lock_queue_element {
|
||||
struct lock_queue_element
|
||||
{
|
||||
struct lock_queue_element *next;
|
||||
pthread_cond_t cond;
|
||||
fuse_ino_t nodeid1;
|
||||
@ -94,7 +97,8 @@ struct lock_queue_element {
|
||||
bool done : 1;
|
||||
};
|
||||
|
||||
struct node_table {
|
||||
struct node_table
|
||||
{
|
||||
struct node **array;
|
||||
size_t use;
|
||||
size_t size;
|
||||
@ -108,12 +112,14 @@ struct node_table {
|
||||
#define list_entry(ptr, type, member) \
|
||||
container_of(ptr, type, member)
|
||||
|
||||
struct list_head {
|
||||
struct list_head
|
||||
{
|
||||
struct list_head *next;
|
||||
struct list_head *prev;
|
||||
};
|
||||
|
||||
struct node_slab {
|
||||
struct node_slab
|
||||
{
|
||||
struct list_head list; /* must be the first member */
|
||||
struct list_head freelist;
|
||||
int used;
|
||||
@ -139,7 +145,8 @@ struct fuse
|
||||
pthread_t prune_thread;
|
||||
};
|
||||
|
||||
struct lock {
|
||||
struct lock
|
||||
{
|
||||
int type;
|
||||
off_t start;
|
||||
off_t end;
|
||||
@ -171,7 +178,8 @@ struct node
|
||||
#define TREELOCK_WRITE -1
|
||||
#define TREELOCK_WAIT_OFFSET INT_MIN
|
||||
|
||||
struct node_lru {
|
||||
struct node_lru
|
||||
{
|
||||
struct node node;
|
||||
struct list_head lru;
|
||||
struct timespec forget_time;
|
||||
@ -184,7 +192,8 @@ struct fuse_dh
|
||||
fuse_dirents_t d;
|
||||
};
|
||||
|
||||
struct fuse_context_i {
|
||||
struct fuse_context_i
|
||||
{
|
||||
struct fuse_context ctx;
|
||||
fuse_req_t req;
|
||||
};
|
||||
@ -193,18 +202,25 @@ static pthread_key_t fuse_context_key;
|
||||
static pthread_mutex_t fuse_context_lock = PTHREAD_MUTEX_INITIALIZER;
|
||||
static int fuse_context_ref;
|
||||
|
||||
static void init_list_head(struct list_head *list)
|
||||
static
|
||||
void
|
||||
init_list_head(struct list_head *list)
|
||||
{
|
||||
list->next = list;
|
||||
list->prev = list;
|
||||
}
|
||||
|
||||
static int list_empty(const struct list_head *head)
|
||||
static
|
||||
int
|
||||
list_empty(const struct list_head *head)
|
||||
{
|
||||
return head->next == head;
|
||||
}
|
||||
|
||||
static void list_add(struct list_head *new, struct list_head *prev,
|
||||
static
|
||||
void
|
||||
list_add(struct list_head *new,
|
||||
struct list_head *prev,
|
||||
struct list_head *next)
|
||||
{
|
||||
next->prev = new;
|
||||
@ -213,17 +229,28 @@ static void list_add(struct list_head *new, struct list_head *prev,
|
||||
prev->next = new;
|
||||
}
|
||||
|
||||
static inline void list_add_head(struct list_head *new, struct list_head *head)
|
||||
static
|
||||
inline
|
||||
void
|
||||
list_add_head(struct list_head *new,
|
||||
struct list_head *head)
|
||||
{
|
||||
list_add(new, head, head->next);
|
||||
}
|
||||
|
||||
static inline void list_add_tail(struct list_head *new, struct list_head *head)
|
||||
static
|
||||
inline
|
||||
void
|
||||
list_add_tail(struct list_head *new,
|
||||
struct list_head *head)
|
||||
{
|
||||
list_add(new, head->prev, head);
|
||||
}
|
||||
|
||||
static inline void list_del(struct list_head *entry)
|
||||
static
|
||||
inline
|
||||
void
|
||||
list_del(struct list_head *entry)
|
||||
{
|
||||
struct list_head *prev = entry->prev;
|
||||
struct list_head *next = entry->next;
|
||||
@ -232,17 +259,25 @@ static inline void list_del(struct list_head *entry)
|
||||
prev->next = next;
|
||||
}
|
||||
|
||||
static inline int lru_enabled(struct fuse *f)
|
||||
static
|
||||
inline
|
||||
int
|
||||
lru_enabled(struct fuse *f)
|
||||
{
|
||||
return f->conf.remember > 0;
|
||||
}
|
||||
|
||||
static struct node_lru *node_lru(struct node *node)
|
||||
static
|
||||
struct
|
||||
node_lru*
|
||||
node_lru(struct node *node)
|
||||
{
|
||||
return (struct node_lru *) node;
|
||||
return (struct node_lru*)node;
|
||||
}
|
||||
|
||||
static size_t get_node_size(struct fuse *f)
|
||||
static
|
||||
size_t
|
||||
get_node_size(struct fuse *f)
|
||||
{
|
||||
if (lru_enabled(f))
|
||||
return sizeof(struct node_lru);
|
||||
@ -251,17 +286,23 @@ static size_t get_node_size(struct fuse *f)
|
||||
}
|
||||
|
||||
#ifdef FUSE_NODE_SLAB
|
||||
static struct node_slab *list_to_slab(struct list_head *head)
|
||||
static
|
||||
struct node_slab*
|
||||
list_to_slab(struct list_head *head)
|
||||
{
|
||||
return (struct node_slab *) head;
|
||||
}
|
||||
|
||||
static struct node_slab *node_to_slab(struct fuse *f, struct node *node)
|
||||
static
|
||||
struct node_slab*
|
||||
node_to_slab(struct fuse *f, struct node *node)
|
||||
{
|
||||
return (struct node_slab *) (((uintptr_t) node) & ~((uintptr_t) f->pagesize - 1));
|
||||
}
|
||||
|
||||
static int alloc_slab(struct fuse *f)
|
||||
static
|
||||
int
|
||||
alloc_slab(struct fuse *f)
|
||||
{
|
||||
void *mem;
|
||||
struct node_slab *slab;
|
||||
@ -293,7 +334,9 @@ static int alloc_slab(struct fuse *f)
|
||||
return 0;
|
||||
}
|
||||
|
||||
static struct node *alloc_node(struct fuse *f)
|
||||
static
|
||||
struct node*
|
||||
alloc_node(struct fuse *f)
|
||||
{
|
||||
struct node_slab *slab;
|
||||
struct list_head *node;
|
||||
@ -316,7 +359,10 @@ static struct node *alloc_node(struct fuse *f)
|
||||
return (struct node *) node;
|
||||
}
|
||||
|
||||
static void free_slab(struct fuse *f, struct node_slab *slab)
|
||||
static
|
||||
void
|
||||
free_slab(struct fuse *f,
|
||||
struct node_slab *slab)
|
||||
{
|
||||
int res;
|
||||
|
||||
@ -326,7 +372,10 @@ static void free_slab(struct fuse *f, struct node_slab *slab)
|
||||
fprintf(stderr, "fuse warning: munmap(%p) failed\n", slab);
|
||||
}
|
||||
|
||||
static void free_node_mem(struct fuse *f, struct node *node)
|
||||
static
|
||||
void
|
||||
free_node_mem(struct fuse *f,
|
||||
struct node *node)
|
||||
{
|
||||
struct node_slab *slab = node_to_slab(f, node);
|
||||
struct list_head *n = (struct list_head *) node;
|
||||
@ -343,19 +392,27 @@ static void free_node_mem(struct fuse *f, struct node *node)
|
||||
}
|
||||
}
|
||||
#else
|
||||
static struct node *alloc_node(struct fuse *f)
|
||||
static
|
||||
struct node*
|
||||
alloc_node(struct fuse *f)
|
||||
{
|
||||
return (struct node *) calloc(1, get_node_size(f));
|
||||
}
|
||||
|
||||
static void free_node_mem(struct fuse *f, struct node *node)
|
||||
static
|
||||
void
|
||||
free_node_mem(struct fuse *f,
|
||||
struct node *node)
|
||||
{
|
||||
(void) f;
|
||||
free(node);
|
||||
}
|
||||
#endif
|
||||
|
||||
static size_t id_hash(struct fuse *f, fuse_ino_t ino)
|
||||
static
|
||||
size_t
|
||||
id_hash(struct fuse *f,
|
||||
fuse_ino_t ino)
|
||||
{
|
||||
uint64_t hash = ((uint32_t) ino * 2654435761U) % f->id_table.size;
|
||||
uint64_t oldhash = hash % (f->id_table.size / 2);
|
||||
@ -366,7 +423,10 @@ static size_t id_hash(struct fuse *f, fuse_ino_t ino)
|
||||
return hash;
|
||||
}
|
||||
|
||||
static struct node *get_node_nocheck(struct fuse *f, fuse_ino_t nodeid)
|
||||
static
|
||||
struct node*
|
||||
get_node_nocheck(struct fuse *f,
|
||||
fuse_ino_t nodeid)
|
||||
{
|
||||
size_t hash = id_hash(f, nodeid);
|
||||
struct node *node;
|
||||
@ -399,14 +459,19 @@ static void curr_time(struct timespec *now);
|
||||
static double diff_timespec(const struct timespec *t1,
|
||||
const struct timespec *t2);
|
||||
|
||||
static void remove_node_lru(struct node *node)
|
||||
static
|
||||
void
|
||||
remove_node_lru(struct node *node)
|
||||
{
|
||||
struct node_lru *lnode = node_lru(node);
|
||||
list_del(&lnode->lru);
|
||||
init_list_head(&lnode->lru);
|
||||
}
|
||||
|
||||
static void set_forget_time(struct fuse *f, struct node *node)
|
||||
static
|
||||
void
|
||||
set_forget_time(struct fuse *f,
|
||||
struct node *node)
|
||||
{
|
||||
struct node_lru *lnode = node_lru(node);
|
||||
|
||||
@ -429,7 +494,9 @@ free_node(struct fuse *f_,
|
||||
free_node_mem(f_,node_);
|
||||
}
|
||||
|
||||
static void node_table_reduce(struct node_table *t)
|
||||
static
|
||||
void
|
||||
node_table_reduce(struct node_table *t)
|
||||
{
|
||||
size_t newsize = t->size / 2;
|
||||
void *newarray;
|
||||
@ -445,7 +512,9 @@ static void node_table_reduce(struct node_table *t)
|
||||
t->split = t->size / 2;
|
||||
}
|
||||
|
||||
static void remerge_id(struct fuse *f)
|
||||
static
|
||||
void
|
||||
remerge_id(struct fuse *f)
|
||||
{
|
||||
struct node_table *t = &f->id_table;
|
||||
int iter;
|
||||
@ -471,7 +540,9 @@ static void remerge_id(struct fuse *f)
|
||||
}
|
||||
}
|
||||
|
||||
static void unhash_id(struct fuse *f, struct node *node)
|
||||
static
|
||||
void
|
||||
unhash_id(struct fuse *f, struct node *node)
|
||||
{
|
||||
struct node **nodep = &f->id_table.array[id_hash(f, node->nodeid)];
|
||||
|
||||
@ -777,7 +848,7 @@ static struct node *find_node(struct fuse *f, fuse_ino_t parent,
|
||||
remove_node_lru(node);
|
||||
}
|
||||
inc_nlookup(node);
|
||||
out_err:
|
||||
out_err:
|
||||
pthread_mutex_unlock(&f->lock);
|
||||
return node;
|
||||
}
|
||||
@ -982,9 +1053,9 @@ static void queue_element_wakeup(struct fuse *f, struct lock_queue_element *qe)
|
||||
/* keep trying */
|
||||
return;
|
||||
|
||||
err_unlock:
|
||||
err_unlock:
|
||||
queue_element_unlock(f, qe);
|
||||
done:
|
||||
done:
|
||||
qe->err = err;
|
||||
qe->done = true;
|
||||
pthread_cond_signal(&qe->cond);
|
||||
@ -1263,7 +1334,7 @@ static int rename_node(struct fuse *f, fuse_ino_t olddir, const char *oldname,
|
||||
goto out;
|
||||
}
|
||||
|
||||
out:
|
||||
out:
|
||||
pthread_mutex_unlock(&f->lock);
|
||||
return err;
|
||||
}
|
||||
@ -1790,10 +1861,10 @@ int fuse_fs_write_buf(struct fuse_fs *fs,
|
||||
|
||||
res = fs->op.write(flatbuf->mem, flatbuf->size,
|
||||
off, fi);
|
||||
out_free:
|
||||
out_free:
|
||||
free(mem);
|
||||
}
|
||||
out:
|
||||
out:
|
||||
if (fs->debug && res >= 0)
|
||||
fprintf(stderr, " write%s[%llu] %u bytes to %llu\n",
|
||||
fi->writepage ? "page" : "",
|
||||
@ -3809,7 +3880,7 @@ static int locks_insert(struct node *node, struct lock *lock)
|
||||
insert_lock(lp, newl1);
|
||||
newl1 = NULL;
|
||||
}
|
||||
out:
|
||||
out:
|
||||
free(newl1);
|
||||
free(newl2);
|
||||
return 0;
|
||||
@ -4032,9 +4103,9 @@ static void fuse_lib_ioctl(fuse_req_t req, fuse_ino_t ino, unsigned long cmd, vo
|
||||
|
||||
fuse_reply_ioctl(req, err, out_buf, out_bufsz);
|
||||
goto out;
|
||||
err:
|
||||
err:
|
||||
reply_err(req, err);
|
||||
out:
|
||||
out:
|
||||
free(out_buf);
|
||||
}
|
||||
|
||||
@ -4381,17 +4452,17 @@ static const struct fuse_opt fuse_lib_opts[] = {
|
||||
static void fuse_lib_help(void)
|
||||
{
|
||||
fprintf(stderr,
|
||||
" -o umask=M set file permissions (octal)\n"
|
||||
" -o uid=N set file owner\n"
|
||||
" -o gid=N set file group\n"
|
||||
" -o noforget never forget cached inodes\n"
|
||||
" -o remember=T remember cached inodes for T seconds (0s)\n"
|
||||
" -o intr allow requests to be interrupted\n"
|
||||
" -o intr_signal=NUM signal to send on interrupt (%i)\n"
|
||||
" -o threads=NUM number of worker threads. 0 = autodetect.\n"
|
||||
" Negative values autodetect then divide by\n"
|
||||
" absolute value. default = 0\n"
|
||||
"\n", FUSE_DEFAULT_INTR_SIGNAL);
|
||||
" -o umask=M set file permissions (octal)\n"
|
||||
" -o uid=N set file owner\n"
|
||||
" -o gid=N set file group\n"
|
||||
" -o noforget never forget cached inodes\n"
|
||||
" -o remember=T remember cached inodes for T seconds (0s)\n"
|
||||
" -o intr allow requests to be interrupted\n"
|
||||
" -o intr_signal=NUM signal to send on interrupt (%i)\n"
|
||||
" -o threads=NUM number of worker threads. 0 = autodetect.\n"
|
||||
" Negative values autodetect then divide by\n"
|
||||
" absolute value. default = 0\n"
|
||||
"\n", FUSE_DEFAULT_INTR_SIGNAL);
|
||||
}
|
||||
|
||||
static int fuse_lib_opt_proc(void *data, const char *arg, int key,
|
||||
@ -4607,24 +4678,24 @@ struct fuse *fuse_new_common(struct fuse_chan *ch, struct fuse_args *args,
|
||||
|
||||
return f;
|
||||
|
||||
out_free_root:
|
||||
out_free_root:
|
||||
free(root);
|
||||
out_free_id_table:
|
||||
out_free_id_table:
|
||||
free(f->id_table.array);
|
||||
out_free_name_table:
|
||||
out_free_name_table:
|
||||
free(f->name_table.array);
|
||||
out_free_session:
|
||||
out_free_session:
|
||||
fuse_session_destroy(f->se);
|
||||
out_free_fs:
|
||||
out_free_fs:
|
||||
/* Horrible compatibility hack to stop the destructor from being
|
||||
called on the filesystem without init being called first */
|
||||
fs->op.destroy = NULL;
|
||||
fuse_fs_destroy(f->fs);
|
||||
out_free:
|
||||
out_free:
|
||||
free(f);
|
||||
out_delete_context_key:
|
||||
out_delete_context_key:
|
||||
fuse_delete_context_key();
|
||||
out:
|
||||
out:
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
@ -12,7 +12,8 @@
|
||||
struct fuse_chan;
|
||||
struct fuse_ll;
|
||||
|
||||
struct fuse_session {
|
||||
struct fuse_session
|
||||
{
|
||||
struct fuse_session_ops op;
|
||||
|
||||
int (*receive_buf)(struct fuse_session *se, struct fuse_buf *buf,
|
||||
@ -28,7 +29,8 @@ struct fuse_session {
|
||||
struct fuse_chan *ch;
|
||||
};
|
||||
|
||||
struct fuse_req {
|
||||
struct fuse_req
|
||||
{
|
||||
struct fuse_ll *f;
|
||||
uint64_t unique;
|
||||
int ctr;
|
||||
@ -50,7 +52,8 @@ struct fuse_req {
|
||||
struct fuse_req *prev;
|
||||
};
|
||||
|
||||
struct fuse_notify_req {
|
||||
struct fuse_notify_req
|
||||
{
|
||||
uint64_t unique;
|
||||
void (*reply)(struct fuse_notify_req *, fuse_req_t, fuse_ino_t,
|
||||
const void *, const struct fuse_buf *);
|
||||
@ -58,10 +61,10 @@ struct fuse_notify_req {
|
||||
struct fuse_notify_req *prev;
|
||||
};
|
||||
|
||||
struct fuse_ll {
|
||||
struct fuse_ll
|
||||
{
|
||||
int debug;
|
||||
int allow_root;
|
||||
int atomic_o_trunc;
|
||||
int no_remote_posix_lock;
|
||||
int no_remote_flock;
|
||||
int big_writes;
|
||||
@ -87,7 +90,8 @@ struct fuse_ll {
|
||||
struct fuse_notify_req notify_list;
|
||||
};
|
||||
|
||||
struct fuse_cmd {
|
||||
struct fuse_cmd
|
||||
{
|
||||
char *buf;
|
||||
size_t buflen;
|
||||
struct fuse_chan *ch;
|
||||
|
@ -24,7 +24,7 @@ static int fuse_kern_chan_receive(struct fuse_chan **chp, char *buf,
|
||||
struct fuse_session *se = fuse_chan_session(ch);
|
||||
assert(se != NULL);
|
||||
|
||||
restart:
|
||||
restart:
|
||||
res = read(fuse_chan_fd(ch), buf, size);
|
||||
err = errno;
|
||||
|
||||
|
@ -733,11 +733,11 @@ static int fuse_send_data_iov(struct fuse_ll *f, struct fuse_chan *ch,
|
||||
}
|
||||
return 0;
|
||||
|
||||
clear_pipe:
|
||||
clear_pipe:
|
||||
fuse_ll_clear_pipe(f);
|
||||
return res;
|
||||
|
||||
fallback:
|
||||
fallback:
|
||||
return fuse_send_data_iov_fallback(f, ch, iov, iov_count, buf, len);
|
||||
}
|
||||
#else
|
||||
@ -900,13 +900,13 @@ int fuse_reply_ioctl_retry(fuse_req_t req,
|
||||
}
|
||||
|
||||
res = send_reply_iov(req, 0, iov, count);
|
||||
out:
|
||||
out:
|
||||
free(in_fiov);
|
||||
free(out_fiov);
|
||||
|
||||
return res;
|
||||
|
||||
enomem:
|
||||
enomem:
|
||||
res = fuse_reply_err(req, ENOMEM);
|
||||
goto out;
|
||||
}
|
||||
@ -1306,7 +1306,7 @@ static void do_write_buf(fuse_req_t req, fuse_ino_t nodeid, const void *inarg,
|
||||
|
||||
req->f->op.write_buf(req, nodeid, &bufv, arg->offset, &fi);
|
||||
|
||||
out:
|
||||
out:
|
||||
/* Need to reset the pipe if ->write_buf() didn't consume all data */
|
||||
if ((ibuf->flags & FUSE_BUF_IS_FD) && bufv.idx < bufv.count)
|
||||
fuse_ll_clear_pipe(f);
|
||||
@ -2225,7 +2225,7 @@ static void fuse_ll_retrieve_reply(struct fuse_notify_req *nreq,
|
||||
} else {
|
||||
fuse_reply_none(req);
|
||||
}
|
||||
out:
|
||||
out:
|
||||
free(rreq);
|
||||
if ((ibuf->flags & FUSE_BUF_IS_FD) && bufv.idx < bufv.count)
|
||||
fuse_ll_clear_pipe(f);
|
||||
@ -2538,13 +2538,13 @@ static void fuse_ll_process_buf(void *data, const struct fuse_buf *buf,
|
||||
else
|
||||
fuse_ll_ops[in->opcode].func(req, in->nodeid, inarg);
|
||||
|
||||
out_free:
|
||||
out_free:
|
||||
free(mbuf);
|
||||
return;
|
||||
|
||||
reply_err:
|
||||
reply_err:
|
||||
fuse_reply_err(req, err);
|
||||
clear_pipe:
|
||||
clear_pipe:
|
||||
if (buf->flags & FUSE_BUF_IS_FD)
|
||||
fuse_ll_clear_pipe(f);
|
||||
goto out_free;
|
||||
@ -2601,16 +2601,16 @@ static void fuse_ll_version(void)
|
||||
static void fuse_ll_help(void)
|
||||
{
|
||||
fprintf(stderr,
|
||||
" -o max_readahead=N set maximum readahead\n"
|
||||
" -o max_background=N set number of maximum background requests\n"
|
||||
" -o congestion_threshold=N set kernel's congestion threshold\n"
|
||||
" -o no_remote_lock disable remote file locking\n"
|
||||
" -o no_remote_flock disable remote file locking (BSD)\n"
|
||||
" -o no_remote_posix_lock disable remove file locking (POSIX)\n"
|
||||
" -o [no_]splice_write use splice to write to the fuse device\n"
|
||||
" -o [no_]splice_move move data while splicing to the fuse device\n"
|
||||
" -o [no_]splice_read use splice to read from the fuse device\n"
|
||||
);
|
||||
" -o max_readahead=N set maximum readahead\n"
|
||||
" -o max_background=N set number of maximum background requests\n"
|
||||
" -o congestion_threshold=N set kernel's congestion threshold\n"
|
||||
" -o no_remote_lock disable remote file locking\n"
|
||||
" -o no_remote_flock disable remote file locking (BSD)\n"
|
||||
" -o no_remote_posix_lock disable remove file locking (POSIX)\n"
|
||||
" -o [no_]splice_write use splice to write to the fuse device\n"
|
||||
" -o [no_]splice_move move data while splicing to the fuse device\n"
|
||||
" -o [no_]splice_read use splice to read from the fuse device\n"
|
||||
);
|
||||
}
|
||||
|
||||
static int fuse_ll_opt_proc(void *data, const char *arg, int key,
|
||||
@ -2752,7 +2752,7 @@ static int fuse_ll_receive_buf(struct fuse_session *se, struct fuse_buf *buf,
|
||||
|
||||
return res;
|
||||
|
||||
fallback:
|
||||
fallback:
|
||||
res = fuse_chan_recv(chp, buf->mem, bufsize);
|
||||
if (res <= 0)
|
||||
return res;
|
||||
@ -2840,12 +2840,12 @@ struct fuse_session *fuse_lowlevel_new_common(struct fuse_args *args,
|
||||
|
||||
return se;
|
||||
|
||||
out_key_destroy:
|
||||
out_key_destroy:
|
||||
pthread_key_delete(f->pipe_key);
|
||||
out_free:
|
||||
out_free:
|
||||
pthread_mutex_destroy(&f->lock);
|
||||
free(f);
|
||||
out:
|
||||
out:
|
||||
return NULL;
|
||||
}
|
||||
|
||||
@ -2870,7 +2870,7 @@ int fuse_req_getgroups(fuse_req_t req, int size, gid_t list[])
|
||||
|
||||
sprintf(path, "/proc/%lu/task/%lu/status", pid, pid);
|
||||
|
||||
retry:
|
||||
retry:
|
||||
buf = malloc(bufsize);
|
||||
if (buf == NULL)
|
||||
return -ENOMEM;
|
||||
@ -2912,7 +2912,7 @@ retry:
|
||||
ret++;
|
||||
}
|
||||
|
||||
out_free:
|
||||
out_free:
|
||||
free(buf);
|
||||
return ret;
|
||||
}
|
||||
|
@ -16,7 +16,8 @@
|
||||
#include <pthread.h>
|
||||
#include <assert.h>
|
||||
|
||||
struct procdata {
|
||||
struct procdata
|
||||
{
|
||||
struct fuse *f;
|
||||
struct fuse_chan *prevch;
|
||||
struct fuse_session *prevse;
|
||||
|
@ -14,7 +14,8 @@
|
||||
#include <string.h>
|
||||
#include <assert.h>
|
||||
|
||||
struct fuse_opt_context {
|
||||
struct fuse_opt_context
|
||||
{
|
||||
void *data;
|
||||
const struct fuse_opt *opt;
|
||||
fuse_opt_proc_t proc;
|
||||
@ -26,7 +27,8 @@ struct fuse_opt_context {
|
||||
int nonopt;
|
||||
};
|
||||
|
||||
void fuse_opt_free_args(struct fuse_args *args)
|
||||
void
|
||||
fuse_opt_free_args(struct fuse_args *args)
|
||||
{
|
||||
if (args) {
|
||||
if (args->argv && args->allocated) {
|
||||
@ -41,13 +43,16 @@ void fuse_opt_free_args(struct fuse_args *args)
|
||||
}
|
||||
}
|
||||
|
||||
static int alloc_failed(void)
|
||||
static
|
||||
int
|
||||
alloc_failed(void)
|
||||
{
|
||||
fprintf(stderr, "fuse: memory allocation failed\n");
|
||||
return -1;
|
||||
}
|
||||
|
||||
int fuse_opt_add_arg(struct fuse_args *args, const char *arg)
|
||||
int
|
||||
fuse_opt_add_arg(struct fuse_args *args, const char *arg)
|
||||
{
|
||||
char **newargv;
|
||||
char *newarg;
|
||||
|
@ -17,17 +17,13 @@
|
||||
#include <assert.h>
|
||||
#include <errno.h>
|
||||
|
||||
struct fuse_chan {
|
||||
struct fuse_chan
|
||||
{
|
||||
struct fuse_chan_ops op;
|
||||
|
||||
struct fuse_session *se;
|
||||
|
||||
int fd;
|
||||
|
||||
size_t bufsize;
|
||||
|
||||
void *data;
|
||||
|
||||
int compat;
|
||||
};
|
||||
|
||||
|
@ -69,4 +69,3 @@ void fuse_remove_signal_handlers(struct fuse_session *se)
|
||||
set_one_signal_handler(SIGTERM, exit_handler, 1);
|
||||
set_one_signal_handler(SIGPIPE, SIG_IGN, 1);
|
||||
}
|
||||
|
||||
|
@ -58,7 +58,7 @@ struct fuse_opt fuse_helper_opts[] =
|
||||
FUSE_OPT_KEY("fsname=", FUSE_OPT_KEY_KEEP),
|
||||
FUSE_OPT_KEY("subtype=", FUSE_OPT_KEY_KEEP),
|
||||
FUSE_OPT_END
|
||||
};
|
||||
};
|
||||
|
||||
static void usage(const char *progname)
|
||||
{
|
||||
@ -336,11 +336,11 @@ struct fuse *fuse_setup_common(int argc, char *argv[],
|
||||
|
||||
return fuse;
|
||||
|
||||
err_unmount:
|
||||
err_unmount:
|
||||
fuse_unmount_common(*mountpoint, ch);
|
||||
if (fuse)
|
||||
fuse_destroy(fuse);
|
||||
err_free:
|
||||
err_free:
|
||||
free(*mountpoint);
|
||||
return NULL;
|
||||
}
|
||||
|
@ -241,7 +241,7 @@ void fuse_kern_unmount(const char *mountpoint, int fd)
|
||||
|
||||
do_unmount(dev, fd);
|
||||
|
||||
out:
|
||||
out:
|
||||
close(fd);
|
||||
}
|
||||
|
||||
@ -295,7 +295,7 @@ static int fuse_mount_core(const char *mountpoint, const char *opts)
|
||||
return -1;
|
||||
}
|
||||
|
||||
mount:
|
||||
mount:
|
||||
if (getenv("FUSE_NO_MOUNT") || ! mountpoint)
|
||||
goto out;
|
||||
|
||||
@ -356,7 +356,7 @@ mount:
|
||||
return -1;
|
||||
}
|
||||
|
||||
out:
|
||||
out:
|
||||
return fd;
|
||||
}
|
||||
|
||||
@ -383,7 +383,7 @@ int fuse_kern_mount(const char *mountpoint, struct fuse_args *args)
|
||||
return 0;
|
||||
|
||||
res = fuse_mount_core(mountpoint, mo.kernel_opts);
|
||||
out:
|
||||
out:
|
||||
free(mo.kernel_opts);
|
||||
return res;
|
||||
}
|
||||
|
@ -129,16 +129,16 @@ static const struct fuse_opt fuse_mount_opts[] = {
|
||||
static void mount_help(void)
|
||||
{
|
||||
fprintf(stderr,
|
||||
" -o allow_other allow access to other users\n"
|
||||
" -o allow_root allow access to root\n"
|
||||
" -o auto_unmount auto unmount on process termination\n"
|
||||
" -o nonempty allow mounts over non-empty file/dir\n"
|
||||
" -o default_permissions enable permission checking by kernel\n"
|
||||
" -o fsname=NAME set filesystem name\n"
|
||||
" -o subtype=NAME set filesystem type\n"
|
||||
" -o large_read issue large read requests (2.4 only)\n"
|
||||
" -o max_read=N set maximum size of read requests\n"
|
||||
"\n");
|
||||
" -o allow_other allow access to other users\n"
|
||||
" -o allow_root allow access to root\n"
|
||||
" -o auto_unmount auto unmount on process termination\n"
|
||||
" -o nonempty allow mounts over non-empty file/dir\n"
|
||||
" -o default_permissions enable permission checking by kernel\n"
|
||||
" -o fsname=NAME set filesystem name\n"
|
||||
" -o subtype=NAME set filesystem type\n"
|
||||
" -o large_read issue large read requests (2.4 only)\n"
|
||||
" -o max_read=N set maximum size of read requests\n"
|
||||
"\n");
|
||||
}
|
||||
|
||||
static void exec_fusermount(const char *argv[])
|
||||
@ -553,9 +553,9 @@ static int fuse_mount_sys(const char *mnt, struct mount_opts *mo,
|
||||
|
||||
return fd;
|
||||
|
||||
out_umount:
|
||||
out_umount:
|
||||
umount2(mnt, 2); /* lazy umount */
|
||||
out_close:
|
||||
out_close:
|
||||
free(type);
|
||||
free(source);
|
||||
close(fd);
|
||||
@ -631,7 +631,7 @@ int fuse_kern_mount(const char *mountpoint, struct fuse_args *args)
|
||||
res = fuse_mount_fusermount(mountpoint, &mo, mnt_opts, 0);
|
||||
}
|
||||
}
|
||||
out:
|
||||
out:
|
||||
free(mnt_opts);
|
||||
free(mo.fsname);
|
||||
free(mo.subtype);
|
||||
|
@ -179,9 +179,9 @@ static struct owner *ulockmgr_new_owner(const void *id, size_t id_len)
|
||||
|
||||
return o;
|
||||
|
||||
out_close:
|
||||
out_close:
|
||||
close(sv[1]);
|
||||
out_free:
|
||||
out_free:
|
||||
free(o);
|
||||
return NULL;
|
||||
}
|
||||
|
Reference in New Issue
Block a user