buf.h revision 1.2
11.2Slukem/*	$NetBSD: buf.h,v 1.2 2001/11/02 03:12:49 lukem Exp $	*/
21.1Slukem
31.1Slukem/*
41.2Slukem * Copyright (c) 2001 Wasabi Systems, Inc.
51.1Slukem * All rights reserved.
61.1Slukem *
71.1Slukem * Written by Luke Mewburn for Wasabi Systems, Inc.
81.1Slukem *
91.1Slukem * Redistribution and use in source and binary forms, with or without
101.1Slukem * modification, are permitted provided that the following conditions
111.1Slukem * are met:
121.1Slukem * 1. Redistributions of source code must retain the above copyright
131.1Slukem *    notice, this list of conditions and the following disclaimer.
141.1Slukem * 2. Redistributions in binary form must reproduce the above copyright
151.1Slukem *    notice, this list of conditions and the following disclaimer in the
161.1Slukem *    documentation and/or other materials provided with the distribution.
171.1Slukem * 3. All advertising materials mentioning features or use of this software
181.1Slukem *    must display the following acknowledgement:
191.1Slukem *      This product includes software developed for the NetBSD Project by
201.1Slukem *      Wasabi Systems, Inc.
211.1Slukem * 4. The name of Wasabi Systems, Inc. may not be used to endorse
221.1Slukem *    or promote products derived from this software without specific prior
231.1Slukem *    written permission.
241.1Slukem *
251.1Slukem * THIS SOFTWARE IS PROVIDED BY WASABI SYSTEMS, INC. ``AS IS'' AND
261.1Slukem * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
271.1Slukem * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
281.1Slukem * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL WASABI SYSTEMS, INC
291.1Slukem * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
301.1Slukem * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
311.1Slukem * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
321.1Slukem * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
331.1Slukem * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
341.1Slukem * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
351.1Slukem * POSSIBILITY OF SUCH DAMAGE.
361.1Slukem */
371.1Slukem
381.1Slukem#ifndef _FFS_BUF_H
391.1Slukem#define	_FFS_BUF_H
401.1Slukem
411.1Slukem#include <sys/param.h>
421.1Slukem#include <sys/queue.h>
431.1Slukem
441.1Slukemstruct buf {
451.1Slukem	void *		b_data;
461.1Slukem	long		b_bufsize;
471.1Slukem	long		b_bcount;
481.1Slukem	daddr_t		b_blkno;
491.1Slukem	daddr_t		b_lblkno;
501.1Slukem	int		b_fd;
511.1Slukem	struct fs *	b_fs;
521.1Slukem
531.1Slukem	TAILQ_ENTRY(buf)	b_tailq;
541.1Slukem};
551.1Slukem
561.1Slukemvoid		bcleanup(void);
571.1Slukemint		bread(int, struct fs *, daddr_t, int, struct buf **);
581.1Slukemvoid		brelse(struct buf *);
591.1Slukemint		bwrite(struct buf *);
601.1Slukemstruct buf *	getblk(int, struct fs *, daddr_t, int);
611.1Slukem
621.1Slukem#define	bdwrite(bp)	bwrite(bp)
631.1Slukem#define	clrbuf(bp)	memset((bp)->b_data, 0, (u_int)(bp)->b_bcount)
641.1Slukem
651.1Slukem#endif	/* _FFS_BUF_H */
66