Browse Source

general cleanup, slight memory reduction

pull/844/head
Antonio SJ Musumeci 4 years ago
parent
commit
1b26f4908e
  1. 142
      libfuse/include/fuse.h
  2. 9
      libfuse/include/fuse_common.h
  3. 398
      libfuse/include/fuse_lowlevel.h
  4. 4631
      libfuse/lib/fuse.c
  5. 139
      libfuse/lib/fuse_loop_mt.c
  6. 2389
      libfuse/lib/fuse_lowlevel.c
  7. 12
      src/fuse_copy_file_range.cpp
  8. 12
      src/fuse_copy_file_range.hpp
  9. 10
      src/fuse_create.cpp
  10. 6
      src/fuse_create.hpp
  11. 8
      src/fuse_fallocate.cpp
  12. 8
      src/fuse_fallocate.hpp
  13. 4
      src/fuse_fchmod.cpp
  14. 4
      src/fuse_fchmod.hpp
  15. 6
      src/fuse_fchown.cpp
  16. 6
      src/fuse_fchown.hpp
  17. 6
      src/fuse_fgetattr.cpp
  18. 6
      src/fuse_fgetattr.hpp
  19. 5
      src/fuse_flock.cpp
  20. 5
      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. 4
      src/fuse_futimens.cpp
  30. 4
      src/fuse_futimens.hpp
  31. 48
      src/fuse_ioctl.cpp
  32. 12
      src/fuse_ioctl.hpp
  33. 8
      src/fuse_open.cpp
  34. 4
      src/fuse_open.hpp
  35. 4
      src/fuse_opendir.cpp
  36. 4
      src/fuse_opendir.hpp
  37. 2
      src/fuse_prepare_hide.cpp
  38. 17
      src/fuse_read.cpp
  39. 16
      src/fuse_read.hpp
  40. 8
      src/fuse_read_buf.cpp
  41. 8
      src/fuse_read_buf.hpp
  42. 4
      src/fuse_readdir.cpp
  43. 4
      src/fuse_readdir.hpp
  44. 12
      src/fuse_readdir_plus.cpp
  45. 4
      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. 28
      src/fuse_write.cpp
  51. 16
      src/fuse_write.hpp
  52. 12
      src/fuse_write_buf.cpp
  53. 12
      src/fuse_write_buf.hpp

142
libfuse/include/fuse.h

@ -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,
struct fuse_file_info *);
int (*read) (const fuse_file_info_t *,
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,
struct fuse_file_info *);
int (*write) (const fuse_file_info_t *,
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,
void *arg,
struct fuse_file_info *ffi,
unsigned int flags,
void *data,
uint32_t *out_bufsz);
int (*ioctl) (const fuse_file_info_t *ffi,
unsigned long cmd,
void *arg,
unsigned int flags,
void *data,
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 *,
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 /** 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,
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 /** 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,
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 * 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,
off_t offset_in,
struct fuse_file_info *fi_out,
off_t offset_out,
size_t size,
int flags);
ssize_t (*copy_file_range)(const fuse_file_info_t *fi_in,
off_t offset_in,
const fuse_file_info_t *fi_out,
off_t offset_out,
size_t size,
int flags);
}; };
/** Extra context that may be needed by some filesystems /** Extra context that may be needed by some filesystems
@ -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,
struct stat *buf,
struct fuse_file_info *fi,
fuse_timeouts_t *timeout);
int fuse_fs_fgetattr(struct fuse_fs *fs,
struct stat *buf,
fuse_file_info_t *fi,
fuse_timeouts_t *timeout);
int fuse_fs_rename(struct fuse_fs *fs, const char *oldpath, int fuse_fs_rename(struct fuse_fs *fs, const char *oldpath,
const char *newpath); 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,
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); 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

9
libfuse/include/fuse_common.h

@ -46,8 +46,8 @@ EXTERN_C_BEGIN
* *
* Changed in version 2.5 * 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() */ /** 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 *

398
libfuse/include/fuse_lowlevel.h

@ -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
*
* In lookup, zero means negative entry (from version 2.5)
* Returning ENOENT also means negative entry, but by setting zero
* ino the kernel may cache negative entries for entry_timeout
* seconds.
*/
fuse_ino_t ino;
/** Unique inode number
*
* In lookup, zero means negative entry (from version 2.5)
* Returning ENOENT also means negative entry, but by setting zero
* ino the kernel may cache negative entries for entry_timeout
* seconds.
*/
fuse_ino_t ino;
/** Generation number for this entry.
*
* If the file system will be exported over NFS, the
* ino/generation pairs need to be unique over the file
* system's lifetime (rather than just the mount time). So if
* the file system reuses an inode after it has been deleted,
* it must assign a new, previously unused generation number
* to the inode at the same time.
*
* The generation must be non-zero, otherwise FUSE will treat
* it as an error.
*
*/
uint64_t generation;
/** Generation number for this entry.
*
* If the file system will be exported over NFS, the
* ino/generation pairs need to be unique over the file
* system's lifetime (rather than just the mount time). So if
* the file system reuses an inode after it has been deleted,
* it must assign a new, previously unused generation number
* to the inode at the same time.
*
* The generation must be non-zero, otherwise FUSE will treat
* it as an error.
*
*/
uint64_t generation;
/** Inode attributes.
*
* Even if attr_timeout == 0, attr must be correct. For example,
* for open(), FUSE uses attr.st_size from lookup() to determine
* how many bytes to request. If this value is not correct,
* incorrect data will be returned.
*/
struct stat attr;
/** Inode attributes.
*
* Even if attr_timeout == 0, attr must be correct. For example,
* for open(), FUSE uses attr.st_size from lookup() to determine
* how many bytes to request. If this value is not correct,
* incorrect data will be returned.
*/
struct stat attr;
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 */
uid_t uid;
/** User ID of the calling process */
uid_t uid;
/** Group ID of the calling process */
gid_t gid;
/** Group ID of the calling process */
gid_t gid;
/** Thread ID of the calling process */
pid_t pid;
/** Thread ID of the calling process */
pid_t pid;
/** Umask of the calling process (introduced in version 2.8) */
mode_t umask;
/** Umask of the calling process (introduced in version 2.8) */
mode_t umask;
}; };
struct fuse_forget_data struct fuse_forget_data
{ {
fuse_ino_t ino;
uint64_t nlookup;
fuse_ino_t ino;
uint64_t nlookup;
}; };
/* ----------------------------------------------------------- * /* ----------------------------------------------------------- *
@ -153,78 +153,78 @@ uint64_t nlookup;
*/ */
struct fuse_lowlevel_ops struct fuse_lowlevel_ops
{ {
/**
* Initialize filesystem
*
* Called before any other filesystem method
*
* There's no reply to this function
*
* @param userdata the user data passed to fuse_lowlevel_new()
*/
void (*init) (void *userdata, struct fuse_conn_info *conn);
/**
* Initialize filesystem
*
* Called before any other filesystem method
*
* There's no reply to this function
*
* @param userdata the user data passed to fuse_lowlevel_new()
*/
void (*init)(void *userdata, struct fuse_conn_info *conn);
/**
* Clean up filesystem
*
* Called on filesystem exit
*
* There's no reply to this function
*
* @param userdata the user data passed to fuse_lowlevel_new()
*/
void (*destroy) (void *userdata);
/**
* Clean up filesystem
*
* Called on filesystem exit
*
* There's no reply to this function
*
* @param userdata the user data passed to fuse_lowlevel_new()
*/
void (*destroy)(void *userdata);
/**
* Look up a directory entry by name and get its attributes.
*
* Valid replies:
* fuse_reply_entry
* fuse_reply_err
*
* @param req request handle
* @param parent inode number of the parent directory
* @param name the name to look up
*/
void (*lookup) (fuse_req_t req, fuse_ino_t parent, const char *name);
/**
* Look up a directory entry by name and get its attributes.
*
* Valid replies:
* fuse_reply_entry
* fuse_reply_err
*
* @param req request handle
* @param parent inode number of the parent directory
* @param name the name to look up
*/
void (*lookup)(fuse_req_t req, fuse_ino_t parent, const char *name);
/**
* Forget about an inode
*
* This function is called when the kernel removes an inode
* from its internal caches.
*
* The inode's lookup count increases by one for every call to
* fuse_reply_entry and fuse_reply_create. The nlookup parameter
* indicates by how much the lookup count should be decreased.
*
* Inodes with a non-zero lookup count may receive request from
* the kernel even after calls to unlink, rmdir or (when
* overwriting an existing file) rename. Filesystems must handle
* such requests properly and it is recommended to defer removal
* of the inode until the lookup count reaches zero. Calls to
* unlink, remdir or rename will be followed closely by forget
* unless the file or directory is open, in which case the
* kernel issues forget only after the release or releasedir
* calls.
*
* Note that if a file system will be exported over NFS the
* inodes lifetime must extend even beyond forget. See the
* generation field in struct fuse_entry_param above.
*
* On unmount the lookup count for all inodes implicitly drops
* to zero. It is not guaranteed that the file system will
* receive corresponding forget messages for the affected
* inodes.
*
* Valid replies:
* fuse_reply_none
*
* @param req request handle
* @param ino the inode number
* @param nlookup the number of lookups to forget
*/
void (*forget) (fuse_req_t req, fuse_ino_t ino, uint64_t nlookup);
/**
* Forget about an inode
*
* This function is called when the kernel removes an inode
* from its internal caches.
*
* The inode's lookup count increases by one for every call to
* fuse_reply_entry and fuse_reply_create. The nlookup parameter
* indicates by how much the lookup count should be decreased.
*
* Inodes with a non-zero lookup count may receive request from
* the kernel even after calls to unlink, rmdir or (when
* overwriting an existing file) rename. Filesystems must handle
* such requests properly and it is recommended to defer removal
* of the inode until the lookup count reaches zero. Calls to
* unlink, remdir or rename will be followed closely by forget
* unless the file or directory is open, in which case the
* kernel issues forget only after the release or releasedir
* calls.
*
* Note that if a file system will be exported over NFS the
* inodes lifetime must extend even beyond forget. See the
* generation field in struct fuse_entry_param above.
*
* On unmount the lookup count for all inodes implicitly drops
* to zero. It is not guaranteed that the file system will
* receive corresponding forget messages for the affected
* inodes.
*
* Valid replies:
* fuse_reply_none
*
* @param req request handle
* @param ino the inode number
* @param nlookup the number of lookups to forget
*/
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,
struct fuse_file_info *fi);
void (*getattr)(fuse_req_t req, fuse_ino_t ino,
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,
int to_set, struct fuse_file_info *fi);
void (*setattr)(fuse_req_t req, fuse_ino_t ino, struct stat *attr,
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,
mode_t mode, dev_t rdev);
void (*mknod)(fuse_req_t req, fuse_ino_t parent, const char *name,
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,
mode_t mode);
void (*mkdir)(fuse_req_t req, fuse_ino_t parent, const char *name,
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,
const char *name);
void (*symlink)(fuse_req_t req, const char *link, fuse_ino_t parent,
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,
fuse_ino_t newparent, const char *newname);
void (*rename)(fuse_req_t req, fuse_ino_t parent, const char *name,
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,
const char *newname);
void (*link)(fuse_req_t req, fuse_ino_t ino, fuse_ino_t newparent,
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,
struct fuse_file_info *fi);
void (*open)(fuse_req_t req, fuse_ino_t ino,
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,
struct fuse_file_info *fi);
void (*read)(fuse_req_t req, fuse_ino_t ino, size_t size, off_t off,
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,
size_t size, off_t off, struct fuse_file_info *fi);
void (*write)(fuse_req_t req, fuse_ino_t ino, const char *buf,
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,
struct fuse_file_info *fi);
void (*flush)(fuse_req_t req, fuse_ino_t ino,
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,
struct fuse_file_info *fi);
void (*release)(fuse_req_t req, fuse_ino_t ino,
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,
struct fuse_file_info *fi);
void (*fsync)(fuse_req_t req, fuse_ino_t ino, int datasync,
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,
struct fuse_file_info *fi);
void (*opendir)(fuse_req_t req, fuse_ino_t ino,
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,
struct fuse_file_info *llffi);
void (*readdir)(fuse_req_t req, fuse_ino_t ino, size_t size, off_t off,
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,
struct fuse_file_info *fi);
void (*releasedir)(fuse_req_t req, fuse_ino_t ino,
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,
struct fuse_file_info *fi);
void (*fsyncdir)(fuse_req_t req, fuse_ino_t ino, int datasync,
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,
const char *value, size_t size, int flags);
void (*setxattr)(fuse_req_t req, fuse_ino_t ino, const char *name,
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,
size_t size);
void (*getxattr)(fuse_req_t req, fuse_ino_t ino, const char *name,
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,
mode_t mode, struct fuse_file_info *fi);
void (*create)(fuse_req_t req, fuse_ino_t parent, const char *name,
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,
struct fuse_file_info *fi, struct flock *lock);
void (*getlk)(fuse_req_t req, fuse_ino_t ino,
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,
struct fuse_file_info *fi,
struct flock *lock, int sleep);
void (*setlk)(fuse_req_t req, fuse_ino_t ino,
fuse_file_info_t *fi,
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,
uint64_t idx);
void (*bmap)(fuse_req_t req, fuse_ino_t ino, size_t blocksize,
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,
struct fuse_file_info *fi, unsigned flags,
const void *in_buf, uint32_t in_bufsz, uint32_t out_bufsz);
void (*ioctl)(fuse_req_t req, fuse_ino_t ino, unsigned long cmd, void *arg,
fuse_file_info_t *fi, unsigned flags,
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,
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 * 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,
struct fuse_bufvec *bufv, off_t off,
struct fuse_file_info *fi);
void (*write_buf)(fuse_req_t req, fuse_ino_t ino,
struct fuse_bufvec *bufv, off_t off,
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,
off_t offset, struct fuse_bufvec *bufv);
void (*retrieve_reply)(fuse_req_t req, void *cookie, fuse_ino_t ino,
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,
struct fuse_forget_data *forgets);
void (*forget_multi)(fuse_req_t req, size_t count,
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,
struct fuse_file_info *fi, int op);
void (*flock)(fuse_req_t req, fuse_ino_t ino,
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,
off_t offset, off_t length, struct fuse_file_info *fi);
void (*fallocate)(fuse_req_t req, fuse_ino_t ino, int mode,
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,
fuse_ino_t ino_in,
off_t off_in,
struct fuse_file_info *fi_in,
fuse_ino_t ino_out,
off_t off_out,
struct fuse_file_info *fi_out,
size_t len,
int flags);
void (*copy_file_range)(fuse_req_t req,
fuse_ino_t ino_in,
off_t off_in,
fuse_file_info_t *fi_in,
fuse_ino_t ino_out,
off_t off_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 * @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,
struct fuse_chan *ch);
void (*process)(void *data, const char *buf, size_t len,
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);
}; };
/** /**

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

139
libfuse/lib/fuse_loop_mt.c

@ -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,37 +66,40 @@ 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)) {
struct fuse_chan *ch = mt->prevch;
struct fuse_buf fbuf = {
.mem = w->buf,
.size = w->bufsize,
};
int res;
pthread_setcancelstate(PTHREAD_CANCEL_ENABLE, NULL);
res = fuse_session_receive_buf(mt->se, &fbuf, &ch);
pthread_setcancelstate(PTHREAD_CANCEL_DISABLE, NULL);
if (res == -EINTR)
continue;
if (res <= 0) {
if (res < 0) {
fuse_session_exit(mt->se);
mt->error = -1;
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);
pthread_setcancelstate(PTHREAD_CANCEL_DISABLE, NULL);
if(res == -EINTR)
continue;
if(res <= 0) {
if(res < 0) {
fuse_session_exit(mt->se);
mt->error = -1;
}
break;
} }
break;
}
if (mt->exit)
return NULL;
if(mt->exit)
return NULL;
fuse_session_process_buf(mt->se, &fbuf, ch);
}
fuse_session_process_buf(mt->se, &fbuf, ch);
}
sem_post(&mt->finish); sem_post(&mt->finish);
@ -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);
sigaddset(&newset, SIGTERM);
sigaddset(&newset, SIGINT);
sigaddset(&newset, SIGHUP);
sigaddset(&newset, SIGQUIT);
pthread_sigmask(SIG_BLOCK, &newset, &oldset);
sigfillset(&newset);
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,
const int _threads)
int
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));
mt.se = se;
mt.prevch = fuse_session_next_chan(se, NULL);
memset(&mt,0,sizeof(struct fuse_mt));
mt.se = se_;
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());
if(_threads < 0)
threads /= -_threads;
threads = ((threads_ > 0) ? threads_ : number_of_threads());
if(threads_ < 0)
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) {
/* sem_wait() is interruptible */
while (!fuse_session_exited(se))
sem_wait(&mt.finish);
if(!err)
{
/* sem_wait() is interruptible */
while(!fuse_session_exited(se_))
sem_wait(&mt.finish);
for (w = mt.main.next; w != &mt.main; w = w->next)
pthread_cancel(w->thread_id);
mt.exit = 1;
for(w = mt.main.next; w != &mt.main; w = w->next)
pthread_cancel(w->thread_id);
mt.exit = 1;
while (mt.main.next != &mt.main)
fuse_join_worker(mt.main.next);
while(mt.main.next != &mt.main)
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;
} }

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

12
src/fuse_copy_file_range.cpp

@ -49,12 +49,12 @@ namespace l
namespace FUSE namespace FUSE
{ {
ssize_t ssize_t
copy_file_range(struct fuse_file_info *ffi_in_,
off_t offset_in_,
struct fuse_file_info *ffi_out_,
off_t offset_out_,
size_t size_,
int flags_)
copy_file_range(const fuse_file_info_t *ffi_in_,
off_t offset_in_,
const fuse_file_info_t *ffi_out_,
off_t offset_out_,
size_t size_,
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);

12
src/fuse_copy_file_range.hpp

@ -19,10 +19,10 @@
namespace FUSE namespace FUSE
{ {
ssize_t ssize_t
copy_file_range(struct fuse_file_info *ffi_in,
off_t offset_in,
struct fuse_file_info *ffi_out,
off_t offset_out,
size_t size,
int flags);
copy_file_range(const fuse_file_info_t *ffi_in,
off_t offset_in,
const fuse_file_info_t *ffi_out,
off_t offset_out,
size_t size,
int flags);
} }

10
src/fuse_create.cpp

@ -54,8 +54,8 @@ namespace l
static static
void void
config_to_ffi_flags(const Config &config_,
fuse_file_info *ffi_)
config_to_ffi_flags(const Config &config_,
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_,
mode_t mode_,
fuse_file_info *ffi_)
create(const char *fusepath_,
mode_t mode_,
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();

6
src/fuse_create.hpp

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

8
src/fuse_fallocate.cpp

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

8
src/fuse_fallocate.hpp

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

4
src/fuse_fchmod.cpp

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

4
src/fuse_fchmod.hpp

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

6
src/fuse_fchown.cpp

@ -43,9 +43,9 @@ namespace l
namespace FUSE namespace FUSE
{ {
int int
fchown(const struct fuse_file_info *ffi_,
const uid_t uid_,
const gid_t gid_)
fchown(const fuse_file_info_t *ffi_,
const uid_t uid_,
const gid_t gid_)
{ {
FileInfo *fi = reinterpret_cast<FileInfo*>(ffi_->fh); FileInfo *fi = reinterpret_cast<FileInfo*>(ffi_->fh);

6
src/fuse_fchown.hpp

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

6
src/fuse_fgetattr.cpp

@ -45,9 +45,9 @@ namespace l
namespace FUSE namespace FUSE
{ {
int int
fgetattr(struct stat *st_,
fuse_file_info *ffi_,
fuse_timeouts_t *timeout_)
fgetattr(const fuse_file_info_t *ffi_,
struct stat *st_,
fuse_timeouts_t *timeout_)
{ {
int rv; int rv;
const Config &config = Config::ro(); const Config &config = Config::ro();

6
src/fuse_fgetattr.hpp

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

5
src/fuse_flock.cpp

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

5
src/fuse_flock.hpp

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

2
src/fuse_flush.cpp

@ -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);

2
src/fuse_flush.hpp

@ -21,5 +21,5 @@
namespace FUSE namespace FUSE
{ {
int 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 namespace FUSE
{ {
int int
fsync(int isdatasync_,
fuse_file_info *ffi_)
fsync(const fuse_file_info_t *ffi_,
int isdatasync_)
{ {
FileInfo *fi = reinterpret_cast<FileInfo*>(ffi_->fh); FileInfo *fi = reinterpret_cast<FileInfo*>(ffi_->fh);

5
src/fuse_fsync.hpp

@ -21,6 +21,7 @@
namespace FUSE namespace FUSE
{ {
int 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 namespace FUSE
{ {
int int
fsyncdir(int isdatasync_,
fuse_file_info *ffi_)
fsyncdir(const fuse_file_info_t *ffi_,
int isdatasync_)
{ {
DirInfo *di = reinterpret_cast<DirInfo*>(ffi_->fh); DirInfo *di = reinterpret_cast<DirInfo*>(ffi_->fh);

4
src/fuse_fsyncdir.hpp

@ -21,6 +21,6 @@
namespace FUSE namespace FUSE
{ {
int 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 namespace FUSE
{ {
int 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); FileInfo *fi = reinterpret_cast<FileInfo*>(ffi_->fh);

4
src/fuse_ftruncate.hpp

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

4
src/fuse_futimens.cpp

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

4
src/fuse_futimens.hpp

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

48
src/fuse_ioctl.cpp

@ -116,10 +116,10 @@ namespace l
static static
int int
ioctl_file(fuse_file_info *ffi_,
const uint32_t cmd_,
void *data_,
uint32_t *out_bufsz_)
ioctl_file(const fuse_file_info_t *ffi_,
const uint32_t cmd_,
void *data_,
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_,
const uint32_t cmd_,
void *data_,
uint32_t *out_bufsz_)
ioctl_dir(const fuse_file_info_t *ffi_,
const uint32_t cmd_,
void *data_,
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_,
void *data_)
file_basepath(const fuse_file_info_t *ffi_,
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_,
void *data_)
file_relpath(const fuse_file_info_t *ffi_,
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_,
void *data_)
file_fullpath(const fuse_file_info_t *ffi_,
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_,
void *data_)
file_allpaths(const fuse_file_info_t *ffi_,
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_,
void *data_)
file_info(const fuse_file_info_t *ffi_,
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_,
void *arg_,
fuse_file_info *ffi_,
unsigned int flags_,
void *data_,
uint32_t *out_bufsz_)
ioctl(const fuse_file_info_t *ffi_,
unsigned long cmd_,
void *arg_,
unsigned int flags_,
void *data_,
uint32_t *out_bufsz_)
{ {
switch(cmd_) switch(cmd_)
{ {

12
src/fuse_ioctl.hpp

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

8
src/fuse_open.cpp

@ -117,8 +117,8 @@ namespace l
static static
void void
config_to_ffi_flags(const Config &config_,
fuse_file_info *ffi_)
config_to_ffi_flags(const Config &config_,
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_,
fuse_file_info *ffi_)
open(const char *fusepath_,
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();

4
src/fuse_open.hpp

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

4
src/fuse_opendir.cpp

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

4
src/fuse_opendir.hpp

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

2
src/fuse_prepare_hide.cpp

@ -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);

17
src/fuse_read.cpp

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

16
src/fuse_read.hpp

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

8
src/fuse_read_buf.cpp

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

8
src/fuse_read_buf.hpp

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

4
src/fuse_readdir.cpp

@ -29,8 +29,8 @@
namespace FUSE namespace FUSE
{ {
int int
readdir(fuse_file_info *ffi_,
fuse_dirents_t *buf_)
readdir(const fuse_file_info_t *ffi_,
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();

4
src/fuse_readdir.hpp

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

12
src/fuse_readdir_plus.cpp

@ -29,13 +29,13 @@
namespace FUSE namespace FUSE
{ {
int int
readdir_plus(fuse_file_info *ffi_,
fuse_dirents_t *buf_)
readdir_plus(const fuse_file_info_t *ffi_,
fuse_dirents_t *buf_)
{ {
DirInfo *di = reinterpret_cast<DirInfo*>(ffi_->fh);
const fuse_context *fc = fuse_get_context();
const Config &config = Config::ro();
const ugid::Set ugid(fc->uid,fc->gid);
DirInfo *di = reinterpret_cast<DirInfo*>(ffi_->fh);
const fuse_context *fc = fuse_get_context();
const Config &config = Config::ro();
const ugid::Set ugid(fc->uid,fc->gid);
switch(config.readdir) switch(config.readdir)
{ {

4
src/fuse_readdir_plus.hpp

@ -21,6 +21,6 @@
namespace FUSE namespace FUSE
{ {
int int
readdir_plus(fuse_file_info *ffi,
fuse_dirents_t *buf);
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 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);

2
src/fuse_release.hpp

@ -21,5 +21,5 @@
namespace FUSE namespace FUSE
{ {
int 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 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);

2
src/fuse_releasedir.hpp

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

28
src/fuse_write.cpp

@ -102,11 +102,11 @@ namespace l
static static
int int
write(WriteFunc func_,
const char *buf_,
const size_t count_,
const off_t offset_,
fuse_file_info *ffi_)
write(const fuse_file_info_t *ffi_,
WriteFunc func_,
const char *buf_,
const size_t count_,
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_,
size_t count_,
off_t offset_,
fuse_file_info *ffi_)
write(const fuse_file_info_t *ffi_,
const char *buf_,
size_t count_,
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_,
size_t count_,
off_t offset_,
fuse_file_info *ffi_)
write_null(const fuse_file_info_t *ffi_,
const char *buf_,
size_t count_,
off_t offset_)
{ {
return count_; return count_;
} }

16
src/fuse_write.hpp

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

12
src/fuse_write_buf.cpp

@ -86,9 +86,9 @@ namespace l
namespace FUSE namespace FUSE
{ {
int 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; 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_,
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; return src_->buf[0].size;
} }

12
src/fuse_write_buf.hpp

@ -23,12 +23,12 @@
namespace FUSE namespace FUSE
{ {
int 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 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