Merge git://git.kernel.org/pub/scm/linux/kernel/git/davem/net
[firefly-linux-kernel-4.4.55.git] / drivers / staging / ramster / zcache.h
1
2 /*
3  * zcache.h
4  *
5  * Copyright (c) 2012, Dan Magenheimer, Oracle Corp.
6  */
7
8 #ifndef _ZCACHE_H_
9 #define _ZCACHE_H_
10
11 struct zcache_preload {
12         struct tmem_obj *obj;
13         struct tmem_objnode *objnodes[OBJNODE_TREE_MAX_PATH];
14 };
15
16 struct tmem_pool;
17
18 #define MAX_POOLS_PER_CLIENT 16
19
20 #define MAX_CLIENTS 16
21 #define LOCAL_CLIENT ((uint16_t)-1)
22
23 struct zcache_client {
24         struct tmem_pool *tmem_pools[MAX_POOLS_PER_CLIENT];
25         bool allocated;
26         atomic_t refcount;
27 };
28
29 extern struct tmem_pool *zcache_get_pool_by_id(uint16_t cli_id,
30                                                         uint16_t poolid);
31 extern void zcache_put_pool(struct tmem_pool *pool);
32
33 extern int zcache_put_page(int, int, struct tmem_oid *,
34                                 uint32_t, void *,
35                                 unsigned int, bool, int);
36 extern int zcache_get_page(int, int, struct tmem_oid *, uint32_t,
37                                 void *, size_t *, bool, int);
38 extern int zcache_flush_page(int, int, struct tmem_oid *, uint32_t);
39 extern int zcache_flush_object(int, int, struct tmem_oid *);
40 extern void zcache_decompress_to_page(char *, unsigned int, struct page *);
41
42 #ifdef CONFIG_RAMSTER
43 extern void *zcache_pampd_create(char *, unsigned int, bool, int,
44                                 struct tmem_handle *);
45 int zcache_autocreate_pool(unsigned int cli_id, unsigned int pool_id, bool eph);
46 #endif
47
48 #define MAX_POOLS_PER_CLIENT 16
49
50 #define MAX_CLIENTS 16
51 #define LOCAL_CLIENT ((uint16_t)-1)
52
53 #endif /* _ZCACHE_H_ */