#include "fuse_common.h"#include <fcntl.h>#include <time.h>#include <utime.h>#include <sys/types.h>#include <sys/stat.h>#include <sys/statvfs.h>#include "fuse_compat.h"Data Structures | |
| struct | fuse_operations |
| struct | fuse_context |
| struct | fuse_module |
Defines | |
| #define | fuse_main(argc, argv, op, user_data) fuse_main_real(argc, argv, op, sizeof(*(op)), user_data) |
| #define | FUSE_REGISTER_MODULE(name_, factory_) |
| #define | fuse_main fuse_main_compat2 |
Typedefs | |
| typedef int(*) | fuse_fill_dir_t (void *buf, const char *name, const struct stat *stbuf, off_t off) |
| typedef void(*) | fuse_processor_t (struct fuse *, struct fuse_cmd *, void *) |
Functions | |
| fuse * | fuse_new (struct fuse_chan *ch, struct fuse_args *args, const struct fuse_operations *op, size_t op_size, void *user_data) |
| void | fuse_destroy (struct fuse *f) |
| int | fuse_loop (struct fuse *f) |
| void | fuse_exit (struct fuse *f) |
| int | fuse_loop_mt (struct fuse *f) |
| fuse_context * | fuse_get_context (void) |
| int | fuse_interrupted (void) |
| int | fuse_invalidate (struct fuse *f, const char *path) |
| int | fuse_main_real (int argc, char *argv[], const struct fuse_operations *op, size_t op_size, void *user_data) |
| fuse_fs * | fuse_fs_new (const struct fuse_operations *op, size_t op_size, void *user_data) |
| void | fuse_register_module (struct fuse_module *mod) |
| fuse * | fuse_setup (int argc, char *argv[], const struct fuse_operations *op, size_t op_size, char **mountpoint, int *multithreaded, void *user_data) |
| void | fuse_teardown (struct fuse *fuse, char *mountpoint) |
| fuse_cmd * | fuse_read_cmd (struct fuse *f) |
| void | fuse_process_cmd (struct fuse *f, struct fuse_cmd *cmd) |
| int | fuse_loop_mt_proc (struct fuse *f, fuse_processor_t proc, void *data) |
| int | fuse_exited (struct fuse *f) |
| void | fuse_set_getcontext_func (struct fuse_context *(*func)(void)) |
| fuse_session * | fuse_get_session (struct fuse *f) |
IMPORTANT: you should define FUSE_USE_VERSION before including this header. To use the newest API define it to 26 (recommended for any new application), to use the old API define it to 21 (default) 22 or 25, to use the even older 1.X API define it to 11.
| #define fuse_main fuse_main_compat2 |
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:
Note: this is currently implemented as a macro.
| argc | the argument counter passed to the main() function | |
| argv | the argument vector passed to the main() function | |
| op | the file system operation | |
| user_data | user data supplied in the context during the init() method |
| #define fuse_main | ( | argc, | |||
| argv, | |||||
| op, | |||||
| user_data | ) | fuse_main_real(argc, argv, op, sizeof(*(op)), user_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:
Note: this is currently implemented as a macro.
| argc | the argument counter passed to the main() function | |
| argv | the argument vector passed to the main() function | |
| op | the file system operation | |
| user_data | user data supplied in the context during the init() method |
| #define FUSE_REGISTER_MODULE | ( | name_, | |||
| factory_ | ) |
Value:
static __attribute__((constructor)) void name_ ## _register(void) \ { \ static struct fuse_module mod = { #name_, factory_, NULL, NULL, 0 }; \ fuse_register_module(&mod); \ }
For the parameters, see description of the fields in 'struct fuse_module'
| typedef int(*) fuse_fill_dir_t(void *buf, const char *name, const struct stat *stbuf, off_t off) |
Function to add an entry in a readdir() operation
| buf | the buffer passed to the readdir() operation | |
| name | the file name of the directory entry | |
| stat | file attributes, can be NULL | |
| off | offset of the next entry or zero |
| typedef void(*) fuse_processor_t(struct fuse *, struct fuse_cmd *, void *) |
Function type used to process commands
| void fuse_destroy | ( | struct fuse * | f | ) |
Destroy the FUSE handle.
The communication channel attached to the handle is also destroyed.
NOTE: This function does not unmount the filesystem. If this is needed, call fuse_unmount() before calling this function.
| f | the FUSE handle |
| void fuse_exit | ( | struct fuse * | f | ) |
Exit from event loop
| f | the FUSE handle |
| int fuse_exited | ( | struct fuse * | f | ) |
Return the exited flag, which indicates if fuse_exit() has been called
| struct fuse_fs* fuse_fs_new | ( | const struct fuse_operations * | op, | |
| size_t | op_size, | |||
| void * | user_data | |||
| ) |
Create a new fuse filesystem object
This is usually called from the factory of a fuse module to create a new instance of a filesystem.
| op | the filesystem operations | |
| op_size | the size of the fuse_operations structure | |
| user_data | user data supplied in the context during the init() method |
| struct fuse_context* fuse_get_context | ( | void | ) |
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.
| struct fuse_session* fuse_get_session | ( | struct fuse * | f | ) |
Get session from fuse object
| int fuse_interrupted | ( | void | ) |
Check if a request has already been interrupted
| req | request handle |
| int fuse_invalidate | ( | struct fuse * | f, | |
| const char * | path | |||
| ) |
Obsolete, doesn't do anything
| int fuse_loop | ( | struct fuse * | f | ) |
FUSE event loop.
Requests from the kernel are processed, and the appropriate operations are called.
| f | the FUSE handle |
| int fuse_loop_mt | ( | 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.
| f | the FUSE handle |
| int fuse_loop_mt_proc | ( | struct fuse * | f, | |
| fuse_processor_t | proc, | |||
| void * | data | |||
| ) |
Multi threaded event loop, which calls the custom command processor function
| int fuse_main_real | ( | int | argc, | |
| char * | argv[], | |||
| const struct fuse_operations * | op, | |||
| size_t | op_size, | |||
| void * | user_data | |||
| ) |
The real main function
Do not call this directly, use fuse_main()
| struct fuse* fuse_new | ( | struct fuse_chan * | ch, | |
| struct fuse_args * | args, | |||
| const struct fuse_operations * | op, | |||
| size_t | op_size, | |||
| void * | user_data | |||
| ) |
Create a new FUSE filesystem.
| ch | the communication channel | |
| args | argument vector | |
| op | the filesystem operations | |
| op_size | the size of the fuse_operations structure | |
| user_data | user data supplied in the context during the init() method |
| void fuse_process_cmd | ( | struct fuse * | f, | |
| struct fuse_cmd * | cmd | |||
| ) |
Process a single command
| struct fuse_cmd* fuse_read_cmd | ( | struct fuse * | f | ) |
Read a single command. If none are read, return NULL
| void fuse_register_module | ( | struct fuse_module * | mod | ) |
Register a filesystem module
This function is used by FUSE_REGISTER_MODULE and there's usually no need to call it directly
| void fuse_set_getcontext_func | ( | struct fuse_context *(*)(void) | func | ) |
This function is obsolete and implemented as a no-op
| struct fuse* fuse_setup | ( | int | argc, | |
| char * | argv[], | |||
| const struct fuse_operations * | op, | |||
| size_t | op_size, | |||
| char ** | mountpoint, | |||
| int * | multithreaded, | |||
| void * | user_data | |||
| ) |
This is the part of fuse_main() before the event loop
| void fuse_teardown | ( | struct fuse * | fuse, | |
| char * | mountpoint | |||
| ) |
This is the part of fuse_main() after the event loop
1.5.0