sync with the new api.

This commit is contained in:
yamt 2005-10-16 04:06:20 +00:00
parent c4dfab8cf0
commit e060d87164

View File

@ -1,4 +1,4 @@
.\" $NetBSD: bufq.9,v 1.8 2005/10/10 15:28:42 xtraeme Exp $ .\" $NetBSD: bufq.9,v 1.9 2005/10/16 04:06:20 yamt Exp $
.\" .\"
.\" Copyright (c) 2002 The NetBSD Foundation, Inc. .\" Copyright (c) 2002 The NetBSD Foundation, Inc.
.\" All rights reserved. .\" All rights reserved.
@ -34,7 +34,7 @@
.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE .\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
.\" POSSIBILITY OF SUCH DAMAGE. .\" POSSIBILITY OF SUCH DAMAGE.
.\" .\"
.Dd October 10, 2005 .Dd October 16, 2005
.Dt BUFQ 9 .Dt BUFQ 9
.Os .Os
.Sh NAME .Sh NAME
@ -49,8 +49,8 @@
.Nd device buffer queues .Nd device buffer queues
.Sh SYNOPSIS .Sh SYNOPSIS
.In sys/bufq.h .In sys/bufq.h
.Ft void .Ft int
.Fn bufq_alloc "struct bufq_state *bufq" "int flags" .Fn bufq_alloc "struct bufq_state **bufq" "const char *strategy" "int flags"
.Ft void .Ft void
.Fn bufq_drain "struct bufq_state *bufq" .Fn bufq_drain "struct bufq_state *bufq"
.Ft void .Ft void
@ -68,20 +68,33 @@ subsystem is a set of operations for the management of device buffer queues.
.Pp .Pp
The primary data type for using the operations is the The primary data type for using the operations is the
.Em bufq_state .Em bufq_state
structure in structure, which is opaque for users.
.Pa sys/bufq.h : .Sh FUNCTIONS
.Bd -literal .Bl -tag -width compact
struct bufq_state { .It Fn bufq_alloc "bufq" "strategy" "flags"
void (*bq_put)(struct bufq_state *, struct buf *); Allocate and initialize a
struct buf *(*bq_get)(struct bufq_state *, int); .Em bufq_state
void *bq_private; descriptor.
int bq_flags; /* Flags from bufq_alloc() */
};
.Ed
.Pp .Pp
Valid values for the The argument
.Em flags .Fa strategy
argument are: specifies a buffer queue strategy to be used for this buffer queue.
Following special values can be used.
.Pp
.Bl -tag -offset indent -width BUFQ_DISK_DEFAULT_STRAT -compact
.It Dv BUFQ_STRAT_ANY
Let
.Fn bufq_alloc
select a strategy.
.It Dv BUFQ_DISK_DEFAULT_STRAT
Let
.Fn bufq_alloc
select a strategy, assuming it will be used for a normal disk device.
.El
.Pp
Valid bits for the
.Fa flags
are:
.Pp .Pp
.Bl -tag -offset indent -width BUFQ_SORT_RAWBLOCK -compact .Bl -tag -offset indent -width BUFQ_SORT_RAWBLOCK -compact
.It Dv BUFQ_SORT_RAWBLOCK .It Dv BUFQ_SORT_RAWBLOCK
@ -92,25 +105,18 @@ sort by
.Em b_cylinder .Em b_cylinder
and then by and then by
.Em b_rawblkno .Em b_rawblkno
.It Dv BUFQ_FCFS .It Dv BUFQ_EXACT
queue strategy is first-come first-serve Fail if a strategy specified by
.It Dv BUFQ_DISKSORT .Fa strategy
queue strategy is min seek sort is not available.
.It Dv BUFQ_READ_PRIO In that case,
queue strategy is min seek sort for writes and first-come first-serve .Fa bufq_alloc
for reads with read priority returns
.It Dv BUFQ_PRIOCSCAN .Dv ENOENT .
queue strategy is per-priority cyclical scan If this flag is not specified,
.Fn bufq_alloc
will silently uses one of available strategies.
.El .El
.Sh FUNCTIONS
.Bl -tag -width compact
.It Fn bufq_alloc "bufq" "flags"
Initialize a
.Em bufq_state
descriptor.
The argument
.Fa flags
controls the strategy and sort order.
.It Fn bufq_drain "bufq" .It Fn bufq_drain "bufq"
Drain a Drain a
.Em bufq_state .Em bufq_state
@ -140,7 +146,7 @@ if the queue is empty.
.Sh CODE REFERENCES .Sh CODE REFERENCES
The actual code implementing the device buffer queues can be found The actual code implementing the device buffer queues can be found
in the file in the file
.Pa sys/kern/subr_disk.c . .Pa sys/kern/subr_bufq.c .
.Sh HISTORY .Sh HISTORY
The The
.Nm .Nm