diff options
author | Linus Torvalds <torvalds@linux-foundation.org> | 2011-03-16 11:58:09 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2011-03-16 11:58:09 -0400 |
commit | 26a992dbc24e34cbdd03621d1c97ce571ad74e65 (patch) | |
tree | cbb3171eb715b7c1ed28ed3ca29f1f03165e2faa /net/9p/protocol.c | |
parent | abab012a52237693ae48a655ece30cacb2ce4cf7 (diff) | |
parent | 7c9e592e1f6a994d2903c9b055e488ec90f58159 (diff) |
Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/ericvh/v9fs
* 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/ericvh/v9fs: (46 commits)
fs/9p: Make the writeback_fid owned by root
fs/9p: Writeback dirty data before setattr
fs/9p: call vmtruncate before setattr 9p opeation
fs/9p: Properly update inode attributes on link
fs/9p: Prevent multiple inclusion of same header
fs/9p: Workaround vfs rename rehash bug
fs/9p: Mark directory inode invalid for many directory inode operations
fs/9p: Add . and .. dentry revalidation flag
fs/9p: mark inode attribute invalid on rename, unlink and setattr
fs/9p: Add support for marking inode attribute invalid
fs/9p: Initialize root inode number for dotl
fs/9p: Update link count correctly on different file system operations
fs/9p: Add drop_inode 9p callback
fs/9p: Add direct IO support in cached mode
fs/9p: Fix inode i_size update in file_write
fs/9p: set default readahead pages in cached mode
fs/9p: Move writeback fid to v9fs_inode
fs/9p: Add v9fs_inode
fs/9p: Don't set stat.st_blocks based on nrpages
fs/9p: Add inode hashing
...
Diffstat (limited to 'net/9p/protocol.c')
-rw-r--r-- | net/9p/protocol.c | 44 |
1 files changed, 44 insertions, 0 deletions
diff --git a/net/9p/protocol.c b/net/9p/protocol.c index 1e308f210928..2ce515b859b3 100644 --- a/net/9p/protocol.c +++ b/net/9p/protocol.c | |||
@@ -114,6 +114,26 @@ pdu_write_u(struct p9_fcall *pdu, const char __user *udata, size_t size) | |||
114 | return size - len; | 114 | return size - len; |
115 | } | 115 | } |
116 | 116 | ||
117 | static size_t | ||
118 | pdu_write_urw(struct p9_fcall *pdu, const char *kdata, const char __user *udata, | ||
119 | size_t size) | ||
120 | { | ||
121 | BUG_ON(pdu->size > P9_IOHDRSZ); | ||
122 | pdu->pubuf = (char __user *)udata; | ||
123 | pdu->pkbuf = (char *)kdata; | ||
124 | pdu->pbuf_size = size; | ||
125 | return 0; | ||
126 | } | ||
127 | |||
128 | static size_t | ||
129 | pdu_write_readdir(struct p9_fcall *pdu, const char *kdata, size_t size) | ||
130 | { | ||
131 | BUG_ON(pdu->size > P9_READDIRHDRSZ); | ||
132 | pdu->pkbuf = (char *)kdata; | ||
133 | pdu->pbuf_size = size; | ||
134 | return 0; | ||
135 | } | ||
136 | |||
117 | /* | 137 | /* |
118 | b - int8_t | 138 | b - int8_t |
119 | w - int16_t | 139 | w - int16_t |
@@ -445,6 +465,25 @@ p9pdu_vwritef(struct p9_fcall *pdu, int proto_version, const char *fmt, | |||
445 | errcode = -EFAULT; | 465 | errcode = -EFAULT; |
446 | } | 466 | } |
447 | break; | 467 | break; |
468 | case 'E':{ | ||
469 | int32_t cnt = va_arg(ap, int32_t); | ||
470 | const char *k = va_arg(ap, const void *); | ||
471 | const char *u = va_arg(ap, const void *); | ||
472 | errcode = p9pdu_writef(pdu, proto_version, "d", | ||
473 | cnt); | ||
474 | if (!errcode && pdu_write_urw(pdu, k, u, cnt)) | ||
475 | errcode = -EFAULT; | ||
476 | } | ||
477 | break; | ||
478 | case 'F':{ | ||
479 | int32_t cnt = va_arg(ap, int32_t); | ||
480 | const char *k = va_arg(ap, const void *); | ||
481 | errcode = p9pdu_writef(pdu, proto_version, "d", | ||
482 | cnt); | ||
483 | if (!errcode && pdu_write_readdir(pdu, k, cnt)) | ||
484 | errcode = -EFAULT; | ||
485 | } | ||
486 | break; | ||
448 | case 'U':{ | 487 | case 'U':{ |
449 | int32_t count = va_arg(ap, int32_t); | 488 | int32_t count = va_arg(ap, int32_t); |
450 | const char __user *udata = | 489 | const char __user *udata = |
@@ -579,6 +618,7 @@ EXPORT_SYMBOL(p9stat_read); | |||
579 | 618 | ||
580 | int p9pdu_prepare(struct p9_fcall *pdu, int16_t tag, int8_t type) | 619 | int p9pdu_prepare(struct p9_fcall *pdu, int16_t tag, int8_t type) |
581 | { | 620 | { |
621 | pdu->id = type; | ||
582 | return p9pdu_writef(pdu, 0, "dbw", 0, type, tag); | 622 | return p9pdu_writef(pdu, 0, "dbw", 0, type, tag); |
583 | } | 623 | } |
584 | 624 | ||
@@ -606,6 +646,10 @@ void p9pdu_reset(struct p9_fcall *pdu) | |||
606 | { | 646 | { |
607 | pdu->offset = 0; | 647 | pdu->offset = 0; |
608 | pdu->size = 0; | 648 | pdu->size = 0; |
649 | pdu->private = NULL; | ||
650 | pdu->pubuf = NULL; | ||
651 | pdu->pkbuf = NULL; | ||
652 | pdu->pbuf_size = 0; | ||
609 | } | 653 | } |
610 | 654 | ||
611 | int p9dirent_read(char *buf, int len, struct p9_dirent *dirent, | 655 | int p9dirent_read(char *buf, int len, struct p9_dirent *dirent, |