nfs-ganesha 1.4
|
00001 #ifndef GANESHA_FUSE_WRAP_H_ 00002 #define GANESHA_FUSE_WRAP_H_ 00003 00004 #include <fcntl.h> 00005 #include <time.h> 00006 #include <utime.h> 00007 #include <fcntl.h> 00008 #include <sys/types.h> 00009 #include <sys/stat.h> 00010 #include <sys/statvfs.h> 00011 #include <sys/uio.h> 00012 #include <stdint.h> 00013 00014 /* Major version of FUSE library interface */ 00015 #define FUSE_MAJOR_VERSION 2 00016 00017 /* Minor version of FUSE library interface */ 00018 #define FUSE_MINOR_VERSION 6 00019 00020 #define FUSE_MAKE_VERSION(maj, min) ((maj) * 10 + (min)) 00021 #define FUSE_VERSION FUSE_MAKE_VERSION(FUSE_MAJOR_VERSION, FUSE_MINOR_VERSION) 00022 00023 struct ganefuse; 00024 struct ganefuse_cmd; 00025 typedef int (*ganefuse_fill_dir_t) (void *buf, const char *name, 00026 const struct stat * stbuf, off_t off); 00027 00028 struct ganefuse_file_info 00029 { 00030 int flags; 00031 unsigned long fh_old; 00032 int writepage; 00033 unsigned int direct_io:1; 00034 unsigned int keep_cache:1; 00035 unsigned int flush:1; 00036 unsigned int padding:29; 00037 uint64_t fh; 00038 uint64_t lock_owner; 00039 }; 00040 00041 struct ganefuse_conn_info 00042 { 00043 unsigned proto_major; 00044 unsigned proto_minor; 00045 unsigned async_read; 00046 unsigned max_write; 00047 unsigned max_readahead; 00048 unsigned reserved[27]; 00049 00050 }; 00051 00052 /* Used by deprecated getdir() method */ 00053 typedef struct ganefuse_dirhandle *ganefuse_dirh_t; 00054 typedef int (*ganefuse_dirfil_t) (ganefuse_dirh_t h, const char *name, int type, 00055 ino_t ino); 00056 00057 struct ganefuse_operations 00058 { 00059 int (*getattr) (const char *, struct stat *); 00060 int (*readlink) (const char *, char *, size_t); 00061 00062 /* getdir (deprecated, use readdir() instead) 00063 * Supported for backward compatibility. 00064 */ 00065 int (*getdir) (const char *, ganefuse_dirh_t, ganefuse_dirfil_t); 00066 00067 int (*mknod) (const char *, mode_t, dev_t); 00068 int (*mkdir) (const char *, mode_t); 00069 int (*unlink) (const char *); 00070 int (*rmdir) (const char *); 00071 int (*symlink) (const char *, const char *); 00072 int (*rename) (const char *, const char *); 00073 int (*link) (const char *, const char *); 00074 int (*chmod) (const char *, mode_t); 00075 int (*chown) (const char *, uid_t, gid_t); 00076 int (*truncate) (const char *, off_t); 00077 00082 int (*utime) (const char *, struct utimbuf *); 00083 00084 int (*open) (const char *, struct ganefuse_file_info *); 00085 int (*read) (const char *, char *, size_t, off_t, struct ganefuse_file_info *); 00086 int (*write) (const char *, const char *, size_t, off_t, struct ganefuse_file_info *); 00087 int (*statfs) (const char *, struct statvfs *); 00088 int (*flush) (const char *, struct ganefuse_file_info *); 00089 int (*release) (const char *, struct ganefuse_file_info *); 00090 int (*fsync) (const char *, int, struct ganefuse_file_info *); 00091 int (*setxattr) (const char *, const char *, const char *, size_t, int); 00092 int (*getxattr) (const char *, const char *, char *, size_t); 00093 int (*listxattr) (const char *, char *, size_t); 00094 int (*removexattr) (const char *, const char *); 00095 int (*opendir) (const char *, struct ganefuse_file_info *); 00096 int (*readdir) (const char *, void *, ganefuse_fill_dir_t, off_t, 00097 struct ganefuse_file_info *); 00098 int (*releasedir) (const char *, struct ganefuse_file_info *); 00099 int (*fsyncdir) (const char *, int, struct ganefuse_file_info *); 00100 void *(*init) (struct ganefuse_conn_info * conn); 00101 void (*destroy) (void *); 00102 int (*access) (const char *, int); 00103 int (*create) (const char *, mode_t, struct ganefuse_file_info *); 00104 int (*ftruncate) (const char *, off_t, struct ganefuse_file_info *); 00105 int (*fgetattr) (const char *, struct stat *, struct ganefuse_file_info *); 00106 int (*lock) (const char *, struct ganefuse_file_info *, int cmd, struct flock *); 00107 int (*utimens) (const char *, const struct timespec tv[2]); 00108 int (*bmap) (const char *, size_t blocksize, uint64_t * idx); 00109 }; 00110 00111 struct ganefuse_context 00112 { 00113 struct ganefuse *ganefuse; 00114 uid_t uid; 00115 gid_t gid; 00116 pid_t pid; 00117 void *private_data; 00118 }; 00119 00120 struct ganefuse_context *ganefuse_get_context(void); 00121 00122 #ifdef __cplusplus 00123 extern "C" 00124 { 00125 #endif 00126 00127 int ganefuse_main(int argc, char *argv[], 00128 const struct ganefuse_operations *op, void *user_data); 00129 00130 #ifdef __cplusplus 00131 } 00132 #endif 00133 /* Binding for FUSE binded programs, so they don't need to 00134 * change their code. 00135 */ 00136 #define fuse ganefuse 00137 #define fuse_cmd ganefuse_cmd 00138 #define fuse_fill_dir_t ganefuse_fill_dir_t 00139 #define fuse_file_info ganefuse_file_info 00140 #define fuse_conn_info ganefuse_conn_info 00141 #define fuse_operations ganefuse_operations 00142 #define fuse_context ganefuse_context 00143 #define fuse_main ganefuse_main 00144 #define fuse_get_context ganefuse_get_context 00145 #define fuse_dirh_t ganefuse_dirh_t 00146 #define fuse_dirfil_t ganefuse_dirfil_t 00147 #endif