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
49int zpool_malloc(struct zpool *pool, size_t size, gfp_t gfp,
50 unsigned long *handle);
51
52void zpool_free(struct zpool *pool, unsigned long handle);
53
54int zpool_shrink(struct zpool *pool, unsigned int pages,
55 unsigned int *reclaimed);
56
57void *zpool_map_handle(struct zpool *pool, unsigned long handle,
58 enum zpool_mapmode mm);
59
60void zpool_unmap_handle(struct zpool *pool, unsigned long handle);
61
62u64 zpool_get_total_size(struct zpool *pool);
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81struct zpool_driver {
82 char *type;
83 struct module *owner;
84 atomic_t refcount;
85 struct list_head list;
86
87 void *(*create)(const char *name,
88 gfp_t gfp,
89 const struct zpool_ops *ops,
90 struct zpool *zpool);
91 void (*destroy)(void *pool);
92
93 int (*malloc)(void *pool, size_t size, gfp_t gfp,
94 unsigned long *handle);
95 void (*free)(void *pool, unsigned long handle);
96
97 int (*shrink)(void *pool, unsigned int pages,
98 unsigned int *reclaimed);
99
100 void *(*map)(void *pool, unsigned long handle,
101 enum zpool_mapmode mm);
102 void (*unmap)(void *pool, unsigned long handle);
103
104 u64 (*total_size)(void *pool);
105};
106
107void zpool_register_driver(struct zpool_driver *driver);
108
109int zpool_unregister_driver(struct zpool_driver *driver);
110
111bool zpool_evictable(struct zpool *pool);
112
113#endif
114