diff options
| author | pooka <pooka@NetBSD.org> | 2007-10-19 14:38:45 +0000 |
|---|---|---|
| committer | pooka <pooka@NetBSD.org> | 2007-10-19 14:38:45 +0000 |
| commit | cf6e3aa4f9041b1fb331e0197be6285948e239da (patch) | |
| tree | bb5346d3e480c15f17f78dc0fb5f9543bf638078 | |
| parent | 4f0f9d66adf1b5e4381ad71b0e9b362191a93d4f (diff) | |
When doing a read operation, don't copy the whole kernel buffer to
userspace, since it doesn't contain any information yet. I should
still rework this more so this is just a quickie to get the read/write
style interface more up to speed with the ioctl version.
| -rw-r--r-- | lib/libpuffs/requests.c | 7 | ||||
| -rw-r--r-- | sys/fs/puffs/puffs_msgif.c | 7 | ||||
| -rw-r--r-- | sys/fs/puffs/puffs_msgif.h | 5 | ||||
| -rw-r--r-- | sys/fs/puffs/puffs_vnops.c | 10 |
4 files changed, 16 insertions, 13 deletions
diff --git a/lib/libpuffs/requests.c b/lib/libpuffs/requests.c index f6461c09a3d..c808aa29c17 100644 --- a/lib/libpuffs/requests.c +++ b/lib/libpuffs/requests.c @@ -1,4 +1,4 @@ -/* $NetBSD: requests.c,v 1.10 2007/10/11 19:41:15 pooka Exp $ */ +/* $NetBSD: requests.c,v 1.11 2007/10/19 14:38:45 pooka Exp $ */ /* * Copyright (c) 2006 Antti Kantee. All Rights Reserved. @@ -27,7 +27,7 @@ #include <sys/cdefs.h> #if !defined(lint) -__RCSID("$NetBSD: requests.c,v 1.10 2007/10/11 19:41:15 pooka Exp $"); +__RCSID("$NetBSD: requests.c,v 1.11 2007/10/19 14:38:45 pooka Exp $"); #endif /* !lint */ #include <sys/types.h> @@ -78,7 +78,7 @@ puffs_req_loadget(struct puffs_getreq *pgr) return 0; return -1; } - buf = malloc(pfr.pfr_len); + buf = malloc(pfr.pfr_alloclen); assert(buf != NULL); /* XXX: a bit more grace here, thanks */ memcpy(buf, &pfr, sizeof(pfr)); @@ -148,6 +148,7 @@ puffs_req_put(struct puffs_putreq *ppr, struct puffs_req *preq) { ssize_t n; + preq->preq_frhdr.pfr_len = preq->preq_buflen; n = write(ppr->ppr_pu->pu_fd, preq, preq->preq_frhdr.pfr_len); assert(n == preq->preq_frhdr.pfr_len); free(preq); diff --git a/sys/fs/puffs/puffs_msgif.c b/sys/fs/puffs/puffs_msgif.c index 2f59b7df333..52270ad00b2 100644 --- a/sys/fs/puffs/puffs_msgif.c +++ b/sys/fs/puffs/puffs_msgif.c @@ -1,4 +1,4 @@ -/* $NetBSD: puffs_msgif.c,v 1.47 2007/10/11 23:04:21 pooka Exp $ */ +/* $NetBSD: puffs_msgif.c,v 1.48 2007/10/19 14:38:45 pooka Exp $ */ /* * Copyright (c) 2005, 2006, 2007 Antti Kantee. All Rights Reserved. @@ -30,7 +30,7 @@ */ #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: puffs_msgif.c,v 1.47 2007/10/11 23:04:21 pooka Exp $"); +__KERNEL_RCSID(0, "$NetBSD: puffs_msgif.c,v 1.48 2007/10/19 14:38:45 pooka Exp $"); #include <sys/param.h> #include <sys/fstrans.h> @@ -657,7 +657,8 @@ puffs_msgif_getout(void *this, size_t maxsize, int nonblock, if (error == 0) { *data = (uint8_t *)preq; - preq->preq_frhdr.pfr_len = park->park_maxlen; + preq->preq_frhdr.pfr_len = park->park_copylen; + preq->preq_frhdr.pfr_alloclen = park->park_maxlen; preq->preq_frhdr.pfr_type = preq->preq_opclass; /* yay! */ *dlen = preq->preq_frhdr.pfr_len; *parkptr = park; diff --git a/sys/fs/puffs/puffs_msgif.h b/sys/fs/puffs/puffs_msgif.h index 3e8f81d13e3..28a1119a923 100644 --- a/sys/fs/puffs/puffs_msgif.h +++ b/sys/fs/puffs/puffs_msgif.h @@ -1,4 +1,4 @@ -/* $NetBSD: puffs_msgif.h,v 1.57 2007/10/11 23:46:08 pooka Exp $ */ +/* $NetBSD: puffs_msgif.h,v 1.58 2007/10/19 14:38:45 pooka Exp $ */ /* * Copyright (c) 2005, 2006, 2007 Antti Kantee. All Rights Reserved. @@ -48,6 +48,7 @@ struct puffs_frame { uint32_t pfr_len; uint32_t pfr_type; + uint32_t pfr_alloclen; }; #define PUFFSOP_VFS 0x01 /* read/write */ @@ -104,7 +105,7 @@ enum { #define PUFFS_ERR_MAX PUFFS_ERR_VPTOFH #define PUFFSDEVELVERS 0x80000000 -#define PUFFSVERSION 20 +#define PUFFSVERSION 21 #define PUFFSNAMESIZE 32 #define PUFFS_TYPEPREFIX "puffs|" diff --git a/sys/fs/puffs/puffs_vnops.c b/sys/fs/puffs/puffs_vnops.c index a908ea03851..c4f99da8b2e 100644 --- a/sys/fs/puffs/puffs_vnops.c +++ b/sys/fs/puffs/puffs_vnops.c @@ -1,4 +1,4 @@ -/* $NetBSD: puffs_vnops.c,v 1.109 2007/10/19 13:04:06 pooka Exp $ */ +/* $NetBSD: puffs_vnops.c,v 1.110 2007/10/19 14:38:45 pooka Exp $ */ /* * Copyright (c) 2005, 2006, 2007 Antti Kantee. All Rights Reserved. @@ -30,7 +30,7 @@ */ #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: puffs_vnops.c,v 1.109 2007/10/19 13:04:06 pooka Exp $"); +__KERNEL_RCSID(0, "$NetBSD: puffs_vnops.c,v 1.110 2007/10/19 14:38:45 pooka Exp $"); #include <sys/param.h> #include <sys/fstrans.h> @@ -1121,7 +1121,7 @@ puffs_readdir(void *v) readdir_msg->pvnr_dentoff = cookiemem; error = puffs_msg_vn(pmp, park_readdir, PUFFS_VN_READDIR, - 0, vp, NULL); + tomove, vp, NULL); error = checkerr(pmp, error, __func__); if (error) goto out; @@ -1750,7 +1750,7 @@ puffs_read(void *v) uio->uio_offset, ap->a_cred); error = puffs_msg_vn(pmp, park_read, PUFFS_VN_READ, - 0, vp, NULL); + tomove, vp, NULL); error = checkerr(pmp, error, __func__); if (error) break; @@ -2107,7 +2107,7 @@ puffs_strategy(void *v) puffs_parkdone_asyncbioread, bp, vp); } else { error = puffs_msg_vn(pmp, park_rw, PUFFS_VN_READ, - 0, vp, NULL); + tomove, vp, NULL); error = checkerr(pmp, error, __func__); if (error) goto out; |
