1104477Ssam/*	$NetBSD: buf.h,v 1.2 2001/11/02 03:12:49 lukem Exp $	*/
2104477Ssam
3104477Ssam/*
4139749Simp * Copyright (c) 2001 Wasabi Systems, Inc.
5104477Ssam * All rights reserved.
6104477Ssam *
7104477Ssam * Written by Luke Mewburn for Wasabi Systems, Inc.
8104477Ssam *
9104477Ssam * Redistribution and use in source and binary forms, with or without
10104477Ssam * modification, are permitted provided that the following conditions
11104477Ssam * are met:
12104477Ssam * 1. Redistributions of source code must retain the above copyright
13104477Ssam *    notice, this list of conditions and the following disclaimer.
14104477Ssam * 2. Redistributions in binary form must reproduce the above copyright
15104477Ssam *    notice, this list of conditions and the following disclaimer in the
16104477Ssam *    documentation and/or other materials provided with the distribution.
17104477Ssam * 3. All advertising materials mentioning features or use of this software
18104477Ssam *    must display the following acknowledgement:
19104477Ssam *      This product includes software developed for the NetBSD Project by
20104477Ssam *      Wasabi Systems, Inc.
21104477Ssam * 4. The name of Wasabi Systems, Inc. may not be used to endorse
22104477Ssam *    or promote products derived from this software without specific prior
23104477Ssam *    written permission.
24104477Ssam *
25104477Ssam * THIS SOFTWARE IS PROVIDED BY WASABI SYSTEMS, INC. ``AS IS'' AND
26104477Ssam * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
27104477Ssam * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
28104477Ssam * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL WASABI SYSTEMS, INC
29104477Ssam * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
30104477Ssam * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
31104477Ssam * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
32104477Ssam * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
33104477Ssam * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
34104477Ssam * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
35104477Ssam * POSSIBILITY OF SUCH DAMAGE.
36104477Ssam *
37104477Ssam * $FreeBSD$
38104477Ssam */
39104477Ssam
40104477Ssam#ifndef _FFS_BUF_H
41104477Ssam#define	_FFS_BUF_H
42104477Ssam
43104477Ssam#include <sys/param.h>
44104477Ssam#include <sys/queue.h>
45104477Ssam
46104477Ssamstruct buf {
47104477Ssam	void *		b_data;
48104477Ssam	long		b_bufsize;
49104477Ssam	long		b_bcount;
50104477Ssam	daddr_t		b_blkno;
51104477Ssam	daddr_t		b_lblkno;
52104477Ssam	int		b_fd;
53104477Ssam	struct fs *	b_fs;
54104477Ssam
55104477Ssam	TAILQ_ENTRY(buf)	b_tailq;
56104477Ssam};
57104477Ssam
58104477Ssamvoid		bcleanup(void);
59104477Ssamint		bread(int, struct fs *, daddr_t, int, struct buf **);
60104477Ssamvoid		brelse(struct buf *);
61104477Ssamint		bwrite(struct buf *);
62104477Ssamstruct buf *	getblk(int, struct fs *, daddr_t, int);
63104477Ssam
64104477Ssam#define	bdwrite(bp)	bwrite(bp)
65104477Ssam#define	clrbuf(bp)	memset((bp)->b_data, 0, (u_int)(bp)->b_bcount)
66104477Ssam
67104477Ssam#endif	/* _FFS_BUF_H */
68104477Ssam