This source file includes following definitions.
- NILFS_CPINFO_FNS
- NILFS_SUINFO_FNS
- NILFS_SUINFO_UPDATE_FNS
1
2
3
4
5
6
7
8
9
10
11
12
13 #ifndef _LINUX_NILFS2_API_H
14 #define _LINUX_NILFS2_API_H
15
16 #include <linux/types.h>
17 #include <linux/ioctl.h>
18
19
20
21
22
23
24
25
26
27
28
29
30 struct nilfs_cpinfo {
31 __u32 ci_flags;
32 __u32 ci_pad;
33 __u64 ci_cno;
34 __u64 ci_create;
35 __u64 ci_nblk_inc;
36 __u64 ci_inodes_count;
37 __u64 ci_blocks_count;
38 __u64 ci_next;
39 };
40
41
42 enum {
43 NILFS_CPINFO_SNAPSHOT,
44 NILFS_CPINFO_INVALID,
45 NILFS_CPINFO_SKETCH,
46 NILFS_CPINFO_MINOR,
47 };
48
49 #define NILFS_CPINFO_FNS(flag, name) \
50 static inline int \
51 nilfs_cpinfo_##name(const struct nilfs_cpinfo *cpinfo) \
52 { \
53 return !!(cpinfo->ci_flags & (1UL << NILFS_CPINFO_##flag)); \
54 }
55
56 NILFS_CPINFO_FNS(SNAPSHOT, snapshot)
57 NILFS_CPINFO_FNS(INVALID, invalid)
58 NILFS_CPINFO_FNS(MINOR, minor)
59
60
61
62
63
64
65
66 struct nilfs_suinfo {
67 __u64 sui_lastmod;
68 __u32 sui_nblocks;
69 __u32 sui_flags;
70 };
71
72
73 enum {
74 NILFS_SUINFO_ACTIVE,
75 NILFS_SUINFO_DIRTY,
76 NILFS_SUINFO_ERROR,
77 };
78
79 #define NILFS_SUINFO_FNS(flag, name) \
80 static inline int \
81 nilfs_suinfo_##name(const struct nilfs_suinfo *si) \
82 { \
83 return si->sui_flags & (1UL << NILFS_SUINFO_##flag); \
84 }
85
86 NILFS_SUINFO_FNS(ACTIVE, active)
87 NILFS_SUINFO_FNS(DIRTY, dirty)
88 NILFS_SUINFO_FNS(ERROR, error)
89
90 static inline int nilfs_suinfo_clean(const struct nilfs_suinfo *si)
91 {
92 return !si->sui_flags;
93 }
94
95
96
97
98
99
100
101
102 struct nilfs_suinfo_update {
103 __u64 sup_segnum;
104 __u32 sup_flags;
105 __u32 sup_reserved;
106 struct nilfs_suinfo sup_sui;
107 };
108
109 enum {
110 NILFS_SUINFO_UPDATE_LASTMOD,
111 NILFS_SUINFO_UPDATE_NBLOCKS,
112 NILFS_SUINFO_UPDATE_FLAGS,
113 __NR_NILFS_SUINFO_UPDATE_FIELDS,
114 };
115
116 #define NILFS_SUINFO_UPDATE_FNS(flag, name) \
117 static inline void \
118 nilfs_suinfo_update_set_##name(struct nilfs_suinfo_update *sup) \
119 { \
120 sup->sup_flags |= 1UL << NILFS_SUINFO_UPDATE_##flag; \
121 } \
122 static inline void \
123 nilfs_suinfo_update_clear_##name(struct nilfs_suinfo_update *sup) \
124 { \
125 sup->sup_flags &= ~(1UL << NILFS_SUINFO_UPDATE_##flag); \
126 } \
127 static inline int \
128 nilfs_suinfo_update_##name(const struct nilfs_suinfo_update *sup) \
129 { \
130 return !!(sup->sup_flags & (1UL << NILFS_SUINFO_UPDATE_##flag));\
131 }
132
133 NILFS_SUINFO_UPDATE_FNS(LASTMOD, lastmod)
134 NILFS_SUINFO_UPDATE_FNS(NBLOCKS, nblocks)
135 NILFS_SUINFO_UPDATE_FNS(FLAGS, flags)
136
137 enum {
138 NILFS_CHECKPOINT,
139 NILFS_SNAPSHOT,
140 };
141
142
143
144
145
146
147
148 struct nilfs_cpmode {
149 __u64 cm_cno;
150 __u32 cm_mode;
151 __u32 cm_pad;
152 };
153
154
155
156
157
158
159
160
161
162 struct nilfs_argv {
163 __u64 v_base;
164 __u32 v_nmembs;
165 __u16 v_size;
166 __u16 v_flags;
167 __u64 v_index;
168 };
169
170
171
172
173
174
175 struct nilfs_period {
176 __u64 p_start;
177 __u64 p_end;
178 };
179
180
181
182
183
184
185
186 struct nilfs_cpstat {
187 __u64 cs_cno;
188 __u64 cs_ncps;
189 __u64 cs_nsss;
190 };
191
192
193
194
195
196
197
198
199
200
201 struct nilfs_sustat {
202 __u64 ss_nsegs;
203 __u64 ss_ncleansegs;
204 __u64 ss_ndirtysegs;
205 __u64 ss_ctime;
206 __u64 ss_nongc_ctime;
207 __u64 ss_prot_seq;
208 };
209
210
211
212
213
214
215
216
217 struct nilfs_vinfo {
218 __u64 vi_vblocknr;
219 __u64 vi_start;
220 __u64 vi_end;
221 __u64 vi_blocknr;
222 };
223
224
225
226
227
228
229
230
231
232
233
234
235 struct nilfs_vdesc {
236 __u64 vd_ino;
237 __u64 vd_cno;
238 __u64 vd_vblocknr;
239 struct nilfs_period vd_period;
240 __u64 vd_blocknr;
241 __u64 vd_offset;
242 __u32 vd_flags;
243 __u32 vd_pad;
244 };
245
246
247
248
249
250
251
252
253
254
255 struct nilfs_bdesc {
256 __u64 bd_ino;
257 __u64 bd_oblocknr;
258 __u64 bd_blocknr;
259 __u64 bd_offset;
260 __u32 bd_level;
261 __u32 bd_pad;
262 };
263
264 #define NILFS_IOCTL_IDENT 'n'
265
266 #define NILFS_IOCTL_CHANGE_CPMODE \
267 _IOW(NILFS_IOCTL_IDENT, 0x80, struct nilfs_cpmode)
268 #define NILFS_IOCTL_DELETE_CHECKPOINT \
269 _IOW(NILFS_IOCTL_IDENT, 0x81, __u64)
270 #define NILFS_IOCTL_GET_CPINFO \
271 _IOR(NILFS_IOCTL_IDENT, 0x82, struct nilfs_argv)
272 #define NILFS_IOCTL_GET_CPSTAT \
273 _IOR(NILFS_IOCTL_IDENT, 0x83, struct nilfs_cpstat)
274 #define NILFS_IOCTL_GET_SUINFO \
275 _IOR(NILFS_IOCTL_IDENT, 0x84, struct nilfs_argv)
276 #define NILFS_IOCTL_GET_SUSTAT \
277 _IOR(NILFS_IOCTL_IDENT, 0x85, struct nilfs_sustat)
278 #define NILFS_IOCTL_GET_VINFO \
279 _IOWR(NILFS_IOCTL_IDENT, 0x86, struct nilfs_argv)
280 #define NILFS_IOCTL_GET_BDESCS \
281 _IOWR(NILFS_IOCTL_IDENT, 0x87, struct nilfs_argv)
282 #define NILFS_IOCTL_CLEAN_SEGMENTS \
283 _IOW(NILFS_IOCTL_IDENT, 0x88, struct nilfs_argv[5])
284 #define NILFS_IOCTL_SYNC \
285 _IOR(NILFS_IOCTL_IDENT, 0x8A, __u64)
286 #define NILFS_IOCTL_RESIZE \
287 _IOW(NILFS_IOCTL_IDENT, 0x8B, __u64)
288 #define NILFS_IOCTL_SET_ALLOC_RANGE \
289 _IOW(NILFS_IOCTL_IDENT, 0x8C, __u64[2])
290 #define NILFS_IOCTL_SET_SUINFO \
291 _IOW(NILFS_IOCTL_IDENT, 0x8D, struct nilfs_argv)
292
293 #endif