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