diff options
author | Miklos Szeredi <miklos@szeredi.hu> | 2005-11-11 21:32:42 +0000 |
---|---|---|
committer | Miklos Szeredi <miklos@szeredi.hu> | 2005-11-11 21:32:42 +0000 |
commit | 3a77047661e345939e36f761db7a7a04ae632b76 (patch) | |
tree | 96f7fb8e682473dbe9739357040d94f7d9a1d9c2 /include | |
parent | bcc5385cc146c45bfe08e8351e3dcdd1d6354fee (diff) | |
download | libfuse-3a77047661e345939e36f761db7a7a04ae632b76.tar.gz |
fix
Diffstat (limited to 'include')
-rw-r--r-- | include/fuse.h | 24 | ||||
-rw-r--r-- | include/fuse_common.h | 20 | ||||
-rw-r--r-- | include/fuse_compat.h | 51 | ||||
-rw-r--r-- | include/fuse_lowlevel.h | 7 | ||||
-rw-r--r-- | include/fuse_lowlevel_compat.h | 25 |
5 files changed, 87 insertions, 40 deletions
diff --git a/include/fuse.h b/include/fuse.h index 2e977b2..adf0c9a 100644 --- a/include/fuse.h +++ b/include/fuse.h @@ -167,7 +167,14 @@ struct fuse_operations { struct fuse_file_info *); /** Just a placeholder, don't set */ - void (*statfs_old) (void); + /** Get file system statistics + * + * The 'f_frsize', 'f_favail', 'f_fsid' and 'f_flag' fields are ignored + * + * Replaced 'struct statfs' parameter with 'struct statvfs' in + * version 2.5 + */ + int (*statfs) (const char *, struct statvfs *); /** Possibly flush cached data * @@ -353,15 +360,6 @@ struct fuse_operations { * Introduced in version 2.5 */ int (*fgetattr) (const char *, struct stat *, struct fuse_file_info *); - - /** Get file system statistics - * - * The 'f_frsize', 'f_favail', 'f_fsid' and 'f_flag' fields are ignored - * - * Replaced 'struct statfs' parameter with 'struct statvfs' in - * version 2.5 - */ - int (*statfs) (const char *, struct statvfs *); }; /** Extra context that may be needed by some filesystems @@ -549,8 +547,12 @@ void fuse_set_getcontext_func(struct fuse_context *(*func)(void)); # undef fuse_main # if FUSE_USE_VERSION == 22 # define FUSE_MINOR_VERSION 4 -# define fuse_main fuse_main_compat22 +# 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 # else # define fuse_dirfil_t fuse_dirfil_t_compat # define __fuse_read_cmd fuse_read_cmd diff --git a/include/fuse_common.h b/include/fuse_common.h index 96f4702..979c092 100644 --- a/include/fuse_common.h +++ b/include/fuse_common.h @@ -13,6 +13,8 @@ #ifndef _FUSE_COMMON_H_ #define _FUSE_COMMON_H_ +#include <stdint.h> + /** Major version of FUSE library interface */ #define FUSE_MAJOR_VERSION 2 @@ -31,14 +33,17 @@ extern "C" { #endif -/** Information about open files */ +/** + * Information about open files + * + * Changed in version 2.5 + */ struct fuse_file_info { /** Open flags. Available in open() and release() */ int flags; - /** File handle. May be filled in by filesystem in open(). - Available in all other file operations */ - unsigned long fh; + /** Old file handle, don't use */ + unsigned long fh_old; /** In case of a write operation indicates if this was caused by a writepage */ @@ -51,6 +56,13 @@ struct fuse_file_info { /** Can be filled in by open, to indicate, that cached file data need not be invalidated. Introduced in version 2.4 */ unsigned int keep_cache : 1; + + /** Padding. Do not use*/ + unsigned int padding : 30; + + /** File handle. May be filled in by filesystem in open(). + Available in all other file operations */ + uint64_t fh; }; /* diff --git a/include/fuse_compat.h b/include/fuse_compat.h index 176560f..1fe68ec 100644 --- a/include/fuse_compat.h +++ b/include/fuse_compat.h @@ -11,6 +11,14 @@ #include <sys/statfs.h> +struct fuse_file_info_compat22 { + int flags; + unsigned long fh; + int writepage; + unsigned int direct_io : 1; + unsigned int keep_cache : 1; +}; + struct fuse_operations_compat22 { int (*getattr) (const char *, struct stat *); int (*readlink) (const char *, char *, size_t); @@ -26,39 +34,40 @@ struct fuse_operations_compat22 { 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 (*open) (const char *, struct fuse_file_info_compat22 *); + int (*read) (const char *, char *, size_t, off_t, + struct fuse_file_info_compat22 *); int (*write) (const char *, const char *, size_t, off_t, - struct fuse_file_info *); + struct fuse_file_info_compat22 *); int (*statfs) (const char *, struct statfs *); - 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 (*flush) (const char *, struct fuse_file_info_compat22 *); + int (*release) (const char *, struct fuse_file_info_compat22 *); + int (*fsync) (const char *, int, struct fuse_file_info_compat22 *); 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 (*opendir) (const char *, struct fuse_file_info_compat22 *); 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 *); + struct fuse_file_info_compat22 *); + int (*releasedir) (const char *, struct fuse_file_info_compat22 *); + int (*fsyncdir) (const char *, int, struct fuse_file_info_compat22 *); 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 *); - void (*statfs_new) (void); }; -static inline int fuse_main_compat22(int argc, char *argv[], - const struct fuse_operations_compat22 *op) -{ - return fuse_main_real(argc, argv, (const struct fuse_operations *) op, - sizeof(*op)); -} +struct fuse *fuse_new_compat22(int fd, const char *opts, + const struct fuse_operations_compat22 *op, + size_t op_size); + +struct fuse *fuse_setup_compat22(int argc, char *argv[], + const struct fuse_operations_compat22 *op, + size_t op_size, char **mountpoint, + int *multithreaded, int *fd); +int fuse_main_real_compat22(int argc, char *argv[], + const struct fuse_operations_compat22 *op, + size_t op_size); typedef int (*fuse_dirfil_t_compat) (fuse_dirh_t h, const char *name, int type); struct fuse_operations_compat2 { diff --git a/include/fuse_lowlevel.h b/include/fuse_lowlevel.h index d2b43a2..aa1e453 100644 --- a/include/fuse_lowlevel.h +++ b/include/fuse_lowlevel.h @@ -1211,13 +1211,12 @@ void fuse_chan_destroy(struct fuse_chan *ch); * ----------------------------------------------------------- */ #if FUSE_USE_VERSION == 24 -#include <sys/statfs.h> - -int fuse_reply_statfs_compat(fuse_req_t req, const struct statfs *stbuf); - +#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 diff --git a/include/fuse_lowlevel_compat.h b/include/fuse_lowlevel_compat.h new file mode 100644 index 0000000..c2bd3c1 --- /dev/null +++ b/include/fuse_lowlevel_compat.h @@ -0,0 +1,25 @@ +/* + FUSE: Filesystem in Userspace + Copyright (C) 2001-2005 Miklos Szeredi <miklos@szeredi.hu> + + This program can be distributed under the terms of the GNU LGPL. + See the file COPYING.LIB. +*/ + +/* these definitions provide source compatibility to prior versions. + Do not include this file directly! */ + +#include <sys/statfs.h> + +struct fuse_file_info_compat { + int flags; + unsigned long fh; + int writepage; + unsigned int direct_io : 1; + unsigned int keep_cache : 1; +}; + +int fuse_reply_statfs_compat(fuse_req_t req, const struct statfs *stbuf); + +int fuse_reply_open_compat(fuse_req_t req, + const struct fuse_file_info_compat *fi); |