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. 186
      libfuse/include/fuse_lowlevel.h
  4. 3465
      libfuse/lib/fuse.c
  5. 99
      libfuse/lib/fuse_loop_mt.c
  6. 1159
      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 *

186
libfuse/include/fuse_lowlevel.h

@ -67,16 +67,16 @@ struct fuse_chan;
/** Directory entry parameters supplied to fuse_reply_entry() */
struct fuse_entry_param
{
/** Unique inode number
/** Unique inode number
*
* In lookup, zero means negative entry (from version 2.5)
* Returning ENOENT also means negative entry, but by setting zero
* ino the kernel may cache negative entries for entry_timeout
* seconds.
*/
fuse_ino_t ino;
fuse_ino_t ino;
/** Generation number for this entry.
/** Generation number for this entry.
*
* If the file system will be exported over NFS, the
* ino/generation pairs need to be unique over the file
@ -89,41 +89,41 @@ fuse_ino_t ino;
* it as an error.
*
*/
uint64_t generation;
uint64_t generation;
/** Inode attributes.
/** Inode attributes.
*
* Even if attr_timeout == 0, attr must be correct. For example,
* for open(), FUSE uses attr.st_size from lookup() to determine
* how many bytes to request. If this value is not correct,
* incorrect data will be returned.
*/
struct stat attr;
struct stat attr;
fuse_timeouts_t timeout;
fuse_timeouts_t timeout;
};
/** Additional context associated with requests */
struct fuse_ctx
{
/** User ID of the calling process */
uid_t uid;
/** User ID of the calling process */
uid_t uid;
/** Group ID of the calling process */
gid_t gid;
/** Group ID of the calling process */
gid_t gid;
/** Thread ID of the calling process */
pid_t pid;
/** Thread ID of the calling process */
pid_t pid;
/** Umask of the calling process (introduced in version 2.8) */
mode_t umask;
/** Umask of the calling process (introduced in version 2.8) */
mode_t umask;
};
struct fuse_forget_data
{
fuse_ino_t ino;
uint64_t nlookup;
fuse_ino_t ino;
uint64_t nlookup;
};
/* ----------------------------------------------------------- *
@ -153,7 +153,7 @@ uint64_t nlookup;
*/
struct fuse_lowlevel_ops
{
/**
/**
* Initialize filesystem
*
* Called before any other filesystem method
@ -162,9 +162,9 @@ struct fuse_lowlevel_ops
*
* @param userdata the user data passed to fuse_lowlevel_new()
*/
void (*init) (void *userdata, struct fuse_conn_info *conn);
void (*init)(void *userdata, struct fuse_conn_info *conn);
/**
/**
* Clean up filesystem
*
* Called on filesystem exit
@ -173,9 +173,9 @@ void (*init) (void *userdata, struct fuse_conn_info *conn);
*
* @param userdata the user data passed to fuse_lowlevel_new()
*/
void (*destroy) (void *userdata);
void (*destroy)(void *userdata);
/**
/**
* Look up a directory entry by name and get its attributes.
*
* Valid replies:
@ -186,9 +186,9 @@ void (*destroy) (void *userdata);
* @param parent inode number of the parent directory
* @param name the name to look up
*/
void (*lookup) (fuse_req_t req, fuse_ino_t parent, const char *name);
void (*lookup)(fuse_req_t req, fuse_ino_t parent, const char *name);
/**
/**
* Forget about an inode
*
* This function is called when the kernel removes an inode
@ -224,7 +224,7 @@ void (*lookup) (fuse_req_t req, fuse_ino_t parent, const char *name);
* @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);
void (*forget)(fuse_req_t req, fuse_ino_t ino, uint64_t nlookup);
/**
* 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 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
@ -267,8 +267,8 @@ void (*lookup) (fuse_req_t req, fuse_ino_t parent, const char *name);
* Changed in version 2.5:
* 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
@ -280,7 +280,7 @@ void (*lookup) (fuse_req_t req, fuse_ino_t parent, const char *name);
* @param req request handle
* @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
@ -298,7 +298,7 @@ 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 rdev the device number (only valid if created file is a device)
*/
void (*mknod) (fuse_req_t req, fuse_ino_t parent, const char *name,
void (*mknod)(fuse_req_t req, fuse_ino_t parent, const char *name,
mode_t mode, dev_t rdev);
/**
@ -313,7 +313,7 @@ void (*lookup) (fuse_req_t req, fuse_ino_t parent, const char *name);
* @param name to create
* @param mode with which to create the new file
*/
void (*mkdir) (fuse_req_t req, fuse_ino_t parent, const char *name,
void (*mkdir)(fuse_req_t req, fuse_ino_t parent, const char *name,
mode_t mode);
/**
@ -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 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
@ -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 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
@ -362,7 +362,7 @@ void (*lookup) (fuse_req_t req, fuse_ino_t parent, const char *name);
* @param parent inode number of the parent directory
* @param name to create
*/
void (*symlink) (fuse_req_t req, const char *link, fuse_ino_t parent,
void (*symlink)(fuse_req_t req, const char *link, fuse_ino_t parent,
const char *name);
/** Rename a file
@ -382,7 +382,7 @@ void (*lookup) (fuse_req_t req, fuse_ino_t parent, const char *name);
* @param newparent inode number of the new parent directory
* @param newname new name
*/
void (*rename) (fuse_req_t req, fuse_ino_t parent, const char *name,
void (*rename)(fuse_req_t req, fuse_ino_t parent, const char *name,
fuse_ino_t newparent, const char *newname);
/**
@ -397,7 +397,7 @@ void (*lookup) (fuse_req_t req, fuse_ino_t parent, const char *name);
* @param newparent inode number of the new parent directory
* @param newname new name to create
*/
void (*link) (fuse_req_t req, fuse_ino_t ino, fuse_ino_t newparent,
void (*link)(fuse_req_t req, fuse_ino_t ino, fuse_ino_t newparent,
const char *newname);
/**
@ -425,8 +425,8 @@ void (*lookup) (fuse_req_t req, fuse_ino_t parent, const char *name);
* @param ino the inode number
* @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
@ -453,8 +453,8 @@ void (*lookup) (fuse_req_t req, fuse_ino_t parent, const char *name);
* @param off offset to read from
* @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
@ -479,8 +479,8 @@ void (*lookup) (fuse_req_t req, fuse_ino_t parent, const char *name);
* @param off offset to write to
* @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
@ -511,8 +511,8 @@ void (*lookup) (fuse_req_t req, fuse_ino_t parent, const char *name);
* @param ino the inode number
* @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
@ -538,8 +538,8 @@ void (*lookup) (fuse_req_t req, fuse_ino_t parent, const char *name);
* @param ino the inode number
* @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
@ -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 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
@ -579,8 +579,8 @@ void (*lookup) (fuse_req_t req, fuse_ino_t parent, const char *name);
* @param ino the inode number
* @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
@ -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 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,
size_t size, off_t off,
struct fuse_file_info *ffi);
fuse_file_info_t *ffi);
/**
* 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 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
@ -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 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
@ -659,7 +659,7 @@ void (*lookup) (fuse_req_t req, fuse_ino_t parent, const char *name);
* @param req request handle
* @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
@ -667,7 +667,7 @@ void (*lookup) (fuse_req_t req, fuse_ino_t parent, const char *name);
* Valid replies:
* fuse_reply_err
*/
void (*setxattr) (fuse_req_t req, fuse_ino_t ino, const char *name,
void (*setxattr)(fuse_req_t req, fuse_ino_t ino, const char *name,
const char *value, size_t size, int flags);
/**
@ -693,7 +693,7 @@ void (*lookup) (fuse_req_t req, fuse_ino_t parent, const char *name);
* @param name of the extended attribute
* @param size maximum size of the value to send
*/
void (*getxattr) (fuse_req_t req, fuse_ino_t ino, const char *name,
void (*getxattr)(fuse_req_t req, fuse_ino_t ino, const char *name,
size_t size);
/**
@ -719,7 +719,7 @@ void (*lookup) (fuse_req_t req, fuse_ino_t parent, const char *name);
* @param ino the inode number
* @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
@ -731,7 +731,7 @@ void (*lookup) (fuse_req_t req, fuse_ino_t parent, const char *name);
* @param ino the inode number
* @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
@ -751,7 +751,7 @@ void (*lookup) (fuse_req_t req, fuse_ino_t parent, const char *name);
* @param ino the inode number
* @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
@ -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 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
@ -803,8 +803,8 @@ void (*lookup) (fuse_req_t req, fuse_ino_t parent, const char *name);
* @param fi file information
* @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
@ -830,8 +830,8 @@ void (*lookup) (fuse_req_t req, fuse_ino_t parent, const char *name);
* @param lock the region/type to set
* @param sleep locking operation may sleep
*/
void (*setlk) (fuse_req_t req, fuse_ino_t ino,
struct fuse_file_info *fi,
void (*setlk)(fuse_req_t req, fuse_ino_t ino,
fuse_file_info_t *fi,
struct flock *lock, int sleep);
/**
@ -851,7 +851,7 @@ void (*lookup) (fuse_req_t req, fuse_ino_t parent, const char *name);
* @param blocksize unit of block index
* @param idx block index within file
*/
void (*bmap) (fuse_req_t req, fuse_ino_t ino, size_t blocksize,
void (*bmap)(fuse_req_t req, fuse_ino_t ino, size_t blocksize,
uint64_t idx);
/**
@ -881,8 +881,8 @@ void (*lookup) (fuse_req_t req, fuse_ino_t parent, const char *name);
* @param in_bufsz number of fetched bytes
* @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,
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);
/**
@ -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
@ -940,9 +942,9 @@ void (*lookup) (fuse_req_t req, fuse_ino_t parent, const char *name);
* @param off offset to write to
* @param fi file information
*/
void (*write_buf) (fuse_req_t req, fuse_ino_t ino,
void (*write_buf)(fuse_req_t req, fuse_ino_t ino,
struct fuse_bufvec *bufv, off_t off,
struct fuse_file_info *fi);
fuse_file_info_t *fi);
/**
* Callback function for the retrieve request
@ -958,7 +960,7 @@ void (*lookup) (fuse_req_t req, fuse_ino_t parent, const char *name);
* @param offset the offset supplied to fuse_lowlevel_notify_retrieve()
* @param bufv the buffer containing the returned data
*/
void (*retrieve_reply) (fuse_req_t req, void *cookie, fuse_ino_t ino,
void (*retrieve_reply)(fuse_req_t req, void *cookie, fuse_ino_t ino,
off_t offset, struct fuse_bufvec *bufv);
/**
@ -974,7 +976,7 @@ void (*lookup) (fuse_req_t req, fuse_ino_t parent, const char *name);
*
* @param req request handle
*/
void (*forget_multi) (fuse_req_t req, size_t count,
void (*forget_multi)(fuse_req_t req, size_t count,
struct fuse_forget_data *forgets);
/**
@ -994,8 +996,8 @@ void (*lookup) (fuse_req_t req, fuse_ino_t parent, const char *name);
* @param fi file information
* @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
@ -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,
* 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
@ -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
@ -1549,7 +1551,7 @@ struct fuse_session_ops
* @param len request length
* @param ch channel on which the request was received
*/
void (*process) (void *data, const char *buf, size_t len,
void (*process)(void *data, const char *buf, size_t len,
struct fuse_chan *ch);
/**
@ -1558,7 +1560,7 @@ struct fuse_session_ops
* @param data user data passed to fuse_session_new()
* @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)
@ -1566,14 +1568,14 @@ struct fuse_session_ops
* @param data user data passed to fuse_session_new()
* @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)
*
* @param data user data passed to fuse_session_new()
*/
void (*destroy) (void *data);
void (*destroy)(void *data);
};
/**

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

99
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,33 +66,36 @@ 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);
pthread_setcancelstate(PTHREAD_CANCEL_DISABLE, NULL);
if (res == -EINTR)
if(res == -EINTR)
continue;
if (res <= 0) {
if (res < 0) {
if(res <= 0) {
if(res < 0) {
fuse_session_exit(mt->se);
mt->error = -1;
}
break;
}
if (mt->exit)
if(mt->exit)
return NULL;
fuse_session_process_buf(mt->se, &fbuf, ch);
@ -109,20 +117,16 @@ int fuse_start_thread(pthread_t *thread_id, void *(*func)(void *), void *arg)
/* Override default stack size */
pthread_attr_init(&attr);
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);
/* 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);
pthread_sigmask(SIG_SETMASK, &oldset, NULL);
pthread_sigmask(SIG_SETMASK,&oldset,NULL);
pthread_attr_destroy(&attr);
if (res != 0) {
if(res != 0) {
fprintf(stderr, "fuse: error creating thread: %s\n",
strerror(res));
return -1;
@ -135,7 +139,7 @@ static int fuse_loop_start_thread(struct fuse_mt *mt)
{
int res;
struct fuse_worker *w = malloc(sizeof(struct fuse_worker));
if (!w) {
if(!w) {
fprintf(stderr, "fuse: failed to allocate worker structure\n");
return -1;
}
@ -143,14 +147,14 @@ static int fuse_loop_start_thread(struct fuse_mt *mt)
w->bufsize = fuse_chan_bufsize(mt->prevch);
w->buf = calloc(w->bufsize,1);
w->mt = mt;
if (!w->buf) {
if(!w->buf) {
fprintf(stderr, "fuse: failed to allocate read buffer\n");
free(w);
return -1;
}
res = fuse_start_thread(&w->thread_id, fuse_do_work, w);
if (res == -1) {
if(res == -1) {
free(w->buf);
free(w);
return -1;
@ -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;
@ -186,17 +191,17 @@ int fuse_session_loop_mt(struct fuse_session *se,
struct fuse_mt mt;
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.main.thread_id = pthread_self();
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)
threads = 1;
@ -204,22 +209,24 @@ 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)
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)
while(mt.main.next != &mt.main)
fuse_join_worker(mt.main.next);
err = mt.error;
}
sem_destroy(&mt.finish);
fuse_session_reset(se);
fuse_session_reset(se_);
return err;
}

1159
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