diff options
| author | Linus Torvalds <torvalds@linux-foundation.org> | 2009-01-06 20:01:20 -0500 |
|---|---|---|
| committer | Linus Torvalds <torvalds@linux-foundation.org> | 2009-01-06 20:01:20 -0500 |
| commit | 5fec8bdbf9a1c4df4ad3f20e52aa2d8caed490c8 (patch) | |
| tree | e8c1b1a9f3ea6b6a0edb972f082d0d7338c98af4 | |
| parent | 59e3af21e94bd56f6a31ba774786a2bfc753581b (diff) | |
| parent | 5d9ec854bfb6f1e122b1d96b344164a71eac5be8 (diff) | |
Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/mszeredi/fuse
* 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/mszeredi/fuse:
fuse: clean up annotations of fc->lock
fuse: fix sparse warning in ioctl
fuse: update interface version
fuse: add fuse_conn->release()
fuse: separate out fuse_conn_init() from new_conn()
fuse: add fuse_ prefix to several functions
fuse: implement poll support
fuse: implement unsolicited notification
fuse: add file kernel handle
fuse: implement ioctl support
fuse: don't let fuse_req->end() put the base reference
fuse: move FUSE_MINOR to miscdevice.h
fuse: style fixes
| -rw-r--r-- | fs/fuse/control.c | 6 | ||||
| -rw-r--r-- | fs/fuse/dev.c | 113 | ||||
| -rw-r--r-- | fs/fuse/dir.c | 48 | ||||
| -rw-r--r-- | fs/fuse/file.c | 457 | ||||
| -rw-r--r-- | fs/fuse/fuse_i.h | 83 | ||||
| -rw-r--r-- | fs/fuse/inode.c | 157 | ||||
| -rw-r--r-- | include/linux/fuse.h | 79 | ||||
| -rw-r--r-- | include/linux/miscdevice.h | 42 |
8 files changed, 783 insertions, 202 deletions
diff --git a/fs/fuse/control.c b/fs/fuse/control.c index 4f3cab321415..99c99dfb0373 100644 --- a/fs/fuse/control.c +++ b/fs/fuse/control.c | |||
| @@ -1,6 +1,6 @@ | |||
| 1 | /* | 1 | /* |
| 2 | FUSE: Filesystem in Userspace | 2 | FUSE: Filesystem in Userspace |
| 3 | Copyright (C) 2001-2006 Miklos Szeredi <miklos@szeredi.hu> | 3 | Copyright (C) 2001-2008 Miklos Szeredi <miklos@szeredi.hu> |
| 4 | 4 | ||
| 5 | This program can be distributed under the terms of the GNU GPL. | 5 | This program can be distributed under the terms of the GNU GPL. |
| 6 | See the file COPYING. | 6 | See the file COPYING. |
| @@ -48,11 +48,13 @@ static ssize_t fuse_conn_waiting_read(struct file *file, char __user *buf, | |||
| 48 | size_t size; | 48 | size_t size; |
| 49 | 49 | ||
| 50 | if (!*ppos) { | 50 | if (!*ppos) { |
| 51 | long value; | ||
| 51 | struct fuse_conn *fc = fuse_ctl_file_conn_get(file); | 52 | struct fuse_conn *fc = fuse_ctl_file_conn_get(file); |
| 52 | if (!fc) | 53 | if (!fc) |
| 53 | return 0; | 54 | return 0; |
| 54 | 55 | ||
| 55 | file->private_data=(void *)(long)atomic_read(&fc->num_waiting); | 56 | value = atomic_read(&fc->num_waiting); |
| 57 | file->private_data = (void *)value; | ||
| 56 | fuse_conn_put(fc); | 58 | fuse_conn_put(fc); |
| 57 | } | 59 | } |
| 58 | size = sprintf(tmp, "%ld\n", (long)file->private_data); | 60 | size = sprintf(tmp, "%ld\n", (long)file->private_data); |
diff --git a/fs/fuse/dev.c b/fs/fuse/dev.c index fba571648a8e..e0c7ada08a1f 100644 --- a/fs/fuse/dev.c +++ b/fs/fuse/dev.c | |||
| @@ -1,6 +1,6 @@ | |||
| 1 | /* | 1 | /* |
| 2 | FUSE: Filesystem in Userspace | 2 | FUSE: Filesystem in Userspace |
| 3 | Copyright (C) 2001-2006 Miklos Szeredi <miklos@szeredi.hu> | 3 | Copyright (C) 2001-2008 Miklos Szeredi <miklos@szeredi.hu> |
| 4 | 4 | ||
| 5 | This program can be distributed under the terms of the GNU GPL. | 5 | This program can be distributed under the terms of the GNU GPL. |
| 6 | See the file COPYING. | 6 | See the file COPYING. |
| @@ -269,7 +269,7 @@ static void flush_bg_queue(struct fuse_conn *fc) | |||
| 269 | * Called with fc->lock, unlocks it | 269 | * Called with fc->lock, unlocks it |
| 270 | */ | 270 | */ |
| 271 | static void request_end(struct fuse_conn *fc, struct fuse_req *req) | 271 | static void request_end(struct fuse_conn *fc, struct fuse_req *req) |
| 272 | __releases(fc->lock) | 272 | __releases(&fc->lock) |
| 273 | { | 273 | { |
| 274 | void (*end) (struct fuse_conn *, struct fuse_req *) = req->end; | 274 | void (*end) (struct fuse_conn *, struct fuse_req *) = req->end; |
| 275 | req->end = NULL; | 275 | req->end = NULL; |
| @@ -293,13 +293,13 @@ static void request_end(struct fuse_conn *fc, struct fuse_req *req) | |||
| 293 | wake_up(&req->waitq); | 293 | wake_up(&req->waitq); |
| 294 | if (end) | 294 | if (end) |
| 295 | end(fc, req); | 295 | end(fc, req); |
| 296 | else | 296 | fuse_put_request(fc, req); |
| 297 | fuse_put_request(fc, req); | ||
| 298 | } | 297 | } |
| 299 | 298 | ||
| 300 | static void wait_answer_interruptible(struct fuse_conn *fc, | 299 | static void wait_answer_interruptible(struct fuse_conn *fc, |
| 301 | struct fuse_req *req) | 300 | struct fuse_req *req) |
| 302 | __releases(fc->lock) __acquires(fc->lock) | 301 | __releases(&fc->lock) |
| 302 | __acquires(&fc->lock) | ||
| 303 | { | 303 | { |
| 304 | if (signal_pending(current)) | 304 | if (signal_pending(current)) |
| 305 | return; | 305 | return; |
| @@ -317,7 +317,8 @@ static void queue_interrupt(struct fuse_conn *fc, struct fuse_req *req) | |||
| 317 | } | 317 | } |
| 318 | 318 | ||
| 319 | static void request_wait_answer(struct fuse_conn *fc, struct fuse_req *req) | 319 | static void request_wait_answer(struct fuse_conn *fc, struct fuse_req *req) |
| 320 | __releases(fc->lock) __acquires(fc->lock) | 320 | __releases(&fc->lock) |
| 321 | __acquires(&fc->lock) | ||
| 321 | { | 322 | { |
| 322 | if (!fc->no_interrupt) { | 323 | if (!fc->no_interrupt) { |
| 323 | /* Any signal may interrupt this */ | 324 | /* Any signal may interrupt this */ |
| @@ -380,7 +381,7 @@ static void request_wait_answer(struct fuse_conn *fc, struct fuse_req *req) | |||
| 380 | } | 381 | } |
| 381 | } | 382 | } |
| 382 | 383 | ||
| 383 | void request_send(struct fuse_conn *fc, struct fuse_req *req) | 384 | void fuse_request_send(struct fuse_conn *fc, struct fuse_req *req) |
| 384 | { | 385 | { |
| 385 | req->isreply = 1; | 386 | req->isreply = 1; |
| 386 | spin_lock(&fc->lock); | 387 | spin_lock(&fc->lock); |
| @@ -399,8 +400,8 @@ void request_send(struct fuse_conn *fc, struct fuse_req *req) | |||
| 399 | spin_unlock(&fc->lock); | 400 | spin_unlock(&fc->lock); |
| 400 | } | 401 | } |
| 401 | 402 | ||
| 402 | static void request_send_nowait_locked(struct fuse_conn *fc, | 403 | static void fuse_request_send_nowait_locked(struct fuse_conn *fc, |
| 403 | struct fuse_req *req) | 404 | struct fuse_req *req) |
| 404 | { | 405 | { |
| 405 | req->background = 1; | 406 | req->background = 1; |
| 406 | fc->num_background++; | 407 | fc->num_background++; |
| @@ -414,11 +415,11 @@ static void request_send_nowait_locked(struct fuse_conn *fc, | |||
| 414 | flush_bg_queue(fc); | 415 | flush_bg_queue(fc); |
| 415 | } | 416 | } |
| 416 | 417 | ||
| 417 | static void request_send_nowait(struct fuse_conn *fc, struct fuse_req *req) | 418 | static void fuse_request_send_nowait(struct fuse_conn *fc, struct fuse_req *req) |
| 418 | { | 419 | { |
| 419 | spin_lock(&fc->lock); | 420 | spin_lock(&fc->lock); |
| 420 | if (fc->connected) { | 421 | if (fc->connected) { |
| 421 | request_send_nowait_locked(fc, req); | 422 | fuse_request_send_nowait_locked(fc, req); |
| 422 | spin_unlock(&fc->lock); | 423 | spin_unlock(&fc->lock); |
| 423 | } else { | 424 | } else { |
| 424 | req->out.h.error = -ENOTCONN; | 425 | req->out.h.error = -ENOTCONN; |
| @@ -426,16 +427,16 @@ static void request_send_nowait(struct fuse_conn *fc, struct fuse_req *req) | |||
| 426 | } | 427 | } |
| 427 | } | 428 | } |
| 428 | 429 | ||
| 429 | void request_send_noreply(struct fuse_conn *fc, struct fuse_req *req) | 430 | void fuse_request_send_noreply(struct fuse_conn *fc, struct fuse_req *req) |
| 430 | { | 431 | { |
| 431 | req->isreply = 0; | 432 | req->isreply = 0; |
| 432 | request_send_nowait(fc, req); | 433 | fuse_request_send_nowait(fc, req); |
| 433 | } | 434 | } |
| 434 | 435 | ||
| 435 | void request_send_background(struct fuse_conn *fc, struct fuse_req *req) | 436 | void fuse_request_send_background(struct fuse_conn *fc, struct fuse_req *req) |
| 436 | { | 437 | { |
| 437 | req->isreply = 1; | 438 | req->isreply = 1; |
| 438 | request_send_nowait(fc, req); | 439 | fuse_request_send_nowait(fc, req); |
| 439 | } | 440 | } |
| 440 | 441 | ||
| 441 | /* | 442 | /* |
| @@ -443,10 +444,11 @@ void request_send_background(struct fuse_conn *fc, struct fuse_req *req) | |||
| 443 | * | 444 | * |
| 444 | * fc->connected must have been checked previously | 445 | * fc->connected must have been checked previously |
| 445 | */ | 446 | */ |
| 446 | void request_send_background_locked(struct fuse_conn *fc, struct fuse_req *req) | 447 | void fuse_request_send_background_locked(struct fuse_conn *fc, |
| 448 | struct fuse_req *req) | ||
| 447 | { | 449 | { |
| 448 | req->isreply = 1; | 450 | req->isreply = 1; |
| 449 | request_send_nowait_locked(fc, req); | 451 | fuse_request_send_nowait_locked(fc, req); |
| 450 | } | 452 | } |
| 451 | 453 | ||
| 452 | /* | 454 | /* |
| @@ -539,8 +541,8 @@ static int fuse_copy_fill(struct fuse_copy_state *cs) | |||
| 539 | BUG_ON(!cs->nr_segs); | 541 | BUG_ON(!cs->nr_segs); |
| 540 | cs->seglen = cs->iov[0].iov_len; | 542 | cs->seglen = cs->iov[0].iov_len; |
| 541 | cs->addr = (unsigned long) cs->iov[0].iov_base; | 543 | cs->addr = (unsigned long) cs->iov[0].iov_base; |
| 542 | cs->iov ++; | 544 | cs->iov++; |
| 543 | cs->nr_segs --; | 545 | cs->nr_segs--; |
| 544 | } | 546 | } |
| 545 | down_read(¤t->mm->mmap_sem); | 547 | down_read(¤t->mm->mmap_sem); |
| 546 | err = get_user_pages(current, current->mm, cs->addr, 1, cs->write, 0, | 548 | err = get_user_pages(current, current->mm, cs->addr, 1, cs->write, 0, |
| @@ -589,9 +591,11 @@ static int fuse_copy_page(struct fuse_copy_state *cs, struct page *page, | |||
| 589 | kunmap_atomic(mapaddr, KM_USER1); | 591 | kunmap_atomic(mapaddr, KM_USER1); |
| 590 | } | 592 | } |
| 591 | while (count) { | 593 | while (count) { |
| 592 | int err; | 594 | if (!cs->len) { |
| 593 | if (!cs->len && (err = fuse_copy_fill(cs))) | 595 | int err = fuse_copy_fill(cs); |
| 594 | return err; | 596 | if (err) |
| 597 | return err; | ||
| < | |||
