dkwedge_read: don't place struct buf on the stack.

This commit is contained in:
ad 2008-06-03 12:14:08 +00:00
parent e1be8408a0
commit a22432a7bc

View File

@ -1,4 +1,4 @@
/* $NetBSD: dk.c,v 1.40 2008/06/01 11:38:26 chris Exp $ */
/* $NetBSD: dk.c,v 1.41 2008/06/03 12:14:08 ad Exp $ */
/*-
* Copyright (c) 2004, 2005, 2006, 2007 The NetBSD Foundation, Inc.
@ -30,7 +30,7 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: dk.c,v 1.40 2008/06/01 11:38:26 chris Exp $");
__KERNEL_RCSID(0, "$NetBSD: dk.c,v 1.41 2008/06/03 12:14:08 ad Exp $");
#include "opt_dkwedge.h"
@ -851,22 +851,22 @@ int
dkwedge_read(struct disk *pdk, struct vnode *vp, daddr_t blkno,
void *tbuf, size_t len)
{
struct buf b;
struct buf *bp;
int result;
buf_init(&b);
bp = getiobuf(vp, true);
b.b_vp = vp;
b.b_dev = vp->v_rdev;
b.b_blkno = blkno;
b.b_bcount = b.b_resid = len;
b.b_flags = B_READ;
b.b_proc = curproc;
b.b_data = tbuf;
bp->b_dev = vp->v_rdev;
bp->b_blkno = blkno;
bp->b_bcount = len;
bp->b_resid = len;
bp->b_flags = B_READ;
bp->b_data = tbuf;
VOP_STRATEGY(vp, bp);
result = biowait(bp);
putiobuf(bp);
VOP_STRATEGY(vp, &b);
result = biowait(&b);
buf_destroy(&b);
return result;
}