initialize necessary members of struct buf. PR/32462 from Reinoud Zandijk.

This commit is contained in:
yamt 2006-01-06 09:21:44 +00:00
parent 0e79e13e9c
commit 7b826aac85
4 changed files with 14 additions and 9 deletions

View File

@ -1,4 +1,4 @@
/* $NetBSD: fd.c,v 1.123 2006/01/04 10:30:26 yamt Exp $ */
/* $NetBSD: fd.c,v 1.124 2006/01/06 09:21:44 yamt Exp $ */
/*-
* Copyright (c) 2000 The NetBSD Foundation, Inc.
@ -108,7 +108,7 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: fd.c,v 1.123 2006/01/04 10:30:26 yamt Exp $");
__KERNEL_RCSID(0, "$NetBSD: fd.c,v 1.124 2006/01/06 09:21:44 yamt Exp $");
#include "opt_ddb.h"
#include "opt_md.h"
@ -2148,6 +2148,7 @@ fdformat(dev_t dev, struct ne7_fd_formb *finfo, struct proc *p)
if (bp == NULL)
return (ENOBUFS);
bp->b_vp = NULL;
bp->b_flags = B_BUSY | B_PHYS | B_FORMAT;
bp->b_proc = p;
bp->b_dev = dev;

View File

@ -1,4 +1,4 @@
/* $NetBSD: fd.c,v 1.63 2006/01/04 10:13:05 yamt Exp $ */
/* $NetBSD: fd.c,v 1.64 2006/01/06 09:21:44 yamt Exp $ */
/*-
* Copyright (c) 1998, 2003 The NetBSD Foundation, Inc.
@ -88,7 +88,7 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: fd.c,v 1.63 2006/01/04 10:13:05 yamt Exp $");
__KERNEL_RCSID(0, "$NetBSD: fd.c,v 1.64 2006/01/06 09:21:44 yamt Exp $");
#include "rnd.h"
#include "opt_ddb.h"
@ -1532,6 +1532,7 @@ fdformat(dev, finfo, l)
if (bp == NULL)
return ENOBUFS;
bp->b_vp = NULL;
bp->b_flags = B_BUSY | B_PHYS | B_FORMAT;
bp->b_proc = l->l_proc;
bp->b_dev = dev;

View File

@ -1,4 +1,4 @@
/* $NetBSD: rf_diskqueue.c,v 1.43 2006/01/04 10:13:05 yamt Exp $ */
/* $NetBSD: rf_diskqueue.c,v 1.44 2006/01/06 09:21:44 yamt Exp $ */
/*
* Copyright (c) 1995 Carnegie-Mellon University.
* All rights reserved.
@ -66,7 +66,7 @@
****************************************************************************/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: rf_diskqueue.c,v 1.43 2006/01/04 10:13:05 yamt Exp $");
__KERNEL_RCSID(0, "$NetBSD: rf_diskqueue.c,v 1.44 2006/01/06 09:21:44 yamt Exp $");
#include <dev/raidframe/raidframevar.h>
@ -465,6 +465,8 @@ rf_CreateDiskQueueData(RF_IoType_t typ, RF_SectorNum_t ssect,
pool_put(&rf_pools.dqd, p);
return (NULL);
}
p->bp->b_flags = 0;
p->bp->b_vp = NULL; /* XXX unnecessary? */
p->sectorOffset = ssect + rf_protectedSectors;
p->numSector = nsect;

View File

@ -1,4 +1,4 @@
/* $NetBSD: lfs_bio.c,v 1.88 2006/01/04 10:13:06 yamt Exp $ */
/* $NetBSD: lfs_bio.c,v 1.89 2006/01/06 09:21:44 yamt Exp $ */
/*-
* Copyright (c) 1999, 2000, 2001, 2002, 2003 The NetBSD Foundation, Inc.
@ -67,7 +67,7 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: lfs_bio.c,v 1.88 2006/01/04 10:13:06 yamt Exp $");
__KERNEL_RCSID(0, "$NetBSD: lfs_bio.c,v 1.89 2006/01/06 09:21:44 yamt Exp $");
#include <sys/param.h>
#include <sys/systm.h>
@ -755,6 +755,7 @@ lfs_newbuf(struct lfs *fs, struct vnode *vp, daddr_t daddr, size_t size, int typ
if (bp == NULL)
panic("bp is NULL after malloc in lfs_newbuf");
#endif
bp->b_vp = NULL;
s = splbio();
bgetvp(vp, bp);
splx(s);
@ -766,7 +767,7 @@ lfs_newbuf(struct lfs *fs, struct vnode *vp, daddr_t daddr, size_t size, int typ
bp->b_error = 0;
bp->b_resid = 0;
bp->b_iodone = lfs_callback;
bp->b_flags |= B_BUSY | B_CALL | B_NOCACHE;
bp->b_flags = B_BUSY | B_CALL | B_NOCACHE;
bp->b_private = fs;
return (bp);