fs/9p: Update zero-copy implementation in 9p
[linux-2.6.git] / net / 9p / protocol.c
index df58375ea6b33890030c649938403cf73c2f30f6..b7d4e8aa5383e7e2022cdcdd92205d0b634fe06e 100644 (file)
@@ -81,7 +81,7 @@ void p9stat_free(struct p9_wstat *stbuf)
 }
 EXPORT_SYMBOL(p9stat_free);
 
-static size_t pdu_read(struct p9_fcall *pdu, void *data, size_t size)
+size_t pdu_read(struct p9_fcall *pdu, void *data, size_t size)
 {
        size_t len = min(pdu->size - pdu->offset, size);
        memcpy(data, &pdu->sdata[pdu->offset], len);
@@ -108,26 +108,6 @@ pdu_write_u(struct p9_fcall *pdu, const char __user *udata, size_t size)
        return size - len;
 }
 
-static size_t
-pdu_write_urw(struct p9_fcall *pdu, const char *kdata, const char __user *udata,
-               size_t size)
-{
-       BUG_ON(pdu->size > P9_IOHDRSZ);
-       pdu->pubuf = (char __user *)udata;
-       pdu->pkbuf = (char *)kdata;
-       pdu->pbuf_size = size;
-       return 0;
-}
-
-static size_t
-pdu_write_readdir(struct p9_fcall *pdu, const char *kdata, size_t size)
-{
-       BUG_ON(pdu->size > P9_READDIRHDRSZ);
-       pdu->pkbuf = (char *)kdata;
-       pdu->pbuf_size = size;
-       return 0;
-}
-
 /*
        b - int8_t
        w - int16_t
@@ -459,26 +439,6 @@ p9pdu_vwritef(struct p9_fcall *pdu, int proto_version, const char *fmt,
                                        errcode = -EFAULT;
                        }
                        break;
-               case 'E':{
-                                int32_t cnt = va_arg(ap, int32_t);
-                                const char *k = va_arg(ap, const void *);
-                                const char __user *u = va_arg(ap,
-                                                       const void __user *);
-                                errcode = p9pdu_writef(pdu, proto_version, "d",
-                                                cnt);
-                                if (!errcode && pdu_write_urw(pdu, k, u, cnt))
-                                       errcode = -EFAULT;
-                        }
-                        break;
-               case 'F':{
-                                int32_t cnt = va_arg(ap, int32_t);
-                                const char *k = va_arg(ap, const void *);
-                                errcode = p9pdu_writef(pdu, proto_version, "d",
-                                                cnt);
-                                if (!errcode && pdu_write_readdir(pdu, k, cnt))
-                                       errcode = -EFAULT;
-                        }
-                        break;
                case 'U':{
                                int32_t count = va_arg(ap, int32_t);
                                const char __user *udata =
@@ -637,10 +597,6 @@ void p9pdu_reset(struct p9_fcall *pdu)
 {
        pdu->offset = 0;
        pdu->size = 0;
-       pdu->private = NULL;
-       pdu->pubuf = NULL;
-       pdu->pkbuf = NULL;
-       pdu->pbuf_size = 0;
 }
 
 int p9dirent_read(char *buf, int len, struct p9_dirent *dirent,