[BACK]Return to bufq.9 CVS log [TXT][DIR] Up to [cvs.NetBSD.org] / src / share / man / man9

File: [cvs.NetBSD.org] / src / share / man / man9 / bufq.9 (download)

Revision 1.20, Sun Apr 12 19:00:56 2009 UTC (14 years, 11 months ago) by joerg
Branch: MAIN
CVS Tags: yamt-pagecache-tag8, yamt-pagecache-base9, yamt-pagecache-base8, yamt-pagecache-base7, yamt-pagecache-base6, yamt-pagecache-base5, yamt-pagecache-base4, yamt-pagecache-base3, yamt-pagecache-base2, yamt-pagecache-base, yamt-pagecache, uebayasi-xip-base7, uebayasi-xip-base6, uebayasi-xip-base5, uebayasi-xip-base4, uebayasi-xip-base3, uebayasi-xip-base2, uebayasi-xip-base1, uebayasi-xip, tls-maxphys-base, tls-maxphys, tls-earlyentropy-base, tls-earlyentropy, riastradh-xf86-video-intel-2-7-1-pre-2-21-15, riastradh-drm2-base3, riastradh-drm2-base2, riastradh-drm2-base1, riastradh-drm2-base, riastradh-drm2, pgoyette-localcount-base, pgoyette-localcount-20161104, pgoyette-localcount-20160806, pgoyette-localcount-20160726, netbsd-7-nhusb-base-20170116, netbsd-7-nhusb-base, netbsd-7-nhusb, netbsd-7-base, netbsd-7-2-RELEASE, netbsd-7-1-RELEASE, netbsd-7-1-RC2, netbsd-7-1-RC1, netbsd-7-1-2-RELEASE, netbsd-7-1-1-RELEASE, netbsd-7-1, netbsd-7-0-RELEASE, netbsd-7-0-RC3, netbsd-7-0-RC2, netbsd-7-0-RC1, netbsd-7-0-2-RELEASE, netbsd-7-0-1-RELEASE, netbsd-7-0, netbsd-7, netbsd-6-base, netbsd-6-1-RELEASE, netbsd-6-1-RC4, netbsd-6-1-RC3, netbsd-6-1-RC2, netbsd-6-1-RC1, netbsd-6-1-5-RELEASE, netbsd-6-1-4-RELEASE, netbsd-6-1-3-RELEASE, netbsd-6-1-2-RELEASE, netbsd-6-1-1-RELEASE, netbsd-6-1, netbsd-6-0-RELEASE, netbsd-6-0-RC2, netbsd-6-0-RC1, netbsd-6-0-6-RELEASE, netbsd-6-0-5-RELEASE, netbsd-6-0-4-RELEASE, netbsd-6-0-3-RELEASE, netbsd-6-0-2-RELEASE, netbsd-6-0-1-RELEASE, netbsd-6-0, netbsd-6, matt-premerge-20091211, matt-nb6-plus-nbase, matt-nb6-plus-base, matt-nb6-plus, matt-mips64-premerge-20101231, localcount-20160914, jym-xensuspend-nbase, jym-xensuspend-base, cherry-xenmp-base, cherry-xenmp, bouyer-quota2-nbase, bouyer-quota2-base, bouyer-quota2, agc-symver-base, agc-symver
Branch point for: pgoyette-localcount
Changes since 1.19: +2 -3 lines

Drop conditionals now that groff can handle the umlaut in the author
name.

.\"     $NetBSD: bufq.9,v 1.20 2009/04/12 19:00:56 joerg Exp $
.\"
.\" Copyright (c) 2002 The NetBSD Foundation, Inc.
.\" All rights reserved.
.\"
.\" This code is derived from software contributed to The NetBSD Foundation
.\" by Juergen Hannken-Illjes.
.\"
.\" Redistribution and use in source and binary forms, with or without
.\" modification, are permitted provided that the following conditions
.\" are met:
.\" 1. Redistributions of source code must retain the above copyright
.\"    notice, this list of conditions and the following disclaimer.
.\" 2. Redistributions in binary form must reproduce the above copyright
.\"    notice, this list of conditions and the following disclaimer in the
.\"    documentation and/or other materials provided with the distribution.
.\"
.\" THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
.\" ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
.\" TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
.\" PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
.\" BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
.\" CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
.\" SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
.\" INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
.\" CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
.\" POSSIBILITY OF SUCH DAMAGE.
.\"
.Dd January 24, 2009
.Dt BUFQ 9
.Os
.Sh NAME
.Nm bufq ,
.Nm bufq_state ,
.Nm bufq_alloc ,
.Nm bufq_drain ,
.Nm bufq_free ,
.Nm bufq_getstrategyname ,
.Nm bufq_move ,
.Nm bufq_put ,
.Nm bufq_get ,
.Nm bufq_peek ,
.Nm bufq_cancel
.Nd device buffer queues
.Sh SYNOPSIS
.In sys/bufq.h
.Ft int
.Fn bufq_alloc "struct bufq_state **bufq" "const char *strategy" "int flags"
.Ft void
.Fn bufq_drain "struct bufq_state *bufq"
.Ft void
.Fn bufq_free "struct bufq_state *bufq"
.Ft "const char *"
.Fn bufq_getstrategyname "struct bufq_state *bufq"
.Ft void
.Fn bufq_move "struct bufq_state *dst" "struct bufq_state *src"
.Ft void
.Fn bufq_put "struct bufq_state *bufq" "struct buf *bp"
.Ft "struct buf *"
.Fn bufq_get "struct bufq_state *bufq"
.Ft "struct buf *"
.Fn bufq_peek "struct bufq_state *bufq"
.Ft "struct buf *"
.Fn bufq_cancel "struct bufq_state *bufq" "struct buf *bp"
.Sh DESCRIPTION
The
.Nm
subsystem is a set of operations for the management of device buffer queues.
.Pp
The primary data type for using the operations is the
.Em bufq_state
structure, which is opaque for users.
.Sh FUNCTIONS
.Bl -tag -width compact
.It Fn bufq_alloc "bufq" "strategy" "flags"
Allocate and initialize a
.Em bufq_state
descriptor.
.Pp
The argument
.Fa strategy
specifies a buffer queue strategy to be used for this buffer queue.
The 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
.Bl -tag -offset indent -width BUFQ_SORT_RAWBLOCK -compact
.It Dv BUFQ_SORT_RAWBLOCK
sort by
.Em b_rawblkno
.It Dv BUFQ_SORT_CYLINDER
sort by
.Em b_cylinder
and then by
.Em b_rawblkno
.It Dv BUFQ_EXACT
Fail if a strategy specified by
.Fa strategy
is not available.
In that case,
.Fa bufq_alloc
returns
.Dv ENOENT .
If this flag is not specified,
.Fn bufq_alloc
will silently use one of available strategies.
.El
.It Fn bufq_drain "bufq"
Drain a
.Em bufq_state
descriptor.
.It Fn bufq_free "bufq"
Destroy a
.Em bufq_state
descriptor.
.It Fn bufq_getstrategyname "bufq"
Get a strategy identifier of a buffer queue, the
string returned will be NUL-terminated and it always
will be a valid strategy name.
.It Fn bufq_move "dst" "src"
Move all requests from the buffer queue
.Fa src
to the buffer queue
.Fa dst .
.It Fn bufq_put "bufq" "bp"
Put the buf
.Fa bp
in the queue.
.It Fn bufq_get "bufq"
Get the next buf from the queue and remove it from the queue.
Returns
.Dv NULL
if the queue is empty.
.It Fn bufq_peek "bufq"
Get the next buf from the queue without removal.
The next buf will remain the same until
.Fn bufq_get ,
.Fn bufq_put ,
or
.Fn bufq_drain
is called.
Returns
.Dv NULL
if the queue is empty.
.It Fn bufq_cancel "bufq" "bp"
Cancel the buf
.Fa bp
issued earlier on the queue.
Returns
.Dv NULL
if the element can not be found on the queue or
.Fa bp
if it has been found and removed.
This operation can be computationally expensive if there are
a lot of buffers queued.
.El
.Sh CODE REFERENCES
The actual code implementing the device buffer queues can be found
in the file
.Pa sys/kern/subr_bufq.c .
.Sh HISTORY
The
.Nm
subsystem appeared in
.Nx 2.0 .
.Sh AUTHORS
The
.Nm
subsystem was written by
.An J\(:urgen Hannken-Illjes
.Aq hannken@NetBSD.org .