⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 fuse_lowlevel.h

📁 LINUX下读写NTFS分区的工具。 已经集成了通过LIBCONV库支持中文的代码。
💻 H
📖 第 1 页 / 共 3 页
字号:
/** * Reply with data * * Possible requests: *   read, readdir, getxattr, listxattr * * @param req request handle * @param buf buffer containing data * @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);/** * Reply with data vector * * Possible requests: *   read, readdir, getxattr, listxattr * * @param req request handle * @param iov the vector containing the data * @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);/** * Reply with filesystem statistics * * Possible requests: *   statfs * * @param req request handle * @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);/** * Reply with needed buffer size * * Possible requests: *   getxattr, listxattr * * @param req request handle * @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);/** * Reply with file lock information * * Possible requests: *   getlk * * @param req request handle * @param lock the lock information * @return zero for success, -errno for failure to send reply */int fuse_reply_lock(fuse_req_t req, struct flock *lock);/** * Reply with block index * * Possible requests: *   bmap * * @param req request handle * @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);/* ----------------------------------------------------------- * * Filling a buffer in readdir                                 * * ----------------------------------------------------------- *//** * Add a directory entry to the buffer * * Buffer needs to be large enough to hold the entry.  Of it's not, * then the entry is not filled in but the size of the entry is still * returned.  The caller can check this by comparing the bufsize * parameter with the returned entry size.  If the entry size is * larger than the buffer size, the operation failed. * * From the 'stbuf' argument the st_ino field and bits 12-15 of the * st_mode field are used.  The other fields are ignored. * * Note: offsets do not necessarily represent physical offsets, and * could be any marker, that enables the implementation to find a * specific point in the directory stream. * * @param req request handle * @param buf the point where the new entry will be added to the buffer * @param bufsize remaining size of the buffer * @param the name of the entry * @param stbuf the file attributes * @param off the offset of the next entry * @return the space needed for the entry */size_t fuse_add_direntry(fuse_req_t req, char *buf, size_t bufsize,                         const char *name, const struct stat *stbuf,                         off_t off);/* ----------------------------------------------------------- * * 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);/** * Get the context from the request * * The pointer returned by this function will only be valid for the * request's lifetime * * @param req request handle * @return the context structure */const struct fuse_ctx *fuse_req_ctx(fuse_req_t req);/** * 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);/** * Register/unregister callback for an interrupt * * If an interrupt has already happened, then the callback function is * called from within this function, hence it's not possible for * interrupts to be lost. * * @param req request handle * @param func the callback function or NULL for unregister * @parm data user data passed to the callback function */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);/* ----------------------------------------------------------- * * Filesystem setup                                            * * ----------------------------------------------------------- *//** * Create a low level session * * @param args argument vector * @param op the low level filesystem operations * @param op_size sizeof(struct fuse_lowlevel_ops) * @param userdata user data * @return the created session object, or NULL on failure */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 {    /**     * Hook to process a request (mandatory)     *     * @param data user data passed to fuse_session_new()     * @param buf buffer containing the raw request     * @param len request length     * @param ch channel on which the request was received     */    void (*process) (void *data, const char *buf, size_t len,                     struct fuse_chan *ch);    /**     * Hook for session exit and reset (optional)     *     * @param data user data passed to fuse_session_new()     * @param val exited status (1 - exited, 0 - not exited)     */    void (*exit) (void *data, int val);    /**     * Hook for querying the current exited status (optional)     *     * @param data user data passed to fuse_session_new()     * @return 1 if exited, 0 if not exited     */    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);};/** * 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);/** * Assign a channel to a session * * Note: currently only a single channel may be assigned.  This may * change in the future * * If a session is destroyed, the assigned channel is also destroyed * * @param se the session * @param ch the channel */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);/** * Iterate over the channels assigned to a session * * The iterating function needs to start with a NULL channel, and * after that needs to pass the previously returned channel to the * function. * * @param se the session * @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 *ch);/** * Process a raw request * * @param se the session * @param buf buffer containing the raw request * @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,                          struct fuse_chan *ch);/** * Destroy a session * * @param se the session */void fuse_session_destroy(struct fuse_session *se);/** * Exit a session * * @param se the session */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);/** * 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);/** * 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);/** * 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);/* ----------------------------------------------------------- * * Channel interface                                           * * ----------------------------------------------------------- *//** * Channel operations * * This is used in channel creation */struct fuse_chan_ops {    /**     * Hook for receiving a raw request     *     * @param ch pointer to the channel     * @param buf the buffer to store the request in     * @param size the size of the buffer     * @return the actual size of the raw request, or -1 on error     */    int (*receive)(struct fuse_chan **chp, char *buf, size_t size);    /**     * Hook for sending a raw reply     *     * A return value of -ENOENT means, that the request was     * interrupted, and the reply was discarded     *     * @param ch the channel     * @param iov vector of blocks     * @param count the number of blocks in vector     * @return zero on success, -errno on failure     */    int (*send)(struct fuse_chan *ch, const struct iovec iov[], size_t count);    /**     * Destroy the channel     *     * @param ch the channel     */    void (*destroy)(struct fuse_chan *ch);};/** * Create a new channel * * @param op channel operations * @param fd file descriptor of the channel * @param bufsize the minimal receive buffer size * @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,                                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);/** * 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);/** * 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);/** * 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);/** * Receive a raw request * * A return value of -ENODEV means, that the filesystem was unmounted * * @param ch pointer to the channel * @param buf the buffer to store the request in * @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);/** * Send a raw reply * * A return value of -ENOENT means, that the request was * interrupted, and the reply was discarded * * @param ch the channel * @param iov vector of blocks * @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[],                   size_t count);/** * Destroy a channel * * @param ch the channel */void fuse_chan_destroy(struct fuse_chan *ch);#ifdef __cplusplus}#endif#endif /* _FUSE_LOWLEVEL_H_ */

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -