debuggers.hg

view tools/memshr/bidir-namedefs.h @ 21067:b4a1832a916f

Update Xen version to 4.0.0-rc6
author Keir Fraser <keir.fraser@citrix.com>
date Tue Mar 09 18:18:05 2010 +0000 (2010-03-09)
parents 47ec2d131c22
children
line source
1 /******************************************************************************
2 *
3 * Copyright (c) 2009 Citrix Systems, Inc. (Grzegorz Milos)
4 *
5 * This program is free software; you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License as published by
7 * the Free Software Foundation; either version 2 of the License, or
8 * (at your option) any later version.
9 *
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
14 *
15 * You should have received a copy of the GNU General Public License
16 * along with this program; if not, write to the Free Software
17 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
18 */
19 #include "memshr-priv.h"
21 /* Macros used to assemble the names */
22 #define BIDIR_NAME_ONE_INTERNAL(prefix, name) \
23 prefix ## _ ## name
24 #define BIDIR_NAME_TWO_INTERNAL(prefix, name1, name2) \
25 prefix ## _ ## name1 ## _ ## name2
27 #define BIDIR_NAME_ONE(prefix, name) \
28 BIDIR_NAME_ONE_INTERNAL(prefix, name)
29 #define BIDIR_NAME_TWO(prefix, name1, name2) \
30 BIDIR_NAME_TWO_INTERNAL(prefix, name1, name2)
32 #define INTERNAL_NAME_ONE(name) BIDIR_NAME_ONE(BIDIR_NAME_PREFIX, name)
33 #define INTERNAL_NAME_TWO(name1, name2) \
34 BIDIR_NAME_TWO(BIDIR_NAME_PREFIX, name1, name2)
36 /* Function/type names */
37 #define __k_t BIDIR_KEY_T
38 #define __v_t BIDIR_VALUE_T
40 #define __hash INTERNAL_NAME_ONE(hash)
41 #define __shm_hash_init INTERNAL_NAME_ONE(shm_hash_init)
42 #define __shm_hash_get INTERNAL_NAME_ONE(shm_hash_get)
43 #define __hash_init INTERNAL_NAME_ONE(hash_init)
44 #define __key_lookup INTERNAL_NAME_TWO(BIDIR_KEY, lookup)
45 #define __value_lookup INTERNAL_NAME_TWO(BIDIR_VALUE, lookup)
46 #define __insert INTERNAL_NAME_ONE(insert)
47 #define __key_remove INTERNAL_NAME_TWO(BIDIR_KEY, remove)
48 #define __value_remove INTERNAL_NAME_TWO(BIDIR_VALUE, remove)
49 #define __hash_destroy INTERNAL_NAME_ONE(hash_destroy)
50 #define __hash_iterator INTERNAL_NAME_ONE(hash_iterator)
52 #define __key_hash INTERNAL_NAME_TWO(BIDIR_KEY, hash)
53 #define __key_cmp INTERNAL_NAME_TWO(BIDIR_KEY, cmp)
54 #define __value_hash INTERNAL_NAME_TWO(BIDIR_VALUE, hash)
55 #define __value_cmp INTERNAL_NAME_TWO(BIDIR_VALUE, cmp)
57 #define __hash_sizes INTERNAL_NAME_ONE(hash_sizes)
60 /* Final function exports */
61 struct __hash* __shm_hash_init(unsigned long shm_baddr, unsigned long shm_size);
62 struct __hash* __shm_hash_get(unsigned long shm_baddr);
63 struct __hash *__hash_init (struct __hash *h, uint32_t min_size);
64 int __key_lookup (struct __hash *h, __k_t k, __v_t *vp);
65 int __value_lookup(struct __hash *h, __v_t v, __k_t *kp);
66 int __insert (struct __hash *h, __k_t k, __v_t v);
67 int __key_remove (struct __hash *h, __k_t k, __v_t *vp);
68 int __value_remove(struct __hash *h, __v_t v, __k_t *kp);
69 int __hash_destroy(struct __hash *h,
70 void (*entry_consumer)(__k_t k, __v_t v, void *p),
71 void *d);
72 int __hash_iterator(struct __hash *h,
73 int (*entry_consumer)(__k_t k, __v_t v, void *p),
74 void *d);
75 void __hash_sizes(struct __hash *h,
76 uint32_t *nr_ent,
77 uint32_t *max_nr_ent,
78 uint32_t *tab_size,
79 uint32_t *max_load,
80 uint32_t *min_load);