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 * don't open device when calling ge...
details: https://anonhg.NetBSD.org/src/rev/d6d68d9d56dc
branches: trunk
changeset: 749154:d6d68d9d56dc
user: pooka <pooka%NetBSD.org@localhost>
date: Thu Nov 19 13:46:55 2009 +0000
description:
* don't open device when calling getfileinfo(), it might need to open
the device and will f-a-i-l if it's a block device
* use rumpuser_ioctl() as little as possible (going away completely
wewy wewy soon)
* improve some variable scoping
diffstat:
sys/rump/librump/rumpvfs/rumpblk.c | 27 +++++++++------------------
1 files changed, 9 insertions(+), 18 deletions(-)
diffs (76 lines):
diff -r 2567918f7806 -r d6d68d9d56dc sys/rump/librump/rumpvfs/rumpblk.c
--- a/sys/rump/librump/rumpvfs/rumpblk.c Thu Nov 19 13:42:29 2009 +0000
+++ b/sys/rump/librump/rumpvfs/rumpblk.c Thu Nov 19 13:46:55 2009 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: rumpblk.c,v 1.29 2009/10/07 09:42:14 pooka Exp $ */
+/* $NetBSD: rumpblk.c,v 1.30 2009/11/19 13:46:55 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.29 2009/10/07 09:42:14 pooka Exp $");
+__KERNEL_RCSID(0, "$NetBSD: rumpblk.c,v 1.30 2009/11/19 13:46:55 pooka Exp $");
#include <sys/param.h>
#include <sys/buf.h>
@@ -344,16 +344,10 @@
struct rblkdev *rblk;
uint64_t flen;
size_t len;
- int ftype, error, dummy, i;
- int fd;
+ int ftype, error, i;
/* devices might not report correct size unless they're open */
- fd = rumpuser_open(path, O_RDONLY, &error);
- if (fd == -1)
- return error;
- rumpuser_getfileinfo(path, &flen, &ftype, &error);
- rumpuser_close(fd, &dummy);
- if (error)
+ if (rumpuser_getfileinfo(path, &flen, &ftype, &error) == -1)
return error;
/* verify host file is of supported type */
@@ -403,7 +397,6 @@
rumpblk_open(dev_t dev, int flag, int fmt, struct lwp *l)
{
struct rblkdev *rblk = &minors[minor(dev)];
- uint64_t fsize, off;
int dummy;
int error, fd;
@@ -423,10 +416,8 @@
return error;
#endif
- fsize = rblk->rblk_size;
- off = rblk->rblk_hostoffset;
-
if (rblk->rblk_ftype == RUMPUSER_FT_REG) {
+ uint64_t fsize = rblk->rblk_size, off = rblk->rblk_hostoffset;
struct blkwin *win;
int i, winsize;
@@ -473,14 +464,14 @@
rblk->rblk_dl.d_secsize = DEV_BSIZE;
rblk->rblk_curpi = &rblk->rblk_pi;
} else {
- if (rumpuser_ioctl(fd, DIOCGDINFO, &rblk->rblk_dl,
- &error) == -1) {
- KASSERT(error);
+ rblk->rblk_fd = fd;
+
+ if ((error = rumpblk_ioctl(dev, DIOCGDINFO, &rblk->rblk_dl,
+ 0, curlwp)) != 0) {
rumpuser_close(fd, &dummy);
return error;
}
- rblk->rblk_fd = fd;
rblk->rblk_curpi = &rblk->rblk_dl.d_partitions[0];
}
Home |
Main Index |
Thread Index |
Old Index