4 * The contents of this file are subject to the terms of the
5 * Common Development and Distribution License (the "License").
6 * You may not use this file except in compliance with the License.
8 * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
9 * or http://www.opensolaris.org/os/licensing.
10 * See the License for the specific language governing permissions
11 * and limitations under the License.
13 * When distributing Covered Code, include this CDDL HEADER in each
14 * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
15 * If applicable, add the following below this CDDL HEADER, with the
16 * fields enclosed by brackets "[]" replaced with your own identifying
17 * information: Portions Copyright [yyyy] [name of copyright owner]
23 * Copyright 2008 Sun Microsystems, Inc. All rights reserved.
24 * Use is subject to license terms.
31 #include <isns_htab.h>
38 #define CACHE_FLAG_UPDATED 0x1
40 #define SET_CACHE_UPDATED() (cache_flag |= CACHE_FLAG_UPDATED)
41 #define RESET_CACHE_UPDATED() (cache_flag &= ~CACHE_FLAG_UPDATED)
43 #define IS_CACHE_UPDATED() (cache_flag & CACHE_FLAG_UPDATED)
45 #define CACHE_NO_ACTION (0)
46 #define CACHE_READ (1)
47 #define CACHE_TRY_READ (2)
48 #define CACHE_WRITE (3)
50 typedef struct cache
{
54 uint32_t (*get_hval
)(void *, uint16_t, uint32_t *);
55 uint32_t (*get_uid
)(const void *);
56 uint32_t (*set_uid
)(void *, uint32_t);
57 uint32_t (*timestamp
)(void);
58 int (*add_hook
)(void *);
59 int (*replace_hook
)(void *, void *, uint32_t *, int);
60 int (*cmp
)(void *, void *, int);
61 void *(*clone
)(void *, int);
62 int (*ddd
)(void *, const uchar_t
);
69 void cache_destroy(void);
71 int cache_unlock(int, int);
72 int cache_lock_read(void);
73 int cache_lock_write(void);
74 int cache_unlock_sync(int);
75 int cache_unlock_nosync(void);
76 htab_t
*cache_get_htab(isns_type_t
);
77 matrix_t
*cache_get_matrix(isns_type_t
);
78 int cache_lookup(lookup_ctrl_t
*, uint32_t *, int (*)(void *, void *));
79 int cache_rekey(lookup_ctrl_t
*, uint32_t *, int (*)(void *, void *));
80 int cache_add(isns_obj_t
*, int, uint32_t *, int *);
81 isns_obj_t
*cache_remove(lookup_ctrl_t
*, int);
84 void cache_dump_htab(isns_type_t
);
91 #endif /* _ISNS_CACHE_H */