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