xref: /haiku/headers/private/userlandfs/fuse/fuse_compat.h (revision 4a55cc230cf7566cadcbb23b1928eefff8aea9a2)
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 struct fuse_operations_compat25 {
13 	int (*getattr) (const char *, struct stat *);
14 	int (*readlink) (const char *, char *, size_t);
15 	int (*getdir) (const char *, fuse_dirh_t, fuse_dirfil_t);
16 	int (*mknod) (const char *, mode_t, dev_t);
17 	int (*mkdir) (const char *, mode_t);
18 	int (*unlink) (const char *);
19 	int (*rmdir) (const char *);
20 	int (*symlink) (const char *, const char *);
21 	int (*rename) (const char *, const char *);
22 	int (*link) (const char *, const char *);
23 	int (*chmod) (const char *, mode_t);
24 	int (*chown) (const char *, uid_t, gid_t);
25 	int (*truncate) (const char *, off_t);
26 	int (*utime) (const char *, struct utimbuf *);
27 	int (*open) (const char *, struct fuse_file_info *);
28 	int (*read) (const char *, char *, size_t, off_t,
29 		     struct fuse_file_info *);
30 	int (*write) (const char *, const char *, size_t, off_t,
31 		      struct fuse_file_info *);
32 	int (*statfs) (const char *, struct statvfs *);
33 	int (*flush) (const char *, struct fuse_file_info *);
34 	int (*release) (const char *, struct fuse_file_info *);
35 	int (*fsync) (const char *, int, struct fuse_file_info *);
36 	int (*setxattr) (const char *, const char *, const char *, size_t, int);
37 	int (*getxattr) (const char *, const char *, char *, size_t);
38 	int (*listxattr) (const char *, char *, size_t);
39 	int (*removexattr) (const char *, const char *);
40 	int (*opendir) (const char *, struct fuse_file_info *);
41 	int (*readdir) (const char *, void *, fuse_fill_dir_t, off_t,
42 			struct fuse_file_info *);
43 	int (*releasedir) (const char *, struct fuse_file_info *);
44 	int (*fsyncdir) (const char *, int, struct fuse_file_info *);
45 	void *(*init) (void);
46 	void (*destroy) (void *);
47 	int (*access) (const char *, int);
48 	int (*create) (const char *, mode_t, struct fuse_file_info *);
49 	int (*ftruncate) (const char *, off_t, struct fuse_file_info *);
50 	int (*fgetattr) (const char *, struct stat *, struct fuse_file_info *);
51 };
52 
53 struct fuse *fuse_new_compat25(int fd, struct fuse_args *args,
54 			       const struct fuse_operations_compat25 *op,
55 			       size_t op_size);
56 
57 int fuse_main_real_compat25(int argc, char *argv[],
58 			    const struct fuse_operations_compat25 *op,
59 			    size_t op_size);
60 
61 struct fuse *fuse_setup_compat25(int argc, char *argv[],
62 				 const struct fuse_operations_compat25 *op,
63 				 size_t op_size, char **mountpoint,
64 				 int *multithreaded, int *fd);
65 
66 void fuse_teardown_compat22(struct fuse *fuse, int fd, char *mountpoint);
67 
68 #if !defined(__FreeBSD__) && !defined(__NetBSD__) && !defined(__HAIKU__)
69 #include <sys/statfs.h>
70 
71 struct fuse_operations_compat22 {
72 	int (*getattr) (const char *, struct stat *);
73 	int (*readlink) (const char *, char *, size_t);
74 	int (*getdir) (const char *, fuse_dirh_t, fuse_dirfil_t);
75 	int (*mknod) (const char *, mode_t, dev_t);
76 	int (*mkdir) (const char *, mode_t);
77 	int (*unlink) (const char *);
78 	int (*rmdir) (const char *);
79 	int (*symlink) (const char *, const char *);
80 	int (*rename) (const char *, const char *);
81 	int (*link) (const char *, const char *);
82 	int (*chmod) (const char *, mode_t);
83 	int (*chown) (const char *, uid_t, gid_t);
84 	int (*truncate) (const char *, off_t);
85 	int (*utime) (const char *, struct utimbuf *);
86 	int (*open) (const char *, struct fuse_file_info_compat *);
87 	int (*read) (const char *, char *, size_t, off_t,
88 		     struct fuse_file_info_compat *);
89 	int (*write) (const char *, const char *, size_t, off_t,
90 		      struct fuse_file_info_compat *);
91 	int (*statfs) (const char *, struct statfs *);
92 	int (*flush) (const char *, struct fuse_file_info_compat *);
93 	int (*release) (const char *, struct fuse_file_info_compat *);
94 	int (*fsync) (const char *, int, struct fuse_file_info_compat *);
95 	int (*setxattr) (const char *, const char *, const char *, size_t, int);
96 	int (*getxattr) (const char *, const char *, char *, size_t);
97 	int (*listxattr) (const char *, char *, size_t);
98 	int (*removexattr) (const char *, const char *);
99 	int (*opendir) (const char *, struct fuse_file_info_compat *);
100 	int (*readdir) (const char *, void *, fuse_fill_dir_t, off_t,
101 			struct fuse_file_info_compat *);
102 	int (*releasedir) (const char *, struct fuse_file_info_compat *);
103 	int (*fsyncdir) (const char *, int, struct fuse_file_info_compat *);
104 	void *(*init) (void);
105 	void (*destroy) (void *);
106 };
107 
108 struct fuse *fuse_new_compat22(int fd, const char *opts,
109 			       const struct fuse_operations_compat22 *op,
110 			       size_t op_size);
111 
112 struct fuse *fuse_setup_compat22(int argc, char *argv[],
113 				 const struct fuse_operations_compat22 *op,
114 				 size_t op_size, char **mountpoint,
115 				 int *multithreaded, int *fd);
116 
117 int fuse_main_real_compat22(int argc, char *argv[],
118 			    const struct fuse_operations_compat22 *op,
119 			    size_t op_size);
120 
121 typedef int (*fuse_dirfil_t_compat) (fuse_dirh_t h, const char *name, int type);
122 struct fuse_operations_compat2 {
123 	int (*getattr)	   (const char *, struct stat *);
124 	int (*readlink)	   (const char *, char *, size_t);
125 	int (*getdir)	   (const char *, fuse_dirh_t, fuse_dirfil_t_compat);
126 	int (*mknod)	   (const char *, mode_t, dev_t);
127 	int (*mkdir)	   (const char *, mode_t);
128 	int (*unlink)	   (const char *);
129 	int (*rmdir)	   (const char *);
130 	int (*symlink)	   (const char *, const char *);
131 	int (*rename)	   (const char *, const char *);
132 	int (*link)	   (const char *, const char *);
133 	int (*chmod)	   (const char *, mode_t);
134 	int (*chown)	   (const char *, uid_t, gid_t);
135 	int (*truncate)	   (const char *, off_t);
136 	int (*utime)	   (const char *, struct utimbuf *);
137 	int (*open)	   (const char *, int);
138 	int (*read)	   (const char *, char *, size_t, off_t);
139 	int (*write)	   (const char *, const char *, size_t, off_t);
140 	int (*statfs)	   (const char *, struct statfs *);
141 	int (*flush)	   (const char *);
142 	int (*release)	   (const char *, int);
143 	int (*fsync)	   (const char *, int);
144 	int (*setxattr)	   (const char *, const char *, const char *,
145 			    size_t, int);
146 	int (*getxattr)	   (const char *, const char *, char *, size_t);
147 	int (*listxattr)   (const char *, char *, size_t);
148 	int (*removexattr) (const char *, const char *);
149 };
150 
151 int fuse_main_compat2(int argc, char *argv[],
152 		      const struct fuse_operations_compat2 *op);
153 
154 struct fuse *fuse_new_compat2(int fd, const char *opts,
155 			      const struct fuse_operations_compat2 *op);
156 
157 struct fuse *fuse_setup_compat2(int argc, char *argv[],
158 				const struct fuse_operations_compat2 *op,
159 				char **mountpoint, int *multithreaded, int *fd);
160 
161 struct fuse_statfs_compat1 {
162 	long block_size;
163 	long blocks;
164 	long blocks_free;
165 	long files;
166 	long files_free;
167 	long namelen;
168 };
169 
170 struct fuse_operations_compat1 {
171 	int (*getattr)	(const char *, struct stat *);
172 	int (*readlink) (const char *, char *, size_t);
173 	int (*getdir)	(const char *, fuse_dirh_t, fuse_dirfil_t_compat);
174 	int (*mknod)	(const char *, mode_t, dev_t);
175 	int (*mkdir)	(const char *, mode_t);
176 	int (*unlink)	(const char *);
177 	int (*rmdir)	(const char *);
178 	int (*symlink)	(const char *, const char *);
179 	int (*rename)	(const char *, const char *);
180 	int (*link)	(const char *, const char *);
181 	int (*chmod)	(const char *, mode_t);
182 	int (*chown)	(const char *, uid_t, gid_t);
183 	int (*truncate) (const char *, off_t);
184 	int (*utime)	(const char *, struct utimbuf *);
185 	int (*open)	(const char *, int);
186 	int (*read)	(const char *, char *, size_t, off_t);
187 	int (*write)	(const char *, const char *, size_t, off_t);
188 	int (*statfs)	(struct fuse_statfs_compat1 *);
189 	int (*release)	(const char *, int);
190 	int (*fsync)	(const char *, int);
191 };
192 
193 #define FUSE_DEBUG_COMPAT1	 (1 << 1)
194 
195 struct fuse *fuse_new_compat1(int fd, int flags,
196 			      const struct fuse_operations_compat1 *op);
197 
198 void fuse_main_compat1(int argc, char *argv[],
199 		       const struct fuse_operations_compat1 *op);
200 
201 #endif /* __FreeBSD__ || __NetBSD__ */
202