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 Calculate memory mapping size based...
details: https://anonhg.NetBSD.org/src/rev/6abb667df4df
branches: trunk
changeset: 755793:6abb667df4df
user: pooka <pooka%NetBSD.org@localhost>
date: Mon Jun 21 14:25:35 2010 +0000
description:
Calculate memory mapping size based on underlying file size, not
our window to it. This fixes cases like opening a window at offsets
[8,32] to a file, which would cause host file offset [0,32-8] to
be mapped, i.e. [0,16] inside the window. Obviously, access to
the entire in-window [0,24] range should have been mapped (and
after this fix it is).
diffstat:
sys/rump/librump/rumpvfs/rumpblk.c | 9 ++++++---
1 files changed, 6 insertions(+), 3 deletions(-)
diffs (44 lines):
diff -r e89c5aa70c48 -r 6abb667df4df sys/rump/librump/rumpvfs/rumpblk.c
--- a/sys/rump/librump/rumpvfs/rumpblk.c Mon Jun 21 11:04:27 2010 +0000
+++ b/sys/rump/librump/rumpvfs/rumpblk.c Mon Jun 21 14:25:35 2010 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: rumpblk.c,v 1.40 2010/06/15 18:53:48 pooka Exp $ */
+/* $NetBSD: rumpblk.c,v 1.41 2010/06/21 14:25:35 pooka Exp $ */
/*
* Copyright (c) 2009 Antti Kantee. All Rights Reserved.
@@ -52,7 +52,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: rumpblk.c,v 1.40 2010/06/15 18:53:48 pooka Exp $");
+__KERNEL_RCSID(0, "$NetBSD: rumpblk.c,v 1.41 2010/06/21 14:25:35 pooka Exp $");
#include <sys/param.h>
#include <sys/buf.h>
@@ -83,7 +83,8 @@
#define STARTWIN(off) ((off) & ~((off_t)memwinsize-1))
#define INWIN(win,off) ((win)->win_off == STARTWIN(off))
-#define WINSIZE(rblk, win) (MIN((rblk->rblk_size-win->win_off),memwinsize))
+#define WINSIZE(rblk, win) (MIN((rblk->rblk_hostsize-win->win_off), \
+ memwinsize))
#define WINVALID(win) ((win)->win_off != (off_t)-1)
#define WINVALIDATE(win) ((win)->win_off = (off_t)-1)
struct blkwin {
@@ -104,6 +105,7 @@
#endif
uint64_t rblk_size;
uint64_t rblk_hostoffset;
+ uint64_t rblk_hostsize;
int rblk_ftype;
/* for mmap */
@@ -433,6 +435,7 @@
KASSERT(offset < flen);
rblk->rblk_size = flen - offset;
}
+ rblk->rblk_hostsize = flen;
rblk->rblk_ftype = ftype;
makedefaultlabel(&rblk->rblk_label, rblk->rblk_size, i);
mutex_exit(&rumpblk_lock);
Home |
Main Index |
Thread Index |
Old Index