Revision 7cf0125c xseg/xtypes/xcache.h
b/xseg/xtypes/xcache.h | ||
---|---|---|
5 | 5 |
#include <xtypes/xlock.h> |
6 | 6 |
#include <xtypes/xq.h> |
7 | 7 |
#include <xtypes/xhash.h> |
8 |
#include <xtypes/xbinheap.h> |
|
8 | 9 |
#include <xseg/xseg.h> |
9 | 10 |
#include <xseg/protocol.h> |
10 | 11 |
#include <sys/util.h> |
11 | 12 |
|
13 |
#define XCACHE_LRU_ARRAY (1<<0) |
|
14 |
#define XCACHE_LRU_HEAP (1<<1) |
|
15 |
|
|
12 | 16 |
/* |
13 | 17 |
* on_init: called on cache entry initialization. |
14 | 18 |
* Should return negative on error to abort cache entry initialization. |
... | ... | |
27 | 31 |
struct xlock lock; |
28 | 32 |
uint32_t ref; |
29 | 33 |
char name[XSEG_MAX_TARGETLEN + 1]; |
34 |
xbinheap_handler h; |
|
30 | 35 |
void *priv; |
31 | 36 |
}; |
32 | 37 |
|
... | ... | |
39 | 44 |
struct xcache_entry *nodes; |
40 | 45 |
uint64_t time; |
41 | 46 |
uint64_t *times; |
47 |
struct xbinheap binheap; |
|
42 | 48 |
struct xcache_ops ops; |
49 |
uint32_t flags; |
|
43 | 50 |
void *priv; |
44 | 51 |
}; |
45 | 52 |
|
... | ... | |
61 | 68 |
} |
62 | 69 |
|
63 | 70 |
int xcache_init(struct xcache *cache, uint32_t xcache_size, |
64 |
struct xcache_ops *ops, void *priv); |
|
71 |
struct xcache_ops *ops, uint32_t flags, void *priv);
|
|
65 | 72 |
void xcache_close(struct xcache *cache); |
66 | 73 |
xcache_handler xcache_lookup(struct xcache *cache, char *name); |
67 | 74 |
xcache_handler xcache_alloc_init(struct xcache *cache, char *name); |
Also available in: Unified diff