fix update fuse to 2.7.1 - fixes compile breakage with 2.6.23
[openwrt/svn-archive/archive.git] / package / fuse / patches / 200-disable_compat.patch
1 Index: fuse-2.7.1/include/fuse_common_compat.h
2 ===================================================================
3 --- fuse-2.7.1.orig/include/fuse_common_compat.h 2007-10-20 17:13:51.409738304 +0200
4 +++ fuse-2.7.1/include/fuse_common_compat.h 2007-10-20 17:14:26.323727941 +0200
5 @@ -17,6 +17,7 @@
6 unsigned int keep_cache : 1;
7 };
8
9 +#ifndef DISABLE_COMPAT
10 int fuse_mount_compat25(const char *mountpoint, struct fuse_args *args);
11
12 int fuse_mount_compat22(const char *mountpoint, const char *opts);
13 @@ -24,4 +25,4 @@
14 int fuse_mount_compat1(const char *mountpoint, const char *args[]);
15
16 void fuse_unmount_compat22(const char *mountpoint);
17 -
18 +#endif
19 Index: fuse-2.7.1/lib/fuse.c
20 ===================================================================
21 --- fuse-2.7.1.orig/lib/fuse.c 2007-10-20 17:13:51.417738760 +0200
22 +++ fuse-2.7.1/lib/fuse.c 2007-10-20 17:26:30.657005340 +0200
23 @@ -14,8 +14,6 @@
24 #include "fuse_lowlevel.h"
25 #include "fuse_opt.h"
26 #include "fuse_misc.h"
27 -#include "fuse_common_compat.h"
28 -#include "fuse_compat.h"
29
30 #include <stdio.h>
31 #include <string.h>
32 @@ -621,127 +619,6 @@
33 fuse_do_prepare_interrupt(req, d);
34 }
35
36 -#ifndef __FreeBSD__
37 -
38 -static int fuse_compat_open(struct fuse_fs *fs, const char *path,
39 - struct fuse_file_info *fi)
40 -{
41 - int err;
42 - if (!fs->compat || fs->compat >= 25)
43 - err = fs->op.open(path, fi);
44 - else if (fs->compat == 22) {
45 - struct fuse_file_info_compat tmp;
46 - memcpy(&tmp, fi, sizeof(tmp));
47 - err = ((struct fuse_operations_compat22 *) &fs->op)->open(path, &tmp);
48 - memcpy(fi, &tmp, sizeof(tmp));
49 - fi->fh = tmp.fh;
50 - } else
51 - err = ((struct fuse_operations_compat2 *) &fs->op)
52 - ->open(path, fi->flags);
53 - return err;
54 -}
55 -
56 -static int fuse_compat_release(struct fuse_fs *fs, const char *path,
57 - struct fuse_file_info *fi)
58 -{
59 - if (!fs->compat || fs->compat >= 22)
60 - return fs->op.release(path, fi);
61 - else
62 - return ((struct fuse_operations_compat2 *) &fs->op)
63 - ->release(path, fi->flags);
64 -}
65 -
66 -static int fuse_compat_opendir(struct fuse_fs *fs, const char *path,
67 - struct fuse_file_info *fi)
68 -{
69 - if (!fs->compat || fs->compat >= 25)
70 - return fs->op.opendir(path, fi);
71 - else {
72 - int err;
73 - struct fuse_file_info_compat tmp;
74 - memcpy(&tmp, fi, sizeof(tmp));
75 - err = ((struct fuse_operations_compat22 *) &fs->op)
76 - ->opendir(path, &tmp);
77 - memcpy(fi, &tmp, sizeof(tmp));
78 - fi->fh = tmp.fh;
79 - return err;
80 - }
81 -}
82 -
83 -static void convert_statfs_compat(struct fuse_statfs_compat1 *compatbuf,
84 - struct statvfs *stbuf)
85 -{
86 - stbuf->f_bsize = compatbuf->block_size;
87 - stbuf->f_blocks = compatbuf->blocks;
88 - stbuf->f_bfree = compatbuf->blocks_free;
89 - stbuf->f_bavail = compatbuf->blocks_free;
90 - stbuf->f_files = compatbuf->files;
91 - stbuf->f_ffree = compatbuf->files_free;
92 - stbuf->f_namemax = compatbuf->namelen;
93 -}
94 -
95 -static void convert_statfs_old(struct statfs *oldbuf, struct statvfs *stbuf)
96 -{
97 - stbuf->f_bsize = oldbuf->f_bsize;
98 - stbuf->f_blocks = oldbuf->f_blocks;
99 - stbuf->f_bfree = oldbuf->f_bfree;
100 - stbuf->f_bavail = oldbuf->f_bavail;
101 - stbuf->f_files = oldbuf->f_files;
102 - stbuf->f_ffree = oldbuf->f_ffree;
103 - stbuf->f_namemax = oldbuf->f_namelen;
104 -}
105 -
106 -static int fuse_compat_statfs(struct fuse_fs *fs, const char *path,
107 - struct statvfs *buf)
108 -{
109 - int err;
110 -
111 - if (!fs->compat || fs->compat >= 25) {
112 - err = fs->op.statfs(fs->compat == 25 ? "/" : path, buf);
113 - } else if (fs->compat > 11) {
114 - struct statfs oldbuf;
115 - err = ((struct fuse_operations_compat22 *) &fs->op)
116 - ->statfs("/", &oldbuf);
117 - if (!err)
118 - convert_statfs_old(&oldbuf, buf);
119 - } else {
120 - struct fuse_statfs_compat1 compatbuf;
121 - memset(&compatbuf, 0, sizeof(struct fuse_statfs_compat1));
122 - err = ((struct fuse_operations_compat1 *) &fs->op)->statfs(&compatbuf);
123 - if (!err)
124 - convert_statfs_compat(&compatbuf, buf);
125 - }
126 - return err;
127 -}
128 -
129 -#else /* __FreeBSD__ */
130 -
131 -static inline int fuse_compat_open(struct fuse_fs *fs, char *path,
132 - struct fuse_file_info *fi)
133 -{
134 - return fs->op.open(path, fi);
135 -}
136 -
137 -static inline int fuse_compat_release(struct fuse_fs *fs, const char *path,
138 - struct fuse_file_info *fi)
139 -{
140 - return fs->op.release(path, fi);
141 -}
142 -
143 -static inline int fuse_compat_opendir(struct fuse_fs *fs, const char *path,
144 - struct fuse_file_info *fi)
145 -{
146 - return fs->op.opendir(path, fi);
147 -}
148 -
149 -static inline int fuse_compat_statfs(struct fuse_fs *fs, const char *path,
150 - struct statvfs *buf)
151 -{
152 - return fs->op.statfs(fs->compat == 25 ? "/" : path, buf);
153 -}
154 -
155 -#endif /* __FreeBSD__ */
156 -
157 int fuse_fs_getattr(struct fuse_fs *fs, const char *path, struct stat *buf)
158 {
159 fuse_get_context()->private_data = fs->user_data;
160 @@ -814,7 +691,7 @@
161 {
162 fuse_get_context()->private_data = fs->user_data;
163 if (fs->op.release)
164 - return fuse_compat_release(fs, path, fi);
165 + return fs->op.release(path, fi);
166 else
167 return 0;
168 }
169 @@ -824,7 +701,7 @@
170 {
171 fuse_get_context()->private_data = fs->user_data;
172 if (fs->op.opendir)
173 - return fuse_compat_opendir(fs, path, fi);
174 + return fs->op.opendir(path, fi);
175 else
176 return 0;
177 }
178 @@ -834,7 +711,7 @@
179 {
180 fuse_get_context()->private_data = fs->user_data;
181 if (fs->op.open)
182 - return fuse_compat_open(fs, path, fi);
183 + return fs->op.open(path, fi);
184 else
185 return 0;
186 }
187 @@ -893,7 +770,7 @@
188 {
189 fuse_get_context()->private_data = fs->user_data;
190 if (fs->op.statfs)
191 - return fuse_compat_statfs(fs, path, buf);
192 + return fs->op.statfs(path, buf);
193 else {
194 buf->f_namemax = 255;
195 buf->f_bsize = 512;
196 @@ -3037,7 +2914,6 @@
197 if (!fs)
198 goto out_free;
199
200 - fs->compat = compat;
201 f->fs = fs;
202
203 /* Oh f**k, this is ugly! */
204 @@ -3079,11 +2955,6 @@
205 f->conf.readdir_ino = 1;
206 #endif
207
208 - if (compat && compat <= 25) {
209 - if (fuse_sync_compat_args(args) == -1)
210 - goto out_free_fs;
211 - }
212 -
213 f->se = fuse_lowlevel_new_common(args, &llop, sizeof(llop), f);
214 if (f->se == NULL) {
215 if (f->conf.help)
216 @@ -3217,19 +3088,6 @@
217 fuse_delete_context_key();
218 }
219
220 -static struct fuse *fuse_new_common_compat25(int fd, struct fuse_args *args,
221 - const struct fuse_operations *op,
222 - size_t op_size, int compat)
223 -{
224 - struct fuse *f = NULL;
225 - struct fuse_chan *ch = fuse_kern_chan_new(fd);
226 -
227 - if (ch)
228 - f = fuse_new_common(ch, args, op, op_size, NULL, compat);
229 -
230 - return f;
231 -}
232 -
233 /* called with fuse_context_lock held or during initialization (before
234 main() has been called) */
235 void fuse_register_module(struct fuse_module *mod)
236 @@ -3242,69 +3100,3 @@
237 fuse_modules = mod;
238 }
239
240 -#ifndef __FreeBSD__
241 -
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)
245 -{
246 - struct fuse *f;
247 - struct fuse_args args = FUSE_ARGS_INIT(0, NULL);
248 -
249 - if (fuse_opt_add_arg(&args, "") == -1)
250 - return NULL;
251 - if (opts &&
252 - (fuse_opt_add_arg(&args, "-o") == -1 ||
253 - fuse_opt_add_arg(&args, opts) == -1)) {
254 - fuse_opt_free_args(&args);
255 - return NULL;
256 - }
257 - f = fuse_new_common_compat25(fd, &args, op, op_size, compat);
258 - fuse_opt_free_args(&args);
259 -
260 - return f;
261 -}
262 -
263 -struct fuse *fuse_new_compat22(int fd, const char *opts,
264 - const struct fuse_operations_compat22 *op,
265 - size_t op_size)
266 -{
267 - return fuse_new_common_compat(fd, opts, (struct fuse_operations *) op,
268 - op_size, 22);
269 -}
270 -
271 -struct fuse *fuse_new_compat2(int fd, const char *opts,
272 - const struct fuse_operations_compat2 *op)
273 -{
274 - return fuse_new_common_compat(fd, opts, (struct fuse_operations *) op,
275 - sizeof(struct fuse_operations_compat2), 21);
276 -}
277 -
278 -struct fuse *fuse_new_compat1(int fd, int flags,
279 - const struct fuse_operations_compat1 *op)
280 -{
281 - const char *opts = NULL;
282 - if (flags & FUSE_DEBUG_COMPAT1)
283 - opts = "debug";
284 - return fuse_new_common_compat(fd, opts, (struct fuse_operations *) op,
285 - sizeof(struct fuse_operations_compat1), 11);
286 -}
287 -
288 -__asm__(".symver fuse_exited,__fuse_exited@");
289 -__asm__(".symver fuse_process_cmd,__fuse_process_cmd@");
290 -__asm__(".symver fuse_read_cmd,__fuse_read_cmd@");
291 -__asm__(".symver fuse_set_getcontext_func,__fuse_set_getcontext_func@");
292 -__asm__(".symver fuse_new_compat2,fuse_new@");
293 -__asm__(".symver fuse_new_compat22,fuse_new@FUSE_2.2");
294 -
295 -#endif /* __FreeBSD__ */
296 -
297 -struct fuse *fuse_new_compat25(int fd, struct fuse_args *args,
298 - const struct fuse_operations_compat25 *op,
299 - size_t op_size)
300 -{
301 - return fuse_new_common_compat25(fd, args, (struct fuse_operations *) op,
302 - op_size, 25);
303 -}
304 -
305 -__asm__(".symver fuse_new_compat25,fuse_new@FUSE_2.5");
306 Index: fuse-2.7.1/lib/fuse_lowlevel.c
307 ===================================================================
308 --- fuse-2.7.1.orig/lib/fuse_lowlevel.c 2007-10-20 17:13:51.425739218 +0200
309 +++ fuse-2.7.1/lib/fuse_lowlevel.c 2007-10-20 17:22:46.396225455 +0200
310 @@ -11,8 +11,6 @@
311 #include "fuse_opt.h"
312 #include "fuse_i.h"
313 #include "fuse_misc.h"
314 -#include "fuse_common_compat.h"
315 -#include "fuse_lowlevel_compat.h"
316
317 #include <stdio.h>
318 #include <stdlib.h>
319 @@ -1310,129 +1308,3 @@
320 return fuse_lowlevel_new_common(args, op, op_size, userdata);
321 }
322
323 -
324 -#ifndef __FreeBSD__
325 -
326 -static void fill_open_compat(struct fuse_open_out *arg,
327 - const struct fuse_file_info_compat *f)
328 -{
329 - arg->fh = f->fh;
330 - if (f->direct_io)
331 - arg->open_flags |= FOPEN_DIRECT_IO;
332 - if (f->keep_cache)
333 - arg->open_flags |= FOPEN_KEEP_CACHE;
334 -}
335 -
336 -static void convert_statfs_compat(const struct statfs *compatbuf,
337 - struct statvfs *buf)
338 -{
339 - buf->f_bsize = compatbuf->f_bsize;
340 - buf->f_blocks = compatbuf->f_blocks;
341 - buf->f_bfree = compatbuf->f_bfree;
342 - buf->f_bavail = compatbuf->f_bavail;
343 - buf->f_files = compatbuf->f_files;
344 - buf->f_ffree = compatbuf->f_ffree;
345 - buf->f_namemax = compatbuf->f_namelen;
346 -}
347 -
348 -int fuse_reply_open_compat(fuse_req_t req,
349 - const struct fuse_file_info_compat *f)
350 -{
351 - struct fuse_open_out arg;
352 -
353 - memset(&arg, 0, sizeof(arg));
354 - fill_open_compat(&arg, f);
355 - return send_reply_ok(req, &arg, sizeof(arg));
356 -}
357 -
358 -int fuse_reply_statfs_compat(fuse_req_t req, const struct statfs *stbuf)
359 -{
360 - struct statvfs newbuf;
361 -
362 - memset(&newbuf, 0, sizeof(newbuf));
363 - convert_statfs_compat(stbuf, &newbuf);
364 -
365 - return fuse_reply_statfs(req, &newbuf);
366 -}
367 -
368 -struct fuse_session *fuse_lowlevel_new_compat(const char *opts,
369 - const struct fuse_lowlevel_ops_compat *op,
370 - size_t op_size, void *userdata)
371 -{
372 - struct fuse_session *se;
373 - struct fuse_args args = FUSE_ARGS_INIT(0, NULL);
374 -
375 - if (opts &&
376 - (fuse_opt_add_arg(&args, "") == -1 ||
377 - fuse_opt_add_arg(&args, "-o") == -1 ||
378 - fuse_opt_add_arg(&args, opts) == -1)) {
379 - fuse_opt_free_args(&args);
380 - return NULL;
381 - }
382 - se = fuse_lowlevel_new(&args, (const struct fuse_lowlevel_ops *) op,
383 - op_size, userdata);
384 - fuse_opt_free_args(&args);
385 -
386 - return se;
387 -}
388 -
389 -struct fuse_ll_compat_conf {
390 - unsigned max_read;
391 - int set_max_read;
392 -};
393 -
394 -static const struct fuse_opt fuse_ll_opts_compat[] = {
395 - { "max_read=", offsetof(struct fuse_ll_compat_conf, set_max_read), 1 },
396 - { "max_read=%u", offsetof(struct fuse_ll_compat_conf, max_read), 0 },
397 - FUSE_OPT_KEY("max_read=", FUSE_OPT_KEY_KEEP),
398 - FUSE_OPT_END
399 -};
400 -
401 -int fuse_sync_compat_args(struct fuse_args *args)
402 -{
403 - struct fuse_ll_compat_conf conf;
404 -
405 - memset(&conf, 0, sizeof(conf));
406 - if (fuse_opt_parse(args, &conf, fuse_ll_opts_compat, NULL) == -1)
407 - return -1;
408 -
409 - if (fuse_opt_insert_arg(args, 1, "-osync_read"))
410 - return -1;
411 -
412 - if (conf.set_max_read) {
413 - char tmpbuf[64];
414 -
415 - sprintf(tmpbuf, "-omax_readahead=%u", conf.max_read);
416 - if (fuse_opt_insert_arg(args, 1, tmpbuf) == -1)
417 - return -1;
418 - }
419 - return 0;
420 -}
421 -
422 -__asm__(".symver fuse_reply_statfs_compat,fuse_reply_statfs@FUSE_2.4");
423 -__asm__(".symver fuse_reply_open_compat,fuse_reply_open@FUSE_2.4");
424 -__asm__(".symver fuse_lowlevel_new_compat,fuse_lowlevel_new@FUSE_2.4");
425 -
426 -#else /* __FreeBSD__ */
427 -
428 -int fuse_sync_compat_args(struct fuse_args *args)
429 -{
430 - (void) args;
431 - return 0;
432 -}
433 -
434 -#endif /* __FreeBSD__ */
435 -
436 -struct fuse_session *fuse_lowlevel_new_compat25(struct fuse_args *args,
437 - const struct fuse_lowlevel_ops_compat25 *op,
438 - size_t op_size, void *userdata)
439 -{
440 - if (fuse_sync_compat_args(args) == -1)
441 - return NULL;
442 -
443 - return fuse_lowlevel_new_common(args,
444 - (const struct fuse_lowlevel_ops *) op,
445 - op_size, userdata);
446 -}
447 -
448 -__asm__(".symver fuse_lowlevel_new_compat25,fuse_lowlevel_new@FUSE_2.5");
449 Index: fuse-2.7.1/lib/helper.c
450 ===================================================================
451 --- fuse-2.7.1.orig/lib/helper.c 2007-10-20 17:13:51.433739673 +0200
452 +++ fuse-2.7.1/lib/helper.c 2007-10-20 17:21:32.508014797 +0200
453 @@ -10,7 +10,6 @@
454 #include "fuse_i.h"
455 #include "fuse_opt.h"
456 #include "fuse_lowlevel.h"
457 -#include "fuse_common_compat.h"
458
459 #include <stdio.h>
460 #include <stdlib.h>
461 @@ -202,7 +201,7 @@
462 close(fd);
463 } while (fd >= 0 && fd <= 2);
464
465 - fd = fuse_mount_compat25(mountpoint, args);
466 + fd = fuse_kern_mount(mountpoint, args);
467 if (fd == -1)
468 return NULL;
469
470 @@ -349,97 +348,3 @@
471 {
472 return FUSE_VERSION;
473 }
474 -
475 -#include "fuse_compat.h"
476 -
477 -#ifndef __FreeBSD__
478 -
479 -struct fuse *fuse_setup_compat22(int argc, char *argv[],
480 - const struct fuse_operations_compat22 *op,
481 - size_t op_size, char **mountpoint,
482 - int *multithreaded, int *fd)
483 -{
484 - return fuse_setup_common(argc, argv, (struct fuse_operations *) op,
485 - op_size, mountpoint, multithreaded, fd, NULL, 22);
486 -}
487 -
488 -struct fuse *fuse_setup_compat2(int argc, char *argv[],
489 - const struct fuse_operations_compat2 *op,
490 - char **mountpoint, int *multithreaded,
491 - int *fd)
492 -{
493 - return fuse_setup_common(argc, argv, (struct fuse_operations *) op,
494 - sizeof(struct fuse_operations_compat2),
495 - mountpoint, multithreaded, fd, NULL, 21);
496 -}
497 -
498 -int fuse_main_real_compat22(int argc, char *argv[],
499 - const struct fuse_operations_compat22 *op,
500 - size_t op_size)
501 -{
502 - return fuse_main_common(argc, argv, (struct fuse_operations *) op, op_size,
503 - NULL, 22);
504 -}
505 -
506 -void fuse_main_compat1(int argc, char *argv[],
507 - const struct fuse_operations_compat1 *op)
508 -{
509 - fuse_main_common(argc, argv, (struct fuse_operations *) op,
510 - sizeof(struct fuse_operations_compat1), NULL, 11);
511 -}
512 -
513 -int fuse_main_compat2(int argc, char *argv[],
514 - const struct fuse_operations_compat2 *op)
515 -{
516 - return fuse_main_common(argc, argv, (struct fuse_operations *) op,
517 - sizeof(struct fuse_operations_compat2), NULL, 21);
518 -}
519 -
520 -int fuse_mount_compat1(const char *mountpoint, const char *args[])
521 -{
522 - /* just ignore mount args for now */
523 - (void) args;
524 - return fuse_mount_compat22(mountpoint, NULL);
525 -}
526 -
527 -__asm__(".symver fuse_setup_compat2,__fuse_setup@");
528 -__asm__(".symver fuse_setup_compat22,fuse_setup@FUSE_2.2");
529 -__asm__(".symver fuse_teardown,__fuse_teardown@");
530 -__asm__(".symver fuse_main_compat2,fuse_main@");
531 -__asm__(".symver fuse_main_real_compat22,fuse_main_real@FUSE_2.2");
532 -
533 -#endif /* __FreeBSD__ */
534 -
535 -
536 -struct fuse *fuse_setup_compat25(int argc, char *argv[],
537 - const struct fuse_operations_compat25 *op,
538 - size_t op_size, char **mountpoint,
539 - int *multithreaded, int *fd)
540 -{
541 - return fuse_setup_common(argc, argv, (struct fuse_operations *) op,
542 - op_size, mountpoint, multithreaded, fd, NULL, 25);
543 -}
544 -
545 -int fuse_main_real_compat25(int argc, char *argv[],
546 - const struct fuse_operations_compat25 *op,
547 - size_t op_size)
548 -{
549 - return fuse_main_common(argc, argv, (struct fuse_operations *) op, op_size,
550 - NULL, 25);
551 -}
552 -
553 -void fuse_teardown_compat22(struct fuse *fuse, int fd, char *mountpoint)
554 -{
555 - (void) fd;
556 - fuse_teardown_common(fuse, mountpoint);
557 -}
558 -
559 -int fuse_mount_compat25(const char *mountpoint, struct fuse_args *args)
560 -{
561 - return fuse_kern_mount(mountpoint, args);
562 -}
563 -
564 -__asm__(".symver fuse_setup_compat25,fuse_setup@FUSE_2.5");
565 -__asm__(".symver fuse_teardown_compat22,fuse_teardown@FUSE_2.2");
566 -__asm__(".symver fuse_main_real_compat25,fuse_main_real@FUSE_2.5");
567 -__asm__(".symver fuse_mount_compat25,fuse_mount@FUSE_2.5");
568 Index: fuse-2.7.1/lib/mount.c
569 ===================================================================
570 --- fuse-2.7.1.orig/lib/mount.c 2007-10-20 17:13:51.441740129 +0200
571 +++ fuse-2.7.1/lib/mount.c 2007-10-20 17:22:07.209992349 +0200
572 @@ -9,7 +9,6 @@
573 #include "config.h"
574 #include "fuse_i.h"
575 #include "fuse_opt.h"
576 -#include "fuse_common_compat.h"
577 #include "mount_util.h"
578
579 #include <stdio.h>
580 @@ -308,11 +307,6 @@
581 waitpid(pid, NULL, 0);
582 }
583
584 -void fuse_unmount_compat22(const char *mountpoint)
585 -{
586 - fuse_kern_unmount(mountpoint, -1);
587 -}
588 -
589 static int fuse_mount_fusermount(const char *mountpoint, const char *opts,
590 int quiet)
591 {
592 @@ -376,11 +370,6 @@
593 return rv;
594 }
595
596 -int fuse_mount_compat22(const char *mountpoint, const char *opts)
597 -{
598 - return fuse_mount_fusermount(mountpoint, opts, 0);
599 -}
600 -
601 static int fuse_mount_sys(const char *mnt, struct mount_opts *mo,
602 const char *mnt_opts)
603 {
604 @@ -579,5 +568,3 @@
605 return res;
606 }
607
608 -__asm__(".symver fuse_mount_compat22,fuse_mount@FUSE_2.2");
609 -__asm__(".symver fuse_unmount_compat22,fuse_unmount@FUSE_2.2");