1185222Ssam/*	$NetBSD: buf.h,v 1.2 2001/11/02 03:12:49 lukem Exp $	*/
2185222Ssam
3185222Ssam/*
4185222Ssam * Copyright (c) 2001 Wasabi Systems, Inc.
5185222Ssam * All rights reserved.
6185222Ssam *
7185222Ssam * Written by Luke Mewburn for Wasabi Systems, Inc.
8185222Ssam *
9185222Ssam * Redistribution and use in source and binary forms, with or without
10185222Ssam * modification, are permitted provided that the following conditions
11185222Ssam * are met:
12185222Ssam * 1. Redistributions of source code must retain the above copyright
13185222Ssam *    notice, this list of conditions and the following disclaimer.
14185222Ssam * 2. Redistributions in binary form must reproduce the above copyright
15185222Ssam *    notice, this list of conditions and the following disclaimer in the
16185222Ssam *    documentation and/or other materials provided with the distribution.
17185222Ssam * 3. All advertising materials mentioning features or use of this software
18185222Ssam *    must display the following acknowledgement:
19185222Ssam *      This product includes software developed for the NetBSD Project by
20185222Ssam *      Wasabi Systems, Inc.
21185222Ssam * 4. The name of Wasabi Systems, Inc. may not be used to endorse
22185222Ssam *    or promote products derived from this software without specific prior
23185222Ssam *    written permission.
24185222Ssam *
25185222Ssam * THIS SOFTWARE IS PROVIDED BY WASABI SYSTEMS, INC. ``AS IS'' AND
26185222Ssam * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
27185222Ssam * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
28185222Ssam * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL WASABI SYSTEMS, INC
29185222Ssam * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
30185222Ssam * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
31185222Ssam * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
32185222Ssam * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
33185222Ssam * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
34185222Ssam * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
35185222Ssam * POSSIBILITY OF SUCH DAMAGE.
36186334Ssam *
37186334Ssam * $FreeBSD$
38185222Ssam */
39185222Ssam
40185222Ssam#ifndef _FFS_BUF_H
41185222Ssam#define	_FFS_BUF_H
42185222Ssam
43185222Ssam#include <sys/param.h>
44185222Ssam#include <sys/queue.h>
45185222Ssam
46185222Ssamstruct buf {
47185222Ssam	void *		b_data;
48185222Ssam	long		b_bufsize;
49185222Ssam	long		b_bcount;
50185222Ssam	daddr_t		b_blkno;
51185222Ssam	daddr_t		b_lblkno;
52185222Ssam	int		b_fd;
53185222Ssam	struct fs *	b_fs;
54185222Ssam
55185222Ssam	TAILQ_ENTRY(buf)	b_tailq;
56185222Ssam};
57185222Ssam
58185222Ssamvoid		bcleanup(void);
59185222Ssamint		bread(int, struct fs *, daddr_t, int, struct buf **);
60185222Ssamvoid		brelse(struct buf *);
61185222Ssamint		bwrite(struct buf *);
62185222Ssamstruct buf *	getblk(int, struct fs *, daddr_t, int);
63185222Ssam
64185222Ssam#define	bdwrite(bp)	bwrite(bp)
65185222Ssam#define	clrbuf(bp)	memset((bp)->b_data, 0, (u_int)(bp)->b_bcount)
66185222Ssam
67185222Ssam#endif	/* _FFS_BUF_H */
68