dev.c (04ec5af0776e9baefed59891f12adbcb5fa71a23) dev.c (14d46d7abc3973a47e8eb0eb5eb87ee8d910a505)
1/*
2 FUSE: Filesystem in Userspace
3 Copyright (C) 2001-2008 Miklos Szeredi <miklos@szeredi.hu>
4
5 This program can be distributed under the terms of the GNU GPL.
6 See the file COPYING.
7*/
8

--- 163 unchanged lines hidden (view full) ---

172 fuse_drop_waiting(fc);
173 }
174
175 fuse_request_free(req);
176 }
177}
178EXPORT_SYMBOL_GPL(fuse_put_request);
179
1/*
2 FUSE: Filesystem in Userspace
3 Copyright (C) 2001-2008 Miklos Szeredi <miklos@szeredi.hu>
4
5 This program can be distributed under the terms of the GNU GPL.
6 See the file COPYING.
7*/
8

--- 163 unchanged lines hidden (view full) ---

172 fuse_drop_waiting(fc);
173 }
174
175 fuse_request_free(req);
176 }
177}
178EXPORT_SYMBOL_GPL(fuse_put_request);
179
180static unsigned len_args(unsigned numargs, struct fuse_arg *args)
180unsigned int fuse_len_args(unsigned int numargs, struct fuse_arg *args)
181{
182 unsigned nbytes = 0;
183 unsigned i;
184
185 for (i = 0; i < numargs; i++)
186 nbytes += args[i].size;
187
188 return nbytes;
189}
181{
182 unsigned nbytes = 0;
183 unsigned i;
184
185 for (i = 0; i < numargs; i++)
186 nbytes += args[i].size;
187
188 return nbytes;
189}
190EXPORT_SYMBOL_GPL(fuse_len_args);
190
191static u64 fuse_get_unique(struct fuse_iqueue *fiq)
192{
193 fiq->reqctr += FUSE_REQ_ID_STEP;
194 return fiq->reqctr;
195}
196
197static unsigned int fuse_req_hash(u64 unique)
198{
199 return hash_long(unique & ~FUSE_INT_REQ_BIT, FUSE_PQ_HASH_BITS);
200}
201
202static void queue_request(struct fuse_iqueue *fiq, struct fuse_req *req)
203{
204 req->in.h.len = sizeof(struct fuse_in_header) +
191
192static u64 fuse_get_unique(struct fuse_iqueue *fiq)
193{
194 fiq->reqctr += FUSE_REQ_ID_STEP;
195 return fiq->reqctr;
196}
197
198static unsigned int fuse_req_hash(u64 unique)
199{
200 return hash_long(unique & ~FUSE_INT_REQ_BIT, FUSE_PQ_HASH_BITS);
201}
202
203static void queue_request(struct fuse_iqueue *fiq, struct fuse_req *req)
204{
205 req->in.h.len = sizeof(struct fuse_in_header) +
205 len_args(req->args->in_numargs,
206 (struct fuse_arg *) req->args->in_args);
206 fuse_len_args(req->args->in_numargs,
207 (struct fuse_arg *) req->args->in_args);
207 list_add_tail(&req->list, &fiq->pending);
208 wake_up(&fiq->waitq);
209 kill_fasync(&fiq->fasync, SIGIO, POLL_IN);
210}
211
212void fuse_queue_forget(struct fuse_conn *fc, struct fuse_forget_link *forget,
213 u64 nodeid, u64 nlookup)
214{

--- 1559 unchanged lines hidden (view full) ---

1774 return NULL;
1775}
1776
1777static int copy_out_args(struct fuse_copy_state *cs, struct fuse_args *args,
1778 unsigned nbytes)
1779{
1780 unsigned reqsize = sizeof(struct fuse_out_header);
1781
208 list_add_tail(&req->list, &fiq->pending);
209 wake_up(&fiq->waitq);
210 kill_fasync(&fiq->fasync, SIGIO, POLL_IN);
211}
212
213void fuse_queue_forget(struct fuse_conn *fc, struct fuse_forget_link *forget,
214 u64 nodeid, u64 nlookup)
215{

--- 1559 unchanged lines hidden (view full) ---

1775 return NULL;
1776}
1777
1778static int copy_out_args(struct fuse_copy_state *cs, struct fuse_args *args,
1779 unsigned nbytes)
1780{
1781 unsigned reqsize = sizeof(struct fuse_out_header);
1782
1782 reqsize += len_args(args->out_numargs, args->out_args);
1783 reqsize += fuse_len_args(args->out_numargs, args->out_args);
1783
1784 if (reqsize < nbytes || (reqsize > nbytes && !args->out_argvar))
1785 return -EINVAL;
1786 else if (reqsize > nbytes) {
1787 struct fuse_arg *lastarg = &args->out_args[args->out_numargs-1];
1788 unsigned diffsize = reqsize - nbytes;
1789
1790 if (diffsize > lastarg->size)

--- 492 unchanged lines hidden ---
1784
1785 if (reqsize < nbytes || (reqsize > nbytes && !args->out_argvar))
1786 return -EINVAL;
1787 else if (reqsize > nbytes) {
1788 struct fuse_arg *lastarg = &args->out_args[args->out_numargs-1];
1789 unsigned diffsize = reqsize - nbytes;
1790
1791 if (diffsize > lastarg->size)

--- 492 unchanged lines hidden ---