This source file includes following definitions.
- xfs_cred
- xfs_handle
- xfs_cache_handle
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 #ifndef _xmsg_h
37 #define _xmsg_h
38
39
40
41 #define NNPFS_VERSION 18
42
43 #include <xfs/xfs_attr.h>
44
45
46 #define MAX_XMSG_SIZE (1024*64)
47
48 typedef uint32_t xfs_pag_t;
49
50
51
52
53 typedef struct xfs_cred {
54 uint32_t uid;
55 xfs_pag_t pag;
56 } xfs_cred;
57
58 typedef uint32_t xfs_locktype_t;
59 typedef uint32_t xfs_lockid_t;
60
61
62 #define MAXHANDLE (4*4)
63 #define MAXRIGHTS 8
64
65 #define NNPFS_ANONYMOUSID 32766
66
67 typedef struct xfs_handle {
68 uint32_t a, b, c, d;
69 } xfs_handle;
70
71 #define xfs_handle_eq(p, q) \
72 ((p)->a == (q)->a && (p)->b == (q)->b && (p)->c == (q)->c && (p)->d == (q)->d)
73
74
75
76
77
78 #define CACHEHANDLESIZE 80
79
80 typedef struct xfs_cache_handle {
81 u_char data[CACHEHANDLESIZE];
82 } xfs_cache_handle;
83
84
85
86
87
88 #define NNPFS_OPEN_MASK 0x000f
89 #define NNPFS_OPEN_NR 0x0001
90 #define NNPFS_OPEN_SR 0x0002
91 #define NNPFS_OPEN_NW 0x0004
92 #define NNPFS_OPEN_EW 0x0008
93
94 #define NNPFS_ATTR_MASK 0x0030
95 #define NNPFS_ATTR_R 0x0010
96 #define NNPFS_ATTR_W 0x0020
97
98
99
100
101 #define NNPFS_DATA_MASK 0x00c0
102 #define NNPFS_DATA_R 0x0040
103 #define NNPFS_DATA_W 0x0080
104 #define NNPFS_LOCK_MASK 0x0300
105 #define NNPFS_LOCK_R 0x0100
106 #define NNPFS_LOCK_W 0x0200
107
108 #define NNPFS_ATTR_VALID NNPFS_ATTR_R
109 #define NNPFS_DATA_VALID NNPFS_DATA_W
110
111
112
113
114
115
116
117 #define NNPFS_DATA_DIRTY 0x0001
118 #define NNPFS_ATTR_DIRTY 0x0002
119 #define NNPFS_AFSDIR 0x0004
120 #define NNPFS_STALE 0x0008
121 #define NNPFS_XDELETED 0x0010
122 #define NNPFS_VMOPEN 0x0020
123
124
125
126
127
128
129
130 #define NNPFS_TOKEN_GOT(xn, tok) ((xn)->tokens & (tok))
131 #define NNPFS_TOKEN_GOT_ANY(xn, tok) ((xn)->tokens & (tok))
132 #define NNPFS_TOKEN_GOT_ALL(xn, tok) (((xn)->tokens & (tok)) == (tok))
133 #define NNPFS_TOKEN_SET(xn, tok, mask) ((xn)->tokens |= ((tok) & (mask)))
134 #define NNPFS_TOKEN_CLEAR(xn, tok, mask) ((xn)->tokens &= ~((tok) & (mask)))
135
136
137 #define NNPFS_RIGHT_R 0x01
138 #define NNPFS_RIGHT_W 0x02
139 #define NNPFS_RIGHT_X 0x04
140
141
142
143 #define NNPFS_MAX_NAME 256
144 #define NNPFS_MAX_SYMLINK_CONTENT 2048
145
146 struct xfs_msg_node {
147 xfs_handle handle;
148 uint32_t tokens;
149 uint32_t pad1;
150 struct xfs_attr attr;
151 xfs_pag_t id[MAXRIGHTS];
152 u_char rights[MAXRIGHTS];
153 u_char anonrights;
154 uint16_t pad2;
155 uint32_t pad3;
156 };
157
158
159
160
161 struct xfs_message_header {
162 uint32_t size;
163 uint32_t opcode;
164 uint32_t sequence_num;
165 uint32_t pad1;
166 };
167
168
169
170
171 enum { NNPFS_READ = 0x01,
172 NNPFS_WRITE = 0x02,
173 NNPFS_NONBLOCK = 0x04,
174 NNPFS_APPEND = 0x08,
175 NNPFS_FSYNC = 0x10};
176
177
178
179
180 enum { NNPFS_NOREFS = 1, NNPFS_DELETE = 2 };
181
182
183
184
185
186 enum { NNPFS_ID_INVALID_DNLC = 0x01, NNPFS_ID_AFSDIR = 0x02,
187 NNPFS_ID_HANDLE_VALID = 0x04 };
188
189
190
191
192 #define NNPFS_MSG_VERSION 0
193 #define NNPFS_MSG_WAKEUP 1
194
195 #define NNPFS_MSG_GETROOT 2
196 #define NNPFS_MSG_INSTALLROOT 3
197
198 #define NNPFS_MSG_GETNODE 4
199 #define NNPFS_MSG_INSTALLNODE 5
200
201 #define NNPFS_MSG_GETATTR 6
202 #define NNPFS_MSG_INSTALLATTR 7
203
204 #define NNPFS_MSG_GETDATA 8
205 #define NNPFS_MSG_INSTALLDATA 9
206
207 #define NNPFS_MSG_INACTIVENODE 10
208 #define NNPFS_MSG_INVALIDNODE 11
209
210
211 #define NNPFS_MSG_OPEN 12
212
213 #define NNPFS_MSG_PUTDATA 13
214 #define NNPFS_MSG_PUTATTR 14
215
216
217 #define NNPFS_MSG_CREATE 15
218 #define NNPFS_MSG_MKDIR 16
219 #define NNPFS_MSG_LINK 17
220 #define NNPFS_MSG_SYMLINK 18
221
222 #define NNPFS_MSG_REMOVE 19
223 #define NNPFS_MSG_RMDIR 20
224
225 #define NNPFS_MSG_RENAME 21
226
227 #define NNPFS_MSG_PIOCTL 22
228 #define NNPFS_MSG_WAKEUP_DATA 23
229
230 #define NNPFS_MSG_UPDATEFID 24
231
232 #define NNPFS_MSG_ADVLOCK 25
233
234 #define NNPFS_MSG_GC_NODES 26
235
236 #define NNPFS_MSG_COUNT 27
237
238
239 struct xfs_message_version {
240 struct xfs_message_header header;
241 uint32_t ret;
242 };
243
244
245 struct xfs_message_wakeup {
246 struct xfs_message_header header;
247 uint32_t sleepers_sequence_num;
248 uint32_t error;
249 };
250
251
252 struct xfs_message_getroot {
253 struct xfs_message_header header;
254 struct xfs_cred cred;
255 };
256
257
258 struct xfs_message_installroot {
259 struct xfs_message_header header;
260 struct xfs_msg_node node;
261 };
262
263
264 struct xfs_message_getnode {
265 struct xfs_message_header header;
266 struct xfs_cred cred;
267 xfs_handle parent_handle;
268 char name[NNPFS_MAX_NAME];
269 };
270
271
272 struct xfs_message_installnode {
273 struct xfs_message_header header;
274 xfs_handle parent_handle;
275 char name[NNPFS_MAX_NAME];
276 struct xfs_msg_node node;
277 };
278
279
280 struct xfs_message_getattr {
281 struct xfs_message_header header;
282 struct xfs_cred cred;
283 xfs_handle handle;
284 };
285
286
287 struct xfs_message_installattr {
288 struct xfs_message_header header;
289 struct xfs_msg_node node;
290 };
291
292
293 struct xfs_message_getdata {
294 struct xfs_message_header header;
295 struct xfs_cred cred;
296 xfs_handle handle;
297 uint32_t tokens;
298 uint32_t pad1;
299 uint32_t offset;
300 uint32_t pad2;
301 };
302
303
304 struct xfs_message_installdata {
305 struct xfs_message_header header;
306 struct xfs_msg_node node;
307 char cache_name[NNPFS_MAX_NAME];
308 struct xfs_cache_handle cache_handle;
309 uint32_t flag;
310 uint32_t pad1;
311 uint32_t offset;
312 uint32_t pad2;
313 };
314
315
316 struct xfs_message_inactivenode {
317 struct xfs_message_header header;
318 xfs_handle handle;
319 uint32_t flag;
320 uint32_t pad1;
321 };
322
323
324 struct xfs_message_invalidnode {
325 struct xfs_message_header header;
326 xfs_handle handle;
327 };
328
329
330 struct xfs_message_open {
331 struct xfs_message_header header;
332 struct xfs_cred cred;
333 xfs_handle handle;
334 uint32_t tokens;
335 uint32_t pad1;
336 };
337
338
339 struct xfs_message_putdata {
340 struct xfs_message_header header;
341 xfs_handle handle;
342 struct xfs_attr attr;
343 struct xfs_cred cred;
344 uint32_t flag;
345 uint32_t pad1;
346 };
347
348
349 struct xfs_message_putattr {
350 struct xfs_message_header header;
351 xfs_handle handle;
352 struct xfs_attr attr;
353 struct xfs_cred cred;
354 };
355
356
357 struct xfs_message_create {
358 struct xfs_message_header header;
359 xfs_handle parent_handle;
360 char name[NNPFS_MAX_NAME];
361 struct xfs_attr attr;
362 uint32_t mode;
363 uint32_t pad1;
364 struct xfs_cred cred;
365 };
366
367
368 struct xfs_message_mkdir {
369 struct xfs_message_header header;
370 xfs_handle parent_handle;
371 char name[NNPFS_MAX_NAME];
372 struct xfs_attr attr;
373 struct xfs_cred cred;
374 };
375
376
377 struct xfs_message_link {
378 struct xfs_message_header header;
379 xfs_handle parent_handle;
380 char name[NNPFS_MAX_NAME];
381 xfs_handle from_handle;
382 struct xfs_cred cred;
383 };
384
385
386 struct xfs_message_symlink {
387 struct xfs_message_header header;
388 xfs_handle parent_handle;
389 char name[NNPFS_MAX_NAME];
390 char contents[NNPFS_MAX_SYMLINK_CONTENT];
391 struct xfs_attr attr;
392 struct xfs_cred cred;
393 };
394
395
396 struct xfs_message_remove {
397 struct xfs_message_header header;
398 xfs_handle parent_handle;
399 char name[NNPFS_MAX_NAME];
400 struct xfs_cred cred;
401 };
402
403
404 struct xfs_message_rmdir {
405 struct xfs_message_header header;
406 xfs_handle parent_handle;
407 char name[NNPFS_MAX_NAME];
408 struct xfs_cred cred;
409 };
410
411
412 struct xfs_message_rename {
413 struct xfs_message_header header;
414 xfs_handle old_parent_handle;
415 char old_name[NNPFS_MAX_NAME];
416 xfs_handle new_parent_handle;
417 char new_name[NNPFS_MAX_NAME];
418 struct xfs_cred cred;
419 };
420
421 #define NNPFS_MSG_MAX_DATASIZE 2048
422
423
424 struct xfs_message_pioctl {
425 struct xfs_message_header header;
426 uint32_t opcode ;
427 uint32_t pad1;
428 xfs_cred cred;
429 uint32_t insize;
430 uint32_t outsize;
431 char msg[NNPFS_MSG_MAX_DATASIZE];
432 xfs_handle handle;
433 };
434
435
436
437 struct xfs_message_wakeup_data {
438 struct xfs_message_header header;
439 uint32_t sleepers_sequence_num;
440 uint32_t error;
441 uint32_t len;
442 uint32_t pad1;
443 char msg[NNPFS_MSG_MAX_DATASIZE];
444 };
445
446
447 struct xfs_message_updatefid {
448 struct xfs_message_header header;
449 xfs_handle old_handle;
450 xfs_handle new_handle;
451 };
452
453
454 struct xfs_message_advlock {
455 struct xfs_message_header header;
456 xfs_handle handle;
457 struct xfs_cred cred;
458 xfs_locktype_t locktype;
459 #define NNPFS_WR_LOCK 1
460 #define NNPFS_RD_LOCK 2
461 #define NNPFS_UN_LOCK 3
462 #define NNPFS_BR_LOCK 4
463 xfs_lockid_t lockid;
464 };
465
466
467 struct xfs_message_gc_nodes {
468 struct xfs_message_header header;
469 #define NNPFS_GC_NODES_MAX_HANDLE 50
470 uint32_t len;
471 uint32_t pad1;
472 xfs_handle handle[NNPFS_GC_NODES_MAX_HANDLE];
473 };
474
475 #if 0
476 struct xfs_name {
477 u_int16_t name;
478 char name[1];
479 };
480 #endif
481
482 struct xfs_message_bulkgetnode {
483 struct xfs_message_header header;
484 xfs_handle parent_handle;
485 uint32_t flags;
486 #define NNPFS_BGN_LAZY 0x1
487 uint32_t numnodes;
488 struct xfs_handle handles[1];
489 };
490
491 #endif