1
2
3
4
5
6
7
8
9
10
11#ifndef _ZPOOL_H_
12#define _ZPOOL_H_
13
14struct zpool;
15
16struct zpool_ops {
17 int (*evict)(struct zpool *pool, unsigned long handle);
18};
19
20
21
22
23
24
25
26
27
28
29
30
31enum zpool_mapmode {
32 ZPOOL_MM_RW,
33 ZPOOL_MM_RO,
34 ZPOOL_MM_WO,
35
36 ZPOOL_MM_DEFAULT = ZPOOL_MM_RW
37};
38
39struct zpool *zpool_create_pool(char *type, char *name,
40 gfp_t gfp, struct zpool_ops *ops);
41
42char *zpool_get_type(struct zpool *pool);
43
44void zpool_destroy_pool(struct zpool *pool);
45
46int zpool_malloc(struct zpool *pool, size_t size, gfp_t gfp,
47 unsigned long *handle);
48
49void zpool_free(struct zpool *pool, unsigned long handle);
50
51int zpool_shrink(struct zpool *pool, unsigned int pages,
52 unsigned int *reclaimed);
53
54void *zpool_map_handle(struct zpool *pool, unsigned long handle,
55 enum zpool_mapmode mm);
56
57void zpool_unmap_handle(struct zpool *pool, unsigned long handle);
58
59u64 zpool_get_total_size(struct zpool *pool);
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78struct zpool_driver {
79 char *type;
80 struct module *owner;
81 atomic_t refcount;
82 struct list_head list;
83
84 void *(*create)(char *name, gfp_t gfp, struct zpool_ops *ops);
85 void (*destroy)(void *pool);
86
87 int (*malloc)(void *pool, size_t size, gfp_t gfp,
88 unsigned long *handle);
89 void (*free)(void *pool, unsigned long handle);
90
91 int (*shrink)(void *pool, unsigned int pages,
92 unsigned int *reclaimed);
93
94 void *(*map)(void *pool, unsigned long handle,
95 enum zpool_mapmode mm);
96 void (*unmap)(void *pool, unsigned long handle);
97
98 u64 (*total_size)(void *pool);
99};
100
101void zpool_register_driver(struct zpool_driver *driver);
102
103int zpool_unregister_driver(struct zpool_driver *driver);
104
105int zpool_evict(void *pool, unsigned long handle);
106
107#endif
108