forked from bicomsystems/go-libzfs
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathzpool.h
150 lines (128 loc) · 4.3 KB
/
zpool.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
/* C wrappers around some zfs calls and C in general that should simplify
* using libzfs from go language, make go code shorter and more readable.
*/
#ifndef SERVERWARE_ZPOOL_H
#define SERVERWARE_ZPOOL_H
#define INT_MAX_NAME 256
#define INT_MAX_VALUE 1024
#define ZAP_OLDMAXVALUELEN 1024
#define ZFS_MAX_DATASET_NAME_LEN 256
struct zpool_list {
zpool_handle_t *zph;
void *pnext;
};
typedef struct property_list {
char value[INT_MAX_VALUE];
char source[ZFS_MAX_DATASET_NAME_LEN];
int property;
void *pnext;
} property_list_t;
typedef struct zpool_list zpool_list_t;
typedef struct zpool_list* zpool_list_ptr;
typedef struct libzfs_handle* libzfs_handle_ptr;
typedef struct nvlist* nvlist_ptr;
typedef struct property_list *property_list_ptr;
typedef struct pool_scan_stat* pool_scan_stat_ptr;
typedef struct nvpair* nvpair_ptr;
typedef struct vdev_stat* vdev_stat_ptr;
typedef char* char_ptr;
property_list_t *new_property_list();
zpool_list_t *create_zpool_list_item();
void zprop_source_tostr(char *dst, zprop_source_t source);
zpool_list_t* zpool_list_open(libzfs_handle_t *libzfs, const char *name);
int zpool_list(libzfs_handle_t *libzfs, zpool_list_t **first);
zpool_list_t *zpool_next(zpool_list_t *pool);
void zpool_list_close(zpool_list_t *pool);
int read_zpool_property(zpool_handle_t *zh, property_list_t *list, int prop);
property_list_t *read_zpool_properties(zpool_handle_t *zh);
property_list_t *next_property(property_list_t *list);
void free_properties(property_list_t *root);
pool_state_t zpool_read_state(zpool_handle_t *zh);
const char *lasterr(void);
int
add_prop_list(const char *propname, char *propval, nvlist_t **props,
boolean_t poolprop);
nvlist_t** nvlist_alloc_array(int count);
void nvlist_array_set(nvlist_t** a, int i, nvlist_t *item);
void nvlist_free_array(nvlist_t **a);
nvlist_t *nvlist_array_at(nvlist_t **a, uint_t i);
int nvlist_lookup_uint64_array_vds(nvlist_t *nv, const char *p,
vdev_stat_t **vds, uint_t *c);
int nvlist_lookup_uint64_array_ps(nvlist_t *nv, const char *p,
pool_scan_stat_t **vds, uint_t *c);
int refresh_stats(zpool_list_t *pool);
char *sZPOOL_CONFIG_VERSION;
char *sZPOOL_CONFIG_POOL_NAME;
char *sZPOOL_CONFIG_POOL_STATE;
char *sZPOOL_CONFIG_POOL_TXG;
char *sZPOOL_CONFIG_POOL_GUID;
char *sZPOOL_CONFIG_CREATE_TXG;
char *sZPOOL_CONFIG_TOP_GUID;
char *sZPOOL_CONFIG_VDEV_TREE;
char *sZPOOL_CONFIG_TYPE;
char *sZPOOL_CONFIG_CHILDREN;
char *sZPOOL_CONFIG_ID;
char *sZPOOL_CONFIG_GUID;
char *sZPOOL_CONFIG_PATH;
char *sZPOOL_CONFIG_DEVID;
char *sZPOOL_CONFIG_METASLAB_ARRAY;
char *sZPOOL_CONFIG_METASLAB_SHIFT;
char *sZPOOL_CONFIG_ASHIFT;
char *sZPOOL_CONFIG_ASIZE;
char *sZPOOL_CONFIG_DTL;
char *sZPOOL_CONFIG_SCAN_STATS;
char *sZPOOL_CONFIG_VDEV_STATS;
char *sZPOOL_CONFIG_WHOLE_DISK;
char *sZPOOL_CONFIG_ERRCOUNT;
char *sZPOOL_CONFIG_NOT_PRESENT;
char *sZPOOL_CONFIG_SPARES;
char *sZPOOL_CONFIG_IS_SPARE;
char *sZPOOL_CONFIG_NPARITY;
char *sZPOOL_CONFIG_HOSTID;
char *sZPOOL_CONFIG_HOSTNAME;
char *sZPOOL_CONFIG_LOADED_TIME;
char *sZPOOL_CONFIG_UNSPARE;
char *sZPOOL_CONFIG_PHYS_PATH;
char *sZPOOL_CONFIG_IS_LOG;
char *sZPOOL_CONFIG_L2CACHE;
char *sZPOOL_CONFIG_HOLE_ARRAY;
char *sZPOOL_CONFIG_VDEV_CHILDREN;
char *sZPOOL_CONFIG_IS_HOLE;
char *sZPOOL_CONFIG_DDT_HISTOGRAM;
char *sZPOOL_CONFIG_DDT_OBJ_STATS;
char *sZPOOL_CONFIG_DDT_STATS;
char *sZPOOL_CONFIG_SPLIT;
char *sZPOOL_CONFIG_ORIG_GUID;
char *sZPOOL_CONFIG_SPLIT_GUID;
char *sZPOOL_CONFIG_SPLIT_LIST;
char *sZPOOL_CONFIG_REMOVING;
char *sZPOOL_CONFIG_RESILVER_TXG;
char *sZPOOL_CONFIG_COMMENT;
char *sZPOOL_CONFIG_SUSPENDED;
char *sZPOOL_CONFIG_TIMESTAMP;
char *sZPOOL_CONFIG_BOOTFS;
char *sZPOOL_CONFIG_MISSING_DEVICES;
char *sZPOOL_CONFIG_LOAD_INFO;
char *sZPOOL_CONFIG_REWIND_INFO;
char *sZPOOL_CONFIG_UNSUP_FEAT;
char *sZPOOL_CONFIG_ENABLED_FEAT;
char *sZPOOL_CONFIG_CAN_RDONLY;
char *sZPOOL_CONFIG_FEATURES_FOR_READ;
char *sZPOOL_CONFIG_FEATURE_STATS;
char *sZPOOL_CONFIG_ERRATA;
char *sZPOOL_CONFIG_OFFLINE;
char *sZPOOL_CONFIG_FAULTED;
char *sZPOOL_CONFIG_DEGRADED;
char *sZPOOL_CONFIG_REMOVED;
char *sZPOOL_CONFIG_FRU;
char *sZPOOL_CONFIG_AUX_STATE;
char *sZPOOL_REWIND_POLICY;
char *sZPOOL_REWIND_REQUEST;
char *sZPOOL_REWIND_REQUEST_TXG;
char *sZPOOL_REWIND_META_THRESH;
char *sZPOOL_REWIND_DATA_THRESH;
char *sZPOOL_CONFIG_LOAD_TIME;
char *sZPOOL_CONFIG_LOAD_DATA_ERRORS;
char *sZPOOL_CONFIG_REWIND_TIME;
#endif
/* SERVERWARE_ZPOOL_H */