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