Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys/rump/librump/rumpvfs report actual size from read/write ...
details: https://anonhg.NetBSD.org/src/rev/ebbaafb11e7f
branches: trunk
changeset: 755693:ebbaafb11e7f
user: pooka <pooka%NetBSD.org@localhost>
date: Wed Jun 16 19:03:08 2010 +0000
description:
report actual size from read/write vops
diffstat:
sys/rump/librump/rumpvfs/rumpfs.c | 19 +++++++++++++------
1 files changed, 13 insertions(+), 6 deletions(-)
diffs (60 lines):
diff -r 8e29fe67c03d -r ebbaafb11e7f sys/rump/librump/rumpvfs/rumpfs.c
--- a/sys/rump/librump/rumpvfs/rumpfs.c Wed Jun 16 18:49:22 2010 +0000
+++ b/sys/rump/librump/rumpvfs/rumpfs.c Wed Jun 16 19:03:08 2010 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: rumpfs.c,v 1.53 2010/06/15 18:53:48 pooka Exp $ */
+/* $NetBSD: rumpfs.c,v 1.54 2010/06/16 19:03:08 pooka Exp $ */
/*
* Copyright (c) 2009 Antti Kantee. All Rights Reserved.
@@ -26,7 +26,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: rumpfs.c,v 1.53 2010/06/15 18:53:48 pooka Exp $");
+__KERNEL_RCSID(0, "$NetBSD: rumpfs.c,v 1.54 2010/06/16 19:03:08 pooka Exp $");
#include <sys/param.h>
#include <sys/atomic.h>
@@ -926,14 +926,16 @@
struct uio *uio = ap->a_uio;
uint8_t *buf;
size_t bufsize;
+ ssize_t n;
int error = 0;
bufsize = uio->uio_resid;
buf = kmem_alloc(bufsize, KM_SLEEP);
- if (rumpuser_pread(rn->rn_readfd, buf, bufsize,
- uio->uio_offset + rn->rn_offset, &error) == -1)
+ if ((n = rumpuser_pread(rn->rn_readfd, buf, bufsize,
+ uio->uio_offset + rn->rn_offset, &error)) == -1)
goto out;
- error = uiomove(buf, bufsize, uio);
+ KASSERT(n <= bufsize);
+ error = uiomove(buf, n, uio);
out:
kmem_free(buf, bufsize);
@@ -954,6 +956,7 @@
struct uio *uio = ap->a_uio;
uint8_t *buf;
size_t bufsize;
+ ssize_t n;
int error = 0;
bufsize = uio->uio_resid;
@@ -962,8 +965,12 @@
if (error)
goto out;
KASSERT(uio->uio_resid == 0);
- rumpuser_pwrite(rn->rn_writefd, buf, bufsize,
+ n = rumpuser_pwrite(rn->rn_writefd, buf, bufsize,
uio->uio_offset + rn->rn_offset, &error);
+ if (n >= 0) {
+ KASSERT(n <= bufsize);
+ uio->uio_resid = bufsize - n;
+ }
out:
kmem_free(buf, bufsize);
Home |
Main Index |
Thread Index |
Old Index