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