Browse Source

general cleanup, slight memory reduction

pull/844/head
Antonio SJ Musumeci 4 years ago
parent
commit
1b26f4908e
  1. 120
      libfuse/include/fuse.h
  2. 9
      libfuse/include/fuse_common.h
  3. 56
      libfuse/include/fuse_lowlevel.h
  4. 2179
      libfuse/lib/fuse.c
  5. 69
      libfuse/lib/fuse_loop_mt.c
  6. 1143
      libfuse/lib/fuse_lowlevel.c
  7. 4
      src/fuse_copy_file_range.cpp
  8. 4
      src/fuse_copy_file_range.hpp
  9. 4
      src/fuse_create.cpp
  10. 2
      src/fuse_create.hpp
  11. 6
      src/fuse_fallocate.cpp
  12. 6
      src/fuse_fallocate.hpp
  13. 2
      src/fuse_fchmod.cpp
  14. 2
      src/fuse_fchmod.hpp
  15. 2
      src/fuse_fchown.cpp
  16. 2
      src/fuse_fchown.hpp
  17. 4
      src/fuse_fgetattr.cpp
  18. 4
      src/fuse_fgetattr.hpp
  19. 3
      src/fuse_flock.cpp
  20. 3
      src/fuse_flock.hpp
  21. 2
      src/fuse_flush.cpp
  22. 2
      src/fuse_flush.hpp
  23. 4
      src/fuse_fsync.cpp
  24. 5
      src/fuse_fsync.hpp
  25. 4
      src/fuse_fsyncdir.cpp
  26. 4
      src/fuse_fsyncdir.hpp
  27. 4
      src/fuse_ftruncate.cpp
  28. 4
      src/fuse_ftruncate.hpp
  29. 2
      src/fuse_futimens.cpp
  30. 2
      src/fuse_futimens.hpp
  31. 18
      src/fuse_ioctl.cpp
  32. 4
      src/fuse_ioctl.hpp
  33. 4
      src/fuse_open.cpp
  34. 2
      src/fuse_open.hpp
  35. 2
      src/fuse_opendir.cpp
  36. 2
      src/fuse_opendir.hpp
  37. 2
      src/fuse_prepare_hide.cpp
  38. 13
      src/fuse_read.cpp
  39. 12
      src/fuse_read.hpp
  40. 6
      src/fuse_read_buf.cpp
  41. 6
      src/fuse_read_buf.hpp
  42. 2
      src/fuse_readdir.cpp
  43. 2
      src/fuse_readdir.hpp
  44. 2
      src/fuse_readdir_plus.cpp
  45. 2
      src/fuse_readdir_plus.hpp
  46. 2
      src/fuse_release.cpp
  47. 2
      src/fuse_release.hpp
  48. 2
      src/fuse_releasedir.cpp
  49. 2
      src/fuse_releasedir.hpp
  50. 20
      src/fuse_write.cpp
  51. 12
      src/fuse_write.hpp
  52. 12
      src/fuse_write_buf.cpp
  53. 12
      src/fuse_write_buf.hpp

120
libfuse/include/fuse.h

@ -131,11 +131,11 @@ struct fuse_operations
/** Change the permission bits of a file */
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 */
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 */
int (*truncate) (const char *, off_t);
@ -163,7 +163,7 @@ struct fuse_operations
*
* 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
*
@ -176,8 +176,10 @@ struct fuse_operations
*
* Changed in version 2.2
*/
int (*read) (char *, size_t, off_t,
struct fuse_file_info *);
int (*read) (const fuse_file_info_t *,
char *,
size_t,
off_t);
/** Write data to an open file
*
@ -187,8 +189,10 @@ struct fuse_operations
*
* Changed in version 2.2
*/
int (*write) (const char *, size_t, off_t,
struct fuse_file_info *);
int (*write) (const fuse_file_info_t *,
const char *,
size_t,
off_t);
/** Get file system statistics
*
@ -222,7 +226,7 @@ struct fuse_operations
*
* Changed in version 2.2
*/
int (*flush) (struct fuse_file_info *);
int (*flush) (const fuse_file_info_t *);
/** Release an open file
*
@ -238,7 +242,7 @@ struct fuse_operations
*
* Changed in version 2.2
*/
int (*release) (struct fuse_file_info *);
int (*release) (const fuse_file_info_t *);
/** Synchronize file contents
*
@ -247,7 +251,7 @@ struct fuse_operations
*
* Changed in version 2.2
*/
int (*fsync) (int, struct fuse_file_info *);
int (*fsync) (const fuse_file_info_t *, int);
/** Set extended attributes */
int (*setxattr) (const char *, const char *, const char *, size_t, int);
@ -271,7 +275,8 @@ struct fuse_operations
*
* Introduced in version 2.3
*/
int (*opendir) (const char *, struct fuse_file_info *);
int (*opendir) (const char *,
fuse_file_info_t *);
/** Read directory
*
@ -294,10 +299,10 @@ struct fuse_operations
*
* Introduced in version 2.3
*/
int (*readdir)(struct fuse_file_info *,
int (*readdir)(const fuse_file_info_t *,
fuse_dirents_t *);
int (*readdir_plus)(struct fuse_file_info *,
int (*readdir_plus)(const fuse_file_info_t *,
fuse_dirents_t *);
@ -305,7 +310,7 @@ struct fuse_operations
*
* Introduced in version 2.3
*/
int (*releasedir) (struct fuse_file_info *);
int (*releasedir) (const fuse_file_info_t *);
/** Synchronize directory contents
*
@ -314,7 +319,7 @@ struct fuse_operations
*
* Introduced in version 2.3
*/
int (*fsyncdir) (int, struct fuse_file_info *);
int (*fsyncdir) (const fuse_file_info_t *, int);
/**
* Initialize filesystem
@ -362,7 +367,7 @@ struct fuse_operations
*
* 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
@ -376,7 +381,7 @@ struct fuse_operations
*
* 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
@ -390,7 +395,7 @@ struct fuse_operations
*
* 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
@ -424,7 +429,8 @@ struct fuse_operations
*
* Introduced in version 2.6
*/
int (*lock) (struct fuse_file_info *, int cmd,
int (*lock) (const fuse_file_info_t *,
int cmd,
struct flock *);
/**
@ -439,7 +445,7 @@ struct fuse_operations
* Introduced in version 2.6
*/
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
@ -466,9 +472,9 @@ struct fuse_operations
*
* Introduced in version 2.8
*/
int (*ioctl) (unsigned long cmd,
int (*ioctl) (const fuse_file_info_t *ffi,
unsigned long cmd,
void *arg,
struct fuse_file_info *ffi,
unsigned int flags,
void *data,
uint32_t *out_bufsz);
@ -490,8 +496,9 @@ struct fuse_operations
*
* Introduced in version 2.8
*/
int (*poll) (struct fuse_file_info *,
struct fuse_pollhandle *ph, unsigned *reventsp);
int (*poll) (const fuse_file_info_t *ffi,
fuse_pollhandle_t *ph,
unsigned *reventsp);
/** Write contents of buffer to an open file
*
@ -501,8 +508,9 @@ struct fuse_operations
*
* Introduced in version 2.9
*/
int (*write_buf) (struct fuse_bufvec *buf, off_t off,
struct fuse_file_info *);
int (*write_buf) (const fuse_file_info_t *ffi,
struct fuse_bufvec *buf,
off_t off);
/** Store data from an open file in a buffer
*
@ -520,8 +528,10 @@ struct fuse_operations
*
* Introduced in version 2.9
*/
int (*read_buf) (struct fuse_bufvec **bufp,
size_t size, off_t off, struct fuse_file_info *);
int (*read_buf) (const fuse_file_info_t *ffi,
struct fuse_bufvec **bufp,
size_t size,
off_t off);
/**
* Perform BSD file locking operation
*
@ -542,7 +552,7 @@ struct fuse_operations
*
* 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
@ -554,7 +564,7 @@ struct fuse_operations
*
* 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
@ -569,9 +579,9 @@ struct fuse_operations
* destination. Effectively doing an inefficient copy of the
* 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,
struct fuse_file_info *fi_out,
const fuse_file_info_t *fi_out,
off_t offset_out,
size_t size,
int flags);
@ -777,7 +787,7 @@ int fuse_fs_getattr(struct fuse_fs *fs,
int fuse_fs_fgetattr(struct fuse_fs *fs,
struct stat *buf,
struct fuse_file_info *fi,
fuse_file_info_t *fi,
fuse_timeouts_t *timeout);
int fuse_fs_rename(struct fuse_fs *fs, const char *oldpath,
@ -788,44 +798,44 @@ 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,
struct fuse_file_info *fi);
fuse_file_info_t *fi);
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,
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,
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,
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,
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,
struct fuse_file_info *fi);
fuse_file_info_t *fi);
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_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,
struct fuse_file_info *fi,
fuse_file_info_t *fi,
fuse_dirents_t *buf);
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,
struct fuse_file_info *fi);
fuse_file_info_t *fi);
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,
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,
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_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);
fuse_file_info_t *fi);
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);
@ -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,
uint64_t *idx);
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);
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);
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_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,
struct fuse_file_info *fi_in, off_t off_in,
struct fuse_file_info *fi_out, off_t off_out,
fuse_file_info_t *fi_in, off_t off_in,
fuse_file_info_t *fi_out, off_t off_out,
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

9
libfuse/include/fuse_common.h

@ -46,8 +46,8 @@ EXTERN_C_BEGIN
*
* Changed in version 2.5
*/
struct
fuse_file_info
typedef struct fuse_file_info_t fuse_file_info_t;
struct fuse_file_info_t
{
/** Open flags. Available in open() and release() */
int flags;
@ -205,7 +205,8 @@ struct fuse_conn_info {
struct fuse_session;
struct fuse_chan;
struct fuse_pollhandle;
struct fuse_pollhandle_t;
typedef struct fuse_pollhandle_t fuse_pollhandle_t;
/**
* Create a FUSE mountpoint
@ -271,7 +272,7 @@ int fuse_version(void);
*
* @param ph the poll handle
*/
void fuse_pollhandle_destroy(struct fuse_pollhandle *ph);
void fuse_pollhandle_destroy(fuse_pollhandle_t *ph);
/* ----------------------------------------------------------- *
* Data buffer *

56
libfuse/include/fuse_lowlevel.h

@ -238,7 +238,7 @@ void (*lookup) (fuse_req_t req, fuse_ino_t parent, const char *name);
* @param fi for future use, currently always NULL
*/
void (*getattr)(fuse_req_t req, fuse_ino_t ino,
struct fuse_file_info *fi);
fuse_file_info_t *fi);
/**
* Set file attributes
@ -268,7 +268,7 @@ void (*lookup) (fuse_req_t req, fuse_ino_t parent, const char *name);
* file information filled in for ftruncate
*/
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
@ -426,7 +426,7 @@ void (*lookup) (fuse_req_t req, fuse_ino_t parent, const char *name);
* @param fi file information
*/
void (*open)(fuse_req_t req, fuse_ino_t ino,
struct fuse_file_info *fi);
fuse_file_info_t *fi);
/**
* Read data
@ -454,7 +454,7 @@ void (*lookup) (fuse_req_t req, fuse_ino_t parent, const char *name);
* @param fi file information
*/
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
@ -480,7 +480,7 @@ void (*lookup) (fuse_req_t req, fuse_ino_t parent, const char *name);
* @param fi file information
*/
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
@ -512,7 +512,7 @@ void (*lookup) (fuse_req_t req, fuse_ino_t parent, const char *name);
* @param fi file information
*/
void (*flush)(fuse_req_t req, fuse_ino_t ino,
struct fuse_file_info *fi);
fuse_file_info_t *fi);
/**
* Release an open file
@ -539,7 +539,7 @@ void (*lookup) (fuse_req_t req, fuse_ino_t parent, const char *name);
* @param fi file information
*/
void (*release)(fuse_req_t req, fuse_ino_t ino,
struct fuse_file_info *fi);
fuse_file_info_t *fi);
/**
* Synchronize file contents
@ -556,7 +556,7 @@ void (*lookup) (fuse_req_t req, fuse_ino_t parent, const char *name);
* @param fi file information
*/
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
@ -580,7 +580,7 @@ void (*lookup) (fuse_req_t req, fuse_ino_t parent, const char *name);
* @param fi file information
*/
void (*opendir)(fuse_req_t req, fuse_ino_t ino,
struct fuse_file_info *fi);
fuse_file_info_t *fi);
/**
* Read directory
@ -604,11 +604,11 @@ void (*lookup) (fuse_req_t req, fuse_ino_t parent, const char *name);
* @param fi file information
*/
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,
size_t size, off_t off,
struct fuse_file_info *ffi);
fuse_file_info_t *ffi);
/**
* Release an open directory
@ -627,7 +627,7 @@ void (*lookup) (fuse_req_t req, fuse_ino_t parent, const char *name);
* @param fi file information
*/
void (*releasedir)(fuse_req_t req, fuse_ino_t ino,
struct fuse_file_info *fi);
fuse_file_info_t *fi);
/**
* Synchronize directory contents
@ -647,7 +647,7 @@ void (*lookup) (fuse_req_t req, fuse_ino_t parent, const char *name);
* @param fi file information
*/
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
@ -787,7 +787,7 @@ void (*lookup) (fuse_req_t req, fuse_ino_t parent, const char *name);
* @param fi file information
*/
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
@ -804,7 +804,7 @@ void (*lookup) (fuse_req_t req, fuse_ino_t parent, const char *name);
* @param lock the region/type to test
*/
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
@ -831,7 +831,7 @@ void (*lookup) (fuse_req_t req, fuse_ino_t parent, const char *name);
* @param sleep locking operation may sleep
*/
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);
/**
@ -882,7 +882,7 @@ void (*lookup) (fuse_req_t req, fuse_ino_t parent, const char *name);
* @param out_bufsz maximum size of output data
*/
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);
/**
@ -911,8 +911,10 @@ void (*lookup) (fuse_req_t req, fuse_ino_t parent, const char *name);
* @param fi file information
* @param ph poll handle to be used for notification
*/
void (*poll) (fuse_req_t req, fuse_ino_t ino, struct fuse_file_info *fi,
struct fuse_pollhandle *ph);
void (*poll)(fuse_req_t req,
fuse_ino_t ino,
fuse_file_info_t *fi,
fuse_pollhandle_t *ph);
/**
* Write data made available in a buffer
@ -942,7 +944,7 @@ void (*lookup) (fuse_req_t req, fuse_ino_t parent, const char *name);
*/
void (*write_buf)(fuse_req_t req, fuse_ino_t ino,
struct fuse_bufvec *bufv, off_t off,
struct fuse_file_info *fi);
fuse_file_info_t *fi);
/**
* Callback function for the retrieve request
@ -995,7 +997,7 @@ void (*lookup) (fuse_req_t req, fuse_ino_t parent, const char *name);
* @param op the locking operation, see flock(2)
*/
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
@ -1015,7 +1017,7 @@ void (*lookup) (fuse_req_t req, fuse_ino_t parent, const char *name);
* see fallocate(2)
*/
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
@ -1056,10 +1058,10 @@ void (*lookup) (fuse_req_t req, fuse_ino_t parent, const char *name);
void (*copy_file_range)(fuse_req_t req,
fuse_ino_t ino_in,
off_t off_in,
struct fuse_file_info *fi_in,
fuse_file_info_t *fi_in,
fuse_ino_t ino_out,
off_t off_out,
struct fuse_file_info *fi_out,
fuse_file_info_t *fi_out,
size_t len,
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
*/
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
@ -1164,7 +1166,7 @@ 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 fuse_file_info_t *fi);
/**
* 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
*/
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

2179
libfuse/lib/fuse.c
File diff suppressed because it is too large
View File

69
libfuse/lib/fuse_loop_mt.c

@ -6,25 +6,26 @@
See the file COPYING.LIB.
*/
#include "fuse_i.h"
#include "fuse_kernel.h"
#include "fuse_lowlevel.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 <stdlib.h>
#include <string.h>
#include <unistd.h>
#include <signal.h>
#include <semaphore.h>
#include <errno.h>
#include <sys/time.h>
#include <unistd.h>
#include <unistd.h>
/* Environment var controlling the thread stack size */
#define ENVNAME_THREAD_STACK "FUSE_THREAD_STACK"
struct fuse_worker {
struct fuse_worker
{
struct fuse_worker *prev;
struct fuse_worker *next;
pthread_t thread_id;
@ -33,7 +34,8 @@ struct fuse_worker {
struct fuse_mt *mt;
};
struct fuse_mt {
struct fuse_mt
{
struct fuse_session *se;
struct fuse_chan *prevch;
struct fuse_worker main;
@ -42,7 +44,10 @@ struct fuse_mt {
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;
w->next = next;
@ -61,18 +66,21 @@ static void list_del_worker(struct fuse_worker *w)
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_mt *mt = w->mt;
while (!fuse_session_exited(mt->se)) {
struct fuse_chan *ch = mt->prevch;
struct fuse_buf fbuf = {
.mem = w->buf,
.size = w->bufsize,
};
while(!fuse_session_exited(mt->se))
{
int res;
struct fuse_buf fbuf;
struct fuse_chan *ch = mt->prevch;
fbuf.mem = w->buf;
fbuf.size = w->bufsize;
pthread_setcancelstate(PTHREAD_CANCEL_ENABLE, NULL);
res = fuse_session_receive_buf(mt->se, &fbuf, &ch);
@ -113,11 +121,7 @@ int fuse_start_thread(pthread_t *thread_id, void *(*func)(void *), void *arg)
fprintf(stderr, "fuse: invalid stack size: %s\n", stack_size);
/* Disallow signal reception in worker threads */
sigemptyset(&newset);
sigaddset(&newset, SIGTERM);
sigaddset(&newset, SIGINT);
sigaddset(&newset, SIGHUP);
sigaddset(&newset, SIGQUIT);
sigfillset(&newset);
pthread_sigmask(SIG_BLOCK,&newset,&oldset);
res = pthread_create(thread_id, &attr, func, arg);
pthread_sigmask(SIG_SETMASK,&oldset,NULL);
@ -177,8 +181,9 @@ static int number_of_threads(void)
return 4;
}
int fuse_session_loop_mt(struct fuse_session *se,
const int _threads)
int
fuse_session_loop_mt(struct fuse_session *se_,
const int threads_)
{
int i;
int err;
@ -187,16 +192,16 @@ int fuse_session_loop_mt(struct fuse_session *se,
struct fuse_worker *w;
memset(&mt,0,sizeof(struct fuse_mt));
mt.se = se;
mt.prevch = fuse_session_next_chan(se, NULL);
mt.se = se_;
mt.prevch = fuse_session_next_chan(se_,NULL);
mt.error = 0;
mt.main.thread_id = pthread_self();
mt.main.prev = mt.main.next = &mt.main;
sem_init(&mt.finish,0,0);
threads = ((_threads > 0) ? _threads : number_of_threads());
if(_threads < 0)
threads /= -_threads;
threads = ((threads_ > 0) ? threads_ : number_of_threads());
if(threads_ < 0)
threads /= -threads_;
if(threads == 0)
threads = 1;
@ -204,9 +209,10 @@ int fuse_session_loop_mt(struct fuse_session *se,
for(i = 0; (i < threads) && !err; i++)
err = fuse_loop_start_thread(&mt);
if (!err) {
if(!err)
{
/* sem_wait() is interruptible */
while (!fuse_session_exited(se))
while(!fuse_session_exited(se_))
sem_wait(&mt.finish);
for(w = mt.main.next; w != &mt.main; w = w->next)
@ -220,6 +226,7 @@ int fuse_session_loop_mt(struct fuse_session *se,
}
sem_destroy(&mt.finish);
fuse_session_reset(se);
fuse_session_reset(se_);
return err;
}

1143
libfuse/lib/fuse_lowlevel.c
File diff suppressed because it is too large
View File

4
src/fuse_copy_file_range.cpp

@ -49,9 +49,9 @@ namespace l
namespace FUSE
{
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_,
struct fuse_file_info *ffi_out_,
const fuse_file_info_t *ffi_out_,
off_t offset_out_,
size_t size_,
int flags_)

4
src/fuse_copy_file_range.hpp

@ -19,9 +19,9 @@
namespace FUSE
{
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,
struct fuse_file_info *ffi_out,
const fuse_file_info_t *ffi_out,
off_t offset_out,
size_t size,
int flags);

4
src/fuse_create.cpp

@ -55,7 +55,7 @@ namespace l
static
void
config_to_ffi_flags(const Config &config_,
fuse_file_info *ffi_)
fuse_file_info_t *ffi_)
{
switch(config_.cache_files)
{
@ -168,7 +168,7 @@ namespace FUSE
int
create(const char *fusepath_,
mode_t mode_,
fuse_file_info *ffi_)
fuse_file_info_t *ffi_)
{
const fuse_context *fc = fuse_get_context();
const Config &config = Config::ro();

2
src/fuse_create.hpp

@ -25,5 +25,5 @@ namespace FUSE
int
create(const char *fusepath,
mode_t mode,
fuse_file_info *ffi);
fuse_file_info_t *ffi);
}

6
src/fuse_fallocate.cpp

@ -40,10 +40,10 @@ namespace l
namespace FUSE
{
int
fallocate(int mode_,
fallocate(const fuse_file_info_t *ffi_,
int mode_,
off_t offset_,
off_t len_,
fuse_file_info *ffi_)
off_t len_)
{
FileInfo *fi = reinterpret_cast<FileInfo*>(ffi_->fh);

6
src/fuse_fallocate.hpp

@ -21,8 +21,8 @@
namespace FUSE
{
int
fallocate(int mode,
fallocate(const fuse_file_info_t *ffi,
int mode,
off_t offset,
off_t len,
fuse_file_info *ffi);
off_t len);
}

2
src/fuse_fchmod.cpp

@ -40,7 +40,7 @@ namespace l
namespace FUSE
{
int
fchmod(const struct fuse_file_info *ffi_,
fchmod(const fuse_file_info_t *ffi_,
const mode_t mode_)
{
FileInfo *fi = reinterpret_cast<FileInfo*>(ffi_->fh);

2
src/fuse_fchmod.hpp

@ -23,6 +23,6 @@
namespace FUSE
{
int
fchmod(const fuse_file_info *ffi,
fchmod(const fuse_file_info_t *ffi,
const mode_t mode);
}

2
src/fuse_fchown.cpp

@ -43,7 +43,7 @@ namespace l
namespace FUSE
{
int
fchown(const struct fuse_file_info *ffi_,
fchown(const fuse_file_info_t *ffi_,
const uid_t uid_,
const gid_t gid_)
{

2
src/fuse_fchown.hpp

@ -21,7 +21,7 @@
namespace FUSE
{
int
fchown(const fuse_file_info *ffi,
fchown(const fuse_file_info_t *ffi,
uid_t uid,
gid_t gid);
}

4
src/fuse_fgetattr.cpp

@ -45,8 +45,8 @@ namespace l
namespace FUSE
{
int
fgetattr(struct stat *st_,
fuse_file_info *ffi_,
fgetattr(const fuse_file_info_t *ffi_,
struct stat *st_,
fuse_timeouts_t *timeout_)
{
int rv;

4
src/fuse_fgetattr.hpp

@ -25,7 +25,7 @@
namespace FUSE
{
int
fgetattr(struct stat *st,
fuse_file_info *ffi,
fgetattr(const fuse_file_info_t *ffi,
struct stat *st,
fuse_timeouts_t *timeout);
}

3
src/fuse_flock.cpp

@ -38,8 +38,7 @@ namespace l
namespace FUSE
{
int
flock(const char *fusepath_,
fuse_file_info *ffi_,
flock(const fuse_file_info_t *ffi_,
int op_)
{
FileInfo* fi = reinterpret_cast<FileInfo*>(ffi_->fh);

3
src/fuse_flock.hpp

@ -21,7 +21,6 @@
namespace FUSE
{
int
flock(const char *fusepath,
fuse_file_info *ffi,
flock(const fuse_file_info_t *ffi,
int op);
}

2
src/fuse_flush.cpp

@ -42,7 +42,7 @@ namespace l
namespace FUSE
{
int
flush(fuse_file_info *ffi_)
flush(const fuse_file_info_t *ffi_)
{
FileInfo *fi = reinterpret_cast<FileInfo*>(ffi_->fh);

2
src/fuse_flush.hpp

@ -21,5 +21,5 @@
namespace FUSE
{
int
flush(fuse_file_info *ffi);
flush(const fuse_file_info_t *ffi);
}

4
src/fuse_fsync.cpp

@ -44,8 +44,8 @@ namespace l
namespace FUSE
{
int
fsync(int isdatasync_,
fuse_file_info *ffi_)
fsync(const fuse_file_info_t *ffi_,
int isdatasync_)
{
FileInfo *fi = reinterpret_cast<FileInfo*>(ffi_->fh);

5
src/fuse_fsync.hpp

@ -21,6 +21,7 @@
namespace FUSE
{
int
fsync(int isdatasync,
fuse_file_info *ffi);
fsync(const fuse_file_info_t *ffi,
int isdatasync);
}

4
src/fuse_fsyncdir.cpp

@ -42,8 +42,8 @@ namespace l
namespace FUSE
{
int
fsyncdir(int isdatasync_,
fuse_file_info *ffi_)
fsyncdir(const fuse_file_info_t *ffi_,
int isdatasync_)
{
DirInfo *di = reinterpret_cast<DirInfo*>(ffi_->fh);

4
src/fuse_fsyncdir.hpp

@ -21,6 +21,6 @@
namespace FUSE
{
int
fsyncdir(int isdatasync,
fuse_file_info *ffi);
fsyncdir(const fuse_file_info_t *ffi,
int isdatasync);
}

4
src/fuse_ftruncate.cpp

@ -38,8 +38,8 @@ namespace l
namespace FUSE
{
int
ftruncate(off_t size_,
fuse_file_info *ffi_)
ftruncate(const fuse_file_info_t *ffi_,
off_t size_)
{
FileInfo *fi = reinterpret_cast<FileInfo*>(ffi_->fh);

4
src/fuse_ftruncate.hpp

@ -24,6 +24,6 @@
namespace FUSE
{
int
ftruncate(off_t size,
fuse_file_info *ffi);
ftruncate(const fuse_file_info_t *ffi,
off_t size);
}

2
src/fuse_futimens.cpp

@ -42,7 +42,7 @@ namespace l
namespace FUSE
{
int
futimens(const struct fuse_file_info *ffi_,
futimens(const fuse_file_info_t *ffi_,
const struct timespec ts_[2])
{
FileInfo *fi = reinterpret_cast<FileInfo*>(ffi_->fh);

2
src/fuse_futimens.hpp

@ -23,6 +23,6 @@
namespace FUSE
{
int
futimens(const fuse_file_info *ffi,
futimens(const fuse_file_info_t *ffi,
const timespec ts[2]);
}

18
src/fuse_ioctl.cpp

@ -116,7 +116,7 @@ namespace l
static
int
ioctl_file(fuse_file_info *ffi_,
ioctl_file(const fuse_file_info_t *ffi_,
const uint32_t cmd_,
void *data_,
uint32_t *out_bufsz_)
@ -165,7 +165,7 @@ namespace l
static
int
ioctl_dir(fuse_file_info *ffi_,
ioctl_dir(const fuse_file_info_t *ffi_,
const uint32_t cmd_,
void *data_,
uint32_t *out_bufsz_)
@ -270,7 +270,7 @@ namespace l
static
int
file_basepath(fuse_file_info *ffi_,
file_basepath(const fuse_file_info_t *ffi_,
void *data_)
{
const Config &config = Config::ro();
@ -284,7 +284,7 @@ namespace l
static
int
file_relpath(fuse_file_info *ffi_,
file_relpath(const fuse_file_info_t *ffi_,
void *data_)
{
std::string &fusepath = reinterpret_cast<FH*>(ffi_->fh)->fusepath;
@ -314,7 +314,7 @@ namespace l
static
int
file_fullpath(fuse_file_info *ffi_,
file_fullpath(const fuse_file_info_t *ffi_,
void *data_)
{
const Config &config = Config::ro();
@ -328,7 +328,7 @@ namespace l
static
int
file_allpaths(fuse_file_info *ffi_,
file_allpaths(const fuse_file_info_t *ffi_,
void *data_)
{
string concated;
@ -348,7 +348,7 @@ namespace l
static
int
file_info(fuse_file_info *ffi_,
file_info(const fuse_file_info_t *ffi_,
void *data_)
{
char *key = (char*)data_;
@ -369,9 +369,9 @@ namespace l
namespace FUSE
{
int
ioctl(unsigned long cmd_,
ioctl(const fuse_file_info_t *ffi_,
unsigned long cmd_,
void *arg_,
fuse_file_info *ffi_,
unsigned int flags_,
void *data_,
uint32_t *out_bufsz_)

4
src/fuse_ioctl.hpp

@ -21,9 +21,9 @@
namespace FUSE
{
int
ioctl(unsigned long cmd,
ioctl(const fuse_file_info_t *ffi,
unsigned long cmd,
void *arg,
fuse_file_info *ffi,
unsigned int flags,
void *data,
uint32_t *out_bufsz);

4
src/fuse_open.cpp

@ -118,7 +118,7 @@ namespace l
static
void
config_to_ffi_flags(const Config &config_,
fuse_file_info *ffi_)
fuse_file_info_t *ffi_)
{
switch(config_.cache_files)
{
@ -204,7 +204,7 @@ namespace FUSE
{
int
open(const char *fusepath_,
fuse_file_info *ffi_)
fuse_file_info_t *ffi_)
{
const fuse_context *fc = fuse_get_context();
const Config &config = Config::ro();

2
src/fuse_open.hpp

@ -22,5 +22,5 @@ namespace FUSE
{
int
open(const char *fusepath,
fuse_file_info *ffi);
fuse_file_info_t *ffi);
}

2
src/fuse_opendir.cpp

@ -23,7 +23,7 @@ namespace FUSE
{
int
opendir(const char *fusepath_,
fuse_file_info *ffi_)
fuse_file_info_t *ffi_)
{
const Config &config = Config::ro();

2
src/fuse_opendir.hpp

@ -22,5 +22,5 @@ namespace FUSE
{
int
opendir(const char *fusepath,
fuse_file_info *ffi);
fuse_file_info_t *ffi);
}

2
src/fuse_prepare_hide.cpp

@ -29,7 +29,7 @@ namespace FUSE
uint64_t *fh_)
{
int rv;
struct fuse_file_info ffi = {0};
fuse_file_info_t ffi = {0};
ffi.flags = O_RDONLY|O_NOFOLLOW;
rv = FUSE::open(fusepath_,&ffi);

13
src/fuse_read.cpp

@ -62,10 +62,10 @@ namespace l
namespace FUSE
{
int
read(char *buf_,
read(const fuse_file_info_t *ffi_,
char *buf_,
size_t count_,
off_t offset_,
fuse_file_info *ffi_)
off_t offset_)
{
FileInfo *fi;
@ -77,11 +77,10 @@ namespace FUSE
}
int
read_null(char *buf_,
read_null(const fuse_file_info_t *ffi_,
char *buf_,
size_t count_,
off_t offset_,
fuse_file_info *ffi_)
off_t offset_)
{
return count_;
}

12
src/fuse_read.hpp

@ -21,14 +21,14 @@
namespace FUSE
{
int
read(char *buf,
read(const fuse_file_info_t *ffi,
char *buf,
size_t count,
off_t offset,
fuse_file_info *ffi);
off_t offset);
int
read_null(char *buf,
read_null(const fuse_file_info_t *ffi,
char *buf,
size_t count,
off_t offset,
fuse_file_info *ffi);
off_t offset);
}

6
src/fuse_read_buf.cpp

@ -54,10 +54,10 @@ namespace l
namespace FUSE
{
int
read_buf(fuse_bufvec **bufp_,
read_buf(const fuse_file_info_t *ffi_,
fuse_bufvec **bufp_,
size_t size_,
off_t offset_,
fuse_file_info *ffi_)
off_t offset_)
{
FileInfo *fi = reinterpret_cast<FileInfo*>(ffi_->fh);

6
src/fuse_read_buf.hpp

@ -23,8 +23,8 @@
namespace FUSE
{
int
read_buf(struct fuse_bufvec **buf,
read_buf(const fuse_file_info_t *ffi,
struct fuse_bufvec **buf,
size_t size,
off_t offset,
fuse_file_info *ffi);
off_t offset);
}

2
src/fuse_readdir.cpp

@ -29,7 +29,7 @@
namespace FUSE
{
int
readdir(fuse_file_info *ffi_,
readdir(const fuse_file_info_t *ffi_,
fuse_dirents_t *buf_)
{
DirInfo *di = reinterpret_cast<DirInfo*>(ffi_->fh);

2
src/fuse_readdir.hpp

@ -21,6 +21,6 @@
namespace FUSE
{
int
readdir(fuse_file_info *ffi,
readdir(const fuse_file_info_t *ffi,
fuse_dirents_t *buf);
}

2
src/fuse_readdir_plus.cpp

@ -29,7 +29,7 @@
namespace FUSE
{
int
readdir_plus(fuse_file_info *ffi_,
readdir_plus(const fuse_file_info_t *ffi_,
fuse_dirents_t *buf_)
{
DirInfo *di = reinterpret_cast<DirInfo*>(ffi_->fh);

2
src/fuse_readdir_plus.hpp

@ -21,6 +21,6 @@
namespace FUSE
{
int
readdir_plus(fuse_file_info *ffi,
readdir_plus(const fuse_file_info_t *ffi,
fuse_dirents_t *buf);
}

2
src/fuse_release.cpp

@ -50,7 +50,7 @@ namespace l
namespace FUSE
{
int
release(fuse_file_info *ffi_)
release(const fuse_file_info_t *ffi_)
{
const Config &config = Config::ro();
FileInfo *fi = reinterpret_cast<FileInfo*>(ffi_->fh);

2
src/fuse_release.hpp

@ -21,5 +21,5 @@
namespace FUSE
{
int
release(fuse_file_info *ffi);
release(const fuse_file_info_t *ffi);
}

2
src/fuse_releasedir.cpp

@ -34,7 +34,7 @@ namespace l
namespace FUSE
{
int
releasedir(fuse_file_info *ffi_)
releasedir(const fuse_file_info_t *ffi_)
{
DirInfo *di = reinterpret_cast<DirInfo*>(ffi_->fh);

2
src/fuse_releasedir.hpp

@ -21,5 +21,5 @@
namespace FUSE
{
int
releasedir(fuse_file_info *ffi);
releasedir(const fuse_file_info_t *ffi);
}

20
src/fuse_write.cpp

@ -102,11 +102,11 @@ namespace l
static
int
write(WriteFunc func_,
write(const fuse_file_info_t *ffi_,
WriteFunc func_,
const char *buf_,
const size_t count_,
const off_t offset_,
fuse_file_info *ffi_)
const off_t offset_)
{
int rv;
FileInfo* fi;
@ -124,10 +124,10 @@ namespace l
namespace FUSE
{
int
write(const char *buf_,
write(const fuse_file_info_t *ffi_,
const char *buf_,
size_t count_,
off_t offset_,
fuse_file_info *ffi_)
off_t offset_)
{
WriteFunc wf;
@ -135,14 +135,14 @@ namespace FUSE
l::write_direct_io :
l::write_regular);
return l::write(wf,buf_,count_,offset_,ffi_);
return l::write(ffi_,wf,buf_,count_,offset_);
}
int
write_null(const char *buf_,
write_null(const fuse_file_info_t *ffi_,
const char *buf_,
size_t count_,
off_t offset_,
fuse_file_info *ffi_)
off_t offset_)
{
return count_;
}

12
src/fuse_write.hpp

@ -21,14 +21,14 @@
namespace FUSE
{
int
write(const char *buf,
write(const fuse_file_info_t *ffi,
const char *buf,
size_t count,
off_t offset,
fuse_file_info *ffi);
off_t offset);
int
write_null(const char *buf,
write_null(const fuse_file_info_t *ffi,
const char *buf,
size_t count,
off_t offset,
fuse_file_info *ffi);
off_t offset);
}

12
src/fuse_write_buf.cpp

@ -86,9 +86,9 @@ namespace l
namespace FUSE
{
int
write_buf(fuse_bufvec *src_,
off_t offset_,
fuse_file_info *ffi_)
write_buf(const fuse_file_info_t *ffi_,
fuse_bufvec *src_,
off_t offset_)
{
int rv;
FileInfo *fi = reinterpret_cast<FileInfo*>(ffi_->fh);
@ -101,9 +101,9 @@ namespace FUSE
}
int
write_buf_null(fuse_bufvec *src_,
off_t offset_,
fuse_file_info *ffi_)
write_buf_null(const fuse_file_info_t *ffi_,
fuse_bufvec *src_,
off_t offset_)
{
return src_->buf[0].size;
}

12
src/fuse_write_buf.hpp

@ -23,12 +23,12 @@
namespace FUSE
{
int
write_buf(struct fuse_bufvec *buf,
off_t offset,
fuse_file_info *ffi);
write_buf(const fuse_file_info_t *ffi,
struct fuse_bufvec *buf,
off_t offset);
int
write_buf_null(struct fuse_bufvec *buf,
off_t offset,
fuse_file_info *ffi);
write_buf_null(const fuse_file_info_t *ffi,
struct fuse_bufvec *buf,
off_t offset);
}
Loading…
Cancel
Save