mirror of
https://github.com/trapexit/mergerfs.git
synced 2024-11-26 02:09:52 +08:00
general cleanup, slight memory reduction
This commit is contained in:
parent
2d8fab534a
commit
1b26f4908e
|
@ -131,11 +131,11 @@ struct fuse_operations
|
||||||
|
|
||||||
/** Change the permission bits of a file */
|
/** Change the permission bits of a file */
|
||||||
int (*chmod) (const char *, mode_t);
|
int (*chmod) (const char *, mode_t);
|
||||||
int (*fchmod)(const struct fuse_file_info *, const mode_t);
|
int (*fchmod)(const fuse_file_info_t *, const mode_t);
|
||||||
|
|
||||||
/** Change the owner and group of a file */
|
/** Change the owner and group of a file */
|
||||||
int (*chown) (const char *, uid_t, gid_t);
|
int (*chown) (const char *, uid_t, gid_t);
|
||||||
int (*fchown)(const struct fuse_file_info *, const uid_t, const gid_t);
|
int (*fchown)(const fuse_file_info_t *, const uid_t, const gid_t);
|
||||||
|
|
||||||
/** Change the size of a file */
|
/** Change the size of a file */
|
||||||
int (*truncate) (const char *, off_t);
|
int (*truncate) (const char *, off_t);
|
||||||
|
@ -163,7 +163,7 @@ struct fuse_operations
|
||||||
*
|
*
|
||||||
* Changed in version 2.2
|
* Changed in version 2.2
|
||||||
*/
|
*/
|
||||||
int (*open) (const char *, struct fuse_file_info *);
|
int (*open) (const char *, fuse_file_info_t *);
|
||||||
|
|
||||||
/** Read data from an open file
|
/** Read data from an open file
|
||||||
*
|
*
|
||||||
|
@ -176,8 +176,10 @@ struct fuse_operations
|
||||||
*
|
*
|
||||||
* Changed in version 2.2
|
* Changed in version 2.2
|
||||||
*/
|
*/
|
||||||
int (*read) (char *, size_t, off_t,
|
int (*read) (const fuse_file_info_t *,
|
||||||
struct fuse_file_info *);
|
char *,
|
||||||
|
size_t,
|
||||||
|
off_t);
|
||||||
|
|
||||||
/** Write data to an open file
|
/** Write data to an open file
|
||||||
*
|
*
|
||||||
|
@ -187,8 +189,10 @@ struct fuse_operations
|
||||||
*
|
*
|
||||||
* Changed in version 2.2
|
* Changed in version 2.2
|
||||||
*/
|
*/
|
||||||
int (*write) (const char *, size_t, off_t,
|
int (*write) (const fuse_file_info_t *,
|
||||||
struct fuse_file_info *);
|
const char *,
|
||||||
|
size_t,
|
||||||
|
off_t);
|
||||||
|
|
||||||
/** Get file system statistics
|
/** Get file system statistics
|
||||||
*
|
*
|
||||||
|
@ -222,7 +226,7 @@ struct fuse_operations
|
||||||
*
|
*
|
||||||
* Changed in version 2.2
|
* Changed in version 2.2
|
||||||
*/
|
*/
|
||||||
int (*flush) (struct fuse_file_info *);
|
int (*flush) (const fuse_file_info_t *);
|
||||||
|
|
||||||
/** Release an open file
|
/** Release an open file
|
||||||
*
|
*
|
||||||
|
@ -238,7 +242,7 @@ struct fuse_operations
|
||||||
*
|
*
|
||||||
* Changed in version 2.2
|
* Changed in version 2.2
|
||||||
*/
|
*/
|
||||||
int (*release) (struct fuse_file_info *);
|
int (*release) (const fuse_file_info_t *);
|
||||||
|
|
||||||
/** Synchronize file contents
|
/** Synchronize file contents
|
||||||
*
|
*
|
||||||
|
@ -247,7 +251,7 @@ struct fuse_operations
|
||||||
*
|
*
|
||||||
* Changed in version 2.2
|
* Changed in version 2.2
|
||||||
*/
|
*/
|
||||||
int (*fsync) (int, struct fuse_file_info *);
|
int (*fsync) (const fuse_file_info_t *, int);
|
||||||
|
|
||||||
/** Set extended attributes */
|
/** Set extended attributes */
|
||||||
int (*setxattr) (const char *, const char *, const char *, size_t, int);
|
int (*setxattr) (const char *, const char *, const char *, size_t, int);
|
||||||
|
@ -271,7 +275,8 @@ struct fuse_operations
|
||||||
*
|
*
|
||||||
* Introduced in version 2.3
|
* Introduced in version 2.3
|
||||||
*/
|
*/
|
||||||
int (*opendir) (const char *, struct fuse_file_info *);
|
int (*opendir) (const char *,
|
||||||
|
fuse_file_info_t *);
|
||||||
|
|
||||||
/** Read directory
|
/** Read directory
|
||||||
*
|
*
|
||||||
|
@ -294,10 +299,10 @@ struct fuse_operations
|
||||||
*
|
*
|
||||||
* Introduced in version 2.3
|
* Introduced in version 2.3
|
||||||
*/
|
*/
|
||||||
int (*readdir)(struct fuse_file_info *,
|
int (*readdir)(const fuse_file_info_t *,
|
||||||
fuse_dirents_t *);
|
fuse_dirents_t *);
|
||||||
|
|
||||||
int (*readdir_plus)(struct fuse_file_info *,
|
int (*readdir_plus)(const fuse_file_info_t *,
|
||||||
fuse_dirents_t *);
|
fuse_dirents_t *);
|
||||||
|
|
||||||
|
|
||||||
|
@ -305,7 +310,7 @@ struct fuse_operations
|
||||||
*
|
*
|
||||||
* Introduced in version 2.3
|
* Introduced in version 2.3
|
||||||
*/
|
*/
|
||||||
int (*releasedir) (struct fuse_file_info *);
|
int (*releasedir) (const fuse_file_info_t *);
|
||||||
|
|
||||||
/** Synchronize directory contents
|
/** Synchronize directory contents
|
||||||
*
|
*
|
||||||
|
@ -314,7 +319,7 @@ struct fuse_operations
|
||||||
*
|
*
|
||||||
* Introduced in version 2.3
|
* Introduced in version 2.3
|
||||||
*/
|
*/
|
||||||
int (*fsyncdir) (int, struct fuse_file_info *);
|
int (*fsyncdir) (const fuse_file_info_t *, int);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Initialize filesystem
|
* Initialize filesystem
|
||||||
|
@ -362,7 +367,7 @@ struct fuse_operations
|
||||||
*
|
*
|
||||||
* Introduced in version 2.5
|
* Introduced in version 2.5
|
||||||
*/
|
*/
|
||||||
int (*create) (const char *, mode_t, struct fuse_file_info *);
|
int (*create) (const char *, mode_t, fuse_file_info_t *);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Change the size of an open file
|
* Change the size of an open file
|
||||||
|
@ -376,7 +381,7 @@ struct fuse_operations
|
||||||
*
|
*
|
||||||
* Introduced in version 2.5
|
* Introduced in version 2.5
|
||||||
*/
|
*/
|
||||||
int (*ftruncate) (off_t, struct fuse_file_info *);
|
int (*ftruncate) (const fuse_file_info_t *, off_t);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get attributes from an open file
|
* Get attributes from an open file
|
||||||
|
@ -390,7 +395,7 @@ struct fuse_operations
|
||||||
*
|
*
|
||||||
* Introduced in version 2.5
|
* Introduced in version 2.5
|
||||||
*/
|
*/
|
||||||
int (*fgetattr) (struct stat *, struct fuse_file_info *, fuse_timeouts_t *);
|
int (*fgetattr) (const fuse_file_info_t *, struct stat *, fuse_timeouts_t *);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Perform POSIX file locking operation
|
* Perform POSIX file locking operation
|
||||||
|
@ -424,7 +429,8 @@ struct fuse_operations
|
||||||
*
|
*
|
||||||
* Introduced in version 2.6
|
* Introduced in version 2.6
|
||||||
*/
|
*/
|
||||||
int (*lock) (struct fuse_file_info *, int cmd,
|
int (*lock) (const fuse_file_info_t *,
|
||||||
|
int cmd,
|
||||||
struct flock *);
|
struct flock *);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -439,7 +445,7 @@ struct fuse_operations
|
||||||
* Introduced in version 2.6
|
* Introduced in version 2.6
|
||||||
*/
|
*/
|
||||||
int (*utimens)(const char *, const struct timespec tv[2]);
|
int (*utimens)(const char *, const struct timespec tv[2]);
|
||||||
int (*futimens)(const struct fuse_file_info *ffi_, const struct timespec tv_[2]);
|
int (*futimens)(const fuse_file_info_t *ffi_, const struct timespec tv_[2]);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Map block index within file to block index within device
|
* Map block index within file to block index within device
|
||||||
|
@ -466,12 +472,12 @@ struct fuse_operations
|
||||||
*
|
*
|
||||||
* Introduced in version 2.8
|
* Introduced in version 2.8
|
||||||
*/
|
*/
|
||||||
int (*ioctl) (unsigned long cmd,
|
int (*ioctl) (const fuse_file_info_t *ffi,
|
||||||
void *arg,
|
unsigned long cmd,
|
||||||
struct fuse_file_info *ffi,
|
void *arg,
|
||||||
unsigned int flags,
|
unsigned int flags,
|
||||||
void *data,
|
void *data,
|
||||||
uint32_t *out_bufsz);
|
uint32_t *out_bufsz);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Poll for IO readiness events
|
* Poll for IO readiness events
|
||||||
|
@ -490,8 +496,9 @@ struct fuse_operations
|
||||||
*
|
*
|
||||||
* Introduced in version 2.8
|
* Introduced in version 2.8
|
||||||
*/
|
*/
|
||||||
int (*poll) (struct fuse_file_info *,
|
int (*poll) (const fuse_file_info_t *ffi,
|
||||||
struct fuse_pollhandle *ph, unsigned *reventsp);
|
fuse_pollhandle_t *ph,
|
||||||
|
unsigned *reventsp);
|
||||||
|
|
||||||
/** Write contents of buffer to an open file
|
/** Write contents of buffer to an open file
|
||||||
*
|
*
|
||||||
|
@ -501,8 +508,9 @@ struct fuse_operations
|
||||||
*
|
*
|
||||||
* Introduced in version 2.9
|
* Introduced in version 2.9
|
||||||
*/
|
*/
|
||||||
int (*write_buf) (struct fuse_bufvec *buf, off_t off,
|
int (*write_buf) (const fuse_file_info_t *ffi,
|
||||||
struct fuse_file_info *);
|
struct fuse_bufvec *buf,
|
||||||
|
off_t off);
|
||||||
|
|
||||||
/** Store data from an open file in a buffer
|
/** Store data from an open file in a buffer
|
||||||
*
|
*
|
||||||
|
@ -520,8 +528,10 @@ struct fuse_operations
|
||||||
*
|
*
|
||||||
* Introduced in version 2.9
|
* Introduced in version 2.9
|
||||||
*/
|
*/
|
||||||
int (*read_buf) (struct fuse_bufvec **bufp,
|
int (*read_buf) (const fuse_file_info_t *ffi,
|
||||||
size_t size, off_t off, struct fuse_file_info *);
|
struct fuse_bufvec **bufp,
|
||||||
|
size_t size,
|
||||||
|
off_t off);
|
||||||
/**
|
/**
|
||||||
* Perform BSD file locking operation
|
* Perform BSD file locking operation
|
||||||
*
|
*
|
||||||
|
@ -542,7 +552,7 @@ struct fuse_operations
|
||||||
*
|
*
|
||||||
* Introduced in version 2.9
|
* Introduced in version 2.9
|
||||||
*/
|
*/
|
||||||
int (*flock) (struct fuse_file_info *, int op);
|
int (*flock) (const fuse_file_info_t *, int op);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Allocates space for an open file
|
* Allocates space for an open file
|
||||||
|
@ -554,7 +564,7 @@ struct fuse_operations
|
||||||
*
|
*
|
||||||
* Introduced in version 2.9.1
|
* Introduced in version 2.9.1
|
||||||
*/
|
*/
|
||||||
int (*fallocate) (int, off_t, off_t,struct fuse_file_info *);
|
int (*fallocate) (const fuse_file_info_t *, int, off_t, off_t);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Copy a range of data from one file to another
|
* Copy a range of data from one file to another
|
||||||
|
@ -569,12 +579,12 @@ struct fuse_operations
|
||||||
* destination. Effectively doing an inefficient copy of the
|
* destination. Effectively doing an inefficient copy of the
|
||||||
* data.
|
* data.
|
||||||
*/
|
*/
|
||||||
ssize_t (*copy_file_range)(struct fuse_file_info *fi_in,
|
ssize_t (*copy_file_range)(const fuse_file_info_t *fi_in,
|
||||||
off_t offset_in,
|
off_t offset_in,
|
||||||
struct fuse_file_info *fi_out,
|
const fuse_file_info_t *fi_out,
|
||||||
off_t offset_out,
|
off_t offset_out,
|
||||||
size_t size,
|
size_t size,
|
||||||
int flags);
|
int flags);
|
||||||
};
|
};
|
||||||
|
|
||||||
/** Extra context that may be needed by some filesystems
|
/** Extra context that may be needed by some filesystems
|
||||||
|
@ -775,10 +785,10 @@ int fuse_fs_getattr(struct fuse_fs *fs,
|
||||||
struct stat *buf,
|
struct stat *buf,
|
||||||
fuse_timeouts_t *timeout);
|
fuse_timeouts_t *timeout);
|
||||||
|
|
||||||
int fuse_fs_fgetattr(struct fuse_fs *fs,
|
int fuse_fs_fgetattr(struct fuse_fs *fs,
|
||||||
struct stat *buf,
|
struct stat *buf,
|
||||||
struct fuse_file_info *fi,
|
fuse_file_info_t *fi,
|
||||||
fuse_timeouts_t *timeout);
|
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);
|
const char *newpath);
|
||||||
|
@ -788,44 +798,44 @@ int fuse_fs_symlink(struct fuse_fs *fs, const char *linkname,
|
||||||
const char *path);
|
const char *path);
|
||||||
int fuse_fs_link(struct fuse_fs *fs, const char *oldpath, const char *newpath);
|
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_release(struct fuse_fs *fs,
|
||||||
struct fuse_file_info *fi);
|
fuse_file_info_t *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);
|
fuse_file_info_t *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);
|
off_t off, fuse_file_info_t *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_bufvec **bufp, size_t size, off_t off,
|
||||||
struct fuse_file_info *fi);
|
fuse_file_info_t *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);
|
size_t size, off_t off, fuse_file_info_t *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_bufvec *buf, off_t off,
|
||||||
struct fuse_file_info *fi);
|
fuse_file_info_t *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);
|
fuse_file_info_t *fi);
|
||||||
int fuse_fs_flush(struct fuse_fs *fs,
|
int fuse_fs_flush(struct fuse_fs *fs,
|
||||||
struct fuse_file_info *fi);
|
fuse_file_info_t *fi);
|
||||||
int fuse_fs_statfs(struct fuse_fs *fs, const char *path, struct statvfs *buf);
|
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_opendir(struct fuse_fs *fs, const char *path,
|
||||||
struct fuse_file_info *fi);
|
fuse_file_info_t *fi);
|
||||||
int fuse_fs_readdir(struct fuse_fs *fs,
|
int fuse_fs_readdir(struct fuse_fs *fs,
|
||||||
struct fuse_file_info *fi,
|
fuse_file_info_t *fi,
|
||||||
fuse_dirents_t *buf);
|
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);
|
fuse_file_info_t *fi);
|
||||||
int fuse_fs_releasedir(struct fuse_fs *fs,
|
int fuse_fs_releasedir(struct fuse_fs *fs,
|
||||||
struct fuse_file_info *fi);
|
fuse_file_info_t *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);
|
fuse_file_info_t *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);
|
fuse_file_info_t *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);
|
fuse_file_info_t *fi, int op);
|
||||||
int fuse_fs_chmod(struct fuse_fs *fs, const char *path, mode_t mode);
|
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_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_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_ftruncate(struct fuse_fs *fs, off_t size,
|
||||||
struct fuse_file_info *fi);
|
fuse_file_info_t *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]);
|
const struct timespec tv[2]);
|
||||||
int fuse_fs_access(struct fuse_fs *fs, const char *path, int mask);
|
int fuse_fs_access(struct fuse_fs *fs, const char *path, int mask);
|
||||||
|
@ -845,24 +855,24 @@ int fuse_fs_removexattr(struct fuse_fs *fs, const char *path,
|
||||||
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);
|
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,
|
fuse_file_info_t *fi, unsigned int flags,
|
||||||
void *data, uint32_t *out_bufsz);
|
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,
|
fuse_file_info_t *fi, fuse_pollhandle_t *ph,
|
||||||
unsigned *reventsp);
|
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);
|
off_t offset, off_t length, fuse_file_info_t *fi);
|
||||||
void fuse_fs_init(struct fuse_fs *fs, struct fuse_conn_info *conn);
|
void fuse_fs_init(struct fuse_fs *fs, struct fuse_conn_info *conn);
|
||||||
void fuse_fs_destroy(struct fuse_fs *fs);
|
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_prepare_hide(struct fuse_fs *fs, const char *path, uint64_t *fh);
|
||||||
int fuse_fs_free_hide(struct fuse_fs *fs, 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,
|
ssize_t fuse_fs_copy_file_range(struct fuse_fs *fs,
|
||||||
struct fuse_file_info *fi_in, off_t off_in,
|
fuse_file_info_t *fi_in, off_t off_in,
|
||||||
struct fuse_file_info *fi_out, off_t off_out,
|
fuse_file_info_t *fi_out, off_t off_out,
|
||||||
size_t len, int flags);
|
size_t len, int flags);
|
||||||
|
|
||||||
int fuse_notify_poll(struct fuse_pollhandle *ph);
|
int fuse_notify_poll(fuse_pollhandle_t *ph);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Create a new fuse filesystem object
|
* Create a new fuse filesystem object
|
||||||
|
|
|
@ -46,8 +46,8 @@ EXTERN_C_BEGIN
|
||||||
*
|
*
|
||||||
* Changed in version 2.5
|
* Changed in version 2.5
|
||||||
*/
|
*/
|
||||||
struct
|
typedef struct fuse_file_info_t fuse_file_info_t;
|
||||||
fuse_file_info
|
struct fuse_file_info_t
|
||||||
{
|
{
|
||||||
/** Open flags. Available in open() and release() */
|
/** Open flags. Available in open() and release() */
|
||||||
int flags;
|
int flags;
|
||||||
|
@ -205,7 +205,8 @@ struct fuse_conn_info {
|
||||||
|
|
||||||
struct fuse_session;
|
struct fuse_session;
|
||||||
struct fuse_chan;
|
struct fuse_chan;
|
||||||
struct fuse_pollhandle;
|
struct fuse_pollhandle_t;
|
||||||
|
typedef struct fuse_pollhandle_t fuse_pollhandle_t;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Create a FUSE mountpoint
|
* Create a FUSE mountpoint
|
||||||
|
@ -271,7 +272,7 @@ int fuse_version(void);
|
||||||
*
|
*
|
||||||
* @param ph the poll handle
|
* @param ph the poll handle
|
||||||
*/
|
*/
|
||||||
void fuse_pollhandle_destroy(struct fuse_pollhandle *ph);
|
void fuse_pollhandle_destroy(fuse_pollhandle_t *ph);
|
||||||
|
|
||||||
/* ----------------------------------------------------------- *
|
/* ----------------------------------------------------------- *
|
||||||
* Data buffer *
|
* Data buffer *
|
||||||
|
|
|
@ -67,63 +67,63 @@ struct fuse_chan;
|
||||||
/** Directory entry parameters supplied to fuse_reply_entry() */
|
/** Directory entry parameters supplied to fuse_reply_entry() */
|
||||||
struct fuse_entry_param
|
struct fuse_entry_param
|
||||||
{
|
{
|
||||||
/** Unique inode number
|
/** Unique inode number
|
||||||
*
|
*
|
||||||
* In lookup, zero means negative entry (from version 2.5)
|
* In lookup, zero means negative entry (from version 2.5)
|
||||||
* Returning ENOENT also means negative entry, but by setting zero
|
* Returning ENOENT also means negative entry, but by setting zero
|
||||||
* ino the kernel may cache negative entries for entry_timeout
|
* ino the kernel may cache negative entries for entry_timeout
|
||||||
* seconds.
|
* seconds.
|
||||||
*/
|
*/
|
||||||
fuse_ino_t ino;
|
fuse_ino_t ino;
|
||||||
|
|
||||||
/** Generation number for this entry.
|
/** Generation number for this entry.
|
||||||
*
|
*
|
||||||
* If the file system will be exported over NFS, the
|
* If the file system will be exported over NFS, the
|
||||||
* ino/generation pairs need to be unique over the file
|
* ino/generation pairs need to be unique over the file
|
||||||
* system's lifetime (rather than just the mount time). So if
|
* system's lifetime (rather than just the mount time). So if
|
||||||
* the file system reuses an inode after it has been deleted,
|
* the file system reuses an inode after it has been deleted,
|
||||||
* it must assign a new, previously unused generation number
|
* it must assign a new, previously unused generation number
|
||||||
* to the inode at the same time.
|
* to the inode at the same time.
|
||||||
*
|
*
|
||||||
* The generation must be non-zero, otherwise FUSE will treat
|
* The generation must be non-zero, otherwise FUSE will treat
|
||||||
* it as an error.
|
* it as an error.
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
uint64_t generation;
|
uint64_t generation;
|
||||||
|
|
||||||
|
|
||||||
/** Inode attributes.
|
/** Inode attributes.
|
||||||
*
|
*
|
||||||
* Even if attr_timeout == 0, attr must be correct. For example,
|
* Even if attr_timeout == 0, attr must be correct. For example,
|
||||||
* for open(), FUSE uses attr.st_size from lookup() to determine
|
* for open(), FUSE uses attr.st_size from lookup() to determine
|
||||||
* how many bytes to request. If this value is not correct,
|
* how many bytes to request. If this value is not correct,
|
||||||
* incorrect data will be returned.
|
* incorrect data will be returned.
|
||||||
*/
|
*/
|
||||||
struct stat attr;
|
struct stat attr;
|
||||||
|
|
||||||
fuse_timeouts_t timeout;
|
fuse_timeouts_t timeout;
|
||||||
};
|
};
|
||||||
|
|
||||||
/** Additional context associated with requests */
|
/** Additional context associated with requests */
|
||||||
struct fuse_ctx
|
struct fuse_ctx
|
||||||
{
|
{
|
||||||
/** User ID of the calling process */
|
/** User ID of the calling process */
|
||||||
uid_t uid;
|
uid_t uid;
|
||||||
|
|
||||||
/** Group ID of the calling process */
|
/** Group ID of the calling process */
|
||||||
gid_t gid;
|
gid_t gid;
|
||||||
|
|
||||||
/** Thread ID of the calling process */
|
/** Thread ID of the calling process */
|
||||||
pid_t pid;
|
pid_t pid;
|
||||||
|
|
||||||
/** Umask of the calling process (introduced in version 2.8) */
|
/** Umask of the calling process (introduced in version 2.8) */
|
||||||
mode_t umask;
|
mode_t umask;
|
||||||
};
|
};
|
||||||
|
|
||||||
struct fuse_forget_data
|
struct fuse_forget_data
|
||||||
{
|
{
|
||||||
fuse_ino_t ino;
|
fuse_ino_t ino;
|
||||||
uint64_t nlookup;
|
uint64_t nlookup;
|
||||||
};
|
};
|
||||||
|
|
||||||
/* ----------------------------------------------------------- *
|
/* ----------------------------------------------------------- *
|
||||||
|
@ -153,78 +153,78 @@ uint64_t nlookup;
|
||||||
*/
|
*/
|
||||||
struct fuse_lowlevel_ops
|
struct fuse_lowlevel_ops
|
||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
* Initialize filesystem
|
* Initialize filesystem
|
||||||
*
|
*
|
||||||
* Called before any other filesystem method
|
* Called before any other filesystem method
|
||||||
*
|
*
|
||||||
* There's no reply to this function
|
* There's no reply to this function
|
||||||
*
|
*
|
||||||
* @param userdata the user data passed to fuse_lowlevel_new()
|
* @param userdata the user data passed to fuse_lowlevel_new()
|
||||||
*/
|
*/
|
||||||
void (*init) (void *userdata, struct fuse_conn_info *conn);
|
void (*init)(void *userdata, struct fuse_conn_info *conn);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Clean up filesystem
|
* Clean up filesystem
|
||||||
*
|
*
|
||||||
* Called on filesystem exit
|
* Called on filesystem exit
|
||||||
*
|
*
|
||||||
* There's no reply to this function
|
* There's no reply to this function
|
||||||
*
|
*
|
||||||
* @param userdata the user data passed to fuse_lowlevel_new()
|
* @param userdata the user data passed to fuse_lowlevel_new()
|
||||||
*/
|
*/
|
||||||
void (*destroy) (void *userdata);
|
void (*destroy)(void *userdata);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Look up a directory entry by name and get its attributes.
|
* Look up a directory entry by name and get its attributes.
|
||||||
*
|
*
|
||||||
* Valid replies:
|
* Valid replies:
|
||||||
* fuse_reply_entry
|
* fuse_reply_entry
|
||||||
* fuse_reply_err
|
* fuse_reply_err
|
||||||
*
|
*
|
||||||
* @param req request handle
|
* @param req request handle
|
||||||
* @param parent inode number of the parent directory
|
* @param parent inode number of the parent directory
|
||||||
* @param name the name to look up
|
* @param name the name to look up
|
||||||
*/
|
*/
|
||||||
void (*lookup) (fuse_req_t req, fuse_ino_t parent, const char *name);
|
void (*lookup)(fuse_req_t req, fuse_ino_t parent, const char *name);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Forget about an inode
|
* Forget about an inode
|
||||||
*
|
*
|
||||||
* This function is called when the kernel removes an inode
|
* This function is called when the kernel removes an inode
|
||||||
* from its internal caches.
|
* from its internal caches.
|
||||||
*
|
*
|
||||||
* The inode's lookup count increases by one for every call to
|
* The inode's lookup count increases by one for every call to
|
||||||
* fuse_reply_entry and fuse_reply_create. The nlookup parameter
|
* fuse_reply_entry and fuse_reply_create. The nlookup parameter
|
||||||
* indicates by how much the lookup count should be decreased.
|
* indicates by how much the lookup count should be decreased.
|
||||||
*
|
*
|
||||||
* Inodes with a non-zero lookup count may receive request from
|
* Inodes with a non-zero lookup count may receive request from
|
||||||
* the kernel even after calls to unlink, rmdir or (when
|
* the kernel even after calls to unlink, rmdir or (when
|
||||||
* overwriting an existing file) rename. Filesystems must handle
|
* overwriting an existing file) rename. Filesystems must handle
|
||||||
* such requests properly and it is recommended to defer removal
|
* such requests properly and it is recommended to defer removal
|
||||||
* of the inode until the lookup count reaches zero. Calls to
|
* of the inode until the lookup count reaches zero. Calls to
|
||||||
* unlink, remdir or rename will be followed closely by forget
|
* unlink, remdir or rename will be followed closely by forget
|
||||||
* unless the file or directory is open, in which case the
|
* unless the file or directory is open, in which case the
|
||||||
* kernel issues forget only after the release or releasedir
|
* kernel issues forget only after the release or releasedir
|
||||||
* calls.
|
* calls.
|
||||||
*
|
*
|
||||||
* Note that if a file system will be exported over NFS the
|
* Note that if a file system will be exported over NFS the
|
||||||
* inodes lifetime must extend even beyond forget. See the
|
* inodes lifetime must extend even beyond forget. See the
|
||||||
* generation field in struct fuse_entry_param above.
|
* generation field in struct fuse_entry_param above.
|
||||||
*
|
*
|
||||||
* On unmount the lookup count for all inodes implicitly drops
|
* On unmount the lookup count for all inodes implicitly drops
|
||||||
* to zero. It is not guaranteed that the file system will
|
* to zero. It is not guaranteed that the file system will
|
||||||
* receive corresponding forget messages for the affected
|
* receive corresponding forget messages for the affected
|
||||||
* inodes.
|
* inodes.
|
||||||
*
|
*
|
||||||
* Valid replies:
|
* Valid replies:
|
||||||
* fuse_reply_none
|
* fuse_reply_none
|
||||||
*
|
*
|
||||||
* @param req request handle
|
* @param req request handle
|
||||||
* @param ino the inode number
|
* @param ino the inode number
|
||||||
* @param nlookup the number of lookups to forget
|
* @param nlookup the number of lookups to forget
|
||||||
*/
|
*/
|
||||||
void (*forget) (fuse_req_t req, fuse_ino_t ino, uint64_t nlookup);
|
void (*forget)(fuse_req_t req, fuse_ino_t ino, uint64_t nlookup);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get file attributes
|
* Get file attributes
|
||||||
|
@ -237,8 +237,8 @@ void (*lookup) (fuse_req_t req, fuse_ino_t parent, const char *name);
|
||||||
* @param ino the inode number
|
* @param ino the inode number
|
||||||
* @param fi for future use, currently always NULL
|
* @param fi for future use, currently always NULL
|
||||||
*/
|
*/
|
||||||
void (*getattr) (fuse_req_t req, fuse_ino_t ino,
|
void (*getattr)(fuse_req_t req, fuse_ino_t ino,
|
||||||
struct fuse_file_info *fi);
|
fuse_file_info_t *fi);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Set file attributes
|
* Set file attributes
|
||||||
|
@ -267,8 +267,8 @@ void (*lookup) (fuse_req_t req, fuse_ino_t parent, const char *name);
|
||||||
* Changed in version 2.5:
|
* Changed in version 2.5:
|
||||||
* file information filled in for ftruncate
|
* file information filled in for ftruncate
|
||||||
*/
|
*/
|
||||||
void (*setattr) (fuse_req_t req, fuse_ino_t ino, struct stat *attr,
|
void (*setattr)(fuse_req_t req, fuse_ino_t ino, struct stat *attr,
|
||||||
int to_set, struct fuse_file_info *fi);
|
int to_set, fuse_file_info_t *fi);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Read symbolic link
|
* Read symbolic link
|
||||||
|
@ -280,7 +280,7 @@ void (*lookup) (fuse_req_t req, fuse_ino_t parent, const char *name);
|
||||||
* @param req request handle
|
* @param req request handle
|
||||||
* @param ino the inode number
|
* @param ino the inode number
|
||||||
*/
|
*/
|
||||||
void (*readlink) (fuse_req_t req, fuse_ino_t ino);
|
void (*readlink)(fuse_req_t req, fuse_ino_t ino);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Create file node
|
* Create file node
|
||||||
|
@ -298,8 +298,8 @@ void (*lookup) (fuse_req_t req, fuse_ino_t parent, const char *name);
|
||||||
* @param mode file type and mode with which to create the new file
|
* @param mode file type and mode with which to create the new file
|
||||||
* @param rdev the device number (only valid if created file is a device)
|
* @param rdev the device number (only valid if created file is a device)
|
||||||
*/
|
*/
|
||||||
void (*mknod) (fuse_req_t req, fuse_ino_t parent, const char *name,
|
void (*mknod)(fuse_req_t req, fuse_ino_t parent, const char *name,
|
||||||
mode_t mode, dev_t rdev);
|
mode_t mode, dev_t rdev);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Create a directory
|
* Create a directory
|
||||||
|
@ -313,8 +313,8 @@ void (*lookup) (fuse_req_t req, fuse_ino_t parent, const char *name);
|
||||||
* @param name to create
|
* @param name to create
|
||||||
* @param mode with which to create the new file
|
* @param mode with which to create the new file
|
||||||
*/
|
*/
|
||||||
void (*mkdir) (fuse_req_t req, fuse_ino_t parent, const char *name,
|
void (*mkdir)(fuse_req_t req, fuse_ino_t parent, const char *name,
|
||||||
mode_t mode);
|
mode_t mode);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Remove a file
|
* Remove a file
|
||||||
|
@ -331,7 +331,7 @@ void (*lookup) (fuse_req_t req, fuse_ino_t parent, const char *name);
|
||||||
* @param parent inode number of the parent directory
|
* @param parent inode number of the parent directory
|
||||||
* @param name to remove
|
* @param name to remove
|
||||||
*/
|
*/
|
||||||
void (*unlink) (fuse_req_t req, fuse_ino_t parent, const char *name);
|
void (*unlink)(fuse_req_t req, fuse_ino_t parent, const char *name);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Remove a directory
|
* Remove a directory
|
||||||
|
@ -348,7 +348,7 @@ void (*lookup) (fuse_req_t req, fuse_ino_t parent, const char *name);
|
||||||
* @param parent inode number of the parent directory
|
* @param parent inode number of the parent directory
|
||||||
* @param name to remove
|
* @param name to remove
|
||||||
*/
|
*/
|
||||||
void (*rmdir) (fuse_req_t req, fuse_ino_t parent, const char *name);
|
void (*rmdir)(fuse_req_t req, fuse_ino_t parent, const char *name);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Create a symbolic link
|
* Create a symbolic link
|
||||||
|
@ -362,8 +362,8 @@ void (*lookup) (fuse_req_t req, fuse_ino_t parent, const char *name);
|
||||||
* @param parent inode number of the parent directory
|
* @param parent inode number of the parent directory
|
||||||
* @param name to create
|
* @param name to create
|
||||||
*/
|
*/
|
||||||
void (*symlink) (fuse_req_t req, const char *link, fuse_ino_t parent,
|
void (*symlink)(fuse_req_t req, const char *link, fuse_ino_t parent,
|
||||||
const char *name);
|
const char *name);
|
||||||
|
|
||||||
/** Rename a file
|
/** Rename a file
|
||||||
*
|
*
|
||||||
|
@ -382,8 +382,8 @@ void (*lookup) (fuse_req_t req, fuse_ino_t parent, const char *name);
|
||||||
* @param newparent inode number of the new parent directory
|
* @param newparent inode number of the new parent directory
|
||||||
* @param newname new name
|
* @param newname new name
|
||||||
*/
|
*/
|
||||||
void (*rename) (fuse_req_t req, fuse_ino_t parent, const char *name,
|
void (*rename)(fuse_req_t req, fuse_ino_t parent, const char *name,
|
||||||
fuse_ino_t newparent, const char *newname);
|
fuse_ino_t newparent, const char *newname);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Create a hard link
|
* Create a hard link
|
||||||
|
@ -397,8 +397,8 @@ void (*lookup) (fuse_req_t req, fuse_ino_t parent, const char *name);
|
||||||
* @param newparent inode number of the new parent directory
|
* @param newparent inode number of the new parent directory
|
||||||
* @param newname new name to create
|
* @param newname new name to create
|
||||||
*/
|
*/
|
||||||
void (*link) (fuse_req_t req, fuse_ino_t ino, fuse_ino_t newparent,
|
void (*link)(fuse_req_t req, fuse_ino_t ino, fuse_ino_t newparent,
|
||||||
const char *newname);
|
const char *newname);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Open a file
|
* Open a file
|
||||||
|
@ -425,8 +425,8 @@ void (*lookup) (fuse_req_t req, fuse_ino_t parent, const char *name);
|
||||||
* @param ino the inode number
|
* @param ino the inode number
|
||||||
* @param fi file information
|
* @param fi file information
|
||||||
*/
|
*/
|
||||||
void (*open) (fuse_req_t req, fuse_ino_t ino,
|
void (*open)(fuse_req_t req, fuse_ino_t ino,
|
||||||
struct fuse_file_info *fi);
|
fuse_file_info_t *fi);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Read data
|
* Read data
|
||||||
|
@ -453,8 +453,8 @@ void (*lookup) (fuse_req_t req, fuse_ino_t parent, const char *name);
|
||||||
* @param off offset to read from
|
* @param off offset to read from
|
||||||
* @param fi file information
|
* @param fi file information
|
||||||
*/
|
*/
|
||||||
void (*read) (fuse_req_t req, fuse_ino_t ino, size_t size, off_t off,
|
void (*read)(fuse_req_t req, fuse_ino_t ino, size_t size, off_t off,
|
||||||
struct fuse_file_info *fi);
|
fuse_file_info_t *fi);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Write data
|
* Write data
|
||||||
|
@ -479,8 +479,8 @@ void (*lookup) (fuse_req_t req, fuse_ino_t parent, const char *name);
|
||||||
* @param off offset to write to
|
* @param off offset to write to
|
||||||
* @param fi file information
|
* @param fi file information
|
||||||
*/
|
*/
|
||||||
void (*write) (fuse_req_t req, fuse_ino_t ino, const char *buf,
|
void (*write)(fuse_req_t req, fuse_ino_t ino, const char *buf,
|
||||||
size_t size, off_t off, struct fuse_file_info *fi);
|
size_t size, off_t off, fuse_file_info_t *fi);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Flush method
|
* Flush method
|
||||||
|
@ -511,8 +511,8 @@ void (*lookup) (fuse_req_t req, fuse_ino_t parent, const char *name);
|
||||||
* @param ino the inode number
|
* @param ino the inode number
|
||||||
* @param fi file information
|
* @param fi file information
|
||||||
*/
|
*/
|
||||||
void (*flush) (fuse_req_t req, fuse_ino_t ino,
|
void (*flush)(fuse_req_t req, fuse_ino_t ino,
|
||||||
struct fuse_file_info *fi);
|
fuse_file_info_t *fi);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Release an open file
|
* Release an open file
|
||||||
|
@ -538,8 +538,8 @@ void (*lookup) (fuse_req_t req, fuse_ino_t parent, const char *name);
|
||||||
* @param ino the inode number
|
* @param ino the inode number
|
||||||
* @param fi file information
|
* @param fi file information
|
||||||
*/
|
*/
|
||||||
void (*release) (fuse_req_t req, fuse_ino_t ino,
|
void (*release)(fuse_req_t req, fuse_ino_t ino,
|
||||||
struct fuse_file_info *fi);
|
fuse_file_info_t *fi);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Synchronize file contents
|
* Synchronize file contents
|
||||||
|
@ -555,8 +555,8 @@ void (*lookup) (fuse_req_t req, fuse_ino_t parent, const char *name);
|
||||||
* @param datasync flag indicating if only data should be flushed
|
* @param datasync flag indicating if only data should be flushed
|
||||||
* @param fi file information
|
* @param fi file information
|
||||||
*/
|
*/
|
||||||
void (*fsync) (fuse_req_t req, fuse_ino_t ino, int datasync,
|
void (*fsync)(fuse_req_t req, fuse_ino_t ino, int datasync,
|
||||||
struct fuse_file_info *fi);
|
fuse_file_info_t *fi);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Open a directory
|
* Open a directory
|
||||||
|
@ -579,8 +579,8 @@ void (*lookup) (fuse_req_t req, fuse_ino_t parent, const char *name);
|
||||||
* @param ino the inode number
|
* @param ino the inode number
|
||||||
* @param fi file information
|
* @param fi file information
|
||||||
*/
|
*/
|
||||||
void (*opendir) (fuse_req_t req, fuse_ino_t ino,
|
void (*opendir)(fuse_req_t req, fuse_ino_t ino,
|
||||||
struct fuse_file_info *fi);
|
fuse_file_info_t *fi);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Read directory
|
* Read directory
|
||||||
|
@ -603,12 +603,12 @@ void (*lookup) (fuse_req_t req, fuse_ino_t parent, const char *name);
|
||||||
* @param off offset to continue reading the directory stream
|
* @param off offset to continue reading the directory stream
|
||||||
* @param fi file information
|
* @param fi file information
|
||||||
*/
|
*/
|
||||||
void (*readdir) (fuse_req_t req, fuse_ino_t ino, size_t size, off_t off,
|
void (*readdir)(fuse_req_t req, fuse_ino_t ino, size_t size, off_t off,
|
||||||
struct fuse_file_info *llffi);
|
fuse_file_info_t *llffi);
|
||||||
|
|
||||||
void (*readdir_plus)(fuse_req_t req, fuse_ino_t ino,
|
void (*readdir_plus)(fuse_req_t req, fuse_ino_t ino,
|
||||||
size_t size, off_t off,
|
size_t size, off_t off,
|
||||||
struct fuse_file_info *ffi);
|
fuse_file_info_t *ffi);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Release an open directory
|
* Release an open directory
|
||||||
|
@ -626,8 +626,8 @@ void (*lookup) (fuse_req_t req, fuse_ino_t parent, const char *name);
|
||||||
* @param ino the inode number
|
* @param ino the inode number
|
||||||
* @param fi file information
|
* @param fi file information
|
||||||
*/
|
*/
|
||||||
void (*releasedir) (fuse_req_t req, fuse_ino_t ino,
|
void (*releasedir)(fuse_req_t req, fuse_ino_t ino,
|
||||||
struct fuse_file_info *fi);
|
fuse_file_info_t *fi);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Synchronize directory contents
|
* Synchronize directory contents
|
||||||
|
@ -646,8 +646,8 @@ void (*lookup) (fuse_req_t req, fuse_ino_t parent, const char *name);
|
||||||
* @param datasync flag indicating if only data should be flushed
|
* @param datasync flag indicating if only data should be flushed
|
||||||
* @param fi file information
|
* @param fi file information
|
||||||
*/
|
*/
|
||||||
void (*fsyncdir) (fuse_req_t req, fuse_ino_t ino, int datasync,
|
void (*fsyncdir)(fuse_req_t req, fuse_ino_t ino, int datasync,
|
||||||
struct fuse_file_info *fi);
|
fuse_file_info_t *fi);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get file system statistics
|
* Get file system statistics
|
||||||
|
@ -659,7 +659,7 @@ void (*lookup) (fuse_req_t req, fuse_ino_t parent, const char *name);
|
||||||
* @param req request handle
|
* @param req request handle
|
||||||
* @param ino the inode number, zero means "undefined"
|
* @param ino the inode number, zero means "undefined"
|
||||||
*/
|
*/
|
||||||
void (*statfs) (fuse_req_t req, fuse_ino_t ino);
|
void (*statfs)(fuse_req_t req, fuse_ino_t ino);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Set an extended attribute
|
* Set an extended attribute
|
||||||
|
@ -667,8 +667,8 @@ void (*lookup) (fuse_req_t req, fuse_ino_t parent, const char *name);
|
||||||
* Valid replies:
|
* Valid replies:
|
||||||
* fuse_reply_err
|
* fuse_reply_err
|
||||||
*/
|
*/
|
||||||
void (*setxattr) (fuse_req_t req, fuse_ino_t ino, const char *name,
|
void (*setxattr)(fuse_req_t req, fuse_ino_t ino, const char *name,
|
||||||
const char *value, size_t size, int flags);
|
const char *value, size_t size, int flags);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get an extended attribute
|
* Get an extended attribute
|
||||||
|
@ -693,8 +693,8 @@ void (*lookup) (fuse_req_t req, fuse_ino_t parent, const char *name);
|
||||||
* @param name of the extended attribute
|
* @param name of the extended attribute
|
||||||
* @param size maximum size of the value to send
|
* @param size maximum size of the value to send
|
||||||
*/
|
*/
|
||||||
void (*getxattr) (fuse_req_t req, fuse_ino_t ino, const char *name,
|
void (*getxattr)(fuse_req_t req, fuse_ino_t ino, const char *name,
|
||||||
size_t size);
|
size_t size);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* List extended attribute names
|
* List extended attribute names
|
||||||
|
@ -719,7 +719,7 @@ void (*lookup) (fuse_req_t req, fuse_ino_t parent, const char *name);
|
||||||
* @param ino the inode number
|
* @param ino the inode number
|
||||||
* @param size maximum size of the list to send
|
* @param size maximum size of the list to send
|
||||||
*/
|
*/
|
||||||
void (*listxattr) (fuse_req_t req, fuse_ino_t ino, size_t size);
|
void (*listxattr)(fuse_req_t req, fuse_ino_t ino, size_t size);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Remove an extended attribute
|
* Remove an extended attribute
|
||||||
|
@ -731,7 +731,7 @@ void (*lookup) (fuse_req_t req, fuse_ino_t parent, const char *name);
|
||||||
* @param ino the inode number
|
* @param ino the inode number
|
||||||
* @param name of the extended attribute
|
* @param name of the extended attribute
|
||||||
*/
|
*/
|
||||||
void (*removexattr) (fuse_req_t req, fuse_ino_t ino, const char *name);
|
void (*removexattr)(fuse_req_t req, fuse_ino_t ino, const char *name);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Check file access permissions
|
* Check file access permissions
|
||||||
|
@ -751,7 +751,7 @@ void (*lookup) (fuse_req_t req, fuse_ino_t parent, const char *name);
|
||||||
* @param ino the inode number
|
* @param ino the inode number
|
||||||
* @param mask requested access mode
|
* @param mask requested access mode
|
||||||
*/
|
*/
|
||||||
void (*access) (fuse_req_t req, fuse_ino_t ino, int mask);
|
void (*access)(fuse_req_t req, fuse_ino_t ino, int mask);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Create and open a file
|
* Create and open a file
|
||||||
|
@ -786,8 +786,8 @@ void (*lookup) (fuse_req_t req, fuse_ino_t parent, const char *name);
|
||||||
* @param mode file type and mode with which to create the new file
|
* @param mode file type and mode with which to create the new file
|
||||||
* @param fi file information
|
* @param fi file information
|
||||||
*/
|
*/
|
||||||
void (*create) (fuse_req_t req, fuse_ino_t parent, const char *name,
|
void (*create)(fuse_req_t req, fuse_ino_t parent, const char *name,
|
||||||
mode_t mode, struct fuse_file_info *fi);
|
mode_t mode, fuse_file_info_t *fi);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Test for a POSIX file lock
|
* Test for a POSIX file lock
|
||||||
|
@ -803,8 +803,8 @@ void (*lookup) (fuse_req_t req, fuse_ino_t parent, const char *name);
|
||||||
* @param fi file information
|
* @param fi file information
|
||||||
* @param lock the region/type to test
|
* @param lock the region/type to test
|
||||||
*/
|
*/
|
||||||
void (*getlk) (fuse_req_t req, fuse_ino_t ino,
|
void (*getlk)(fuse_req_t req, fuse_ino_t ino,
|
||||||
struct fuse_file_info *fi, struct flock *lock);
|
fuse_file_info_t *fi, struct flock *lock);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Acquire, modify or release a POSIX file lock
|
* Acquire, modify or release a POSIX file lock
|
||||||
|
@ -830,9 +830,9 @@ void (*lookup) (fuse_req_t req, fuse_ino_t parent, const char *name);
|
||||||
* @param lock the region/type to set
|
* @param lock the region/type to set
|
||||||
* @param sleep locking operation may sleep
|
* @param sleep locking operation may sleep
|
||||||
*/
|
*/
|
||||||
void (*setlk) (fuse_req_t req, fuse_ino_t ino,
|
void (*setlk)(fuse_req_t req, fuse_ino_t ino,
|
||||||
struct fuse_file_info *fi,
|
fuse_file_info_t *fi,
|
||||||
struct flock *lock, int sleep);
|
struct flock *lock, int sleep);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Map block index within file to block index within device
|
* Map block index within file to block index within device
|
||||||
|
@ -851,8 +851,8 @@ void (*lookup) (fuse_req_t req, fuse_ino_t parent, const char *name);
|
||||||
* @param blocksize unit of block index
|
* @param blocksize unit of block index
|
||||||
* @param idx block index within file
|
* @param idx block index within file
|
||||||
*/
|
*/
|
||||||
void (*bmap) (fuse_req_t req, fuse_ino_t ino, size_t blocksize,
|
void (*bmap)(fuse_req_t req, fuse_ino_t ino, size_t blocksize,
|
||||||
uint64_t idx);
|
uint64_t idx);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Ioctl
|
* Ioctl
|
||||||
|
@ -881,9 +881,9 @@ void (*lookup) (fuse_req_t req, fuse_ino_t parent, const char *name);
|
||||||
* @param in_bufsz number of fetched bytes
|
* @param in_bufsz number of fetched bytes
|
||||||
* @param out_bufsz maximum size of output data
|
* @param out_bufsz maximum size of output data
|
||||||
*/
|
*/
|
||||||
void (*ioctl) (fuse_req_t req, fuse_ino_t ino, unsigned long cmd, void *arg,
|
void (*ioctl)(fuse_req_t req, fuse_ino_t ino, unsigned long cmd, void *arg,
|
||||||
struct fuse_file_info *fi, unsigned flags,
|
fuse_file_info_t *fi, unsigned flags,
|
||||||
const void *in_buf, uint32_t in_bufsz, uint32_t out_bufsz);
|
const void *in_buf, uint32_t in_bufsz, uint32_t out_bufsz);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Poll for IO readiness
|
* Poll for IO readiness
|
||||||
|
@ -911,8 +911,10 @@ void (*lookup) (fuse_req_t req, fuse_ino_t parent, const char *name);
|
||||||
* @param fi file information
|
* @param fi file information
|
||||||
* @param ph poll handle to be used for notification
|
* @param ph poll handle to be used for notification
|
||||||
*/
|
*/
|
||||||
void (*poll) (fuse_req_t req, fuse_ino_t ino, struct fuse_file_info *fi,
|
void (*poll)(fuse_req_t req,
|
||||||
struct fuse_pollhandle *ph);
|
fuse_ino_t ino,
|
||||||
|
fuse_file_info_t *fi,
|
||||||
|
fuse_pollhandle_t *ph);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Write data made available in a buffer
|
* Write data made available in a buffer
|
||||||
|
@ -940,9 +942,9 @@ void (*lookup) (fuse_req_t req, fuse_ino_t parent, const char *name);
|
||||||
* @param off offset to write to
|
* @param off offset to write to
|
||||||
* @param fi file information
|
* @param fi file information
|
||||||
*/
|
*/
|
||||||
void (*write_buf) (fuse_req_t req, fuse_ino_t ino,
|
void (*write_buf)(fuse_req_t req, fuse_ino_t ino,
|
||||||
struct fuse_bufvec *bufv, off_t off,
|
struct fuse_bufvec *bufv, off_t off,
|
||||||
struct fuse_file_info *fi);
|
fuse_file_info_t *fi);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Callback function for the retrieve request
|
* Callback function for the retrieve request
|
||||||
|
@ -958,8 +960,8 @@ void (*lookup) (fuse_req_t req, fuse_ino_t parent, const char *name);
|
||||||
* @param offset the offset supplied to fuse_lowlevel_notify_retrieve()
|
* @param offset the offset supplied to fuse_lowlevel_notify_retrieve()
|
||||||
* @param bufv the buffer containing the returned data
|
* @param bufv the buffer containing the returned data
|
||||||
*/
|
*/
|
||||||
void (*retrieve_reply) (fuse_req_t req, void *cookie, fuse_ino_t ino,
|
void (*retrieve_reply)(fuse_req_t req, void *cookie, fuse_ino_t ino,
|
||||||
off_t offset, struct fuse_bufvec *bufv);
|
off_t offset, struct fuse_bufvec *bufv);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Forget about multiple inodes
|
* Forget about multiple inodes
|
||||||
|
@ -974,8 +976,8 @@ void (*lookup) (fuse_req_t req, fuse_ino_t parent, const char *name);
|
||||||
*
|
*
|
||||||
* @param req request handle
|
* @param req request handle
|
||||||
*/
|
*/
|
||||||
void (*forget_multi) (fuse_req_t req, size_t count,
|
void (*forget_multi)(fuse_req_t req, size_t count,
|
||||||
struct fuse_forget_data *forgets);
|
struct fuse_forget_data *forgets);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Acquire, modify or release a BSD file lock
|
* Acquire, modify or release a BSD file lock
|
||||||
|
@ -994,8 +996,8 @@ void (*lookup) (fuse_req_t req, fuse_ino_t parent, const char *name);
|
||||||
* @param fi file information
|
* @param fi file information
|
||||||
* @param op the locking operation, see flock(2)
|
* @param op the locking operation, see flock(2)
|
||||||
*/
|
*/
|
||||||
void (*flock) (fuse_req_t req, fuse_ino_t ino,
|
void (*flock)(fuse_req_t req, fuse_ino_t ino,
|
||||||
struct fuse_file_info *fi, int op);
|
fuse_file_info_t *fi, int op);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Allocate requested space. If this function returns success then
|
* Allocate requested space. If this function returns success then
|
||||||
|
@ -1014,8 +1016,8 @@ void (*lookup) (fuse_req_t req, fuse_ino_t parent, const char *name);
|
||||||
* @param mode determines the operation to be performed on the given range,
|
* @param mode determines the operation to be performed on the given range,
|
||||||
* see fallocate(2)
|
* see fallocate(2)
|
||||||
*/
|
*/
|
||||||
void (*fallocate) (fuse_req_t req, fuse_ino_t ino, int mode,
|
void (*fallocate)(fuse_req_t req, fuse_ino_t ino, int mode,
|
||||||
off_t offset, off_t length, struct fuse_file_info *fi);
|
off_t offset, off_t length, fuse_file_info_t *fi);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Copy a range of data from one file to another
|
* Copy a range of data from one file to another
|
||||||
|
@ -1053,15 +1055,15 @@ void (*lookup) (fuse_req_t req, fuse_ino_t parent, const char *name);
|
||||||
* @param len maximum size of the data to copy
|
* @param len maximum size of the data to copy
|
||||||
* @param flags passed along with the copy_file_range() syscall
|
* @param flags passed along with the copy_file_range() syscall
|
||||||
*/
|
*/
|
||||||
void (*copy_file_range)(fuse_req_t req,
|
void (*copy_file_range)(fuse_req_t req,
|
||||||
fuse_ino_t ino_in,
|
fuse_ino_t ino_in,
|
||||||
off_t off_in,
|
off_t off_in,
|
||||||
struct fuse_file_info *fi_in,
|
fuse_file_info_t *fi_in,
|
||||||
fuse_ino_t ino_out,
|
fuse_ino_t ino_out,
|
||||||
off_t off_out,
|
off_t off_out,
|
||||||
struct fuse_file_info *fi_out,
|
fuse_file_info_t *fi_out,
|
||||||
size_t len,
|
size_t len,
|
||||||
int flags);
|
int flags);
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -1122,7 +1124,7 @@ int fuse_reply_entry(fuse_req_t req, const struct fuse_entry_param *e);
|
||||||
* @return zero for success, -errno for failure to send reply
|
* @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);
|
const fuse_file_info_t *fi);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Reply with attributes
|
* Reply with attributes
|
||||||
|
@ -1164,7 +1166,7 @@ int fuse_reply_readlink(fuse_req_t req, const char *link);
|
||||||
* @param fi file information
|
* @param fi file information
|
||||||
* @return zero for success, -errno for failure to send reply
|
* @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 fuse_file_info_t *fi);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Reply with number of bytes written
|
* Reply with number of bytes written
|
||||||
|
@ -1331,7 +1333,7 @@ int fuse_reply_poll(fuse_req_t req, unsigned revents);
|
||||||
*
|
*
|
||||||
* @param ph poll handle to notify IO readiness event for
|
* @param ph poll handle to notify IO readiness event for
|
||||||
*/
|
*/
|
||||||
int fuse_lowlevel_notify_poll(struct fuse_pollhandle *ph);
|
int fuse_lowlevel_notify_poll(fuse_pollhandle_t *ph);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Notify to invalidate cache for an inode
|
* Notify to invalidate cache for an inode
|
||||||
|
@ -1549,8 +1551,8 @@ struct fuse_session_ops
|
||||||
* @param len request length
|
* @param len request length
|
||||||
* @param ch channel on which the request was received
|
* @param ch channel on which the request was received
|
||||||
*/
|
*/
|
||||||
void (*process) (void *data, const char *buf, size_t len,
|
void (*process)(void *data, const char *buf, size_t len,
|
||||||
struct fuse_chan *ch);
|
struct fuse_chan *ch);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Hook for session exit and reset (optional)
|
* Hook for session exit and reset (optional)
|
||||||
|
@ -1558,7 +1560,7 @@ struct fuse_session_ops
|
||||||
* @param data user data passed to fuse_session_new()
|
* @param data user data passed to fuse_session_new()
|
||||||
* @param val exited status (1 - exited, 0 - not exited)
|
* @param val exited status (1 - exited, 0 - not exited)
|
||||||
*/
|
*/
|
||||||
void (*exit) (void *data, int val);
|
void (*exit)(void *data, int val);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Hook for querying the current exited status (optional)
|
* Hook for querying the current exited status (optional)
|
||||||
|
@ -1566,14 +1568,14 @@ struct fuse_session_ops
|
||||||
* @param data user data passed to fuse_session_new()
|
* @param data user data passed to fuse_session_new()
|
||||||
* @return 1 if exited, 0 if not exited
|
* @return 1 if exited, 0 if not exited
|
||||||
*/
|
*/
|
||||||
int (*exited) (void *data);
|
int (*exited)(void *data);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Hook for cleaning up the channel on destroy (optional)
|
* Hook for cleaning up the channel on destroy (optional)
|
||||||
*
|
*
|
||||||
* @param data user data passed to fuse_session_new()
|
* @param data user data passed to fuse_session_new()
|
||||||
*/
|
*/
|
||||||
void (*destroy) (void *data);
|
void (*destroy)(void *data);
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
4849
libfuse/lib/fuse.c
4849
libfuse/lib/fuse.c
File diff suppressed because it is too large
Load Diff
|
@ -6,25 +6,26 @@
|
||||||
See the file COPYING.LIB.
|
See the file COPYING.LIB.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
#include "fuse_i.h"
|
||||||
|
#include "fuse_kernel.h"
|
||||||
#include "fuse_lowlevel.h"
|
#include "fuse_lowlevel.h"
|
||||||
#include "fuse_misc.h"
|
#include "fuse_misc.h"
|
||||||
#include "fuse_kernel.h"
|
|
||||||
#include "fuse_i.h"
|
|
||||||
|
|
||||||
|
#include <errno.h>
|
||||||
|
#include <semaphore.h>
|
||||||
|
#include <signal.h>
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include <unistd.h>
|
|
||||||
#include <signal.h>
|
|
||||||
#include <semaphore.h>
|
|
||||||
#include <errno.h>
|
|
||||||
#include <sys/time.h>
|
#include <sys/time.h>
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
|
#include <unistd.h>
|
||||||
|
|
||||||
/* Environment var controlling the thread stack size */
|
/* Environment var controlling the thread stack size */
|
||||||
#define ENVNAME_THREAD_STACK "FUSE_THREAD_STACK"
|
#define ENVNAME_THREAD_STACK "FUSE_THREAD_STACK"
|
||||||
|
|
||||||
struct fuse_worker {
|
struct fuse_worker
|
||||||
|
{
|
||||||
struct fuse_worker *prev;
|
struct fuse_worker *prev;
|
||||||
struct fuse_worker *next;
|
struct fuse_worker *next;
|
||||||
pthread_t thread_id;
|
pthread_t thread_id;
|
||||||
|
@ -33,7 +34,8 @@ struct fuse_worker {
|
||||||
struct fuse_mt *mt;
|
struct fuse_mt *mt;
|
||||||
};
|
};
|
||||||
|
|
||||||
struct fuse_mt {
|
struct fuse_mt
|
||||||
|
{
|
||||||
struct fuse_session *se;
|
struct fuse_session *se;
|
||||||
struct fuse_chan *prevch;
|
struct fuse_chan *prevch;
|
||||||
struct fuse_worker main;
|
struct fuse_worker main;
|
||||||
|
@ -42,7 +44,10 @@ struct fuse_mt {
|
||||||
int error;
|
int error;
|
||||||
};
|
};
|
||||||
|
|
||||||
static void list_add_worker(struct fuse_worker *w, struct fuse_worker *next)
|
static
|
||||||
|
void
|
||||||
|
list_add_worker(struct fuse_worker *w,
|
||||||
|
struct fuse_worker *next)
|
||||||
{
|
{
|
||||||
struct fuse_worker *prev = next->prev;
|
struct fuse_worker *prev = next->prev;
|
||||||
w->next = next;
|
w->next = next;
|
||||||
|
@ -61,38 +66,41 @@ static void list_del_worker(struct fuse_worker *w)
|
||||||
|
|
||||||
static int fuse_loop_start_thread(struct fuse_mt *mt);
|
static int fuse_loop_start_thread(struct fuse_mt *mt);
|
||||||
|
|
||||||
static void *fuse_do_work(void *data)
|
static
|
||||||
|
void*
|
||||||
|
fuse_do_work(void *data)
|
||||||
{
|
{
|
||||||
struct fuse_worker *w = (struct fuse_worker *) data;
|
struct fuse_worker *w = (struct fuse_worker *) data;
|
||||||
struct fuse_mt *mt = w->mt;
|
struct fuse_mt *mt = w->mt;
|
||||||
|
|
||||||
while (!fuse_session_exited(mt->se)) {
|
while(!fuse_session_exited(mt->se))
|
||||||
struct fuse_chan *ch = mt->prevch;
|
{
|
||||||
struct fuse_buf fbuf = {
|
int res;
|
||||||
.mem = w->buf,
|
struct fuse_buf fbuf;
|
||||||
.size = w->bufsize,
|
struct fuse_chan *ch = mt->prevch;
|
||||||
};
|
|
||||||
int res;
|
|
||||||
|
|
||||||
pthread_setcancelstate(PTHREAD_CANCEL_ENABLE, NULL);
|
fbuf.mem = w->buf;
|
||||||
res = fuse_session_receive_buf(mt->se, &fbuf, &ch);
|
fbuf.size = w->bufsize;
|
||||||
pthread_setcancelstate(PTHREAD_CANCEL_DISABLE, NULL);
|
|
||||||
if (res == -EINTR)
|
pthread_setcancelstate(PTHREAD_CANCEL_ENABLE, NULL);
|
||||||
continue;
|
res = fuse_session_receive_buf(mt->se, &fbuf, &ch);
|
||||||
if (res <= 0) {
|
pthread_setcancelstate(PTHREAD_CANCEL_DISABLE, NULL);
|
||||||
if (res < 0) {
|
if(res == -EINTR)
|
||||||
fuse_session_exit(mt->se);
|
continue;
|
||||||
mt->error = -1;
|
if(res <= 0) {
|
||||||
|
if(res < 0) {
|
||||||
|
fuse_session_exit(mt->se);
|
||||||
|
mt->error = -1;
|
||||||
|
}
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
break;
|
|
||||||
|
if(mt->exit)
|
||||||
|
return NULL;
|
||||||
|
|
||||||
|
fuse_session_process_buf(mt->se, &fbuf, ch);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (mt->exit)
|
|
||||||
return NULL;
|
|
||||||
|
|
||||||
fuse_session_process_buf(mt->se, &fbuf, ch);
|
|
||||||
}
|
|
||||||
|
|
||||||
sem_post(&mt->finish);
|
sem_post(&mt->finish);
|
||||||
|
|
||||||
return NULL;
|
return NULL;
|
||||||
|
@ -109,20 +117,16 @@ int fuse_start_thread(pthread_t *thread_id, void *(*func)(void *), void *arg)
|
||||||
/* Override default stack size */
|
/* Override default stack size */
|
||||||
pthread_attr_init(&attr);
|
pthread_attr_init(&attr);
|
||||||
stack_size = getenv(ENVNAME_THREAD_STACK);
|
stack_size = getenv(ENVNAME_THREAD_STACK);
|
||||||
if (stack_size && pthread_attr_setstacksize(&attr, atoi(stack_size)))
|
if(stack_size && pthread_attr_setstacksize(&attr, atoi(stack_size)))
|
||||||
fprintf(stderr, "fuse: invalid stack size: %s\n", stack_size);
|
fprintf(stderr, "fuse: invalid stack size: %s\n", stack_size);
|
||||||
|
|
||||||
/* Disallow signal reception in worker threads */
|
/* Disallow signal reception in worker threads */
|
||||||
sigemptyset(&newset);
|
sigfillset(&newset);
|
||||||
sigaddset(&newset, SIGTERM);
|
pthread_sigmask(SIG_BLOCK,&newset,&oldset);
|
||||||
sigaddset(&newset, SIGINT);
|
|
||||||
sigaddset(&newset, SIGHUP);
|
|
||||||
sigaddset(&newset, SIGQUIT);
|
|
||||||
pthread_sigmask(SIG_BLOCK, &newset, &oldset);
|
|
||||||
res = pthread_create(thread_id, &attr, func, arg);
|
res = pthread_create(thread_id, &attr, func, arg);
|
||||||
pthread_sigmask(SIG_SETMASK, &oldset, NULL);
|
pthread_sigmask(SIG_SETMASK,&oldset,NULL);
|
||||||
pthread_attr_destroy(&attr);
|
pthread_attr_destroy(&attr);
|
||||||
if (res != 0) {
|
if(res != 0) {
|
||||||
fprintf(stderr, "fuse: error creating thread: %s\n",
|
fprintf(stderr, "fuse: error creating thread: %s\n",
|
||||||
strerror(res));
|
strerror(res));
|
||||||
return -1;
|
return -1;
|
||||||
|
@ -135,7 +139,7 @@ static int fuse_loop_start_thread(struct fuse_mt *mt)
|
||||||
{
|
{
|
||||||
int res;
|
int res;
|
||||||
struct fuse_worker *w = malloc(sizeof(struct fuse_worker));
|
struct fuse_worker *w = malloc(sizeof(struct fuse_worker));
|
||||||
if (!w) {
|
if(!w) {
|
||||||
fprintf(stderr, "fuse: failed to allocate worker structure\n");
|
fprintf(stderr, "fuse: failed to allocate worker structure\n");
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
@ -143,14 +147,14 @@ static int fuse_loop_start_thread(struct fuse_mt *mt)
|
||||||
w->bufsize = fuse_chan_bufsize(mt->prevch);
|
w->bufsize = fuse_chan_bufsize(mt->prevch);
|
||||||
w->buf = calloc(w->bufsize,1);
|
w->buf = calloc(w->bufsize,1);
|
||||||
w->mt = mt;
|
w->mt = mt;
|
||||||
if (!w->buf) {
|
if(!w->buf) {
|
||||||
fprintf(stderr, "fuse: failed to allocate read buffer\n");
|
fprintf(stderr, "fuse: failed to allocate read buffer\n");
|
||||||
free(w);
|
free(w);
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
res = fuse_start_thread(&w->thread_id, fuse_do_work, w);
|
res = fuse_start_thread(&w->thread_id, fuse_do_work, w);
|
||||||
if (res == -1) {
|
if(res == -1) {
|
||||||
free(w->buf);
|
free(w->buf);
|
||||||
free(w);
|
free(w);
|
||||||
return -1;
|
return -1;
|
||||||
|
@ -177,8 +181,9 @@ static int number_of_threads(void)
|
||||||
return 4;
|
return 4;
|
||||||
}
|
}
|
||||||
|
|
||||||
int fuse_session_loop_mt(struct fuse_session *se,
|
int
|
||||||
const int _threads)
|
fuse_session_loop_mt(struct fuse_session *se_,
|
||||||
|
const int threads_)
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
int err;
|
int err;
|
||||||
|
@ -186,17 +191,17 @@ int fuse_session_loop_mt(struct fuse_session *se,
|
||||||
struct fuse_mt mt;
|
struct fuse_mt mt;
|
||||||
struct fuse_worker *w;
|
struct fuse_worker *w;
|
||||||
|
|
||||||
memset(&mt, 0, sizeof(struct fuse_mt));
|
memset(&mt,0,sizeof(struct fuse_mt));
|
||||||
mt.se = se;
|
mt.se = se_;
|
||||||
mt.prevch = fuse_session_next_chan(se, NULL);
|
mt.prevch = fuse_session_next_chan(se_,NULL);
|
||||||
mt.error = 0;
|
mt.error = 0;
|
||||||
mt.main.thread_id = pthread_self();
|
mt.main.thread_id = pthread_self();
|
||||||
mt.main.prev = mt.main.next = &mt.main;
|
mt.main.prev = mt.main.next = &mt.main;
|
||||||
sem_init(&mt.finish, 0, 0);
|
sem_init(&mt.finish,0,0);
|
||||||
|
|
||||||
threads = ((_threads > 0) ? _threads : number_of_threads());
|
threads = ((threads_ > 0) ? threads_ : number_of_threads());
|
||||||
if(_threads < 0)
|
if(threads_ < 0)
|
||||||
threads /= -_threads;
|
threads /= -threads_;
|
||||||
if(threads == 0)
|
if(threads == 0)
|
||||||
threads = 1;
|
threads = 1;
|
||||||
|
|
||||||
|
@ -204,22 +209,24 @@ int fuse_session_loop_mt(struct fuse_session *se,
|
||||||
for(i = 0; (i < threads) && !err; i++)
|
for(i = 0; (i < threads) && !err; i++)
|
||||||
err = fuse_loop_start_thread(&mt);
|
err = fuse_loop_start_thread(&mt);
|
||||||
|
|
||||||
if (!err) {
|
if(!err)
|
||||||
/* sem_wait() is interruptible */
|
{
|
||||||
while (!fuse_session_exited(se))
|
/* sem_wait() is interruptible */
|
||||||
sem_wait(&mt.finish);
|
while(!fuse_session_exited(se_))
|
||||||
|
sem_wait(&mt.finish);
|
||||||
|
|
||||||
for (w = mt.main.next; w != &mt.main; w = w->next)
|
for(w = mt.main.next; w != &mt.main; w = w->next)
|
||||||
pthread_cancel(w->thread_id);
|
pthread_cancel(w->thread_id);
|
||||||
mt.exit = 1;
|
mt.exit = 1;
|
||||||
|
|
||||||
while (mt.main.next != &mt.main)
|
while(mt.main.next != &mt.main)
|
||||||
fuse_join_worker(mt.main.next);
|
fuse_join_worker(mt.main.next);
|
||||||
|
|
||||||
err = mt.error;
|
err = mt.error;
|
||||||
}
|
}
|
||||||
|
|
||||||
sem_destroy(&mt.finish);
|
sem_destroy(&mt.finish);
|
||||||
fuse_session_reset(se);
|
fuse_session_reset(se_);
|
||||||
|
|
||||||
return err;
|
return err;
|
||||||
}
|
}
|
||||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -49,12 +49,12 @@ namespace l
|
||||||
namespace FUSE
|
namespace FUSE
|
||||||
{
|
{
|
||||||
ssize_t
|
ssize_t
|
||||||
copy_file_range(struct fuse_file_info *ffi_in_,
|
copy_file_range(const fuse_file_info_t *ffi_in_,
|
||||||
off_t offset_in_,
|
off_t offset_in_,
|
||||||
struct fuse_file_info *ffi_out_,
|
const fuse_file_info_t *ffi_out_,
|
||||||
off_t offset_out_,
|
off_t offset_out_,
|
||||||
size_t size_,
|
size_t size_,
|
||||||
int flags_)
|
int flags_)
|
||||||
{
|
{
|
||||||
FileInfo *fi_in = reinterpret_cast<FileInfo*>(ffi_in_->fh);
|
FileInfo *fi_in = reinterpret_cast<FileInfo*>(ffi_in_->fh);
|
||||||
FileInfo *fi_out = reinterpret_cast<FileInfo*>(ffi_out_->fh);
|
FileInfo *fi_out = reinterpret_cast<FileInfo*>(ffi_out_->fh);
|
||||||
|
|
|
@ -19,10 +19,10 @@
|
||||||
namespace FUSE
|
namespace FUSE
|
||||||
{
|
{
|
||||||
ssize_t
|
ssize_t
|
||||||
copy_file_range(struct fuse_file_info *ffi_in,
|
copy_file_range(const fuse_file_info_t *ffi_in,
|
||||||
off_t offset_in,
|
off_t offset_in,
|
||||||
struct fuse_file_info *ffi_out,
|
const fuse_file_info_t *ffi_out,
|
||||||
off_t offset_out,
|
off_t offset_out,
|
||||||
size_t size,
|
size_t size,
|
||||||
int flags);
|
int flags);
|
||||||
}
|
}
|
||||||
|
|
|
@ -54,8 +54,8 @@ namespace l
|
||||||
|
|
||||||
static
|
static
|
||||||
void
|
void
|
||||||
config_to_ffi_flags(const Config &config_,
|
config_to_ffi_flags(const Config &config_,
|
||||||
fuse_file_info *ffi_)
|
fuse_file_info_t *ffi_)
|
||||||
{
|
{
|
||||||
switch(config_.cache_files)
|
switch(config_.cache_files)
|
||||||
{
|
{
|
||||||
|
@ -166,9 +166,9 @@ namespace l
|
||||||
namespace FUSE
|
namespace FUSE
|
||||||
{
|
{
|
||||||
int
|
int
|
||||||
create(const char *fusepath_,
|
create(const char *fusepath_,
|
||||||
mode_t mode_,
|
mode_t mode_,
|
||||||
fuse_file_info *ffi_)
|
fuse_file_info_t *ffi_)
|
||||||
{
|
{
|
||||||
const fuse_context *fc = fuse_get_context();
|
const fuse_context *fc = fuse_get_context();
|
||||||
const Config &config = Config::ro();
|
const Config &config = Config::ro();
|
||||||
|
|
|
@ -23,7 +23,7 @@
|
||||||
namespace FUSE
|
namespace FUSE
|
||||||
{
|
{
|
||||||
int
|
int
|
||||||
create(const char *fusepath,
|
create(const char *fusepath,
|
||||||
mode_t mode,
|
mode_t mode,
|
||||||
fuse_file_info *ffi);
|
fuse_file_info_t *ffi);
|
||||||
}
|
}
|
||||||
|
|
|
@ -40,10 +40,10 @@ namespace l
|
||||||
namespace FUSE
|
namespace FUSE
|
||||||
{
|
{
|
||||||
int
|
int
|
||||||
fallocate(int mode_,
|
fallocate(const fuse_file_info_t *ffi_,
|
||||||
off_t offset_,
|
int mode_,
|
||||||
off_t len_,
|
off_t offset_,
|
||||||
fuse_file_info *ffi_)
|
off_t len_)
|
||||||
{
|
{
|
||||||
FileInfo *fi = reinterpret_cast<FileInfo*>(ffi_->fh);
|
FileInfo *fi = reinterpret_cast<FileInfo*>(ffi_->fh);
|
||||||
|
|
||||||
|
|
|
@ -21,8 +21,8 @@
|
||||||
namespace FUSE
|
namespace FUSE
|
||||||
{
|
{
|
||||||
int
|
int
|
||||||
fallocate(int mode,
|
fallocate(const fuse_file_info_t *ffi,
|
||||||
off_t offset,
|
int mode,
|
||||||
off_t len,
|
off_t offset,
|
||||||
fuse_file_info *ffi);
|
off_t len);
|
||||||
}
|
}
|
||||||
|
|
|
@ -40,8 +40,8 @@ namespace l
|
||||||
namespace FUSE
|
namespace FUSE
|
||||||
{
|
{
|
||||||
int
|
int
|
||||||
fchmod(const struct fuse_file_info *ffi_,
|
fchmod(const fuse_file_info_t *ffi_,
|
||||||
const mode_t mode_)
|
const mode_t mode_)
|
||||||
{
|
{
|
||||||
FileInfo *fi = reinterpret_cast<FileInfo*>(ffi_->fh);
|
FileInfo *fi = reinterpret_cast<FileInfo*>(ffi_->fh);
|
||||||
|
|
||||||
|
|
|
@ -23,6 +23,6 @@
|
||||||
namespace FUSE
|
namespace FUSE
|
||||||
{
|
{
|
||||||
int
|
int
|
||||||
fchmod(const fuse_file_info *ffi,
|
fchmod(const fuse_file_info_t *ffi,
|
||||||
const mode_t mode);
|
const mode_t mode);
|
||||||
}
|
}
|
||||||
|
|
|
@ -43,9 +43,9 @@ namespace l
|
||||||
namespace FUSE
|
namespace FUSE
|
||||||
{
|
{
|
||||||
int
|
int
|
||||||
fchown(const struct fuse_file_info *ffi_,
|
fchown(const fuse_file_info_t *ffi_,
|
||||||
const uid_t uid_,
|
const uid_t uid_,
|
||||||
const gid_t gid_)
|
const gid_t gid_)
|
||||||
{
|
{
|
||||||
FileInfo *fi = reinterpret_cast<FileInfo*>(ffi_->fh);
|
FileInfo *fi = reinterpret_cast<FileInfo*>(ffi_->fh);
|
||||||
|
|
||||||
|
|
|
@ -21,7 +21,7 @@
|
||||||
namespace FUSE
|
namespace FUSE
|
||||||
{
|
{
|
||||||
int
|
int
|
||||||
fchown(const fuse_file_info *ffi,
|
fchown(const fuse_file_info_t *ffi,
|
||||||
uid_t uid,
|
uid_t uid,
|
||||||
gid_t gid);
|
gid_t gid);
|
||||||
}
|
}
|
||||||
|
|
|
@ -45,9 +45,9 @@ namespace l
|
||||||
namespace FUSE
|
namespace FUSE
|
||||||
{
|
{
|
||||||
int
|
int
|
||||||
fgetattr(struct stat *st_,
|
fgetattr(const fuse_file_info_t *ffi_,
|
||||||
fuse_file_info *ffi_,
|
struct stat *st_,
|
||||||
fuse_timeouts_t *timeout_)
|
fuse_timeouts_t *timeout_)
|
||||||
{
|
{
|
||||||
int rv;
|
int rv;
|
||||||
const Config &config = Config::ro();
|
const Config &config = Config::ro();
|
||||||
|
|
|
@ -25,7 +25,7 @@
|
||||||
namespace FUSE
|
namespace FUSE
|
||||||
{
|
{
|
||||||
int
|
int
|
||||||
fgetattr(struct stat *st,
|
fgetattr(const fuse_file_info_t *ffi,
|
||||||
fuse_file_info *ffi,
|
struct stat *st,
|
||||||
fuse_timeouts_t *timeout);
|
fuse_timeouts_t *timeout);
|
||||||
}
|
}
|
||||||
|
|
|
@ -38,9 +38,8 @@ namespace l
|
||||||
namespace FUSE
|
namespace FUSE
|
||||||
{
|
{
|
||||||
int
|
int
|
||||||
flock(const char *fusepath_,
|
flock(const fuse_file_info_t *ffi_,
|
||||||
fuse_file_info *ffi_,
|
int op_)
|
||||||
int op_)
|
|
||||||
{
|
{
|
||||||
FileInfo* fi = reinterpret_cast<FileInfo*>(ffi_->fh);
|
FileInfo* fi = reinterpret_cast<FileInfo*>(ffi_->fh);
|
||||||
|
|
||||||
|
|
|
@ -21,7 +21,6 @@
|
||||||
namespace FUSE
|
namespace FUSE
|
||||||
{
|
{
|
||||||
int
|
int
|
||||||
flock(const char *fusepath,
|
flock(const fuse_file_info_t *ffi,
|
||||||
fuse_file_info *ffi,
|
int op);
|
||||||
int op);
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -42,7 +42,7 @@ namespace l
|
||||||
namespace FUSE
|
namespace FUSE
|
||||||
{
|
{
|
||||||
int
|
int
|
||||||
flush(fuse_file_info *ffi_)
|
flush(const fuse_file_info_t *ffi_)
|
||||||
{
|
{
|
||||||
FileInfo *fi = reinterpret_cast<FileInfo*>(ffi_->fh);
|
FileInfo *fi = reinterpret_cast<FileInfo*>(ffi_->fh);
|
||||||
|
|
||||||
|
|
|
@ -21,5 +21,5 @@
|
||||||
namespace FUSE
|
namespace FUSE
|
||||||
{
|
{
|
||||||
int
|
int
|
||||||
flush(fuse_file_info *ffi);
|
flush(const fuse_file_info_t *ffi);
|
||||||
}
|
}
|
||||||
|
|
|
@ -44,8 +44,8 @@ namespace l
|
||||||
namespace FUSE
|
namespace FUSE
|
||||||
{
|
{
|
||||||
int
|
int
|
||||||
fsync(int isdatasync_,
|
fsync(const fuse_file_info_t *ffi_,
|
||||||
fuse_file_info *ffi_)
|
int isdatasync_)
|
||||||
{
|
{
|
||||||
FileInfo *fi = reinterpret_cast<FileInfo*>(ffi_->fh);
|
FileInfo *fi = reinterpret_cast<FileInfo*>(ffi_->fh);
|
||||||
|
|
||||||
|
|
|
@ -21,6 +21,7 @@
|
||||||
namespace FUSE
|
namespace FUSE
|
||||||
{
|
{
|
||||||
int
|
int
|
||||||
fsync(int isdatasync,
|
fsync(const fuse_file_info_t *ffi,
|
||||||
fuse_file_info *ffi);
|
int isdatasync);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -42,8 +42,8 @@ namespace l
|
||||||
namespace FUSE
|
namespace FUSE
|
||||||
{
|
{
|
||||||
int
|
int
|
||||||
fsyncdir(int isdatasync_,
|
fsyncdir(const fuse_file_info_t *ffi_,
|
||||||
fuse_file_info *ffi_)
|
int isdatasync_)
|
||||||
{
|
{
|
||||||
DirInfo *di = reinterpret_cast<DirInfo*>(ffi_->fh);
|
DirInfo *di = reinterpret_cast<DirInfo*>(ffi_->fh);
|
||||||
|
|
||||||
|
|
|
@ -21,6 +21,6 @@
|
||||||
namespace FUSE
|
namespace FUSE
|
||||||
{
|
{
|
||||||
int
|
int
|
||||||
fsyncdir(int isdatasync,
|
fsyncdir(const fuse_file_info_t *ffi,
|
||||||
fuse_file_info *ffi);
|
int isdatasync);
|
||||||
}
|
}
|
||||||
|
|
|
@ -38,8 +38,8 @@ namespace l
|
||||||
namespace FUSE
|
namespace FUSE
|
||||||
{
|
{
|
||||||
int
|
int
|
||||||
ftruncate(off_t size_,
|
ftruncate(const fuse_file_info_t *ffi_,
|
||||||
fuse_file_info *ffi_)
|
off_t size_)
|
||||||
{
|
{
|
||||||
FileInfo *fi = reinterpret_cast<FileInfo*>(ffi_->fh);
|
FileInfo *fi = reinterpret_cast<FileInfo*>(ffi_->fh);
|
||||||
|
|
||||||
|
|
|
@ -24,6 +24,6 @@
|
||||||
namespace FUSE
|
namespace FUSE
|
||||||
{
|
{
|
||||||
int
|
int
|
||||||
ftruncate(off_t size,
|
ftruncate(const fuse_file_info_t *ffi,
|
||||||
fuse_file_info *ffi);
|
off_t size);
|
||||||
}
|
}
|
||||||
|
|
|
@ -42,8 +42,8 @@ namespace l
|
||||||
namespace FUSE
|
namespace FUSE
|
||||||
{
|
{
|
||||||
int
|
int
|
||||||
futimens(const struct fuse_file_info *ffi_,
|
futimens(const fuse_file_info_t *ffi_,
|
||||||
const struct timespec ts_[2])
|
const struct timespec ts_[2])
|
||||||
{
|
{
|
||||||
FileInfo *fi = reinterpret_cast<FileInfo*>(ffi_->fh);
|
FileInfo *fi = reinterpret_cast<FileInfo*>(ffi_->fh);
|
||||||
|
|
||||||
|
|
|
@ -23,6 +23,6 @@
|
||||||
namespace FUSE
|
namespace FUSE
|
||||||
{
|
{
|
||||||
int
|
int
|
||||||
futimens(const fuse_file_info *ffi,
|
futimens(const fuse_file_info_t *ffi,
|
||||||
const timespec ts[2]);
|
const timespec ts[2]);
|
||||||
}
|
}
|
||||||
|
|
|
@ -116,10 +116,10 @@ namespace l
|
||||||
|
|
||||||
static
|
static
|
||||||
int
|
int
|
||||||
ioctl_file(fuse_file_info *ffi_,
|
ioctl_file(const fuse_file_info_t *ffi_,
|
||||||
const uint32_t cmd_,
|
const uint32_t cmd_,
|
||||||
void *data_,
|
void *data_,
|
||||||
uint32_t *out_bufsz_)
|
uint32_t *out_bufsz_)
|
||||||
{
|
{
|
||||||
FileInfo *fi = reinterpret_cast<FileInfo*>(ffi_->fh);
|
FileInfo *fi = reinterpret_cast<FileInfo*>(ffi_->fh);
|
||||||
const fuse_context *fc = fuse_get_context();
|
const fuse_context *fc = fuse_get_context();
|
||||||
|
@ -165,10 +165,10 @@ namespace l
|
||||||
|
|
||||||
static
|
static
|
||||||
int
|
int
|
||||||
ioctl_dir(fuse_file_info *ffi_,
|
ioctl_dir(const fuse_file_info_t *ffi_,
|
||||||
const uint32_t cmd_,
|
const uint32_t cmd_,
|
||||||
void *data_,
|
void *data_,
|
||||||
uint32_t *out_bufsz_)
|
uint32_t *out_bufsz_)
|
||||||
{
|
{
|
||||||
DirInfo *di = reinterpret_cast<DirInfo*>(ffi_->fh);
|
DirInfo *di = reinterpret_cast<DirInfo*>(ffi_->fh);
|
||||||
const fuse_context *fc = fuse_get_context();
|
const fuse_context *fc = fuse_get_context();
|
||||||
|
@ -270,8 +270,8 @@ namespace l
|
||||||
|
|
||||||
static
|
static
|
||||||
int
|
int
|
||||||
file_basepath(fuse_file_info *ffi_,
|
file_basepath(const fuse_file_info_t *ffi_,
|
||||||
void *data_)
|
void *data_)
|
||||||
{
|
{
|
||||||
const Config &config = Config::ro();
|
const Config &config = Config::ro();
|
||||||
std::string &fusepath = reinterpret_cast<FH*>(ffi_->fh)->fusepath;
|
std::string &fusepath = reinterpret_cast<FH*>(ffi_->fh)->fusepath;
|
||||||
|
@ -284,8 +284,8 @@ namespace l
|
||||||
|
|
||||||
static
|
static
|
||||||
int
|
int
|
||||||
file_relpath(fuse_file_info *ffi_,
|
file_relpath(const fuse_file_info_t *ffi_,
|
||||||
void *data_)
|
void *data_)
|
||||||
{
|
{
|
||||||
std::string &fusepath = reinterpret_cast<FH*>(ffi_->fh)->fusepath;
|
std::string &fusepath = reinterpret_cast<FH*>(ffi_->fh)->fusepath;
|
||||||
|
|
||||||
|
@ -314,8 +314,8 @@ namespace l
|
||||||
|
|
||||||
static
|
static
|
||||||
int
|
int
|
||||||
file_fullpath(fuse_file_info *ffi_,
|
file_fullpath(const fuse_file_info_t *ffi_,
|
||||||
void *data_)
|
void *data_)
|
||||||
{
|
{
|
||||||
const Config &config = Config::ro();
|
const Config &config = Config::ro();
|
||||||
std::string &fusepath = reinterpret_cast<FH*>(ffi_->fh)->fusepath;
|
std::string &fusepath = reinterpret_cast<FH*>(ffi_->fh)->fusepath;
|
||||||
|
@ -328,8 +328,8 @@ namespace l
|
||||||
|
|
||||||
static
|
static
|
||||||
int
|
int
|
||||||
file_allpaths(fuse_file_info *ffi_,
|
file_allpaths(const fuse_file_info_t *ffi_,
|
||||||
void *data_)
|
void *data_)
|
||||||
{
|
{
|
||||||
string concated;
|
string concated;
|
||||||
vector<string> paths;
|
vector<string> paths;
|
||||||
|
@ -348,8 +348,8 @@ namespace l
|
||||||
|
|
||||||
static
|
static
|
||||||
int
|
int
|
||||||
file_info(fuse_file_info *ffi_,
|
file_info(const fuse_file_info_t *ffi_,
|
||||||
void *data_)
|
void *data_)
|
||||||
{
|
{
|
||||||
char *key = (char*)data_;
|
char *key = (char*)data_;
|
||||||
|
|
||||||
|
@ -369,12 +369,12 @@ namespace l
|
||||||
namespace FUSE
|
namespace FUSE
|
||||||
{
|
{
|
||||||
int
|
int
|
||||||
ioctl(unsigned long cmd_,
|
ioctl(const fuse_file_info_t *ffi_,
|
||||||
void *arg_,
|
unsigned long cmd_,
|
||||||
fuse_file_info *ffi_,
|
void *arg_,
|
||||||
unsigned int flags_,
|
unsigned int flags_,
|
||||||
void *data_,
|
void *data_,
|
||||||
uint32_t *out_bufsz_)
|
uint32_t *out_bufsz_)
|
||||||
{
|
{
|
||||||
switch(cmd_)
|
switch(cmd_)
|
||||||
{
|
{
|
||||||
|
|
|
@ -21,10 +21,10 @@
|
||||||
namespace FUSE
|
namespace FUSE
|
||||||
{
|
{
|
||||||
int
|
int
|
||||||
ioctl(unsigned long cmd,
|
ioctl(const fuse_file_info_t *ffi,
|
||||||
void *arg,
|
unsigned long cmd,
|
||||||
fuse_file_info *ffi,
|
void *arg,
|
||||||
unsigned int flags,
|
unsigned int flags,
|
||||||
void *data,
|
void *data,
|
||||||
uint32_t *out_bufsz);
|
uint32_t *out_bufsz);
|
||||||
}
|
}
|
||||||
|
|
|
@ -117,8 +117,8 @@ namespace l
|
||||||
|
|
||||||
static
|
static
|
||||||
void
|
void
|
||||||
config_to_ffi_flags(const Config &config_,
|
config_to_ffi_flags(const Config &config_,
|
||||||
fuse_file_info *ffi_)
|
fuse_file_info_t *ffi_)
|
||||||
{
|
{
|
||||||
switch(config_.cache_files)
|
switch(config_.cache_files)
|
||||||
{
|
{
|
||||||
|
@ -203,8 +203,8 @@ namespace l
|
||||||
namespace FUSE
|
namespace FUSE
|
||||||
{
|
{
|
||||||
int
|
int
|
||||||
open(const char *fusepath_,
|
open(const char *fusepath_,
|
||||||
fuse_file_info *ffi_)
|
fuse_file_info_t *ffi_)
|
||||||
{
|
{
|
||||||
const fuse_context *fc = fuse_get_context();
|
const fuse_context *fc = fuse_get_context();
|
||||||
const Config &config = Config::ro();
|
const Config &config = Config::ro();
|
||||||
|
|
|
@ -21,6 +21,6 @@
|
||||||
namespace FUSE
|
namespace FUSE
|
||||||
{
|
{
|
||||||
int
|
int
|
||||||
open(const char *fusepath,
|
open(const char *fusepath,
|
||||||
fuse_file_info *ffi);
|
fuse_file_info_t *ffi);
|
||||||
}
|
}
|
||||||
|
|
|
@ -22,8 +22,8 @@
|
||||||
namespace FUSE
|
namespace FUSE
|
||||||
{
|
{
|
||||||
int
|
int
|
||||||
opendir(const char *fusepath_,
|
opendir(const char *fusepath_,
|
||||||
fuse_file_info *ffi_)
|
fuse_file_info_t *ffi_)
|
||||||
{
|
{
|
||||||
const Config &config = Config::ro();
|
const Config &config = Config::ro();
|
||||||
|
|
||||||
|
|
|
@ -21,6 +21,6 @@
|
||||||
namespace FUSE
|
namespace FUSE
|
||||||
{
|
{
|
||||||
int
|
int
|
||||||
opendir(const char *fusepath,
|
opendir(const char *fusepath,
|
||||||
fuse_file_info *ffi);
|
fuse_file_info_t *ffi);
|
||||||
}
|
}
|
||||||
|
|
|
@ -29,7 +29,7 @@ namespace FUSE
|
||||||
uint64_t *fh_)
|
uint64_t *fh_)
|
||||||
{
|
{
|
||||||
int rv;
|
int rv;
|
||||||
struct fuse_file_info ffi = {0};
|
fuse_file_info_t ffi = {0};
|
||||||
|
|
||||||
ffi.flags = O_RDONLY|O_NOFOLLOW;
|
ffi.flags = O_RDONLY|O_NOFOLLOW;
|
||||||
rv = FUSE::open(fusepath_,&ffi);
|
rv = FUSE::open(fusepath_,&ffi);
|
||||||
|
|
|
@ -62,10 +62,10 @@ namespace l
|
||||||
namespace FUSE
|
namespace FUSE
|
||||||
{
|
{
|
||||||
int
|
int
|
||||||
read(char *buf_,
|
read(const fuse_file_info_t *ffi_,
|
||||||
size_t count_,
|
char *buf_,
|
||||||
off_t offset_,
|
size_t count_,
|
||||||
fuse_file_info *ffi_)
|
off_t offset_)
|
||||||
{
|
{
|
||||||
FileInfo *fi;
|
FileInfo *fi;
|
||||||
|
|
||||||
|
@ -77,11 +77,10 @@ namespace FUSE
|
||||||
}
|
}
|
||||||
|
|
||||||
int
|
int
|
||||||
read_null(char *buf_,
|
read_null(const fuse_file_info_t *ffi_,
|
||||||
size_t count_,
|
char *buf_,
|
||||||
off_t offset_,
|
size_t count_,
|
||||||
fuse_file_info *ffi_)
|
off_t offset_)
|
||||||
|
|
||||||
{
|
{
|
||||||
return count_;
|
return count_;
|
||||||
}
|
}
|
||||||
|
|
|
@ -21,14 +21,14 @@
|
||||||
namespace FUSE
|
namespace FUSE
|
||||||
{
|
{
|
||||||
int
|
int
|
||||||
read(char *buf,
|
read(const fuse_file_info_t *ffi,
|
||||||
size_t count,
|
char *buf,
|
||||||
off_t offset,
|
size_t count,
|
||||||
fuse_file_info *ffi);
|
off_t offset);
|
||||||
|
|
||||||
int
|
int
|
||||||
read_null(char *buf,
|
read_null(const fuse_file_info_t *ffi,
|
||||||
size_t count,
|
char *buf,
|
||||||
off_t offset,
|
size_t count,
|
||||||
fuse_file_info *ffi);
|
off_t offset);
|
||||||
}
|
}
|
||||||
|
|
|
@ -54,10 +54,10 @@ namespace l
|
||||||
namespace FUSE
|
namespace FUSE
|
||||||
{
|
{
|
||||||
int
|
int
|
||||||
read_buf(fuse_bufvec **bufp_,
|
read_buf(const fuse_file_info_t *ffi_,
|
||||||
size_t size_,
|
fuse_bufvec **bufp_,
|
||||||
off_t offset_,
|
size_t size_,
|
||||||
fuse_file_info *ffi_)
|
off_t offset_)
|
||||||
{
|
{
|
||||||
FileInfo *fi = reinterpret_cast<FileInfo*>(ffi_->fh);
|
FileInfo *fi = reinterpret_cast<FileInfo*>(ffi_->fh);
|
||||||
|
|
||||||
|
|
|
@ -23,8 +23,8 @@
|
||||||
namespace FUSE
|
namespace FUSE
|
||||||
{
|
{
|
||||||
int
|
int
|
||||||
read_buf(struct fuse_bufvec **buf,
|
read_buf(const fuse_file_info_t *ffi,
|
||||||
size_t size,
|
struct fuse_bufvec **buf,
|
||||||
off_t offset,
|
size_t size,
|
||||||
fuse_file_info *ffi);
|
off_t offset);
|
||||||
}
|
}
|
||||||
|
|
|
@ -29,8 +29,8 @@
|
||||||
namespace FUSE
|
namespace FUSE
|
||||||
{
|
{
|
||||||
int
|
int
|
||||||
readdir(fuse_file_info *ffi_,
|
readdir(const fuse_file_info_t *ffi_,
|
||||||
fuse_dirents_t *buf_)
|
fuse_dirents_t *buf_)
|
||||||
{
|
{
|
||||||
DirInfo *di = reinterpret_cast<DirInfo*>(ffi_->fh);
|
DirInfo *di = reinterpret_cast<DirInfo*>(ffi_->fh);
|
||||||
const fuse_context *fc = fuse_get_context();
|
const fuse_context *fc = fuse_get_context();
|
||||||
|
|
|
@ -21,6 +21,6 @@
|
||||||
namespace FUSE
|
namespace FUSE
|
||||||
{
|
{
|
||||||
int
|
int
|
||||||
readdir(fuse_file_info *ffi,
|
readdir(const fuse_file_info_t *ffi,
|
||||||
fuse_dirents_t *buf);
|
fuse_dirents_t *buf);
|
||||||
}
|
}
|
||||||
|
|
|
@ -29,13 +29,13 @@
|
||||||
namespace FUSE
|
namespace FUSE
|
||||||
{
|
{
|
||||||
int
|
int
|
||||||
readdir_plus(fuse_file_info *ffi_,
|
readdir_plus(const fuse_file_info_t *ffi_,
|
||||||
fuse_dirents_t *buf_)
|
fuse_dirents_t *buf_)
|
||||||
{
|
{
|
||||||
DirInfo *di = reinterpret_cast<DirInfo*>(ffi_->fh);
|
DirInfo *di = reinterpret_cast<DirInfo*>(ffi_->fh);
|
||||||
const fuse_context *fc = fuse_get_context();
|
const fuse_context *fc = fuse_get_context();
|
||||||
const Config &config = Config::ro();
|
const Config &config = Config::ro();
|
||||||
const ugid::Set ugid(fc->uid,fc->gid);
|
const ugid::Set ugid(fc->uid,fc->gid);
|
||||||
|
|
||||||
switch(config.readdir)
|
switch(config.readdir)
|
||||||
{
|
{
|
||||||
|
|
|
@ -21,6 +21,6 @@
|
||||||
namespace FUSE
|
namespace FUSE
|
||||||
{
|
{
|
||||||
int
|
int
|
||||||
readdir_plus(fuse_file_info *ffi,
|
readdir_plus(const fuse_file_info_t *ffi,
|
||||||
fuse_dirents_t *buf);
|
fuse_dirents_t *buf);
|
||||||
}
|
}
|
||||||
|
|
|
@ -50,7 +50,7 @@ namespace l
|
||||||
namespace FUSE
|
namespace FUSE
|
||||||
{
|
{
|
||||||
int
|
int
|
||||||
release(fuse_file_info *ffi_)
|
release(const fuse_file_info_t *ffi_)
|
||||||
{
|
{
|
||||||
const Config &config = Config::ro();
|
const Config &config = Config::ro();
|
||||||
FileInfo *fi = reinterpret_cast<FileInfo*>(ffi_->fh);
|
FileInfo *fi = reinterpret_cast<FileInfo*>(ffi_->fh);
|
||||||
|
|
|
@ -21,5 +21,5 @@
|
||||||
namespace FUSE
|
namespace FUSE
|
||||||
{
|
{
|
||||||
int
|
int
|
||||||
release(fuse_file_info *ffi);
|
release(const fuse_file_info_t *ffi);
|
||||||
}
|
}
|
||||||
|
|
|
@ -34,7 +34,7 @@ namespace l
|
||||||
namespace FUSE
|
namespace FUSE
|
||||||
{
|
{
|
||||||
int
|
int
|
||||||
releasedir(fuse_file_info *ffi_)
|
releasedir(const fuse_file_info_t *ffi_)
|
||||||
{
|
{
|
||||||
DirInfo *di = reinterpret_cast<DirInfo*>(ffi_->fh);
|
DirInfo *di = reinterpret_cast<DirInfo*>(ffi_->fh);
|
||||||
|
|
||||||
|
|
|
@ -21,5 +21,5 @@
|
||||||
namespace FUSE
|
namespace FUSE
|
||||||
{
|
{
|
||||||
int
|
int
|
||||||
releasedir(fuse_file_info *ffi);
|
releasedir(const fuse_file_info_t *ffi);
|
||||||
}
|
}
|
||||||
|
|
|
@ -102,11 +102,11 @@ namespace l
|
||||||
|
|
||||||
static
|
static
|
||||||
int
|
int
|
||||||
write(WriteFunc func_,
|
write(const fuse_file_info_t *ffi_,
|
||||||
const char *buf_,
|
WriteFunc func_,
|
||||||
const size_t count_,
|
const char *buf_,
|
||||||
const off_t offset_,
|
const size_t count_,
|
||||||
fuse_file_info *ffi_)
|
const off_t offset_)
|
||||||
{
|
{
|
||||||
int rv;
|
int rv;
|
||||||
FileInfo* fi;
|
FileInfo* fi;
|
||||||
|
@ -124,10 +124,10 @@ namespace l
|
||||||
namespace FUSE
|
namespace FUSE
|
||||||
{
|
{
|
||||||
int
|
int
|
||||||
write(const char *buf_,
|
write(const fuse_file_info_t *ffi_,
|
||||||
size_t count_,
|
const char *buf_,
|
||||||
off_t offset_,
|
size_t count_,
|
||||||
fuse_file_info *ffi_)
|
off_t offset_)
|
||||||
{
|
{
|
||||||
WriteFunc wf;
|
WriteFunc wf;
|
||||||
|
|
||||||
|
@ -135,14 +135,14 @@ namespace FUSE
|
||||||
l::write_direct_io :
|
l::write_direct_io :
|
||||||
l::write_regular);
|
l::write_regular);
|
||||||
|
|
||||||
return l::write(wf,buf_,count_,offset_,ffi_);
|
return l::write(ffi_,wf,buf_,count_,offset_);
|
||||||
}
|
}
|
||||||
|
|
||||||
int
|
int
|
||||||
write_null(const char *buf_,
|
write_null(const fuse_file_info_t *ffi_,
|
||||||
size_t count_,
|
const char *buf_,
|
||||||
off_t offset_,
|
size_t count_,
|
||||||
fuse_file_info *ffi_)
|
off_t offset_)
|
||||||
{
|
{
|
||||||
return count_;
|
return count_;
|
||||||
}
|
}
|
||||||
|
|
|
@ -21,14 +21,14 @@
|
||||||
namespace FUSE
|
namespace FUSE
|
||||||
{
|
{
|
||||||
int
|
int
|
||||||
write(const char *buf,
|
write(const fuse_file_info_t *ffi,
|
||||||
size_t count,
|
const char *buf,
|
||||||
off_t offset,
|
size_t count,
|
||||||
fuse_file_info *ffi);
|
off_t offset);
|
||||||
|
|
||||||
int
|
int
|
||||||
write_null(const char *buf,
|
write_null(const fuse_file_info_t *ffi,
|
||||||
size_t count,
|
const char *buf,
|
||||||
off_t offset,
|
size_t count,
|
||||||
fuse_file_info *ffi);
|
off_t offset);
|
||||||
}
|
}
|
||||||
|
|
|
@ -86,9 +86,9 @@ namespace l
|
||||||
namespace FUSE
|
namespace FUSE
|
||||||
{
|
{
|
||||||
int
|
int
|
||||||
write_buf(fuse_bufvec *src_,
|
write_buf(const fuse_file_info_t *ffi_,
|
||||||
off_t offset_,
|
fuse_bufvec *src_,
|
||||||
fuse_file_info *ffi_)
|
off_t offset_)
|
||||||
{
|
{
|
||||||
int rv;
|
int rv;
|
||||||
FileInfo *fi = reinterpret_cast<FileInfo*>(ffi_->fh);
|
FileInfo *fi = reinterpret_cast<FileInfo*>(ffi_->fh);
|
||||||
|
@ -101,9 +101,9 @@ namespace FUSE
|
||||||
}
|
}
|
||||||
|
|
||||||
int
|
int
|
||||||
write_buf_null(fuse_bufvec *src_,
|
write_buf_null(const fuse_file_info_t *ffi_,
|
||||||
off_t offset_,
|
fuse_bufvec *src_,
|
||||||
fuse_file_info *ffi_)
|
off_t offset_)
|
||||||
{
|
{
|
||||||
return src_->buf[0].size;
|
return src_->buf[0].size;
|
||||||
}
|
}
|
||||||
|
|
|
@ -23,12 +23,12 @@
|
||||||
namespace FUSE
|
namespace FUSE
|
||||||
{
|
{
|
||||||
int
|
int
|
||||||
write_buf(struct fuse_bufvec *buf,
|
write_buf(const fuse_file_info_t *ffi,
|
||||||
off_t offset,
|
struct fuse_bufvec *buf,
|
||||||
fuse_file_info *ffi);
|
off_t offset);
|
||||||
|
|
||||||
int
|
int
|
||||||
write_buf_null(struct fuse_bufvec *buf,
|
write_buf_null(const fuse_file_info_t *ffi,
|
||||||
off_t offset,
|
struct fuse_bufvec *buf,
|
||||||
fuse_file_info *ffi);
|
off_t offset);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue
Block a user