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

📄 fuse.h

📁 linux下的用户文件系统fuse-2.5.2
💻 H
📖 第 1 页 / 共 2 页
字号:
    /**     * Clean up filesystem     *     * Called on filesystem exit.     *     * Introduced in version 2.3     */    void (*destroy) (void *);    /**     * Check file access permissions     *     * This will be called for the access() system call.  If the     * 'default_permissions' mount option is given, this method is not     * called.     *     * This method is not called under Linux kernel versions 2.4.x     *     * Introduced in version 2.5     */    int (*access) (const char *, int);    /**     * Create and open a file     *     * If the file does not exist, first create it with the specified     * mode, and then open it.     *     * If this method is not implemented or under Linux kernel     * versions earlier than 2.6.15, the mknod() and open() methods     * will be called instead.     *     * Introduced in version 2.5     */    int (*create) (const char *, mode_t, struct fuse_file_info *);    /**     * Change the size of an open file     *     * This method is called instead of the truncate() method if the     * truncation was invoked from an ftruncate() system call.     *     * If this method is not implemented or under Linux kernel     * versions earlier than 2.6.15, the truncate() method will be     * called instead.     *     * Introduced in version 2.5     */    int (*ftruncate) (const char *, off_t, struct fuse_file_info *);    /**     * Get attributes from an open file     *     * This method is called instead of the getattr() method if the     * file information is available.     *     * Currently this is only called after the create() method if that     * is implemented (see above).  Later it may be called for     * invocations of fstat() too.     *     * Introduced in version 2.5     */    int (*fgetattr) (const char *, struct stat *, struct fuse_file_info *);};/** Extra context that may be needed by some filesystems * * The uid, gid and pid fields are not filled in case of a writepage * operation. */struct fuse_context {    /** Pointer to the fuse object */    struct fuse *fuse;    /** User ID of the calling process */    uid_t uid;    /** Group ID of the calling process */    gid_t gid;    /** Thread ID of the calling process */    pid_t pid;    /** Private filesystem data */    void *private_data;};/* * Main function of FUSE. * * This is for the lazy.  This is all that has to be called from the * main() function. * * This function does the following: *   - parses command line options (-d -s and -h) *   - passes relevant mount options to the fuse_mount() *   - installs signal handlers for INT, HUP, TERM and PIPE *   - registers an exit handler to unmount the filesystem on program exit *   - creates a fuse handle *   - registers the operations *   - calls either the single-threaded or the multi-threaded event loop * * Note: this is currently implemented as a macro. * * @param argc the argument counter passed to the main() function * @param argv the argument vector passed to the main() function * @param op the file system operation * @return 0 on success, nonzero on failure *//*int fuse_main(int argc, char *argv[], const struct fuse_operations *op);*/#define fuse_main(argc, argv, op) \            fuse_main_real(argc, argv, op, sizeof(*(op)))/* ----------------------------------------------------------- * * More detailed API                                           * * ----------------------------------------------------------- *//** * Create a new FUSE filesystem. * * @param fd the control file descriptor * @param args argument vector * @param op the operations * @param op_size the size of the fuse_operations structure * @return the created FUSE handle */struct fuse *fuse_new(int fd, struct fuse_args *args,                      const struct fuse_operations *op, size_t op_size);/** * Destroy the FUSE handle. * * The filesystem is not unmounted. * * @param f the FUSE handle */void fuse_destroy(struct fuse *f);/** * FUSE event loop. * * Requests from the kernel are processed, and the appropriate * operations are called. * * @param f the FUSE handle * @return 0 if no error occurred, -1 otherwise */int fuse_loop(struct fuse *f);/** * Exit from event loop * * @param f the FUSE handle */void fuse_exit(struct fuse *f);/** * FUSE event loop with multiple threads * * Requests from the kernel are processed, and the appropriate * operations are called.  Request are processed in parallel by * distributing them between multiple threads. * * Calling this function requires the pthreads library to be linked to * the application. * * @param f the FUSE handle * @return 0 if no error occurred, -1 otherwise */int fuse_loop_mt(struct fuse *f);/** * Get the current context * * The context is only valid for the duration of a filesystem * operation, and thus must not be stored and used later. * * @param f the FUSE handle * @return the context */struct fuse_context *fuse_get_context(void);/** * Obsolete, doesn't do anything * * @return -EINVAL */int fuse_invalidate(struct fuse *f, const char *path);/* Deprecated, don't use */int fuse_is_lib_option(const char *opt);/** * The real main function * * Do not call this directly, use fuse_main() */int fuse_main_real(int argc, char *argv[], const struct fuse_operations *op,                   size_t op_size);/* ----------------------------------------------------------- * * Advanced API for event handling, don't worry about this...  * * ----------------------------------------------------------- *//** Function type used to process commands */typedef void (*fuse_processor_t)(struct fuse *, struct fuse_cmd *, void *);/** This is the part of fuse_main() before the event loop */struct fuse *fuse_setup(int argc, char *argv[],                        const struct fuse_operations *op, size_t op_size,                        char **mountpoint, int *multithreaded, int *fd);/** This is the part of fuse_main() after the event loop */void fuse_teardown(struct fuse *fuse, int fd, char *mountpoint);/** Read a single command.  If none are read, return NULL */struct fuse_cmd *fuse_read_cmd(struct fuse *f);/** Process a single command */void fuse_process_cmd(struct fuse *f, struct fuse_cmd *cmd);/** Multi threaded event loop, which calls the custom command    processor function */int fuse_loop_mt_proc(struct fuse *f, fuse_processor_t proc, void *data);/** Return the exited flag, which indicates if fuse_exit() has been    called */int fuse_exited(struct fuse *f);/** Set function which can be used to get the current context */void fuse_set_getcontext_func(struct fuse_context *(*func)(void));/* ----------------------------------------------------------- * * Compatibility stuff                                         * * ----------------------------------------------------------- */#ifndef __FreeBSD__#if FUSE_USE_VERSION == 22 || FUSE_USE_VERSION == 21 || FUSE_USE_VERSION == 11#  include "fuse_compat.h"#  undef FUSE_MINOR_VERSION#  undef fuse_main#  if FUSE_USE_VERSION == 22#    define FUSE_MINOR_VERSION 4#    define fuse_main(argc, argv, op) \            fuse_main_real_compat22(argc, argv, op, sizeof(*(op)))#    define fuse_new fuse_new_compat22#    define fuse_setup fuse_setup_compat22#    define fuse_operations fuse_operations_compat22#    define fuse_file_info fuse_file_info_compat22#    define fuse_mount fuse_mount_compat22#  else#    define fuse_dirfil_t fuse_dirfil_t_compat#    define __fuse_read_cmd fuse_read_cmd#    define __fuse_process_cmd fuse_process_cmd#    define __fuse_loop_mt fuse_loop_mt_proc#    if FUSE_USE_VERSION == 21#      define FUSE_MINOR_VERSION 1#      define fuse_operations fuse_operations_compat2#      define fuse_main fuse_main_compat2#      define fuse_new fuse_new_compat2#      define __fuse_setup fuse_setup_compat2#      define __fuse_teardown fuse_teardown#      define __fuse_exited fuse_exited#      define __fuse_set_getcontext_func fuse_set_getcontext_func#      define fuse_mount fuse_mount_compat22#    else#      warning Compatibility with API version 11 is deprecated#      undef FUSE_MAJOR_VERSION#      define FUSE_MAJOR_VERSION 1#      define FUSE_MINOR_VERSION 1#      define fuse_statfs fuse_statfs_compat1#      define fuse_operations fuse_operations_compat1#      define fuse_main fuse_main_compat1#      define fuse_new fuse_new_compat1#      define fuse_mount fuse_mount_compat1#      define FUSE_DEBUG FUSE_DEBUG_COMPAT1#    endif#  endif#elif FUSE_USE_VERSION < 25#  error Compatibility with API version other than 21, 22 and 11 not supported#endif#else /* __FreeBSD__ */#if FUSE_USE_VERSION < 25#  error On FreeBSD API version 25 or greater must be used#endif#endif /* __FreeBSD__ */#ifdef __cplusplus}#endif#endif /* _FUSE_H_ */

⌨️ 快捷键说明

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