remove compatibility crap from libfuse which seems to break on uClibc, because of...
[openwrt/openwrt.git] / package / fuse / patches / 200-disable_compat.patch
1 diff -ur fuse.old/include/fuse_common_compat.h fuse.dev/include/fuse_common_compat.h
2 --- fuse.old/include/fuse_common_compat.h 2006-09-22 21:30:16.000000000 +0200
3 +++ fuse.dev/include/fuse_common_compat.h 2007-02-27 15:42:40.370284776 +0100
4 @@ -17,6 +17,7 @@
5 unsigned int keep_cache : 1;
6 };
7
8 +#ifndef DISABLE_COMPAT
9 int fuse_mount_compat25(const char *mountpoint, struct fuse_args *args);
10
11 int fuse_mount_compat22(const char *mountpoint, const char *opts);
12 @@ -24,4 +25,4 @@
13 int fuse_mount_compat1(const char *mountpoint, const char *args[]);
14
15 void fuse_unmount_compat22(const char *mountpoint);
16 -
17 +#endif
18 diff -ur fuse.old/lib/fuse.c fuse.dev/lib/fuse.c
19 --- fuse.old/lib/fuse.c 2007-02-02 12:57:48.000000000 +0100
20 +++ fuse.dev/lib/fuse.c 2007-02-27 15:46:09.721458560 +0100
21 @@ -128,6 +128,7 @@
22 static pthread_mutex_t fuse_context_lock = PTHREAD_MUTEX_INITIALIZER;
23 static int fuse_context_ref;
24
25 +#ifndef DISABLE_COMPAT
26 static int fuse_compat_open(struct fuse *, fuse_req_t, char *,
27 struct fuse_file_info *);
28 static void fuse_compat_release(struct fuse *, fuse_req_t, char *,
29 @@ -135,6 +136,7 @@
30 static int fuse_compat_opendir(struct fuse *, fuse_req_t, char *,
31 struct fuse_file_info *);
32 static int fuse_compat_statfs(struct fuse *, fuse_req_t, struct statvfs *);
33 +#endif
34
35 static struct node *get_node_nocheck(struct fuse *f, fuse_ino_t nodeid)
36 {
37 @@ -1509,10 +1511,12 @@
38 pthread_rwlock_rdlock(&f->tree_lock);
39 if (f->op.open) {
40 err = -ENOENT;
41 +#ifndef DISABLE_COMPAT
42 path = get_path(f, ino);
43 if (path != NULL)
44 err = fuse_compat_open(f, req, path, fi);
45 - }
46 +#endif
47 + }
48 if (!err) {
49 if (f->conf.debug) {
50 printf("OPEN[%llu] flags: 0x%x\n", (unsigned long long) fi->fh,
51 @@ -1535,9 +1539,11 @@
52 if (fuse_reply_open(req, fi) == -ENOENT) {
53 /* The open syscall was interrupted, so it must be cancelled */
54 pthread_mutex_unlock(&f->lock);
55 +#ifndef DISABLE_COMPAT
56 if(f->op.release && path != NULL)
57 fuse_compat_release(f, req, path, fi);
58 - } else {
59 +#endif
60 + } else {
61 get_node(f, ino)->open_count++;
62 pthread_mutex_unlock(&f->lock);
63 }
64 @@ -1661,8 +1667,10 @@
65 }
66 if (fi->flush && path && f->op.flush)
67 err = fuse_do_flush(f, req, path, fi);
68 +#ifndef DISABLE_COMPAT
69 if (f->op.release)
70 fuse_compat_release(f, req, path, fi);
71 +#endif
72
73 pthread_mutex_lock(&f->lock);
74 node = get_node(f, ino);
75 @@ -1753,12 +1761,14 @@
76
77 err = -ENOENT;
78 pthread_rwlock_rdlock(&f->tree_lock);
79 +#ifndef DISABLE_COMPAT
80 path = get_path(f, ino);
81 if (path != NULL) {
82 err = fuse_compat_opendir(f, req, path, &fi);
83 dh->fh = fi.fh;
84 }
85 - if (!err) {
86 +#endif
87 + if (!err) {
88 if (fuse_reply_open(req, llfi) == -ENOENT) {
89 /* The opendir syscall was interrupted, so it must be
90 cancelled */
91 @@ -2011,9 +2021,12 @@
92 free(path);
93 }
94 pthread_rwlock_unlock(&f->tree_lock);
95 - } else
96 + }
97 +#ifndef DISABLE_COMPAT
98 + else
99 err = fuse_compat_statfs(f, req, &buf);
100 - } else
101 +#endif
102 + } else
103 err = default_statfs(&buf);
104
105 if (!err)
106 @@ -2691,10 +2704,12 @@
107 f->conf.readdir_ino = 1;
108 #endif
109
110 +#ifndef DISABLE_COMPAT
111 if (compat && compat <= 25) {
112 if (fuse_sync_compat_args(args) == -1)
113 goto out_free;
114 }
115 +#endif
116
117 memcpy(&f->op, op, op_size);
118 if (!f->op.lock) {
119 @@ -2824,6 +2839,7 @@
120 fuse_delete_context_key();
121 }
122
123 +#ifndef DISABLE_COMPAT
124 #include "fuse_common_compat.h"
125 #include "fuse_compat.h"
126
127 @@ -3037,3 +3053,5 @@
128 }
129
130 __asm__(".symver fuse_new_compat25,fuse_new@FUSE_2.5");
131 +
132 +#endif
133 diff -ur fuse.old/lib/fuse_lowlevel.c fuse.dev/lib/fuse_lowlevel.c
134 --- fuse.old/lib/fuse_lowlevel.c 2006-12-09 19:52:22.000000000 +0100
135 +++ fuse.dev/lib/fuse_lowlevel.c 2007-02-27 15:32:35.903177744 +0100
136 @@ -1297,6 +1297,7 @@
137 }
138
139
140 +#ifndef DISABLE_COMPAT
141 #ifndef __FreeBSD__
142
143 static void fill_open_compat(struct fuse_open_out *arg,
144 @@ -1422,3 +1423,4 @@
145 }
146
147 __asm__(".symver fuse_lowlevel_new_compat25,fuse_lowlevel_new@FUSE_2.5");
148 +#endif
149 diff -ur fuse.old/lib/helper.c fuse.dev/lib/helper.c
150 --- fuse.old/lib/helper.c 2006-12-09 19:52:22.000000000 +0100
151 +++ fuse.dev/lib/helper.c 2007-02-27 15:35:17.340635520 +0100
152 @@ -195,7 +195,7 @@
153 struct fuse_args *args)
154 {
155 struct fuse_chan *ch;
156 - int fd = fuse_mount_compat25(mountpoint, args);
157 + int fd = fuse_kern_mount(mountpoint, args);
158 if (fd == -1)
159 return NULL;
160
161 @@ -338,6 +338,7 @@
162 return -1;
163 }
164
165 +#ifndef DISABLE_COMPAT
166 #include "fuse_compat.h"
167
168 #ifndef __FreeBSD__
169 @@ -431,3 +432,4 @@
170 __asm__(".symver fuse_teardown_compat22,fuse_teardown@FUSE_2.2");
171 __asm__(".symver fuse_main_real_compat25,fuse_main_real@FUSE_2.5");
172 __asm__(".symver fuse_mount_compat25,fuse_mount@FUSE_2.5");
173 +#endif
174 diff -ur fuse.old/lib/mount.c fuse.dev/lib/mount.c
175 --- fuse.old/lib/mount.c 2007-01-02 18:10:33.000000000 +0100
176 +++ fuse.dev/lib/mount.c 2007-02-27 15:40:13.645590320 +0100
177 @@ -219,11 +219,16 @@
178 waitpid(pid, NULL, 0);
179 }
180
181 +#ifndef DISABLE_COMPAT
182 void fuse_unmount_compat22(const char *mountpoint)
183 {
184 fuse_kern_unmount(mountpoint, -1);
185 }
186 +#endif
187
188 +#ifdef DISABLE_COMPAT
189 +static
190 +#endif
191 int fuse_mount_compat22(const char *mountpoint, const char *opts)
192 {
193 int fds[2], pid;
194 @@ -304,5 +309,7 @@
195 return res;
196 }
197
198 +#ifndef DISABLE_COMPAT
199 __asm__(".symver fuse_mount_compat22,fuse_mount@FUSE_2.2");
200 __asm__(".symver fuse_unmount_compat22,fuse_unmount@FUSE_2.2");
201 +#endif