1 /* 2 FUSE: Filesystem in Userspace 3 Copyright (C) 2001-2007 Miklos Szeredi <miklos@szeredi.hu> 4 5 This program can be distributed under the terms of the GNU LGPLv2. 6 See the file COPYING.LIB. 7 */ 8 9 /* these definitions provide source compatibility to prior versions. 10 Do not include this file directly! */ 11 12 module c.fuse.fuse_compat; 13 14 import core.stdc.config; 15 import core.sys.posix.sys.stat; 16 import core.sys.posix.sys.statvfs; 17 import core.sys.posix.utime; 18 19 import c.fuse.fuse; 20 import c.fuse.fuse_common_compat; 21 22 struct fuse_operations_compat25 23 { 24 int function (const char *, stat_t *) getattr; 25 int function (const char *, char *, size_t) readlink; 26 int function (const char *, fuse_dirh_t, fuse_dirfil_t) getdir; 27 int function (const char *, mode_t, dev_t) mknod; 28 int function (const char *, mode_t) mkdir; 29 int function (const char *) unlink; 30 int function (const char *) rmdir; 31 int function (const char *, const char *) symlink; 32 int function (const char *, const char *) rename; 33 int function (const char *, const char *) link; 34 int function (const char *, mode_t) chmod; 35 int function (const char *, uid_t, gid_t) chown; 36 int function (const char *, off_t) truncate; 37 int function (const char *, utimbuf *) utime; 38 int function (const char *, fuse_file_info *) open; 39 int function (const char *, char *, size_t, off_t, 40 fuse_file_info *) read; 41 int function (const char *, const char *, size_t, off_t, 42 fuse_file_info *) write; 43 int function (const char *, statvfs_t *) statfs; 44 int function (const char *, fuse_file_info *) flush; 45 int function (const char *, fuse_file_info *) release; 46 int function (const char *, int, fuse_file_info *) fsync; 47 int function (const char *, const char *, const char *, size_t, int) setxattr; 48 int function (const char *, const char *, char *, size_t) getxattr; 49 int function (const char *, char *, size_t) listxattr; 50 int function (const char *, const char *) removexattr; 51 int function (const char *, fuse_file_info *) opendir; 52 int function (const char *, void *, fuse_fill_dir_t, off_t, 53 fuse_file_info *) readdir; 54 int function (const char *, fuse_file_info *) releasedir; 55 int function (const char *, int, fuse_file_info *) fsyncdir; 56 void *function () init; 57 void function (void *) destroy; 58 int function (const char *, int) access; 59 int function (const char *, mode_t, fuse_file_info *) create; 60 int function (const char *, off_t, fuse_file_info *) ftruncate; 61 int function (const char *, stat_t *, fuse_file_info *) fgetattr; 62 } 63 64 fuse *fuse_new_compat25(int fd, fuse_args *args, 65 const fuse_operations_compat25 *op, 66 size_t op_size); 67 68 int fuse_main_real_compat25(int argc, char** argv, 69 const fuse_operations_compat25 *op, 70 size_t op_size); 71 72 fuse* fuse_setup_compat25(int argc, char** argv, 73 const fuse_operations_compat25 *op, 74 size_t op_size, char **mountpoint, 75 int *multithreaded, int *fd); 76 77 void fuse_teardown_compat22(fuse *fuse, int fd, char *mountpoint); 78 79 version (FreeBSD) {} else version (NetBSD) {} else { 80 81 version (none) 82 import core.sys.posix.sys.statfs; // TODO - not in Druntime 83 else 84 struct statfs; 85 86 struct fuse_operations_compat22 { 87 int function (const char *, stat_t *) getattr; 88 int function (const char *, char *, size_t) readlink; 89 int function (const char *, fuse_dirh_t, fuse_dirfil_t) getdir; 90 int function (const char *, mode_t, dev_t) mknod; 91 int function (const char *, mode_t) mkdir; 92 int function (const char *) unlink; 93 int function (const char *) rmdir; 94 int function (const char *, const char *) symlink; 95 int function (const char *, const char *) rename; 96 int function (const char *, const char *) link; 97 int function (const char *, mode_t) chmod; 98 int function (const char *, uid_t, gid_t) chown; 99 int function (const char *, off_t) truncate; 100 int function (const char *, utimbuf *) utime; 101 int function (const char *, fuse_file_info_compat *) open; 102 int function (const char *, char *, size_t, off_t, 103 fuse_file_info_compat *) read; 104 int function (const char *, const char *, size_t, off_t, 105 fuse_file_info_compat *) write; 106 int function (const char *, .statfs *) statfs; 107 int function (const char *, fuse_file_info_compat *) flush; 108 int function (const char *, fuse_file_info_compat *) release; 109 int function (const char *, int, fuse_file_info_compat *) fsync; 110 int function (const char *, const char *, const char *, size_t, int) setxattr; 111 int function (const char *, const char *, char *, size_t) getxattr; 112 int function (const char *, char *, size_t) listxattr; 113 int function (const char *, const char *) removexattr; 114 int function (const char *, fuse_file_info_compat *) opendir; 115 int function (const char *, void *, fuse_fill_dir_t, off_t, 116 fuse_file_info_compat *) readdir; 117 int function (const char *, fuse_file_info_compat *) releasedir; 118 int function (const char *, int, fuse_file_info_compat *) fsyncdir; 119 void *function () init; 120 void function (void *) destroy; 121 } 122 123 fuse* fuse_new_compat22(int fd, const char *opts, 124 const fuse_operations_compat22 *op, 125 size_t op_size); 126 127 fuse* fuse_setup_compat22(int argc, char** argv, 128 const fuse_operations_compat22 *op, 129 size_t op_size, char **mountpoint, 130 int *multithreaded, int *fd); 131 132 int fuse_main_real_compat22(int argc, char** argv, 133 const fuse_operations_compat22 *op, 134 size_t op_size); 135 136 alias fuse_dirfil_t_compat = int function(fuse_dirh_t h, const char *name, int type); 137 struct fuse_operations_compat2 { 138 int function (const char *, stat_t *) getattr; 139 int function (const char *, char *, size_t) readlink; 140 int function (const char *, fuse_dirh_t, fuse_dirfil_t_compat) getdir; 141 int function (const char *, mode_t, dev_t) mknod; 142 int function (const char *, mode_t) mkdir; 143 int function (const char *) unlink; 144 int function (const char *) rmdir; 145 int function (const char *, const char *) symlink; 146 int function (const char *, const char *) rename; 147 int function (const char *, const char *) link; 148 int function (const char *, mode_t) chmod; 149 int function (const char *, uid_t, gid_t) chown; 150 int function (const char *, off_t) truncate; 151 int function (const char *, utimbuf *) utime; 152 int function (const char *, int) open; 153 int function (const char *, char *, size_t, off_t) read; 154 int function (const char *, const char *, size_t, off_t) write; 155 int function (const char *, .statfs *) statfs; 156 int function (const char *) flush; 157 int function (const char *, int) release; 158 int function (const char *, int) fsync; 159 int function (const char *, const char *, const char *, 160 size_t, int) setxattr; 161 int function (const char *, const char *, char *, size_t) getxattr; 162 int function (const char *, char *, size_t) listxattr; 163 int function (const char *, const char *) removexattr; 164 } 165 166 int fuse_main_compat2(int argc, char** argv, 167 const fuse_operations_compat2 *op); 168 169 fuse *fuse_new_compat2(int fd, const char *opts, 170 const fuse_operations_compat2 *op); 171 172 fuse *fuse_setup_compat2(int argc, char** argv, 173 const fuse_operations_compat2 *op, 174 char **mountpoint, int *multithreaded, int *fd); 175 176 struct fuse_statfs_compat1 { 177 c_long block_size; 178 c_long blocks; 179 c_long blocks_free; 180 c_long files; 181 c_long files_free; 182 c_long namelen; 183 } 184 185 struct fuse_operations_compat1 { 186 int function (const char *, stat_t *) getattr; 187 int function (const char *, char *, size_t) readlink; 188 int function (const char *, fuse_dirh_t, fuse_dirfil_t_compat) getdir; 189 int function (const char *, mode_t, dev_t) mknod; 190 int function (const char *, mode_t) mkdir; 191 int function (const char *) unlink; 192 int function (const char *) rmdir; 193 int function (const char *, const char *) symlink; 194 int function (const char *, const char *) rename; 195 int function (const char *, const char *) link; 196 int function (const char *, mode_t) chmod; 197 int function (const char *, uid_t, gid_t) chown; 198 int function (const char *, off_t) truncate; 199 int function (const char *, utimbuf *) utime; 200 int function (const char *, int) open; 201 int function (const char *, char *, size_t, off_t) read; 202 int function (const char *, const char *, size_t, off_t) write; 203 int function (fuse_statfs_compat1 *) statfs; 204 int function (const char *, int) release; 205 int function (const char *, int) fsync; 206 } 207 208 enum FUSE_DEBUG_COMPAT1 = (1 << 1); 209 210 fuse *fuse_new_compat1(int fd, int flags, 211 const fuse_operations_compat1 *op); 212 213 void fuse_main_compat1(int argc, char** argv, 214 const fuse_operations_compat1 *op); 215 216 } // version (FreeBSD) {} else version (NetBSD) {} else