ia64/xen-unstable

view tools/xenstore/hashtable_private.h @ 19731:01748ccc4da3

Intel VT-d: fix Stoakley boot issue with iommu=1

Signed-off-by: Weidong Han <Weidong.han@intel.com>
Signed-off-by: Allen Kay <allen.m.kay@intel.com>
author Keir Fraser <keir.fraser@citrix.com>
date Fri Jun 05 09:25:50 2009 +0100 (2009-06-05)
parents 26af50da86b7
children
line source
1 /* Copyright (C) 2002, 2004 Christopher Clark <firstname.lastname@cl.cam.ac.uk> */
3 #ifndef __HASHTABLE_PRIVATE_CWC22_H__
4 #define __HASHTABLE_PRIVATE_CWC22_H__
6 #include "hashtable.h"
8 /*****************************************************************************/
9 struct entry
10 {
11 void *k, *v;
12 unsigned int h;
13 struct entry *next;
14 };
16 struct hashtable {
17 unsigned int tablelength;
18 struct entry **table;
19 unsigned int entrycount;
20 unsigned int loadlimit;
21 unsigned int primeindex;
22 unsigned int (*hashfn) (void *k);
23 int (*eqfn) (void *k1, void *k2);
24 };
26 /*****************************************************************************/
27 unsigned int
28 hash(struct hashtable *h, void *k);
30 /*****************************************************************************/
31 /* indexFor */
32 static inline unsigned int
33 indexFor(unsigned int tablelength, unsigned int hashvalue) {
34 return (hashvalue % tablelength);
35 };
37 /* Only works if tablelength == 2^N */
38 /*static inline unsigned int
39 indexFor(unsigned int tablelength, unsigned int hashvalue)
40 {
41 return (hashvalue & (tablelength - 1u));
42 }
43 */
45 /*****************************************************************************/
46 #define freekey(X) free(X)
47 /*define freekey(X) ; */
50 /*****************************************************************************/
52 #endif /* __HASHTABLE_PRIVATE_CWC22_H__*/
54 /*
55 * Copyright (c) 2002, Christopher Clark
56 * All rights reserved.
57 *
58 * Redistribution and use in source and binary forms, with or without
59 * modification, are permitted provided that the following conditions
60 * are met:
61 *
62 * * Redistributions of source code must retain the above copyright
63 * notice, this list of conditions and the following disclaimer.
64 *
65 * * Redistributions in binary form must reproduce the above copyright
66 * notice, this list of conditions and the following disclaimer in the
67 * documentation and/or other materials provided with the distribution.
68 *
69 * * Neither the name of the original author; nor the names of any contributors
70 * may be used to endorse or promote products derived from this software
71 * without specific prior written permission.
72 *
73 *
74 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
75 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
76 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
77 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER
78 * OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
79 * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
80 * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
81 * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
82 * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
83 * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
84 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
85 */