vm_radix.h revision 245254
138225Skato/*
216359Sasami * Copyright (c) 2011 Jeffrey Roberson <jeff@freebsd.org>
333080Skato * Copyright (c) 2008 Mayur Shardul <mayur.shardul@gmail.com>
416359Sasami * All rights reserved.
516359Sasami *
616359Sasami * Redistribution and use in source and binary forms, with or without
734458Skato * modification, are permitted provided that the following conditions
830329Skato * are met:
916359Sasami * 1. Redistributions of source code must retain the above copyright
1016359Sasami *    notice, this list of conditions and the following disclaimer.
1116359Sasami * 2. Redistributions in binary form must reproduce the above copyright
1237338Skato *    notice, this list of conditions and the following disclaimer in the
1316359Sasami *    documentation and/or other materials provided with the distribution.
1437338Skato *
1537338Skato * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
1629006Skato * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
1733711Skato * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
1829006Skato * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
1929006Skato * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
2016359Sasami * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
2132939Skato * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
2216359Sasami * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
2316359Sasami * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
2416359Sasami * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
2526477Skato * SUCH DAMAGE.
2616359Sasami *
2716359Sasami */
2816359Sasami
2929631Skato#ifndef _VM_RADIX_H_
3032092Skato#define _VM_RADIX_H_
3127844Skato
3227844Skato/*
3317256Sasami * Radix tree root.  The height and pointer are set together to permit
3425572Skato * coherent lookups while the root is modified.
3525572Skato */
3625572Skatostruct vm_radix {
3725572Skato	uintptr_t	rt_root;		/* root + height */
3825572Skato};
3925195Skato
4025195Skato#ifdef _KERNEL
4125195Skato
4225195Skatovoid	vm_radix_init(void);
4325195Skatoint 	vm_radix_insert(struct vm_radix *, vm_pindex_t, void *);
4418846Sasamivoid	*vm_radix_lookup(struct vm_radix *, vm_pindex_t);
4518846Sasamivoid	*vm_radix_lookup_ge(struct vm_radix *, vm_pindex_t);
4620129Sasamivoid	*vm_radix_lookup_le(struct vm_radix *, vm_pindex_t);
4719269Sasamivoid	vm_radix_reclaim_allnodes(struct vm_radix *);
4818846Sasamivoid	vm_radix_remove(struct vm_radix *, vm_pindex_t);
4933080Skato
5033080Skato#endif /* _KERNEL */
5133080Skato#endif /* !_VM_RADIX_H_ */
5218208Sasami