1 /*
2  * This file is auto-generated. Modifications will be lost.
3  *
4  * See https://android.googlesource.com/platform/bionic/+/master/libc/kernel/
5  * for more information.
6  */
7 #ifndef _UAPI_CODA_HEADER_
8 #define _UAPI_CODA_HEADER_
9 #if defined(__NetBSD__) || (defined(DJGPP) || defined(__CYGWIN32__)) && !defined(KERNEL)
10 #include <sys/types.h>
11 #endif
12 #ifndef CODA_MAXSYMLINKS
13 #define CODA_MAXSYMLINKS 10
14 #endif
15 #if defined(DJGPP) || defined(__CYGWIN32__)
16 #ifdef KERNEL
17 typedef unsigned long u_long;
18 typedef unsigned int u_int;
19 typedef unsigned short u_short;
20 typedef u_long ino_t;
21 typedef u_long dev_t;
22 typedef void * caddr_t;
23 #ifdef DOS
24 typedef unsigned __int64 u_quad_t;
25 #else
26 typedef unsigned long long u_quad_t;
27 #endif
28 #define inline
29 #else
30 #include <sys/time.h>
31 typedef unsigned long long u_quad_t;
32 #endif
33 #endif
34 #ifdef __linux__
35 #include <linux/time.h>
36 #define cdev_t u_quad_t
37 #if !defined(_UQUAD_T_) && (!defined(__GLIBC__) || __GLIBC__ < 2)
38 #define _UQUAD_T_ 1
39 typedef unsigned long long u_quad_t;
40 #endif
41 #else
42 #define cdev_t dev_t
43 #endif
44 #ifndef __BIT_TYPES_DEFINED__
45 #define __BIT_TYPES_DEFINED__
46 typedef signed char int8_t;
47 typedef unsigned char u_int8_t;
48 typedef short int16_t;
49 typedef unsigned short u_int16_t;
50 typedef int int32_t;
51 typedef unsigned int u_int32_t;
52 #endif
53 #define CODA_MAXNAMLEN 255
54 #define CODA_MAXPATHLEN 1024
55 #define CODA_MAXSYMLINK 10
56 #define C_O_READ 0x001
57 #define C_O_WRITE 0x002
58 #define C_O_TRUNC 0x010
59 #define C_O_EXCL 0x100
60 #define C_O_CREAT 0x200
61 #define C_M_READ 00400
62 #define C_M_WRITE 00200
63 #define C_A_C_OK 8
64 #define C_A_R_OK 4
65 #define C_A_W_OK 2
66 #define C_A_X_OK 1
67 #define C_A_F_OK 0
68 #ifndef _VENUS_DIRENT_T_
69 #define _VENUS_DIRENT_T_ 1
70 struct venus_dirent {
71   u_int32_t d_fileno;
72   u_int16_t d_reclen;
73   u_int8_t d_type;
74   u_int8_t d_namlen;
75   char d_name[CODA_MAXNAMLEN + 1];
76 };
77 #undef DIRSIZ
78 #define DIRSIZ(dp) ((sizeof(struct venus_dirent) - (CODA_MAXNAMLEN + 1)) + (((dp)->d_namlen + 1 + 3) & ~3))
79 #define CDT_UNKNOWN 0
80 #define CDT_FIFO 1
81 #define CDT_CHR 2
82 #define CDT_DIR 4
83 #define CDT_BLK 6
84 #define CDT_REG 8
85 #define CDT_LNK 10
86 #define CDT_SOCK 12
87 #define CDT_WHT 14
88 #define IFTOCDT(mode) (((mode) & 0170000) >> 12)
89 #define CDTTOIF(dirtype) ((dirtype) << 12)
90 #endif
91 #ifndef _VUID_T_
92 #define _VUID_T_
93 typedef u_int32_t vuid_t;
94 typedef u_int32_t vgid_t;
95 #endif
96 struct CodaFid {
97   u_int32_t opaque[4];
98 };
99 #define coda_f2i(fid) (fid ? (fid->opaque[3] ^ (fid->opaque[2] << 10) ^ (fid->opaque[1] << 20) ^ fid->opaque[0]) : 0)
100 #ifndef _VENUS_VATTR_T_
101 #define _VENUS_VATTR_T_
102 enum coda_vtype {
103   C_VNON,
104   C_VREG,
105   C_VDIR,
106   C_VBLK,
107   C_VCHR,
108   C_VLNK,
109   C_VSOCK,
110   C_VFIFO,
111   C_VBAD
112 };
113 struct coda_timespec {
114   int64_t tv_sec;
115   long tv_nsec;
116 };
117 struct coda_vattr {
118   long va_type;
119   u_short va_mode;
120   short va_nlink;
121   vuid_t va_uid;
122   vgid_t va_gid;
123   long va_fileid;
124   u_quad_t va_size;
125   long va_blocksize;
126   struct coda_timespec va_atime;
127   struct coda_timespec va_mtime;
128   struct coda_timespec va_ctime;
129   u_long va_gen;
130   u_long va_flags;
131   cdev_t va_rdev;
132   u_quad_t va_bytes;
133   u_quad_t va_filerev;
134 };
135 #endif
136 struct coda_statfs {
137   int32_t f_blocks;
138   int32_t f_bfree;
139   int32_t f_bavail;
140   int32_t f_files;
141   int32_t f_ffree;
142 };
143 #define CODA_ROOT 2
144 #define CODA_OPEN_BY_FD 3
145 #define CODA_OPEN 4
146 #define CODA_CLOSE 5
147 #define CODA_IOCTL 6
148 #define CODA_GETATTR 7
149 #define CODA_SETATTR 8
150 #define CODA_ACCESS 9
151 #define CODA_LOOKUP 10
152 #define CODA_CREATE 11
153 #define CODA_REMOVE 12
154 #define CODA_LINK 13
155 #define CODA_RENAME 14
156 #define CODA_MKDIR 15
157 #define CODA_RMDIR 16
158 #define CODA_SYMLINK 18
159 #define CODA_READLINK 19
160 #define CODA_FSYNC 20
161 #define CODA_VGET 22
162 #define CODA_SIGNAL 23
163 #define CODA_REPLACE 24
164 #define CODA_FLUSH 25
165 #define CODA_PURGEUSER 26
166 #define CODA_ZAPFILE 27
167 #define CODA_ZAPDIR 28
168 #define CODA_PURGEFID 30
169 #define CODA_OPEN_BY_PATH 31
170 #define CODA_RESOLVE 32
171 #define CODA_REINTEGRATE 33
172 #define CODA_STATFS 34
173 #define CODA_STORE 35
174 #define CODA_RELEASE 36
175 #define CODA_ACCESS_INTENT 37
176 #define CODA_NCALLS 38
177 #define DOWNCALL(opcode) (opcode >= CODA_REPLACE && opcode <= CODA_PURGEFID)
178 #define VC_MAXDATASIZE 8192
179 #define VC_MAXMSGSIZE sizeof(union inputArgs) + sizeof(union outputArgs) + VC_MAXDATASIZE
180 #define CIOC_KERNEL_VERSION _IOWR('c', 10, size_t)
181 #define CODA_KERNEL_VERSION 5
182 struct coda_in_hdr {
183   u_int32_t opcode;
184   u_int32_t unique;
185   __kernel_pid_t pid;
186   __kernel_pid_t pgid;
187   vuid_t uid;
188 };
189 struct coda_out_hdr {
190   u_int32_t opcode;
191   u_int32_t unique;
192   u_int32_t result;
193 };
194 struct coda_root_out {
195   struct coda_out_hdr oh;
196   struct CodaFid VFid;
197 };
198 struct coda_root_in {
199   struct coda_in_hdr in;
200 };
201 struct coda_open_in {
202   struct coda_in_hdr ih;
203   struct CodaFid VFid;
204   int flags;
205 };
206 struct coda_open_out {
207   struct coda_out_hdr oh;
208   cdev_t dev;
209   ino_t inode;
210 };
211 struct coda_store_in {
212   struct coda_in_hdr ih;
213   struct CodaFid VFid;
214   int flags;
215 };
216 struct coda_store_out {
217   struct coda_out_hdr out;
218 };
219 struct coda_release_in {
220   struct coda_in_hdr ih;
221   struct CodaFid VFid;
222   int flags;
223 };
224 struct coda_release_out {
225   struct coda_out_hdr out;
226 };
227 struct coda_close_in {
228   struct coda_in_hdr ih;
229   struct CodaFid VFid;
230   int flags;
231 };
232 struct coda_close_out {
233   struct coda_out_hdr out;
234 };
235 struct coda_ioctl_in {
236   struct coda_in_hdr ih;
237   struct CodaFid VFid;
238   int cmd;
239   int len;
240   int rwflag;
241   char * data;
242 };
243 struct coda_ioctl_out {
244   struct coda_out_hdr oh;
245   int len;
246   caddr_t data;
247 };
248 struct coda_getattr_in {
249   struct coda_in_hdr ih;
250   struct CodaFid VFid;
251 };
252 struct coda_getattr_out {
253   struct coda_out_hdr oh;
254   struct coda_vattr attr;
255 };
256 struct coda_setattr_in {
257   struct coda_in_hdr ih;
258   struct CodaFid VFid;
259   struct coda_vattr attr;
260 };
261 struct coda_setattr_out {
262   struct coda_out_hdr out;
263 };
264 struct coda_access_in {
265   struct coda_in_hdr ih;
266   struct CodaFid VFid;
267   int flags;
268 };
269 struct coda_access_out {
270   struct coda_out_hdr out;
271 };
272 #define CLU_CASE_SENSITIVE 0x01
273 #define CLU_CASE_INSENSITIVE 0x02
274 struct coda_lookup_in {
275   struct coda_in_hdr ih;
276   struct CodaFid VFid;
277   int name;
278   int flags;
279 };
280 struct coda_lookup_out {
281   struct coda_out_hdr oh;
282   struct CodaFid VFid;
283   int vtype;
284 };
285 struct coda_create_in {
286   struct coda_in_hdr ih;
287   struct CodaFid VFid;
288   struct coda_vattr attr;
289   int excl;
290   int mode;
291   int name;
292 };
293 struct coda_create_out {
294   struct coda_out_hdr oh;
295   struct CodaFid VFid;
296   struct coda_vattr attr;
297 };
298 struct coda_remove_in {
299   struct coda_in_hdr ih;
300   struct CodaFid VFid;
301   int name;
302 };
303 struct coda_remove_out {
304   struct coda_out_hdr out;
305 };
306 struct coda_link_in {
307   struct coda_in_hdr ih;
308   struct CodaFid sourceFid;
309   struct CodaFid destFid;
310   int tname;
311 };
312 struct coda_link_out {
313   struct coda_out_hdr out;
314 };
315 struct coda_rename_in {
316   struct coda_in_hdr ih;
317   struct CodaFid sourceFid;
318   int srcname;
319   struct CodaFid destFid;
320   int destname;
321 };
322 struct coda_rename_out {
323   struct coda_out_hdr out;
324 };
325 struct coda_mkdir_in {
326   struct coda_in_hdr ih;
327   struct CodaFid VFid;
328   struct coda_vattr attr;
329   int name;
330 };
331 struct coda_mkdir_out {
332   struct coda_out_hdr oh;
333   struct CodaFid VFid;
334   struct coda_vattr attr;
335 };
336 struct coda_rmdir_in {
337   struct coda_in_hdr ih;
338   struct CodaFid VFid;
339   int name;
340 };
341 struct coda_rmdir_out {
342   struct coda_out_hdr out;
343 };
344 struct coda_symlink_in {
345   struct coda_in_hdr ih;
346   struct CodaFid VFid;
347   int srcname;
348   struct coda_vattr attr;
349   int tname;
350 };
351 struct coda_symlink_out {
352   struct coda_out_hdr out;
353 };
354 struct coda_readlink_in {
355   struct coda_in_hdr ih;
356   struct CodaFid VFid;
357 };
358 struct coda_readlink_out {
359   struct coda_out_hdr oh;
360   int count;
361   caddr_t data;
362 };
363 struct coda_fsync_in {
364   struct coda_in_hdr ih;
365   struct CodaFid VFid;
366 };
367 struct coda_fsync_out {
368   struct coda_out_hdr out;
369 };
370 struct coda_vget_in {
371   struct coda_in_hdr ih;
372   struct CodaFid VFid;
373 };
374 struct coda_vget_out {
375   struct coda_out_hdr oh;
376   struct CodaFid VFid;
377   int vtype;
378 };
379 struct coda_purgeuser_out {
380   struct coda_out_hdr oh;
381   vuid_t uid;
382 };
383 struct coda_zapfile_out {
384   struct coda_out_hdr oh;
385   struct CodaFid CodaFid;
386 };
387 struct coda_zapdir_out {
388   struct coda_out_hdr oh;
389   struct CodaFid CodaFid;
390 };
391 struct coda_purgefid_out {
392   struct coda_out_hdr oh;
393   struct CodaFid CodaFid;
394 };
395 struct coda_replace_out {
396   struct coda_out_hdr oh;
397   struct CodaFid NewFid;
398   struct CodaFid OldFid;
399 };
400 struct coda_open_by_fd_in {
401   struct coda_in_hdr ih;
402   struct CodaFid VFid;
403   int flags;
404 };
405 struct coda_open_by_fd_out {
406   struct coda_out_hdr oh;
407   int fd;
408 };
409 struct coda_open_by_path_in {
410   struct coda_in_hdr ih;
411   struct CodaFid VFid;
412   int flags;
413 };
414 struct coda_open_by_path_out {
415   struct coda_out_hdr oh;
416   int path;
417 };
418 struct coda_statfs_in {
419   struct coda_in_hdr in;
420 };
421 struct coda_statfs_out {
422   struct coda_out_hdr oh;
423   struct coda_statfs stat;
424 };
425 #define CODA_ACCESS_TYPE_READ 1
426 #define CODA_ACCESS_TYPE_WRITE 2
427 #define CODA_ACCESS_TYPE_MMAP 3
428 #define CODA_ACCESS_TYPE_READ_FINISH 4
429 #define CODA_ACCESS_TYPE_WRITE_FINISH 5
430 struct coda_access_intent_in {
431   struct coda_in_hdr ih;
432   struct CodaFid VFid;
433   int count;
434   int pos;
435   int type;
436 };
437 struct coda_access_intent_out {
438   struct coda_out_hdr out;
439 };
440 #define CODA_NOCACHE 0x80000000
441 union inputArgs {
442   struct coda_in_hdr ih;
443   struct coda_open_in coda_open;
444   struct coda_store_in coda_store;
445   struct coda_release_in coda_release;
446   struct coda_close_in coda_close;
447   struct coda_ioctl_in coda_ioctl;
448   struct coda_getattr_in coda_getattr;
449   struct coda_setattr_in coda_setattr;
450   struct coda_access_in coda_access;
451   struct coda_lookup_in coda_lookup;
452   struct coda_create_in coda_create;
453   struct coda_remove_in coda_remove;
454   struct coda_link_in coda_link;
455   struct coda_rename_in coda_rename;
456   struct coda_mkdir_in coda_mkdir;
457   struct coda_rmdir_in coda_rmdir;
458   struct coda_symlink_in coda_symlink;
459   struct coda_readlink_in coda_readlink;
460   struct coda_fsync_in coda_fsync;
461   struct coda_vget_in coda_vget;
462   struct coda_open_by_fd_in coda_open_by_fd;
463   struct coda_open_by_path_in coda_open_by_path;
464   struct coda_statfs_in coda_statfs;
465   struct coda_access_intent_in coda_access_intent;
466 };
467 union outputArgs {
468   struct coda_out_hdr oh;
469   struct coda_root_out coda_root;
470   struct coda_open_out coda_open;
471   struct coda_ioctl_out coda_ioctl;
472   struct coda_getattr_out coda_getattr;
473   struct coda_lookup_out coda_lookup;
474   struct coda_create_out coda_create;
475   struct coda_mkdir_out coda_mkdir;
476   struct coda_readlink_out coda_readlink;
477   struct coda_vget_out coda_vget;
478   struct coda_purgeuser_out coda_purgeuser;
479   struct coda_zapfile_out coda_zapfile;
480   struct coda_zapdir_out coda_zapdir;
481   struct coda_purgefid_out coda_purgefid;
482   struct coda_replace_out coda_replace;
483   struct coda_open_by_fd_out coda_open_by_fd;
484   struct coda_open_by_path_out coda_open_by_path;
485   struct coda_statfs_out coda_statfs;
486 };
487 union coda_downcalls {
488   struct coda_purgeuser_out purgeuser;
489   struct coda_zapfile_out zapfile;
490   struct coda_zapdir_out zapdir;
491   struct coda_purgefid_out purgefid;
492   struct coda_replace_out replace;
493 };
494 #define PIOCPARM_MASK 0x0000ffff
495 struct ViceIoctl {
496   void  * in;
497   void  * out;
498   u_short in_size;
499   u_short out_size;
500 };
501 struct PioctlData {
502   const char  * path;
503   int follow;
504   struct ViceIoctl vi;
505 };
506 #define CODA_CONTROL ".CONTROL"
507 #define CODA_CONTROLLEN 8
508 #define CTL_INO - 1
509 #define CODA_MOUNT_VERSION 1
510 struct coda_mount_data {
511   int version;
512   int fd;
513 };
514 #endif
515