Manual browser: bufq(9)
|BUFQ(9)||Kernel Developer's Manual||BUFQ(9)|
NAMEbufq, bufq_state, bufq_alloc, bufq_drain, bufq_free, bufq_getstrategyname, bufq_move, bufq_put, bufq_get, bufq_peek, bufq_cancel — device buffer queues
bufq_alloc(struct bufq_state **bufq, const char *strategy, int flags);
bufq_drain(struct bufq_state *bufq);
bufq_free(struct bufq_state *bufq);
const char *
bufq_getstrategyname(struct bufq_state *bufq);
bufq_move(struct bufq_state *dst, struct bufq_state *src);
bufq_put(struct bufq_state *bufq, struct buf *bp);
struct buf *
bufq_get(struct bufq_state *bufq);
struct buf *
bufq_peek(struct bufq_state *bufq);
struct buf *
bufq_cancel(struct bufq_state *bufq, struct buf *bp);
DESCRIPTIONThe bufq subsystem is a set of operations for the management of device buffer queues.
The primary data type for using the operations is the bufq_state structure, which is opaque for users.
- bufq_alloc(bufq, strategy, flags)
Allocate and initialize a bufq_state descriptor.
The argument strategy specifies a buffer queue strategy to be used for this buffer queue. The following special values can be used:
- Let bufq_alloc() select a strategy.
- Let bufq_alloc() select a strategy, assuming it will be used for a normal disk device.
Valid bits for the flags are:
- sort by b_rawblkno
- sort by b_cylinder and then by b_rawblkno
- Fail if a strategy specified by strategy is not available. In that case, bufq_alloc returns ENOENT. If this flag is not specified, bufq_alloc() will silently use one of available strategies.
- Drain a bufq_state descriptor.
- Destroy a bufq_state descriptor.
- Get a strategy identifier of a buffer queue, the string returned will be NUL-terminated and it always will be a valid strategy name.
- bufq_move(dst, src)
- Move all requests from the buffer queue src to the buffer queue dst.
- bufq_put(bufq, bp)
- Put the buf bp in the queue.
- Get the next buf from the queue and remove it from the queue. Returns NULL if the queue is empty.
- Get the next buf from the queue without removal. The next buf will remain the same until bufq_get(), bufq_put(), or bufq_drain() is called. Returns NULL if the queue is empty.
- bufq_cancel(bufq, bp)
- Cancel the buf bp issued earlier on the queue. Returns NULL if the element can not be found on the queue or bp if it has been found and removed. This operation can be computationally expensive if there are a lot of buffers queued.
CODE REFERENCESThe actual code implementing the device buffer queues can be found in the file sys/kern/subr_bufq.c.
HISTORYThe bufq subsystem appeared in NetBSD 2.0.
AUTHORSThe bufq subsystem was written by <hannken@NetBSD.org>.
|January 24, 2009||NetBSD 7.0|