|
|
@ -37,36 +37,37 @@ |
|
|
|
extern "C" { |
|
|
|
#endif |
|
|
|
|
|
|
|
/* ----------------------------------------------------------- * |
|
|
|
/* ----------------------------------------------------------- * |
|
|
|
* Miscellaneous definitions * |
|
|
|
* ----------------------------------------------------------- */ |
|
|
|
|
|
|
|
/** The node ID of the root inode */ |
|
|
|
/** The node ID of the root inode */ |
|
|
|
#define FUSE_ROOT_ID 1 |
|
|
|
|
|
|
|
/** Inode number type */ |
|
|
|
typedef uint64_t fuse_ino_t; |
|
|
|
/** Inode number type */ |
|
|
|
typedef uint64_t fuse_ino_t; |
|
|
|
|
|
|
|
/** Request pointer type */ |
|
|
|
typedef struct fuse_req *fuse_req_t; |
|
|
|
/** Request pointer type */ |
|
|
|
typedef struct fuse_req *fuse_req_t; |
|
|
|
|
|
|
|
/** |
|
|
|
/** |
|
|
|
* Session |
|
|
|
* |
|
|
|
* This provides hooks for processing requests, and exiting |
|
|
|
*/ |
|
|
|
struct fuse_session; |
|
|
|
struct fuse_session; |
|
|
|
|
|
|
|
/** |
|
|
|
/** |
|
|
|
* Channel |
|
|
|
* |
|
|
|
* A communication channel, providing hooks for sending and receiving |
|
|
|
* messages |
|
|
|
*/ |
|
|
|
struct fuse_chan; |
|
|
|
struct fuse_chan; |
|
|
|
|
|
|
|
/** Directory entry parameters supplied to fuse_reply_entry() */ |
|
|
|
struct fuse_entry_param { |
|
|
|
/** Directory entry parameters supplied to fuse_reply_entry() */ |
|
|
|
struct fuse_entry_param |
|
|
|
{ |
|
|
|
/** Unique inode number |
|
|
|
* |
|
|
|
* In lookup, zero means negative entry (from version 2.5) |
|
|
@ -102,10 +103,11 @@ struct fuse_entry_param { |
|
|
|
struct stat attr; |
|
|
|
|
|
|
|
fuse_timeouts_t timeout; |
|
|
|
}; |
|
|
|
}; |
|
|
|
|
|
|
|
/** Additional context associated with requests */ |
|
|
|
struct fuse_ctx { |
|
|
|
/** Additional context associated with requests */ |
|
|
|
struct fuse_ctx |
|
|
|
{ |
|
|
|
/** User ID of the calling process */ |
|
|
|
uid_t uid; |
|
|
|
|
|
|
@ -117,18 +119,19 @@ struct fuse_ctx { |
|
|
|
|
|
|
|
/** Umask of the calling process (introduced in version 2.8) */ |
|
|
|
mode_t umask; |
|
|
|
}; |
|
|
|
}; |
|
|
|
|
|
|
|
struct fuse_forget_data { |
|
|
|
struct fuse_forget_data |
|
|
|
{ |
|
|
|
fuse_ino_t ino; |
|
|
|
uint64_t nlookup; |
|
|
|
}; |
|
|
|
}; |
|
|
|
|
|
|
|
/* ----------------------------------------------------------- * |
|
|
|
/* ----------------------------------------------------------- * |
|
|
|
* Request methods and replies * |
|
|
|
* ----------------------------------------------------------- */ |
|
|
|
|
|
|
|
/** |
|
|
|
/** |
|
|
|
* Low level filesystem operations |
|
|
|
* |
|
|
|
* Most of the methods (with the exception of init and destroy) |
|
|
@ -149,7 +152,8 @@ struct fuse_forget_data { |
|
|
|
* fuse_reply_open() return -ENOENT means, that the release method for |
|
|
|
* this file will not be called. |
|
|
|
*/ |
|
|
|
struct fuse_lowlevel_ops { |
|
|
|
struct fuse_lowlevel_ops |
|
|
|
{ |
|
|
|
/** |
|
|
|
* Initialize filesystem |
|
|
|
* |
|
|
@ -1059,9 +1063,9 @@ struct fuse_lowlevel_ops { |
|
|
|
struct fuse_file_info *fi_out, |
|
|
|
size_t len, |
|
|
|
int flags); |
|
|
|
}; |
|
|
|
}; |
|
|
|
|
|
|
|
/** |
|
|
|
/** |
|
|
|
* Reply with an error code or success |
|
|
|
* |
|
|
|
* Possible requests: |
|
|
@ -1074,9 +1078,9 @@ struct fuse_lowlevel_ops { |
|
|
|
* @param err the positive error value, or zero for success |
|
|
|
* @return zero for success, -errno for failure to send reply |
|
|
|
*/ |
|
|
|
int fuse_reply_err(fuse_req_t req, int err); |
|
|
|
int fuse_reply_err(fuse_req_t req, int err); |
|
|
|
|
|
|
|
/** |
|
|
|
/** |
|
|
|
* Don't send reply |
|
|
|
* |
|
|
|
* Possible requests: |
|
|
@ -1084,9 +1088,9 @@ int fuse_reply_err(fuse_req_t req, int err); |
|
|
|
* |
|
|
|
* @param req request handle |
|
|
|
*/ |
|
|
|
void fuse_reply_none(fuse_req_t req); |
|
|
|
void fuse_reply_none(fuse_req_t req); |
|
|
|
|
|
|
|
/** |
|
|
|
/** |
|
|
|
* Reply with a directory entry |
|
|
|
* |
|
|
|
* Possible requests: |
|
|
@ -1099,9 +1103,9 @@ void fuse_reply_none(fuse_req_t req); |
|
|
|
* @param e the entry parameters |
|
|
|
* @return zero for success, -errno for failure to send reply |
|
|
|
*/ |
|
|
|
int fuse_reply_entry(fuse_req_t req, const struct fuse_entry_param *e); |
|
|
|
int fuse_reply_entry(fuse_req_t req, const struct fuse_entry_param *e); |
|
|
|
|
|
|
|
/** |
|
|
|
/** |
|
|
|
* Reply with a directory entry and open parameters |
|
|
|
* |
|
|
|
* currently the following members of 'fi' are used: |
|
|
@ -1118,10 +1122,10 @@ int fuse_reply_entry(fuse_req_t req, const struct fuse_entry_param *e); |
|
|
|
* @param fi file information |
|
|
|
* @return zero for success, -errno for failure to send reply |
|
|
|
*/ |
|
|
|
int fuse_reply_create(fuse_req_t req, const struct fuse_entry_param *e, |
|
|
|
int fuse_reply_create(fuse_req_t req, const struct fuse_entry_param *e, |
|
|
|
const struct fuse_file_info *fi); |
|
|
|
|
|
|
|
/** |
|
|
|
/** |
|
|
|
* Reply with attributes |
|
|
|
* |
|
|
|
* Possible requests: |
|
|
@ -1132,11 +1136,11 @@ int fuse_reply_create(fuse_req_t req, const struct fuse_entry_param *e, |
|
|
|
* @param attr_timeout validity timeout (in seconds) for the attributes |
|
|
|
* @return zero for success, -errno for failure to send reply |
|
|
|
*/ |
|
|
|
int fuse_reply_attr(fuse_req_t req, |
|
|
|
int fuse_reply_attr(fuse_req_t req, |
|
|
|
const struct stat *attr, |
|
|
|
const uint64_t timeout); |
|
|
|
|
|
|
|
/** |
|
|
|
/** |
|
|
|
* Reply with the contents of a symbolic link |
|
|
|
* |
|
|
|
* Possible requests: |
|
|
@ -1146,9 +1150,9 @@ int fuse_reply_attr(fuse_req_t req, |
|
|
|
* @param link symbolic link contents |
|
|
|
* @return zero for success, -errno for failure to send reply |
|
|
|
*/ |
|
|
|
int fuse_reply_readlink(fuse_req_t req, const char *link); |
|
|
|
int fuse_reply_readlink(fuse_req_t req, const char *link); |
|
|
|
|
|
|
|
/** |
|
|
|
/** |
|
|
|
* Reply with open parameters |
|
|
|
* |
|
|
|
* currently the following members of 'fi' are used: |
|
|
@ -1161,9 +1165,9 @@ int fuse_reply_readlink(fuse_req_t req, const char *link); |
|
|
|
* @param fi file information |
|
|
|
* @return zero for success, -errno for failure to send reply |
|
|
|
*/ |
|
|
|
int fuse_reply_open(fuse_req_t req, const struct fuse_file_info *fi); |
|
|
|
int fuse_reply_open(fuse_req_t req, const struct fuse_file_info *fi); |
|
|
|
|
|
|
|
/** |
|
|
|
/** |
|
|
|
* Reply with number of bytes written |
|
|
|
* |
|
|
|
* Possible requests: |
|
|
@ -1173,9 +1177,9 @@ int fuse_reply_open(fuse_req_t req, const struct fuse_file_info *fi); |
|
|
|
* @param count the number of bytes written |
|
|
|
* @return zero for success, -errno for failure to send reply |
|
|
|
*/ |
|
|
|
int fuse_reply_write(fuse_req_t req, size_t count); |
|
|
|
int fuse_reply_write(fuse_req_t req, size_t count); |
|
|
|
|
|
|
|
/** |
|
|
|
/** |
|
|
|
* Reply with data |
|
|
|
* |
|
|
|
* Possible requests: |
|
|
@ -1186,9 +1190,9 @@ int fuse_reply_write(fuse_req_t req, size_t count); |
|
|
|
* @param size the size of data in bytes |
|
|
|
* @return zero for success, -errno for failure to send reply |
|
|
|
*/ |
|
|
|
int fuse_reply_buf(fuse_req_t req, const char *buf, size_t size); |
|
|
|
int fuse_reply_buf(fuse_req_t req, const char *buf, size_t size); |
|
|
|
|
|
|
|
/** |
|
|
|
/** |
|
|
|
* Reply with data copied/moved from buffer(s) |
|
|
|
* |
|
|
|
* Possible requests: |
|
|
@ -1199,10 +1203,10 @@ int fuse_reply_buf(fuse_req_t req, const char *buf, size_t size); |
|
|
|
* @param flags flags controlling the copy |
|
|
|
* @return zero for success, -errno for failure to send reply |
|
|
|
*/ |
|
|
|
int fuse_reply_data(fuse_req_t req, struct fuse_bufvec *bufv, |
|
|
|
int fuse_reply_data(fuse_req_t req, struct fuse_bufvec *bufv, |
|
|
|
enum fuse_buf_copy_flags flags); |
|
|
|
|
|
|
|
/** |
|
|
|
/** |
|
|
|
* Reply with data vector |
|
|
|
* |
|
|
|
* Possible requests: |
|
|
@ -1213,9 +1217,9 @@ int fuse_reply_data(fuse_req_t req, struct fuse_bufvec *bufv, |
|
|
|
* @param count the size of vector |
|
|
|
* @return zero for success, -errno for failure to send reply |
|
|
|
*/ |
|
|
|
int fuse_reply_iov(fuse_req_t req, const struct iovec *iov, int count); |
|
|
|
int fuse_reply_iov(fuse_req_t req, const struct iovec *iov, int count); |
|
|
|
|
|
|
|
/** |
|
|
|
/** |
|
|
|
* Reply with filesystem statistics |
|
|
|
* |
|
|
|
* Possible requests: |
|
|
@ -1225,9 +1229,9 @@ int fuse_reply_iov(fuse_req_t req, const struct iovec *iov, int count); |
|
|
|
* @param stbuf filesystem statistics |
|
|
|
* @return zero for success, -errno for failure to send reply |
|
|
|
*/ |
|
|
|
int fuse_reply_statfs(fuse_req_t req, const struct statvfs *stbuf); |
|
|
|
int fuse_reply_statfs(fuse_req_t req, const struct statvfs *stbuf); |
|
|
|
|
|
|
|
/** |
|
|
|
/** |
|
|
|
* Reply with needed buffer size |
|
|
|
* |
|
|
|
* Possible requests: |
|
|
@ -1237,9 +1241,9 @@ int fuse_reply_statfs(fuse_req_t req, const struct statvfs *stbuf); |
|
|
|
* @param count the buffer size needed in bytes |
|
|
|
* @return zero for success, -errno for failure to send reply |
|
|
|
*/ |
|
|
|
int fuse_reply_xattr(fuse_req_t req, size_t count); |
|
|
|
int fuse_reply_xattr(fuse_req_t req, size_t count); |
|
|
|
|
|
|
|
/** |
|
|
|
/** |
|
|
|
* Reply with file lock information |
|
|
|
* |
|
|
|
* Possible requests: |
|
|
@ -1249,9 +1253,9 @@ int fuse_reply_xattr(fuse_req_t req, size_t count); |
|
|
|
* @param lock the lock information |
|
|
|
* @return zero for success, -errno for failure to send reply |
|
|
|
*/ |
|
|
|
int fuse_reply_lock(fuse_req_t req, const struct flock *lock); |
|
|
|
int fuse_reply_lock(fuse_req_t req, const struct flock *lock); |
|
|
|
|
|
|
|
/** |
|
|
|
/** |
|
|
|
* Reply with block index |
|
|
|
* |
|
|
|
* Possible requests: |
|
|
@ -1261,9 +1265,9 @@ int fuse_reply_lock(fuse_req_t req, const struct flock *lock); |
|
|
|
* @param idx block index within device |
|
|
|
* @return zero for success, -errno for failure to send reply |
|
|
|
*/ |
|
|
|
int fuse_reply_bmap(fuse_req_t req, uint64_t idx); |
|
|
|
int fuse_reply_bmap(fuse_req_t req, uint64_t idx); |
|
|
|
|
|
|
|
/** |
|
|
|
/** |
|
|
|
* Reply to ask for data fetch and output buffer preparation. ioctl |
|
|
|
* will be retried with the specified input data fetched and output |
|
|
|
* buffer prepared. |
|
|
@ -1278,11 +1282,11 @@ int fuse_reply_bmap(fuse_req_t req, uint64_t idx); |
|
|
|
* @param out_count number of entries in out_iov |
|
|
|
* @return zero for success, -errno for failure to send reply |
|
|
|
*/ |
|
|
|
int fuse_reply_ioctl_retry(fuse_req_t req, |
|
|
|
int fuse_reply_ioctl_retry(fuse_req_t req, |
|
|
|
const struct iovec *in_iov, size_t in_count, |
|
|
|
const struct iovec *out_iov, size_t out_count); |
|
|
|
|
|
|
|
/** |
|
|
|
/** |
|
|
|
* Reply to finish ioctl |
|
|
|
* |
|
|
|
* Possible requests: |
|
|
@ -1293,9 +1297,9 @@ int fuse_reply_ioctl_retry(fuse_req_t req, |
|
|
|
* @param buf buffer containing output data |
|
|
|
* @param size length of output data |
|
|
|
*/ |
|
|
|
int fuse_reply_ioctl(fuse_req_t req, int result, const void *buf, uint32_t size); |
|
|
|
int fuse_reply_ioctl(fuse_req_t req, int result, const void *buf, uint32_t size); |
|
|
|
|
|
|
|
/** |
|
|
|
/** |
|
|
|
* Reply to finish ioctl with iov buffer |
|
|
|
* |
|
|
|
* Possible requests: |
|
|
@ -1306,31 +1310,31 @@ int fuse_reply_ioctl(fuse_req_t req, int result, const void *buf, uint32_t size) |
|
|
|
* @param iov the vector containing the data |
|
|
|
* @param count the size of vector |
|
|
|
*/ |
|
|
|
int fuse_reply_ioctl_iov(fuse_req_t req, int result, const struct iovec *iov, |
|
|
|
int fuse_reply_ioctl_iov(fuse_req_t req, int result, const struct iovec *iov, |
|
|
|
int count); |
|
|
|
|
|
|
|
/** |
|
|
|
/** |
|
|
|
* Reply with poll result event mask |
|
|
|
* |
|
|
|
* @param req request handle |
|
|
|
* @param revents poll result event mask |
|
|
|
*/ |
|
|
|
int fuse_reply_poll(fuse_req_t req, unsigned revents); |
|
|
|
int fuse_reply_poll(fuse_req_t req, unsigned revents); |
|
|
|
|
|
|
|
/* ----------------------------------------------------------- * |
|
|
|
/* ----------------------------------------------------------- * |
|
|
|
* Notification * |
|
|
|
* ----------------------------------------------------------- */ |
|
|
|
|
|
|
|
/** |
|
|
|
/** |
|
|
|
* Notify IO readiness event |
|
|
|
* |
|
|
|
* For more information, please read comment for poll operation. |
|
|
|
* |
|
|
|
* @param ph poll handle to notify IO readiness event for |
|
|
|
*/ |
|
|
|
int fuse_lowlevel_notify_poll(struct fuse_pollhandle *ph); |
|
|
|
int fuse_lowlevel_notify_poll(struct fuse_pollhandle *ph); |
|
|
|
|
|
|
|
/** |
|
|
|
/** |
|
|
|
* Notify to invalidate cache for an inode |
|
|
|
* |
|
|
|
* @param ch the channel through which to send the invalidation |
|
|
@ -1340,10 +1344,10 @@ int fuse_lowlevel_notify_poll(struct fuse_pollhandle *ph); |
|
|
|
* @param len the amount of cache to invalidate or 0 for all |
|
|
|
* @return zero for success, -errno for failure |
|
|
|
*/ |
|
|
|
int fuse_lowlevel_notify_inval_inode(struct fuse_chan *ch, fuse_ino_t ino, |
|
|
|
int fuse_lowlevel_notify_inval_inode(struct fuse_chan *ch, fuse_ino_t ino, |
|
|
|
off_t off, off_t len); |
|
|
|
|
|
|
|
/** |
|
|
|
/** |
|
|
|
* Notify to invalidate parent attributes and the dentry matching |
|
|
|
* parent/name |
|
|
|
* |
|
|
@ -1357,10 +1361,10 @@ int fuse_lowlevel_notify_inval_inode(struct fuse_chan *ch, fuse_ino_t ino, |
|
|
|
* @param namelen strlen() of file name |
|
|
|
* @return zero for success, -errno for failure |
|
|
|
*/ |
|
|
|
int fuse_lowlevel_notify_inval_entry(struct fuse_chan *ch, fuse_ino_t parent, |
|
|
|
int fuse_lowlevel_notify_inval_entry(struct fuse_chan *ch, fuse_ino_t parent, |
|
|
|
const char *name, size_t namelen); |
|
|
|
|
|
|
|
/** |
|
|
|
/** |
|
|
|
* Notify to invalidate parent attributes and delete the dentry matching |
|
|
|
* parent/name if the dentry's inode number matches child (otherwise it |
|
|
|
* will invalidate the matching dentry). |
|
|
@ -1376,11 +1380,11 @@ int fuse_lowlevel_notify_inval_entry(struct fuse_chan *ch, fuse_ino_t parent, |
|
|
|
* @param namelen strlen() of file name |
|
|
|
* @return zero for success, -errno for failure |
|
|
|
*/ |
|
|
|
int fuse_lowlevel_notify_delete(struct fuse_chan *ch, |
|
|
|
int fuse_lowlevel_notify_delete(struct fuse_chan *ch, |
|
|
|
fuse_ino_t parent, fuse_ino_t child, |
|
|
|
const char *name, size_t namelen); |
|
|
|
|
|
|
|
/** |
|
|
|
/** |
|
|
|
* Store data to the kernel buffers |
|
|
|
* |
|
|
|
* Synchronously store data in the kernel buffers belonging to the |
|
|
@ -1401,10 +1405,10 @@ int fuse_lowlevel_notify_delete(struct fuse_chan *ch, |
|
|
|
* @param flags flags controlling the copy |
|
|
|
* @return zero for success, -errno for failure |
|
|
|
*/ |
|
|
|
int fuse_lowlevel_notify_store(struct fuse_chan *ch, fuse_ino_t ino, |
|
|
|
int fuse_lowlevel_notify_store(struct fuse_chan *ch, fuse_ino_t ino, |
|
|
|
off_t offset, struct fuse_bufvec *bufv, |
|
|
|
enum fuse_buf_copy_flags flags); |
|
|
|
/** |
|
|
|
/** |
|
|
|
* Retrieve data from the kernel buffers |
|
|
|
* |
|
|
|
* Retrieve data in the kernel buffers belonging to the given inode. |
|
|
@ -1429,23 +1433,23 @@ int fuse_lowlevel_notify_store(struct fuse_chan *ch, fuse_ino_t ino, |
|
|
|
* @param cookie user data to supply to the reply callback |
|
|
|
* @return zero for success, -errno for failure |
|
|
|
*/ |
|
|
|
int fuse_lowlevel_notify_retrieve(struct fuse_chan *ch, fuse_ino_t ino, |
|
|
|
int fuse_lowlevel_notify_retrieve(struct fuse_chan *ch, fuse_ino_t ino, |
|
|
|
size_t size, off_t offset, void *cookie); |
|
|
|
|
|
|
|
|
|
|
|
/* ----------------------------------------------------------- * |
|
|
|
/* ----------------------------------------------------------- * |
|
|
|
* Utility functions * |
|
|
|
* ----------------------------------------------------------- */ |
|
|
|
|
|
|
|
/** |
|
|
|
/** |
|
|
|
* Get the userdata from the request |
|
|
|
* |
|
|
|
* @param req request handle |
|
|
|
* @return the user data passed to fuse_lowlevel_new() |
|
|
|
*/ |
|
|
|
void *fuse_req_userdata(fuse_req_t req); |
|
|
|
void *fuse_req_userdata(fuse_req_t req); |
|
|
|
|
|
|
|
/** |
|
|
|
/** |
|
|
|
* Get the context from the request |
|
|
|
* |
|
|
|
* The pointer returned by this function will only be valid for the |
|
|
@ -1454,9 +1458,9 @@ void *fuse_req_userdata(fuse_req_t req); |
|
|
|
* @param req request handle |
|
|
|
* @return the context structure |
|
|
|
*/ |
|
|
|
const struct fuse_ctx *fuse_req_ctx(fuse_req_t req); |
|
|
|
const struct fuse_ctx *fuse_req_ctx(fuse_req_t req); |
|
|
|
|
|
|
|
/** |
|
|
|
/** |
|
|
|
* Get the current supplementary group IDs for the specified request |
|
|
|
* |
|
|
|
* Similar to the getgroups(2) system call, except the return value is |
|
|
@ -1475,17 +1479,17 @@ const struct fuse_ctx *fuse_req_ctx(fuse_req_t req); |
|
|
|
* @param list array of group IDs to be filled in |
|
|
|
* @return the total number of supplementary group IDs or -errno on failure |
|
|
|
*/ |
|
|
|
int fuse_req_getgroups(fuse_req_t req, int size, gid_t list[]); |
|
|
|
int fuse_req_getgroups(fuse_req_t req, int size, gid_t list[]); |
|
|
|
|
|
|
|
/** |
|
|
|
/** |
|
|
|
* Callback function for an interrupt |
|
|
|
* |
|
|
|
* @param req interrupted request |
|
|
|
* @param data user data |
|
|
|
*/ |
|
|
|
typedef void (*fuse_interrupt_func_t)(fuse_req_t req, void *data); |
|
|
|
typedef void (*fuse_interrupt_func_t)(fuse_req_t req, void *data); |
|
|
|
|
|
|
|
/** |
|
|
|
/** |
|
|
|
* Register/unregister callback for an interrupt |
|
|
|
* |
|
|
|
* If an interrupt has already happened, then the callback function is |
|
|
@ -1496,25 +1500,25 @@ typedef void (*fuse_interrupt_func_t)(fuse_req_t req, void *data); |
|
|
|
* @param func the callback function or NULL for unregister |
|
|
|
* @param data user data passed to the callback function |
|
|
|
*/ |
|
|
|
void fuse_req_interrupt_func(fuse_req_t req, fuse_interrupt_func_t func, |
|
|
|
void fuse_req_interrupt_func(fuse_req_t req, fuse_interrupt_func_t func, |
|
|
|
void *data); |
|
|
|
|
|
|
|
/** |
|
|
|
/** |
|
|
|
* Check if a request has already been interrupted |
|
|
|
* |
|
|
|
* @param req request handle |
|
|
|
* @return 1 if the request has been interrupted, 0 otherwise |
|
|
|
*/ |
|
|
|
int fuse_req_interrupted(fuse_req_t req); |
|
|
|
int fuse_req_interrupted(fuse_req_t req); |
|
|
|
|
|
|
|
/* ----------------------------------------------------------- * |
|
|
|
/* ----------------------------------------------------------- * |
|
|
|
* Filesystem setup * |
|
|
|
* ----------------------------------------------------------- */ |
|
|
|
|
|
|
|
/* Deprecated, don't use */ |
|
|
|
int fuse_lowlevel_is_lib_option(const char *opt); |
|
|
|
/* Deprecated, don't use */ |
|
|
|
int fuse_lowlevel_is_lib_option(const char *opt); |
|
|
|
|
|
|
|
/** |
|
|
|
/** |
|
|
|
* Create a low level session |
|
|
|
* |
|
|
|
* @param args argument vector |
|
|
@ -1523,20 +1527,21 @@ int fuse_lowlevel_is_lib_option(const char *opt); |
|
|
|
* @param userdata user data |
|
|
|
* @return the created session object, or NULL on failure |
|
|
|
*/ |
|
|
|
struct fuse_session *fuse_lowlevel_new(struct fuse_args *args, |
|
|
|
struct fuse_session *fuse_lowlevel_new(struct fuse_args *args, |
|
|
|
const struct fuse_lowlevel_ops *op, |
|
|
|
size_t op_size, void *userdata); |
|
|
|
|
|
|
|
/* ----------------------------------------------------------- * |
|
|
|
/* ----------------------------------------------------------- * |
|
|
|
* Session interface * |
|
|
|
* ----------------------------------------------------------- */ |
|
|
|
|
|
|
|
/** |
|
|
|
/** |
|
|
|
* Session operations |
|
|
|
* |
|
|
|
* This is used in session creation |
|
|
|
*/ |
|
|
|
struct fuse_session_ops { |
|
|
|
struct fuse_session_ops |
|
|
|
{ |
|
|
|
/** |
|
|
|
* Hook to process a request (mandatory) |
|
|
|
* |
|
|
@ -1570,18 +1575,18 @@ struct fuse_session_ops { |
|
|
|
* @param data user data passed to fuse_session_new() |
|
|
|
*/ |
|
|
|
void (*destroy) (void *data); |
|
|
|
}; |
|
|
|
}; |
|
|
|
|
|
|
|
/** |
|
|
|
/** |
|
|
|
* Create a new session |
|
|
|
* |
|
|
|
* @param op session operations |
|
|
|
* @param data user data |
|
|
|
* @return new session object, or NULL on failure |
|
|
|
*/ |
|
|
|
struct fuse_session *fuse_session_new(struct fuse_session_ops *op, void *data); |
|
|
|
struct fuse_session *fuse_session_new(struct fuse_session_ops *op, void *data); |
|
|
|
|
|
|
|
/** |
|
|
|
/** |
|
|
|
* Assign a channel to a session |
|
|
|
* |
|
|
|
* Note: currently only a single channel may be assigned. This may |
|
|
@ -1592,18 +1597,18 @@ struct fuse_session *fuse_session_new(struct fuse_session_ops *op, void *data); |
|
|
|
* @param se the session |
|
|
|
* @param ch the channel |
|
|
|
*/ |
|
|
|
void fuse_session_add_chan(struct fuse_session *se, struct fuse_chan *ch); |
|
|
|
void fuse_session_add_chan(struct fuse_session *se, struct fuse_chan *ch); |
|
|
|
|
|
|
|
/** |
|
|
|
/** |
|
|
|
* Remove a channel from a session |
|
|
|
* |
|
|
|
* If the channel is not assigned to a session, then this is a no-op |
|
|
|
* |
|
|
|
* @param ch the channel to remove |
|
|
|
*/ |
|
|
|
void fuse_session_remove_chan(struct fuse_chan *ch); |
|
|
|
void fuse_session_remove_chan(struct fuse_chan *ch); |
|
|
|
|
|
|
|
/** |
|
|
|
/** |
|
|
|
* Iterate over the channels assigned to a session |
|
|
|
* |
|
|
|
* The iterating function needs to start with a NULL channel, and |
|
|
@ -1614,10 +1619,10 @@ void fuse_session_remove_chan(struct fuse_chan *ch); |
|
|
|
* @param ch the previous channel, or NULL |
|
|
|
* @return the next channel, or NULL if no more channels exist |
|
|
|
*/ |
|
|
|
struct fuse_chan *fuse_session_next_chan(struct fuse_session *se, |
|
|
|
struct fuse_chan *fuse_session_next_chan(struct fuse_session *se, |
|
|
|
struct fuse_chan *ch); |
|
|
|
|
|
|
|
/** |
|
|
|
/** |
|
|
|
* Process a raw request |
|
|
|
* |
|
|
|
* @param se the session |
|
|
@ -1625,10 +1630,10 @@ struct fuse_chan *fuse_session_next_chan(struct fuse_session *se, |
|
|
|
* @param len request length |
|
|
|
* @param ch channel on which the request was received |
|
|
|
*/ |
|
|
|
void fuse_session_process(struct fuse_session *se, const char *buf, size_t len, |
|
|
|
void fuse_session_process(struct fuse_session *se, const char *buf, size_t len, |
|
|
|
struct fuse_chan *ch); |
|
|
|
|
|
|
|
/** |
|
|
|
/** |
|
|
|
* Process a raw request supplied in a generic buffer |
|
|
|
* |
|
|
|
* This is a more generic version of fuse_session_process(). The |
|
|
@ -1638,10 +1643,10 @@ void fuse_session_process(struct fuse_session *se, const char *buf, size_t len, |
|
|
|
* @param buf the fuse_buf containing the request |
|
|
|
* @param ch channel on which the request was received |
|
|
|
*/ |
|
|
|
void fuse_session_process_buf(struct fuse_session *se, |
|
|
|
void fuse_session_process_buf(struct fuse_session *se, |
|
|
|
const struct fuse_buf *buf, struct fuse_chan *ch); |
|
|
|
|
|
|
|
/** |
|
|
|
/** |
|
|
|
* Receive a raw request supplied in a generic buffer |
|
|
|
* |
|
|
|
* This is a more generic version of fuse_chan_recv(). The fuse_buf |
|
|
@ -1653,72 +1658,73 @@ void fuse_session_process_buf(struct fuse_session *se, |
|
|
|
* @param chp pointer to the channel |
|
|
|
* @return the actual size of the raw request, or -errno on error |
|
|
|
*/ |
|
|
|
int fuse_session_receive_buf(struct fuse_session *se, struct fuse_buf *buf, |
|
|
|
int fuse_session_receive_buf(struct fuse_session *se, struct fuse_buf *buf, |
|
|
|
struct fuse_chan **chp); |
|
|
|
|
|
|
|
/** |
|
|
|
/** |
|
|
|
* Destroy a session |
|
|
|
* |
|
|
|
* @param se the session |
|
|
|
*/ |
|
|
|
void fuse_session_destroy(struct fuse_session *se); |
|
|
|
void fuse_session_destroy(struct fuse_session *se); |
|
|
|
|
|
|
|
/** |
|
|
|
/** |
|
|
|
* Exit a session |
|
|
|
* |
|
|
|
* @param se the session |
|
|
|
*/ |
|
|
|
void fuse_session_exit(struct fuse_session *se); |
|
|
|
void fuse_session_exit(struct fuse_session *se); |
|
|
|
|
|
|
|
/** |
|
|
|
/** |
|
|
|
* Reset the exited status of a session |
|
|
|
* |
|
|
|
* @param se the session |
|
|
|
*/ |
|
|
|
void fuse_session_reset(struct fuse_session *se); |
|
|
|
void fuse_session_reset(struct fuse_session *se); |
|
|
|
|
|
|
|
/** |
|
|
|
/** |
|
|
|
* Query the exited status of a session |
|
|
|
* |
|
|
|
* @param se the session |
|
|
|
* @return 1 if exited, 0 if not exited |
|
|
|
*/ |
|
|
|
int fuse_session_exited(struct fuse_session *se); |
|
|
|
int fuse_session_exited(struct fuse_session *se); |
|
|
|
|
|
|
|
/** |
|
|
|
/** |
|
|
|
* Get the user data provided to the session |
|
|
|
* |
|
|
|
* @param se the session |
|
|
|
* @return the user data |
|
|
|
*/ |
|
|
|
void *fuse_session_data(struct fuse_session *se); |
|
|
|
void *fuse_session_data(struct fuse_session *se); |
|
|
|
|
|
|
|
/** |
|
|
|
/** |
|
|
|
* Enter a single threaded event loop |
|
|
|
* |
|
|
|
* @param se the session |
|
|
|
* @return 0 on success, -1 on error |
|
|
|
*/ |
|
|
|
int fuse_session_loop(struct fuse_session *se); |
|
|
|
int fuse_session_loop(struct fuse_session *se); |
|
|
|
|
|
|
|
/** |
|
|
|
/** |
|
|
|
* Enter a multi-threaded event loop |
|
|
|
* |
|
|
|
* @param se the session |
|
|
|
* @return 0 on success, -1 on error |
|
|
|
*/ |
|
|
|
int fuse_session_loop_mt(struct fuse_session *se, const int threads); |
|
|
|
int fuse_session_loop_mt(struct fuse_session *se, const int threads); |
|
|
|
|
|
|
|
/* ----------------------------------------------------------- * |
|
|
|
/* ----------------------------------------------------------- * |
|
|
|
* Channel interface * |
|
|
|
* ----------------------------------------------------------- */ |
|
|
|
|
|
|
|
/** |
|
|
|
/** |
|
|
|
* Channel operations |
|
|
|
* |
|
|
|
* This is used in channel creation |
|
|
|
*/ |
|
|
|
struct fuse_chan_ops { |
|
|
|
struct fuse_chan_ops |
|
|
|
{ |
|
|
|
/** |
|
|
|
* Hook for receiving a raw request |
|
|
|
* |
|
|
@ -1749,9 +1755,9 @@ struct fuse_chan_ops { |
|
|
|
* @param ch the channel |
|
|
|
*/ |
|
|
|
void (*destroy)(struct fuse_chan *ch); |
|
|
|
}; |
|
|
|
}; |
|
|
|
|
|
|
|
/** |
|
|
|
/** |
|
|
|
* Create a new channel |
|
|
|
* |
|
|
|
* @param op channel operations |
|
|
@ -1760,42 +1766,42 @@ struct fuse_chan_ops { |
|
|
|
* @param data user data |
|
|
|
* @return the new channel object, or NULL on failure |
|
|
|
*/ |
|
|
|
struct fuse_chan *fuse_chan_new(struct fuse_chan_ops *op, int fd, |
|
|
|
struct fuse_chan *fuse_chan_new(struct fuse_chan_ops *op, int fd, |
|
|
|
size_t bufsize, void *data); |
|
|
|
|
|
|
|
/** |
|
|
|
/** |
|
|
|
* Query the file descriptor of the channel |
|
|
|
* |
|
|
|
* @param ch the channel |
|
|
|
* @return the file descriptor passed to fuse_chan_new() |
|
|
|
*/ |
|
|
|
int fuse_chan_fd(struct fuse_chan *ch); |
|
|
|
int fuse_chan_fd(struct fuse_chan *ch); |
|
|
|
|
|
|
|
/** |
|
|
|
/** |
|
|
|
* Query the minimal receive buffer size |
|
|
|
* |
|
|
|
* @param ch the channel |
|
|
|
* @return the buffer size passed to fuse_chan_new() |
|
|
|
*/ |
|
|
|
size_t fuse_chan_bufsize(struct fuse_chan *ch); |
|
|
|
size_t fuse_chan_bufsize(struct fuse_chan *ch); |
|
|
|
|
|
|
|
/** |
|
|
|
/** |
|
|
|
* Query the user data |
|
|
|
* |
|
|
|
* @param ch the channel |
|
|
|
* @return the user data passed to fuse_chan_new() |
|
|
|
*/ |
|
|
|
void *fuse_chan_data(struct fuse_chan *ch); |
|
|
|
void *fuse_chan_data(struct fuse_chan *ch); |
|
|
|
|
|
|
|
/** |
|
|
|
/** |
|
|
|
* Query the session to which this channel is assigned |
|
|
|
* |
|
|
|
* @param ch the channel |
|
|
|
* @return the session, or NULL if the channel is not assigned |
|
|
|
*/ |
|
|
|
struct fuse_session *fuse_chan_session(struct fuse_chan *ch); |
|
|
|
struct fuse_session *fuse_chan_session(struct fuse_chan *ch); |
|
|
|
|
|
|
|
/** |
|
|
|
/** |
|
|
|
* Receive a raw request |
|
|
|
* |
|
|
|
* A return value of -ENODEV means, that the filesystem was unmounted |
|
|
@ -1805,9 +1811,9 @@ struct fuse_session *fuse_chan_session(struct fuse_chan *ch); |
|
|
|
* @param size the size of the buffer |
|
|
|
* @return the actual size of the raw request, or -errno on error |
|
|
|
*/ |
|
|
|
int fuse_chan_recv(struct fuse_chan **ch, char *buf, size_t size); |
|
|
|
int fuse_chan_recv(struct fuse_chan **ch, char *buf, size_t size); |
|
|
|
|
|
|
|
/** |
|
|
|
/** |
|
|
|
* Send a raw reply |
|
|
|
* |
|
|
|
* A return value of -ENOENT means, that the request was |
|
|
@ -1818,17 +1824,17 @@ int fuse_chan_recv(struct fuse_chan **ch, char *buf, size_t size); |
|
|
|
* @param count the number of blocks in vector |
|
|
|
* @return zero on success, -errno on failure |
|
|
|
*/ |
|
|
|
int fuse_chan_send(struct fuse_chan *ch, const struct iovec iov[], |
|
|
|
int fuse_chan_send(struct fuse_chan *ch, const struct iovec iov[], |
|
|
|
size_t count); |
|
|
|
|
|
|
|
/** |
|
|
|
/** |
|
|
|
* Destroy a channel |
|
|
|
* |
|
|
|
* @param ch the channel |
|
|
|
*/ |
|
|
|
void fuse_chan_destroy(struct fuse_chan *ch); |
|
|
|
void fuse_chan_destroy(struct fuse_chan *ch); |
|
|
|
|
|
|
|
/* ----------------------------------------------------------- * |
|
|
|
/* ----------------------------------------------------------- * |
|
|
|
* Compatibility stuff * |
|
|
|
* ----------------------------------------------------------- */ |
|
|
|
|
|
|
|