1119418Sobrien/*-
2119418Sobrien * Copyright (c) 2004 Poul-Henning Kamp
393746Sjulian * All rights reserved.
493746Sjulian *
593746Sjulian * Redistribution and use in source and binary forms, with or without
693746Sjulian * modification, are permitted provided that the following conditions
793746Sjulian * are met:
893746Sjulian * 1. Redistributions of source code must retain the above copyright
993746Sjulian *    notice, this list of conditions and the following disclaimer.
1093746Sjulian * 2. Redistributions in binary form must reproduce the above copyright
1193746Sjulian *    notice, this list of conditions and the following disclaimer in the
1293746Sjulian *    documentation and/or other materials provided with the distribution.
1393746Sjulian *
1493746Sjulian * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
1593746Sjulian * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
1693746Sjulian * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
1793746Sjulian * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
1893746Sjulian * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
1993746Sjulian * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
2093746Sjulian * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
2193746Sjulian * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
2293746Sjulian * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
2393746Sjulian * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
2493746Sjulian * SUCH DAMAGE.
2593746Sjulian *
2693746Sjulian * $FreeBSD$
27119418Sobrien */
2893746Sjulian
29113038Sobrien#ifndef _SYS_UNRHDR_H
30113038Sobrien#define _SYS_UNRHDR_H
31113038Sobrien
32113038Sobrien#include <sys/queue.h>
3393746Sjulian
3493746Sjulianstruct mtx;
3593746Sjulian
3693746Sjulian/* Header element for a unr number space. */
3793746Sjulian
3893746Sjulianstruct unrhdr {
3993746Sjulian	TAILQ_HEAD(unrhd,unr)	head;
4093746Sjulian	u_int			low;	/* Lowest item */
4193746Sjulian	u_int			high;	/* Highest item */
4293746Sjulian	u_int			busy;	/* Count of allocated items */
4393746Sjulian	u_int			alloc;	/* Count of memory allocations */
4495807Sjulian	u_int			first;	/* items in allocated from start */
4595807Sjulian	u_int			last;	/* items free at end */
4693746Sjulian	struct mtx		*mtx;
4793746Sjulian	TAILQ_HEAD(unrfr,unr)	ppfree;	/* Items to be freed after mtx
4893746Sjulian					   lock dropped */
4993746Sjulian};
5093746Sjulian
5193746Sjulian#endif
5293746Sjulian