diff options
author | Miklos Szeredi <miklos@szeredi.hu> | 2006-01-20 15:15:21 +0000 |
---|---|---|
committer | Miklos Szeredi <miklos@szeredi.hu> | 2006-01-20 15:15:21 +0000 |
commit | 065f222cd58501acbe6dde5520c1c2498e8d3c08 (patch) | |
tree | 6fee89465e3fc21e91591e53ea1c0678ef965367 /include | |
parent | e089b718969bc0aaecf180c675b9c2b6d1b8ba9c (diff) |
fix
Diffstat (limited to 'include')
-rw-r--r-- | include/fuse.h | 36 | ||||
-rw-r--r-- | include/fuse_common.h | 11 | ||||
-rw-r--r-- | include/fuse_compat.h | 56 | ||||
-rw-r--r-- | include/fuse_lowlevel.h | 36 | ||||
-rw-r--r-- | include/fuse_lowlevel_compat.h | 57 | ||||
-rw-r--r-- | include/fuse_opt.h | 41 |
6 files changed, 199 insertions, 38 deletions
diff --git a/include/fuse.h b/include/fuse.h index a94c61a..3c3a98f 100644 --- a/include/fuse.h +++ b/include/fuse.h @@ -295,7 +295,7 @@ struct fuse_operations { * * Introduced in version 2.3 */ - void *(*init) (void); + void *(*init) (struct fuse_conn_info *conn); /** * Clean up filesystem @@ -535,13 +535,25 @@ void fuse_set_getcontext_func(struct fuse_context *(*func)(void)); * Compatibility stuff * * ----------------------------------------------------------- */ -#ifndef __FreeBSD__ +#ifdef __FreeBSD__ +# if FUSE_USE_VERSION < 25 +# error On FreeBSD API version 25 or greater must be used +# endif +#endif -#if FUSE_USE_VERSION == 22 || FUSE_USE_VERSION == 21 || FUSE_USE_VERSION == 11 +#if FUSE_USE_VERSION == 25 || 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 +# if FUSE_USE_VERSION == 25 +# define FUSE_MINOR_VERSION 6 +# define fuse_main(argc, argv, op) \ + fuse_main_real_compat25(argc, argv, op, sizeof(*(op))) +# define fuse_new fuse_new_compat25 +# define fuse_setup fuse_setup_compat25 +# define fuse_operations fuse_operations_compat25 +# elif FUSE_USE_VERSION == 22 # define FUSE_MINOR_VERSION 4 # define fuse_main(argc, argv, op) \ fuse_main_real_compat22(argc, argv, op, sizeof(*(op))) @@ -549,13 +561,14 @@ void fuse_set_getcontext_func(struct fuse_context *(*func)(void)); # 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_MAJOR_VERSION 2 +# define FUSE_MINOR_VERSION 1 # define fuse_operations fuse_operations_compat2 # define fuse_main fuse_main_compat2 # define fuse_new fuse_new_compat2 @@ -563,6 +576,7 @@ void fuse_set_getcontext_func(struct fuse_context *(*func)(void)); # 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 @@ -576,18 +590,10 @@ void fuse_set_getcontext_func(struct fuse_context *(*func)(void)); # 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 +#elif FUSE_USE_VERSION < 27 +# error Compatibility with API version other than 21, 22, 25 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 diff --git a/include/fuse_common.h b/include/fuse_common.h index 0f35ea6..4304462 100644 --- a/include/fuse_common.h +++ b/include/fuse_common.h @@ -20,7 +20,7 @@ #define FUSE_MAJOR_VERSION 2 /** Minor version of FUSE library interface */ -#define FUSE_MINOR_VERSION 5 +#define FUSE_MINOR_VERSION 7 #define FUSE_MAKE_VERSION(maj, min) ((maj) * 10 + (min)) #define FUSE_VERSION FUSE_MAKE_VERSION(FUSE_MAJOR_VERSION, FUSE_MINOR_VERSION) @@ -66,6 +66,15 @@ struct fuse_file_info { uint64_t fh; }; +struct fuse_conn_info { + unsigned proto_major; + unsigned proto_minor; + unsigned async_read; + unsigned max_write; + unsigned max_readahead; + unsigned reserved[27]; +}; + /** * Create a FUSE mountpoint * diff --git a/include/fuse_compat.h b/include/fuse_compat.h index 220ef07..97f7b12 100644 --- a/include/fuse_compat.h +++ b/include/fuse_compat.h @@ -9,6 +9,60 @@ /* these definitions provide source compatibility to prior versions. Do not include this file directly! */ +struct fuse_operations_compat25 { + int (*getattr) (const char *, struct stat *); + int (*readlink) (const char *, char *, size_t); + int (*getdir) (const char *, fuse_dirh_t, fuse_dirfil_t); + int (*mknod) (const char *, mode_t, dev_t); + int (*mkdir) (const char *, mode_t); + int (*unlink) (const char *); + int (*rmdir) (const char *); + int (*symlink) (const char *, const char *); + int (*rename) (const char *, const char *); + int (*link) (const char *, const char *); + int (*chmod) (const char *, mode_t); + int (*chown) (const char *, uid_t, gid_t); + int (*truncate) (const char *, off_t); + int (*utime) (const char *, struct utimbuf *); + int (*open) (const char *, struct fuse_file_info *); + int (*read) (const char *, char *, size_t, off_t, struct fuse_file_info *); + int (*write) (const char *, const char *, size_t, off_t, + struct fuse_file_info *); + int (*statfs) (const char *, struct statvfs *); + int (*flush) (const char *, struct fuse_file_info *); + int (*release) (const char *, struct fuse_file_info *); + int (*fsync) (const char *, int, struct fuse_file_info *); + int (*setxattr) (const char *, const char *, const char *, size_t, int); + int (*getxattr) (const char *, const char *, char *, size_t); + int (*listxattr) (const char *, char *, size_t); + int (*removexattr) (const char *, const char *); + int (*opendir) (const char *, struct fuse_file_info *); + int (*readdir) (const char *, void *, fuse_fill_dir_t, off_t, + struct fuse_file_info *); + int (*releasedir) (const char *, struct fuse_file_info *); + int (*fsyncdir) (const char *, int, struct fuse_file_info *); + void *(*init) (void); + void (*destroy) (void *); + int (*access) (const char *, int); + int (*create) (const char *, mode_t, struct fuse_file_info *); + int (*ftruncate) (const char *, off_t, struct fuse_file_info *); + int (*fgetattr) (const char *, struct stat *, struct fuse_file_info *); +}; + +struct fuse *fuse_new_compat25(int fd, struct fuse_args *args, + const struct fuse_operations_compat25 *op, + size_t op_size); + +int fuse_main_real_compat25(int argc, char *argv[], + const struct fuse_operations_compat25 *op, + size_t op_size); + +struct fuse *fuse_setup_compat25(int argc, char *argv[], + const struct fuse_operations_compat25 *op, + size_t op_size, char **mountpoint, + int *multithreaded, int *fd); + +#ifndef __FreeBSD__ #include <sys/statfs.h> struct fuse_file_info_compat22 { @@ -145,3 +199,5 @@ int fuse_mount_compat1(const char *mountpoint, const char *args[]); struct fuse *fuse_new_compat1(int fd, int flags, const struct fuse_operations_compat1 *op); void fuse_main_compat1(int argc, char *argv[], const struct fuse_operations_compat1 *op); + +#endif /* __FreeBSD__ */ diff --git a/include/fuse_lowlevel.h b/include/fuse_lowlevel.h index e45968c..0c4672f 100644 --- a/include/fuse_lowlevel.h +++ b/include/fuse_lowlevel.h @@ -141,7 +141,7 @@ struct fuse_lowlevel_ops { * * @param userdata the user data passed to fuse_lowlevel_new() */ - void (*init) (void *userdata); + void (*init) (void *userdata, struct fuse_conn_info *conn); /** * Clean up filesystem @@ -1235,27 +1235,29 @@ void fuse_remove_signal_handlers(struct fuse_session *se); * Compatibility stuff * * ----------------------------------------------------------- */ -#ifndef __FreeBSD__ +#ifdef __FreeBSD__ +# if FUSE_USE_VERSION < 25 +# error On FreeBSD API version 25 or greater must be used +# endif +#endif -#if FUSE_USE_VERSION == 24 +#if FUSE_USE_VERSION == 25 || FUSE_USE_VERSION == 24 # include "fuse_lowlevel_compat.h" # undef FUSE_MINOR_VERSION -# define FUSE_MINOR_VERSION 4 -# define fuse_file_info fuse_file_info_compat -# define fuse_reply_statfs fuse_reply_statfs_compat -# define fuse_reply_open fuse_reply_open_compat -#elif FUSE_USE_VERSION < 25 -# error Compatibility with low level API version other than 24 not supported +# if FUSE_USE_VERSION == 25 +# define FUSE_MINOR_VERSION 6 +# define fuse_lowlevel_ops fuse_lowlevel_ops_compat25 +# define fuse_lowlevel_new fuse_lowlevel_new_compat25 +# else +# define FUSE_MINOR_VERSION 4 +# define fuse_file_info fuse_file_info_compat +# define fuse_reply_statfs fuse_reply_statfs_compat +# define fuse_reply_open fuse_reply_open_compat +# endif +#elif FUSE_USE_VERSION < 27 +# error Compatibility with low level API version other than 24 and 25 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 diff --git a/include/fuse_lowlevel_compat.h b/include/fuse_lowlevel_compat.h index ccb7d01..0ba0c96 100644 --- a/include/fuse_lowlevel_compat.h +++ b/include/fuse_lowlevel_compat.h @@ -9,6 +9,61 @@ /* these definitions provide source compatibility to prior versions. Do not include this file directly! */ +struct fuse_lowlevel_ops_compat25 { + void (*init) (void *userdata); + void (*destroy) (void *userdata); + void (*lookup) (fuse_req_t req, fuse_ino_t parent, const char *name); + void (*forget) (fuse_req_t req, fuse_ino_t ino, unsigned long nlookup); + void (*getattr) (fuse_req_t req, fuse_ino_t ino, struct fuse_file_info *fi); + void (*setattr) (fuse_req_t req, fuse_ino_t ino, struct stat *attr, + int to_set, struct fuse_file_info *fi); + void (*readlink) (fuse_req_t req, fuse_ino_t ino); + void (*mknod) (fuse_req_t req, fuse_ino_t parent, const char *name, + mode_t mode, dev_t rdev); + void (*mkdir) (fuse_req_t req, fuse_ino_t parent, const char *name, + mode_t mode); + void (*unlink) (fuse_req_t req, fuse_ino_t parent, const char *name); + void (*rmdir) (fuse_req_t req, fuse_ino_t parent, const char *name); + void (*symlink) (fuse_req_t req, const char *link, 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); + void (*link) (fuse_req_t req, fuse_ino_t ino, fuse_ino_t newparent, + const char *newname); + void (*open) (fuse_req_t req, fuse_ino_t ino, struct fuse_file_info *fi); + void (*read) (fuse_req_t req, fuse_ino_t ino, 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, struct fuse_file_info *fi); + void (*flush) (fuse_req_t req, fuse_ino_t ino, struct fuse_file_info *fi); + void (*release) (fuse_req_t req, fuse_ino_t ino, struct fuse_file_info *fi); + void (*fsync) (fuse_req_t req, fuse_ino_t ino, int datasync, + struct fuse_file_info *fi); + void (*opendir) (fuse_req_t req, fuse_ino_t ino, struct fuse_file_info *fi); + void (*readdir) (fuse_req_t req, fuse_ino_t ino, size_t size, off_t off, + struct fuse_file_info *fi); + void (*releasedir) (fuse_req_t req, fuse_ino_t ino, + struct fuse_file_info *fi); + void (*fsyncdir) (fuse_req_t req, fuse_ino_t ino, int datasync, + struct fuse_file_info *fi); + void (*statfs) (fuse_req_t req); + void (*setxattr) (fuse_req_t req, fuse_ino_t ino, const char *name, + const char *value, size_t size, int flags); + void (*getxattr) (fuse_req_t req, fuse_ino_t ino, const char *name, + size_t size); + void (*listxattr) (fuse_req_t req, fuse_ino_t ino, size_t size); + void (*removexattr) (fuse_req_t req, fuse_ino_t ino, const char *name); + void (*access) (fuse_req_t req, fuse_ino_t ino, int mask); + void (*create) (fuse_req_t req, fuse_ino_t parent, const char *name, + mode_t mode, struct fuse_file_info *fi); +}; + +struct fuse_session *fuse_lowlevel_new_compat25(struct fuse_args *args, + const struct fuse_lowlevel_ops_compat25 *op, + size_t op_size, void *userdata); + +#ifndef __FreeBSD__ + #include <sys/statfs.h> struct fuse_file_info_compat { @@ -27,3 +82,5 @@ int fuse_reply_open_compat(fuse_req_t req, struct fuse_session *fuse_lowlevel_new_compat(const char *opts, const struct fuse_lowlevel_ops *op, size_t op_size, void *userdata); + +#endif /* __FreeBSD__ */ diff --git a/include/fuse_opt.h b/include/fuse_opt.h index 2ef5d56..9e159d5 100644 --- a/include/fuse_opt.h +++ b/include/fuse_opt.h @@ -72,7 +72,7 @@ extern "C" { */ struct fuse_opt { /** Matching template and optional parameter formatting */ - const char *template; + const char *templ; /** * Offset of variable within 'data' parameter of fuse_opt_parse() @@ -82,7 +82,7 @@ struct fuse_opt { /** * Value to set the variable to, or to be passed as 'key' to the - * processing function. Ignored if template a format + * processing function. Ignored if template has a format */ int value; }; @@ -91,13 +91,13 @@ struct fuse_opt { * Key option. In case of a match, the processing function will be * called with the specified key. */ -#define FUSE_OPT_KEY(template, key) { template, -1U, key } +#define FUSE_OPT_KEY(templ, key) { templ, -1U, key } /** * Last option. An array of 'struct fuse_opt' must end with a NULL * template value */ -#define FUSE_OPT_END { .template = NULL } +#define FUSE_OPT_END { .templ = NULL } /** * Argument list @@ -120,7 +120,7 @@ struct fuse_args { /** * Key value passed to the processing function if an option did not - * match any templated + * match any template */ #define FUSE_OPT_KEY_OPT -1 @@ -133,6 +133,22 @@ struct fuse_args { #define FUSE_OPT_KEY_NONOPT -2 /** + * Special key value for options to keep + * + * Argument is not passed to processing function, but behave as if the + * processing function returned 1 + */ +#define FUSE_OPT_KEY_KEEP -3 + +/** + * Special key value for options to discard + * + * Argument is not passed to processing function, but behave as if the + * processing function returned zero + */ +#define FUSE_OPT_KEY_DISCARD -4 + +/** * Processing function * * This function is called if @@ -202,6 +218,21 @@ int fuse_opt_add_opt(char **opts, const char *opt); int fuse_opt_add_arg(struct fuse_args *args, const char *arg); /** + * Add an argument at the specified position in a NULL terminated + * argument vector + * + * Adds the argument to the N-th position. This is useful for adding + * options at the beggining of the array which must not come after the + * special '--' option. + * + * @param args is the structure containing the current argument list + * @param pos is the position at which to add the argument + * @param arg is the new argument to add + * @return -1 on allocation error, 0 on success + */ +int fuse_opt_insert_arg(struct fuse_args *args, int pos, const char *arg); + +/** * Free the contents of argument list * * The structure itself is not freed |