1 diff -Nru fuse-2.7.3.orig/include/fuse_common_compat.h fuse-2.7.3/include/fuse_common_compat.h
2 --- fuse-2.7.3.orig/include/fuse_common_compat.h 2008-02-19 14:51:23.000000000 -0500
3 +++ fuse-2.7.3/include/fuse_common_compat.h 2008-03-17 14:55:01.000000000 -0400
5 unsigned int keep_cache : 1;
8 +#ifndef DISABLE_COMPAT
9 int fuse_mount_compat25(const char *mountpoint, struct fuse_args *args);
11 int fuse_mount_compat22(const char *mountpoint, const char *opts);
13 int fuse_mount_compat1(const char *mountpoint, const char *args[]);
15 void fuse_unmount_compat22(const char *mountpoint);
17 diff -Nru fuse-2.7.3.orig/lib/fuse.c fuse-2.7.3/lib/fuse.c
18 --- fuse-2.7.3.orig/lib/fuse.c 2008-02-19 14:51:25.000000000 -0500
19 +++ fuse-2.7.3/lib/fuse.c 2008-03-17 15:04:54.000000000 -0400
21 #include "fuse_lowlevel.h"
23 #include "fuse_misc.h"
24 -#include "fuse_common_compat.h"
25 -#include "fuse_compat.h"
30 fuse_do_prepare_interrupt(req, d);
35 -static int fuse_compat_open(struct fuse_fs *fs, const char *path,
36 - struct fuse_file_info *fi)
39 - if (!fs->compat || fs->compat >= 25)
40 - err = fs->op.open(path, fi);
41 - else if (fs->compat == 22) {
42 - struct fuse_file_info_compat tmp;
43 - memcpy(&tmp, fi, sizeof(tmp));
44 - err = ((struct fuse_operations_compat22 *) &fs->op)->open(path,
46 - memcpy(fi, &tmp, sizeof(tmp));
49 - err = ((struct fuse_operations_compat2 *) &fs->op)
50 - ->open(path, fi->flags);
54 -static int fuse_compat_release(struct fuse_fs *fs, const char *path,
55 - struct fuse_file_info *fi)
57 - if (!fs->compat || fs->compat >= 22)
58 - return fs->op.release(path, fi);
60 - return ((struct fuse_operations_compat2 *) &fs->op)
61 - ->release(path, fi->flags);
64 -static int fuse_compat_opendir(struct fuse_fs *fs, const char *path,
65 - struct fuse_file_info *fi)
67 - if (!fs->compat || fs->compat >= 25)
68 - return fs->op.opendir(path, fi);
71 - struct fuse_file_info_compat tmp;
72 - memcpy(&tmp, fi, sizeof(tmp));
73 - err = ((struct fuse_operations_compat22 *) &fs->op)
74 - ->opendir(path, &tmp);
75 - memcpy(fi, &tmp, sizeof(tmp));
81 -static void convert_statfs_compat(struct fuse_statfs_compat1 *compatbuf,
82 - struct statvfs *stbuf)
84 - stbuf->f_bsize = compatbuf->block_size;
85 - stbuf->f_blocks = compatbuf->blocks;
86 - stbuf->f_bfree = compatbuf->blocks_free;
87 - stbuf->f_bavail = compatbuf->blocks_free;
88 - stbuf->f_files = compatbuf->files;
89 - stbuf->f_ffree = compatbuf->files_free;
90 - stbuf->f_namemax = compatbuf->namelen;
93 -static void convert_statfs_old(struct statfs *oldbuf, struct statvfs *stbuf)
95 - stbuf->f_bsize = oldbuf->f_bsize;
96 - stbuf->f_blocks = oldbuf->f_blocks;
97 - stbuf->f_bfree = oldbuf->f_bfree;
98 - stbuf->f_bavail = oldbuf->f_bavail;
99 - stbuf->f_files = oldbuf->f_files;
100 - stbuf->f_ffree = oldbuf->f_ffree;
101 - stbuf->f_namemax = oldbuf->f_namelen;
104 -static int fuse_compat_statfs(struct fuse_fs *fs, const char *path,
105 - struct statvfs *buf)
109 - if (!fs->compat || fs->compat >= 25) {
110 - err = fs->op.statfs(fs->compat == 25 ? "/" : path, buf);
111 - } else if (fs->compat > 11) {
112 - struct statfs oldbuf;
113 - err = ((struct fuse_operations_compat22 *) &fs->op)
114 - ->statfs("/", &oldbuf);
116 - convert_statfs_old(&oldbuf, buf);
118 - struct fuse_statfs_compat1 compatbuf;
119 - memset(&compatbuf, 0, sizeof(struct fuse_statfs_compat1));
120 - err = ((struct fuse_operations_compat1 *) &fs->op)
121 - ->statfs(&compatbuf);
123 - convert_statfs_compat(&compatbuf, buf);
128 -#else /* __FreeBSD__ */
130 -static inline int fuse_compat_open(struct fuse_fs *fs, char *path,
131 - struct fuse_file_info *fi)
133 - return fs->op.open(path, fi);
136 -static inline int fuse_compat_release(struct fuse_fs *fs, const char *path,
137 - struct fuse_file_info *fi)
139 - return fs->op.release(path, fi);
142 -static inline int fuse_compat_opendir(struct fuse_fs *fs, const char *path,
143 - struct fuse_file_info *fi)
145 - return fs->op.opendir(path, fi);
148 -static inline int fuse_compat_statfs(struct fuse_fs *fs, const char *path,
149 - struct statvfs *buf)
151 - return fs->op.statfs(fs->compat == 25 ? "/" : path, buf);
154 -#endif /* __FreeBSD__ */
156 int fuse_fs_getattr(struct fuse_fs *fs, const char *path, struct stat *buf)
158 fuse_get_context()->private_data = fs->user_data;
161 fuse_get_context()->private_data = fs->user_data;
163 - return fuse_compat_release(fs, path, fi);
164 + return fs->op.release(path, fi);
170 fuse_get_context()->private_data = fs->user_data;
172 - return fuse_compat_opendir(fs, path, fi);
173 + return fs->op.opendir(path, fi);
179 fuse_get_context()->private_data = fs->user_data;
181 - return fuse_compat_open(fs, path, fi);
182 + return fs->op.open(path, fi);
188 fuse_get_context()->private_data = fs->user_data;
190 - return fuse_compat_statfs(fs, path, buf);
191 + return fs->op.statfs(path, buf);
193 buf->f_namemax = 255;
195 @@ -3070,7 +2945,6 @@
199 - fs->compat = compat;
202 /* Oh f**k, this is ugly! */
203 @@ -3114,11 +2988,6 @@
204 f->conf.readdir_ino = 1;
207 - if (compat && compat <= 25) {
208 - if (fuse_sync_compat_args(args) == -1)
212 f->se = fuse_lowlevel_new_common(args, &llop, sizeof(llop), f);
215 @@ -3254,19 +3123,6 @@
216 fuse_delete_context_key();
219 -static struct fuse *fuse_new_common_compat25(int fd, struct fuse_args *args,
220 - const struct fuse_operations *op,
221 - size_t op_size, int compat)
223 - struct fuse *f = NULL;
224 - struct fuse_chan *ch = fuse_kern_chan_new(fd);
227 - f = fuse_new_common(ch, args, op, op_size, NULL, compat);
232 /* called with fuse_context_lock held or during initialization (before
233 main() has been called) */
234 void fuse_register_module(struct fuse_module *mod)
235 @@ -3278,72 +3134,3 @@
236 mod->next = fuse_modules;
242 -static struct fuse *fuse_new_common_compat(int fd, const char *opts,
243 - const struct fuse_operations *op,
244 - size_t op_size, int compat)
247 - struct fuse_args args = FUSE_ARGS_INIT(0, NULL);
249 - if (fuse_opt_add_arg(&args, "") == -1)
252 - (fuse_opt_add_arg(&args, "-o") == -1 ||
253 - fuse_opt_add_arg(&args, opts) == -1)) {
254 - fuse_opt_free_args(&args);
257 - f = fuse_new_common_compat25(fd, &args, op, op_size, compat);
258 - fuse_opt_free_args(&args);
263 -struct fuse *fuse_new_compat22(int fd, const char *opts,
264 - const struct fuse_operations_compat22 *op,
267 - return fuse_new_common_compat(fd, opts, (struct fuse_operations *) op,
271 -struct fuse *fuse_new_compat2(int fd, const char *opts,
272 - const struct fuse_operations_compat2 *op)
274 - return fuse_new_common_compat(fd, opts, (struct fuse_operations *) op,
275 - sizeof(struct fuse_operations_compat2),
279 -struct fuse *fuse_new_compat1(int fd, int flags,
280 - const struct fuse_operations_compat1 *op)
282 - const char *opts = NULL;
283 - if (flags & FUSE_DEBUG_COMPAT1)
285 - return fuse_new_common_compat(fd, opts, (struct fuse_operations *) op,
286 - sizeof(struct fuse_operations_compat1),
290 -FUSE_SYMVER(".symver fuse_exited,__fuse_exited@");
291 -FUSE_SYMVER(".symver fuse_process_cmd,__fuse_process_cmd@");
292 -FUSE_SYMVER(".symver fuse_read_cmd,__fuse_read_cmd@");
293 -FUSE_SYMVER(".symver fuse_set_getcontext_func,__fuse_set_getcontext_func@");
294 -FUSE_SYMVER(".symver fuse_new_compat2,fuse_new@");
295 -FUSE_SYMVER(".symver fuse_new_compat22,fuse_new@FUSE_2.2");
297 -#endif /* __FreeBSD__ */
299 -struct fuse *fuse_new_compat25(int fd, struct fuse_args *args,
300 - const struct fuse_operations_compat25 *op,
303 - return fuse_new_common_compat25(fd, args, (struct fuse_operations *) op,
307 -FUSE_SYMVER(".symver fuse_new_compat25,fuse_new@FUSE_2.5");
308 diff -Nru fuse-2.7.3.orig/lib/fuse_lowlevel.c fuse-2.7.3/lib/fuse_lowlevel.c
309 --- fuse-2.7.3.orig/lib/fuse_lowlevel.c 2008-02-19 14:51:26.000000000 -0500
310 +++ fuse-2.7.3/lib/fuse_lowlevel.c 2008-03-17 15:07:40.000000000 -0400
312 #include "fuse_opt.h"
314 #include "fuse_misc.h"
315 -#include "fuse_common_compat.h"
316 -#include "fuse_lowlevel_compat.h"
320 @@ -1319,130 +1317,3 @@
322 return fuse_lowlevel_new_common(args, op, op_size, userdata);
328 -static void fill_open_compat(struct fuse_open_out *arg,
329 - const struct fuse_file_info_compat *f)
333 - arg->open_flags |= FOPEN_DIRECT_IO;
335 - arg->open_flags |= FOPEN_KEEP_CACHE;
338 -static void convert_statfs_compat(const struct statfs *compatbuf,
339 - struct statvfs *buf)
341 - buf->f_bsize = compatbuf->f_bsize;
342 - buf->f_blocks = compatbuf->f_blocks;
343 - buf->f_bfree = compatbuf->f_bfree;
344 - buf->f_bavail = compatbuf->f_bavail;
345 - buf->f_files = compatbuf->f_files;
346 - buf->f_ffree = compatbuf->f_ffree;
347 - buf->f_namemax = compatbuf->f_namelen;
350 -int fuse_reply_open_compat(fuse_req_t req,
351 - const struct fuse_file_info_compat *f)
353 - struct fuse_open_out arg;
355 - memset(&arg, 0, sizeof(arg));
356 - fill_open_compat(&arg, f);
357 - return send_reply_ok(req, &arg, sizeof(arg));
360 -int fuse_reply_statfs_compat(fuse_req_t req, const struct statfs *stbuf)
362 - struct statvfs newbuf;
364 - memset(&newbuf, 0, sizeof(newbuf));
365 - convert_statfs_compat(stbuf, &newbuf);
367 - return fuse_reply_statfs(req, &newbuf);
370 -struct fuse_session *fuse_lowlevel_new_compat(const char *opts,
371 - const struct fuse_lowlevel_ops_compat *op,
372 - size_t op_size, void *userdata)
374 - struct fuse_session *se;
375 - struct fuse_args args = FUSE_ARGS_INIT(0, NULL);
378 - (fuse_opt_add_arg(&args, "") == -1 ||
379 - fuse_opt_add_arg(&args, "-o") == -1 ||
380 - fuse_opt_add_arg(&args, opts) == -1)) {
381 - fuse_opt_free_args(&args);
384 - se = fuse_lowlevel_new(&args, (const struct fuse_lowlevel_ops *) op,
385 - op_size, userdata);
386 - fuse_opt_free_args(&args);
391 -struct fuse_ll_compat_conf {
396 -static const struct fuse_opt fuse_ll_opts_compat[] = {
397 - { "max_read=", offsetof(struct fuse_ll_compat_conf, set_max_read), 1 },
398 - { "max_read=%u", offsetof(struct fuse_ll_compat_conf, max_read), 0 },
399 - FUSE_OPT_KEY("max_read=", FUSE_OPT_KEY_KEEP),
403 -int fuse_sync_compat_args(struct fuse_args *args)
405 - struct fuse_ll_compat_conf conf;
407 - memset(&conf, 0, sizeof(conf));
408 - if (fuse_opt_parse(args, &conf, fuse_ll_opts_compat, NULL) == -1)
411 - if (fuse_opt_insert_arg(args, 1, "-osync_read"))
414 - if (conf.set_max_read) {
417 - sprintf(tmpbuf, "-omax_readahead=%u", conf.max_read);
418 - if (fuse_opt_insert_arg(args, 1, tmpbuf) == -1)
424 -FUSE_SYMVER(".symver fuse_reply_statfs_compat,fuse_reply_statfs@FUSE_2.4");
425 -FUSE_SYMVER(".symver fuse_reply_open_compat,fuse_reply_open@FUSE_2.4");
426 -FUSE_SYMVER(".symver fuse_lowlevel_new_compat,fuse_lowlevel_new@FUSE_2.4");
428 -#else /* __FreeBSD__ */
430 -int fuse_sync_compat_args(struct fuse_args *args)
436 -#endif /* __FreeBSD__ */
438 -struct fuse_session *fuse_lowlevel_new_compat25(struct fuse_args *args,
439 - const struct fuse_lowlevel_ops_compat25 *op,
440 - size_t op_size, void *userdata)
442 - if (fuse_sync_compat_args(args) == -1)
445 - return fuse_lowlevel_new_common(args,
446 - (const struct fuse_lowlevel_ops *) op,
447 - op_size, userdata);
450 -FUSE_SYMVER(".symver fuse_lowlevel_new_compat25,fuse_lowlevel_new@FUSE_2.5");
451 diff -Nru fuse-2.7.3.orig/lib/helper.c fuse-2.7.3/lib/helper.c
452 --- fuse-2.7.3.orig/lib/helper.c 2008-02-19 14:51:27.000000000 -0500
453 +++ fuse-2.7.3/lib/helper.c 2008-03-17 15:10:18.000000000 -0400
455 #include "fuse_misc.h"
456 #include "fuse_opt.h"
457 #include "fuse_lowlevel.h"
458 -#include "fuse_common_compat.h"
464 } while (fd >= 0 && fd <= 2);
466 - fd = fuse_mount_compat25(mountpoint, args);
467 + fd = fuse_kern_mount(mountpoint, args);
471 @@ -353,100 +352,3 @@
476 -#include "fuse_compat.h"
480 -struct fuse *fuse_setup_compat22(int argc, char *argv[],
481 - const struct fuse_operations_compat22 *op,
482 - size_t op_size, char **mountpoint,
483 - int *multithreaded, int *fd)
485 - return fuse_setup_common(argc, argv, (struct fuse_operations *) op,
486 - op_size, mountpoint, multithreaded, fd, NULL,
490 -struct fuse *fuse_setup_compat2(int argc, char *argv[],
491 - const struct fuse_operations_compat2 *op,
492 - char **mountpoint, int *multithreaded,
495 - return fuse_setup_common(argc, argv, (struct fuse_operations *) op,
496 - sizeof(struct fuse_operations_compat2),
497 - mountpoint, multithreaded, fd, NULL, 21);
500 -int fuse_main_real_compat22(int argc, char *argv[],
501 - const struct fuse_operations_compat22 *op,
504 - return fuse_main_common(argc, argv, (struct fuse_operations *) op,
505 - op_size, NULL, 22);
508 -void fuse_main_compat1(int argc, char *argv[],
509 - const struct fuse_operations_compat1 *op)
511 - fuse_main_common(argc, argv, (struct fuse_operations *) op,
512 - sizeof(struct fuse_operations_compat1), NULL, 11);
515 -int fuse_main_compat2(int argc, char *argv[],
516 - const struct fuse_operations_compat2 *op)
518 - return fuse_main_common(argc, argv, (struct fuse_operations *) op,
519 - sizeof(struct fuse_operations_compat2), NULL,
523 -int fuse_mount_compat1(const char *mountpoint, const char *args[])
525 - /* just ignore mount args for now */
527 - return fuse_mount_compat22(mountpoint, NULL);
530 -FUSE_SYMVER(".symver fuse_setup_compat2,__fuse_setup@");
531 -FUSE_SYMVER(".symver fuse_setup_compat22,fuse_setup@FUSE_2.2");
532 -FUSE_SYMVER(".symver fuse_teardown,__fuse_teardown@");
533 -FUSE_SYMVER(".symver fuse_main_compat2,fuse_main@");
534 -FUSE_SYMVER(".symver fuse_main_real_compat22,fuse_main_real@FUSE_2.2");
536 -#endif /* __FreeBSD__ */
539 -struct fuse *fuse_setup_compat25(int argc, char *argv[],
540 - const struct fuse_operations_compat25 *op,
541 - size_t op_size, char **mountpoint,
542 - int *multithreaded, int *fd)
544 - return fuse_setup_common(argc, argv, (struct fuse_operations *) op,
545 - op_size, mountpoint, multithreaded, fd, NULL,
549 -int fuse_main_real_compat25(int argc, char *argv[],
550 - const struct fuse_operations_compat25 *op,
553 - return fuse_main_common(argc, argv, (struct fuse_operations *) op,
554 - op_size, NULL, 25);
557 -void fuse_teardown_compat22(struct fuse *fuse, int fd, char *mountpoint)
560 - fuse_teardown_common(fuse, mountpoint);
563 -int fuse_mount_compat25(const char *mountpoint, struct fuse_args *args)
565 - return fuse_kern_mount(mountpoint, args);
568 -FUSE_SYMVER(".symver fuse_setup_compat25,fuse_setup@FUSE_2.5");
569 -FUSE_SYMVER(".symver fuse_teardown_compat22,fuse_teardown@FUSE_2.2");
570 -FUSE_SYMVER(".symver fuse_main_real_compat25,fuse_main_real@FUSE_2.5");
571 -FUSE_SYMVER(".symver fuse_mount_compat25,fuse_mount@FUSE_2.5");
572 diff -Nru fuse-2.7.3.orig/lib/mount.c fuse-2.7.3/lib/mount.c
573 --- fuse-2.7.3.orig/lib/mount.c 2008-02-19 14:51:27.000000000 -0500
574 +++ fuse-2.7.3/lib/mount.c 2008-03-17 15:11:02.000000000 -0400
577 #include "fuse_misc.h"
578 #include "fuse_opt.h"
579 -#include "fuse_common_compat.h"
580 #include "mount_util.h"
584 waitpid(pid, NULL, 0);
587 -void fuse_unmount_compat22(const char *mountpoint)
589 - fuse_kern_unmount(mountpoint, -1);
592 static int fuse_mount_fusermount(const char *mountpoint, const char *opts,
599 -int fuse_mount_compat22(const char *mountpoint, const char *opts)
601 - return fuse_mount_fusermount(mountpoint, opts, 0);
604 static int fuse_mount_sys(const char *mnt, struct mount_opts *mo,
605 const char *mnt_opts)
612 -FUSE_SYMVER(".symver fuse_mount_compat22,fuse_mount@FUSE_2.2");
613 -FUSE_SYMVER(".symver fuse_unmount_compat22,fuse_unmount@FUSE_2.2");