xref: /linux/include/uapi/linux/coda.h (revision 0898782247ae533d1f4e47a06bc5d4870931b284)
1607ca46eSDavid Howells /*
2607ca46eSDavid Howells    You may distribute this file under either of the two licenses that
3607ca46eSDavid Howells    follow at your discretion.
4607ca46eSDavid Howells */
5607ca46eSDavid Howells 
6607ca46eSDavid Howells /* BLURB lgpl
7607ca46eSDavid Howells 
8607ca46eSDavid Howells                            Coda File System
9607ca46eSDavid Howells                               Release 5
10607ca46eSDavid Howells 
11607ca46eSDavid Howells           Copyright (c) 1987-1999 Carnegie Mellon University
12607ca46eSDavid Howells                   Additional copyrights listed below
13607ca46eSDavid Howells 
14607ca46eSDavid Howells This code is distributed "AS IS" without warranty of any kind under
15607ca46eSDavid Howells the terms of the GNU Library General Public Licence Version 2, as
16607ca46eSDavid Howells shown in the file LICENSE, or under the license shown below. The
17607ca46eSDavid Howells technical and financial contributors to Coda are listed in the file
18607ca46eSDavid Howells CREDITS.
19607ca46eSDavid Howells 
20607ca46eSDavid Howells                         Additional copyrights
21607ca46eSDavid Howells */
22607ca46eSDavid Howells 
23607ca46eSDavid Howells /*
24607ca46eSDavid Howells 
25607ca46eSDavid Howells             Coda: an Experimental Distributed File System
26607ca46eSDavid Howells                              Release 4.0
27607ca46eSDavid Howells 
28607ca46eSDavid Howells           Copyright (c) 1987-1999 Carnegie Mellon University
29607ca46eSDavid Howells                          All Rights Reserved
30607ca46eSDavid Howells 
31607ca46eSDavid Howells Permission  to  use, copy, modify and distribute this software and its
32607ca46eSDavid Howells documentation is hereby granted,  provided  that  both  the  copyright
33607ca46eSDavid Howells notice  and  this  permission  notice  appear  in  all  copies  of the
34607ca46eSDavid Howells software, derivative works or  modified  versions,  and  any  portions
35607ca46eSDavid Howells thereof, and that both notices appear in supporting documentation, and
36607ca46eSDavid Howells that credit is given to Carnegie Mellon University  in  all  documents
37607ca46eSDavid Howells and publicity pertaining to direct or indirect use of this code or its
38607ca46eSDavid Howells derivatives.
39607ca46eSDavid Howells 
40607ca46eSDavid Howells CODA IS AN EXPERIMENTAL SOFTWARE SYSTEM AND IS  KNOWN  TO  HAVE  BUGS,
41607ca46eSDavid Howells SOME  OF  WHICH MAY HAVE SERIOUS CONSEQUENCES.  CARNEGIE MELLON ALLOWS
42607ca46eSDavid Howells FREE USE OF THIS SOFTWARE IN ITS "AS IS" CONDITION.   CARNEGIE  MELLON
43607ca46eSDavid Howells DISCLAIMS  ANY  LIABILITY  OF  ANY  KIND  FOR  ANY  DAMAGES WHATSOEVER
44607ca46eSDavid Howells RESULTING DIRECTLY OR INDIRECTLY FROM THE USE OF THIS SOFTWARE  OR  OF
45607ca46eSDavid Howells ANY DERIVATIVE WORK.
46607ca46eSDavid Howells 
47607ca46eSDavid Howells Carnegie  Mellon  encourages  users  of  this  software  to return any
48607ca46eSDavid Howells improvements or extensions that  they  make,  and  to  grant  Carnegie
49607ca46eSDavid Howells Mellon the rights to redistribute these changes without encumbrance.
50607ca46eSDavid Howells */
51607ca46eSDavid Howells 
52607ca46eSDavid Howells /*
53607ca46eSDavid Howells  *
54607ca46eSDavid Howells  * Based on cfs.h from Mach, but revamped for increased simplicity.
55607ca46eSDavid Howells  * Linux modifications by
56607ca46eSDavid Howells  * Peter Braam, Aug 1996
57607ca46eSDavid Howells  */
58607ca46eSDavid Howells 
59607ca46eSDavid Howells #ifndef _UAPI_CODA_HEADER_
60607ca46eSDavid Howells #define _UAPI_CODA_HEADER_
61607ca46eSDavid Howells 
62607ca46eSDavid Howells 
63607ca46eSDavid Howells /* Catch new _KERNEL defn for NetBSD and DJGPP/__CYGWIN32__ */
64607ca46eSDavid Howells #if defined(__NetBSD__) || \
65607ca46eSDavid Howells   ((defined(DJGPP) || defined(__CYGWIN32__)) && !defined(KERNEL))
66607ca46eSDavid Howells #include <sys/types.h>
67607ca46eSDavid Howells #endif
68607ca46eSDavid Howells 
69607ca46eSDavid Howells #ifndef CODA_MAXSYMLINKS
70607ca46eSDavid Howells #define CODA_MAXSYMLINKS 10
71607ca46eSDavid Howells #endif
72607ca46eSDavid Howells 
73607ca46eSDavid Howells #if defined(DJGPP) || defined(__CYGWIN32__)
74607ca46eSDavid Howells #ifdef KERNEL
75607ca46eSDavid Howells typedef unsigned long u_long;
76607ca46eSDavid Howells typedef unsigned int u_int;
77607ca46eSDavid Howells typedef unsigned short u_short;
78607ca46eSDavid Howells typedef u_long ino_t;
79607ca46eSDavid Howells typedef u_long dev_t;
80607ca46eSDavid Howells typedef void * caddr_t;
81607ca46eSDavid Howells #ifdef DOS
82607ca46eSDavid Howells typedef unsigned __int64 u_quad_t;
83607ca46eSDavid Howells #else
84607ca46eSDavid Howells typedef unsigned long long u_quad_t;
85607ca46eSDavid Howells #endif
86607ca46eSDavid Howells 
87607ca46eSDavid Howells #define inline
88607ca46eSDavid Howells 
89607ca46eSDavid Howells #else  /* DJGPP but not KERNEL */
90607ca46eSDavid Howells #include <sys/time.h>
91607ca46eSDavid Howells typedef unsigned long long u_quad_t;
92607ca46eSDavid Howells #endif /* !KERNEL */
93607ca46eSDavid Howells #endif /* !DJGPP */
94607ca46eSDavid Howells 
95607ca46eSDavid Howells 
96607ca46eSDavid Howells #if defined(__linux__)
97607ca46eSDavid Howells #include <linux/time.h>
98607ca46eSDavid Howells #define cdev_t u_quad_t
99607ca46eSDavid Howells #ifndef __KERNEL__
100607ca46eSDavid Howells #if !defined(_UQUAD_T_) && (!defined(__GLIBC__) || __GLIBC__ < 2)
101607ca46eSDavid Howells #define _UQUAD_T_ 1
102607ca46eSDavid Howells typedef unsigned long long u_quad_t;
103607ca46eSDavid Howells #endif
104607ca46eSDavid Howells #endif /* __KERNEL__ */
105607ca46eSDavid Howells #else
106607ca46eSDavid Howells #define cdev_t dev_t
107607ca46eSDavid Howells #endif
108607ca46eSDavid Howells 
109607ca46eSDavid Howells #ifndef __BIT_TYPES_DEFINED__
110607ca46eSDavid Howells #define __BIT_TYPES_DEFINED__
111607ca46eSDavid Howells typedef signed char	      int8_t;
112607ca46eSDavid Howells typedef unsigned char	    u_int8_t;
113607ca46eSDavid Howells typedef short		     int16_t;
114607ca46eSDavid Howells typedef unsigned short	   u_int16_t;
115607ca46eSDavid Howells typedef int		     int32_t;
116607ca46eSDavid Howells typedef unsigned int	   u_int32_t;
117607ca46eSDavid Howells #endif
118607ca46eSDavid Howells 
119607ca46eSDavid Howells 
120607ca46eSDavid Howells /*
121607ca46eSDavid Howells  * Cfs constants
122607ca46eSDavid Howells  */
123607ca46eSDavid Howells #define CODA_MAXNAMLEN   255
124607ca46eSDavid Howells #define CODA_MAXPATHLEN  1024
125607ca46eSDavid Howells #define CODA_MAXSYMLINK  10
126607ca46eSDavid Howells 
127607ca46eSDavid Howells /* these are Coda's version of O_RDONLY etc combinations
128607ca46eSDavid Howells  * to deal with VFS open modes
129607ca46eSDavid Howells  */
130607ca46eSDavid Howells #define	C_O_READ	0x001
131607ca46eSDavid Howells #define	C_O_WRITE       0x002
132607ca46eSDavid Howells #define C_O_TRUNC       0x010
133607ca46eSDavid Howells #define C_O_EXCL	0x100
134607ca46eSDavid Howells #define C_O_CREAT	0x200
135607ca46eSDavid Howells 
136607ca46eSDavid Howells /* these are to find mode bits in Venus */
137607ca46eSDavid Howells #define C_M_READ  00400
138607ca46eSDavid Howells #define C_M_WRITE 00200
139607ca46eSDavid Howells 
140607ca46eSDavid Howells /* for access Venus will use */
141607ca46eSDavid Howells #define C_A_C_OK    8               /* Test for writing upon create.  */
142607ca46eSDavid Howells #define C_A_R_OK    4               /* Test for read permission.  */
143607ca46eSDavid Howells #define C_A_W_OK    2               /* Test for write permission.  */
144607ca46eSDavid Howells #define C_A_X_OK    1               /* Test for execute permission.  */
145607ca46eSDavid Howells #define C_A_F_OK    0               /* Test for existence.  */
146607ca46eSDavid Howells 
147607ca46eSDavid Howells 
148607ca46eSDavid Howells 
149607ca46eSDavid Howells #ifndef _VENUS_DIRENT_T_
150607ca46eSDavid Howells #define _VENUS_DIRENT_T_ 1
151607ca46eSDavid Howells struct venus_dirent {
152607ca46eSDavid Howells         u_int32_t d_fileno;		/* file number of entry */
153607ca46eSDavid Howells         u_int16_t d_reclen;		/* length of this record */
154607ca46eSDavid Howells         u_int8_t  d_type;			/* file type, see below */
155607ca46eSDavid Howells         u_int8_t  d_namlen;		/* length of string in d_name */
156607ca46eSDavid Howells         char	  d_name[CODA_MAXNAMLEN + 1];/* name must be no longer than this */
157607ca46eSDavid Howells };
158607ca46eSDavid Howells #undef DIRSIZ
159607ca46eSDavid Howells #define DIRSIZ(dp)      ((sizeof (struct venus_dirent) - (CODA_MAXNAMLEN+1)) + \
160607ca46eSDavid Howells                          (((dp)->d_namlen+1 + 3) &~ 3))
161607ca46eSDavid Howells 
162607ca46eSDavid Howells /*
163607ca46eSDavid Howells  * File types
164607ca46eSDavid Howells  */
165607ca46eSDavid Howells #define	CDT_UNKNOWN	 0
166607ca46eSDavid Howells #define	CDT_FIFO	 1
167607ca46eSDavid Howells #define	CDT_CHR		 2
168607ca46eSDavid Howells #define	CDT_DIR		 4
169607ca46eSDavid Howells #define	CDT_BLK		 6
170607ca46eSDavid Howells #define	CDT_REG		 8
171607ca46eSDavid Howells #define	CDT_LNK		10
172607ca46eSDavid Howells #define	CDT_SOCK	12
173607ca46eSDavid Howells #define	CDT_WHT		14
174607ca46eSDavid Howells 
175607ca46eSDavid Howells /*
176607ca46eSDavid Howells  * Convert between stat structure types and directory types.
177607ca46eSDavid Howells  */
178607ca46eSDavid Howells #define	IFTOCDT(mode)	(((mode) & 0170000) >> 12)
179607ca46eSDavid Howells #define	CDTTOIF(dirtype)	((dirtype) << 12)
180607ca46eSDavid Howells 
181607ca46eSDavid Howells #endif
182607ca46eSDavid Howells 
183607ca46eSDavid Howells #ifndef _VUID_T_
184607ca46eSDavid Howells #define _VUID_T_
185607ca46eSDavid Howells typedef u_int32_t vuid_t;
186607ca46eSDavid Howells typedef u_int32_t vgid_t;
187607ca46eSDavid Howells #endif /*_VUID_T_ */
188607ca46eSDavid Howells 
189607ca46eSDavid Howells struct CodaFid {
190607ca46eSDavid Howells 	u_int32_t opaque[4];
191607ca46eSDavid Howells };
192607ca46eSDavid Howells 
193607ca46eSDavid Howells #define coda_f2i(fid)\
194607ca46eSDavid Howells 	(fid ? (fid->opaque[3] ^ (fid->opaque[2]<<10) ^ (fid->opaque[1]<<20) ^ fid->opaque[0]) : 0)
195607ca46eSDavid Howells 
196607ca46eSDavid Howells #ifndef _VENUS_VATTR_T_
197607ca46eSDavid Howells #define _VENUS_VATTR_T_
198607ca46eSDavid Howells /*
199607ca46eSDavid Howells  * Vnode types.  VNON means no type.
200607ca46eSDavid Howells  */
201607ca46eSDavid Howells enum coda_vtype	{ C_VNON, C_VREG, C_VDIR, C_VBLK, C_VCHR, C_VLNK, C_VSOCK, C_VFIFO, C_VBAD };
202607ca46eSDavid Howells 
2035e7c31dfSJan Harkes struct coda_timespec {
2045e7c31dfSJan Harkes 	int64_t		tv_sec;		/* seconds */
2056ced9aa7SArnd Bergmann 	long		tv_nsec;	/* nanoseconds */
2066ced9aa7SArnd Bergmann };
2076ced9aa7SArnd Bergmann 
208607ca46eSDavid Howells struct coda_vattr {
209607ca46eSDavid Howells 	long     	va_type;	/* vnode type (for create) */
210607ca46eSDavid Howells 	u_short		va_mode;	/* files access mode and type */
211607ca46eSDavid Howells 	short		va_nlink;	/* number of references to file */
212607ca46eSDavid Howells 	vuid_t		va_uid;		/* owner user id */
213607ca46eSDavid Howells 	vgid_t		va_gid;		/* owner group id */
214607ca46eSDavid Howells 	long		va_fileid;	/* file id */
215607ca46eSDavid Howells 	u_quad_t	va_size;	/* file size in bytes */
216607ca46eSDavid Howells 	long		va_blocksize;	/* blocksize preferred for i/o */
2175e7c31dfSJan Harkes 	struct coda_timespec va_atime;	/* time of last access */
2185e7c31dfSJan Harkes 	struct coda_timespec va_mtime;	/* time of last modification */
2195e7c31dfSJan Harkes 	struct coda_timespec va_ctime;	/* time file changed */
220607ca46eSDavid Howells 	u_long		va_gen;		/* generation number of file */
221607ca46eSDavid Howells 	u_long		va_flags;	/* flags defined for file */
222607ca46eSDavid Howells 	cdev_t	        va_rdev;	/* device special file represents */
223607ca46eSDavid Howells 	u_quad_t	va_bytes;	/* bytes of disk space held by file */
224607ca46eSDavid Howells 	u_quad_t	va_filerev;	/* file modification number */
225607ca46eSDavid Howells };
226607ca46eSDavid Howells 
227607ca46eSDavid Howells #endif
228607ca46eSDavid Howells 
229607ca46eSDavid Howells /* structure used by CODA_STATFS for getting cache information from venus */
230607ca46eSDavid Howells struct coda_statfs {
231607ca46eSDavid Howells     int32_t f_blocks;
232607ca46eSDavid Howells     int32_t f_bfree;
233607ca46eSDavid Howells     int32_t f_bavail;
234607ca46eSDavid Howells     int32_t f_files;
235607ca46eSDavid Howells     int32_t f_ffree;
236607ca46eSDavid Howells };
237607ca46eSDavid Howells 
238607ca46eSDavid Howells /*
239607ca46eSDavid Howells  * Kernel <--> Venus communications.
240607ca46eSDavid Howells  */
241607ca46eSDavid Howells 
242607ca46eSDavid Howells #define CODA_ROOT	2
243607ca46eSDavid Howells #define CODA_OPEN_BY_FD	3
244607ca46eSDavid Howells #define CODA_OPEN	4
245607ca46eSDavid Howells #define CODA_CLOSE	5
246607ca46eSDavid Howells #define CODA_IOCTL	6
247607ca46eSDavid Howells #define CODA_GETATTR	7
248607ca46eSDavid Howells #define CODA_SETATTR	8
249607ca46eSDavid Howells #define CODA_ACCESS	9
250607ca46eSDavid Howells #define CODA_LOOKUP	10
251607ca46eSDavid Howells #define CODA_CREATE	11
252607ca46eSDavid Howells #define CODA_REMOVE	12
253607ca46eSDavid Howells #define CODA_LINK	13
254607ca46eSDavid Howells #define CODA_RENAME	14
255607ca46eSDavid Howells #define CODA_MKDIR	15
256607ca46eSDavid Howells #define CODA_RMDIR	16
257607ca46eSDavid Howells #define CODA_SYMLINK	18
258607ca46eSDavid Howells #define CODA_READLINK	19
259607ca46eSDavid Howells #define CODA_FSYNC	20
260607ca46eSDavid Howells #define CODA_VGET	22
261607ca46eSDavid Howells #define CODA_SIGNAL	23
262607ca46eSDavid Howells #define CODA_REPLACE	 24 /* DOWNCALL */
263607ca46eSDavid Howells #define CODA_FLUSH       25 /* DOWNCALL */
264607ca46eSDavid Howells #define CODA_PURGEUSER   26 /* DOWNCALL */
265607ca46eSDavid Howells #define CODA_ZAPFILE     27 /* DOWNCALL */
266607ca46eSDavid Howells #define CODA_ZAPDIR      28 /* DOWNCALL */
267607ca46eSDavid Howells #define CODA_PURGEFID    30 /* DOWNCALL */
268607ca46eSDavid Howells #define CODA_OPEN_BY_PATH 31
269607ca46eSDavid Howells #define CODA_RESOLVE     32
270607ca46eSDavid Howells #define CODA_REINTEGRATE 33
271607ca46eSDavid Howells #define CODA_STATFS	 34
272607ca46eSDavid Howells #define CODA_STORE	 35
273607ca46eSDavid Howells #define CODA_RELEASE	 36
274*a9fba24cSPedro Cuadra #define CODA_ACCESS_INTENT 37
275*a9fba24cSPedro Cuadra #define CODA_NCALLS 38
276607ca46eSDavid Howells 
277607ca46eSDavid Howells #define DOWNCALL(opcode) (opcode >= CODA_REPLACE && opcode <= CODA_PURGEFID)
278607ca46eSDavid Howells 
279607ca46eSDavid Howells #define VC_MAXDATASIZE	    8192
280607ca46eSDavid Howells #define VC_MAXMSGSIZE      sizeof(union inputArgs)+sizeof(union outputArgs) +\
281607ca46eSDavid Howells                             VC_MAXDATASIZE
282607ca46eSDavid Howells 
283607ca46eSDavid Howells #define CIOC_KERNEL_VERSION _IOWR('c', 10, size_t)
284607ca46eSDavid Howells 
285*a9fba24cSPedro Cuadra //      CODA_KERNEL_VERSION 0 /* don't care about kernel version number */
286*a9fba24cSPedro Cuadra //      CODA_KERNEL_VERSION 1 /* The old venus 4.6 compatible interface */
287*a9fba24cSPedro Cuadra //      CODA_KERNEL_VERSION 2 /* venus_lookup gets an extra parameter */
2885e7c31dfSJan Harkes //      CODA_KERNEL_VERSION 3 /* 128-bit file identifiers */
289*a9fba24cSPedro Cuadra //      CODA_KERNEL_VERSION 4 /* 64-bit timespec */
290*a9fba24cSPedro Cuadra #define CODA_KERNEL_VERSION 5 /* access intent support */
291607ca46eSDavid Howells 
292607ca46eSDavid Howells /*
293607ca46eSDavid Howells  *        Venus <-> Coda  RPC arguments
294607ca46eSDavid Howells  */
295607ca46eSDavid Howells struct coda_in_hdr {
296607ca46eSDavid Howells     u_int32_t opcode;
297607ca46eSDavid Howells     u_int32_t unique;	    /* Keep multiple outstanding msgs distinct */
298694a58e2SMikko Rapeli     __kernel_pid_t pid;
299694a58e2SMikko Rapeli     __kernel_pid_t pgid;
300607ca46eSDavid Howells     vuid_t uid;
301607ca46eSDavid Howells };
302607ca46eSDavid Howells 
303607ca46eSDavid Howells /* Really important that opcode and unique are 1st two fields! */
304607ca46eSDavid Howells struct coda_out_hdr {
305607ca46eSDavid Howells     u_int32_t opcode;
306607ca46eSDavid Howells     u_int32_t unique;
307607ca46eSDavid Howells     u_int32_t result;
308607ca46eSDavid Howells };
309607ca46eSDavid Howells 
310607ca46eSDavid Howells /* coda_root: NO_IN */
311607ca46eSDavid Howells struct coda_root_out {
312607ca46eSDavid Howells     struct coda_out_hdr oh;
313607ca46eSDavid Howells     struct CodaFid VFid;
314607ca46eSDavid Howells };
315607ca46eSDavid Howells 
316607ca46eSDavid Howells struct coda_root_in {
317607ca46eSDavid Howells     struct coda_in_hdr in;
318607ca46eSDavid Howells };
319607ca46eSDavid Howells 
320607ca46eSDavid Howells /* coda_open: */
321607ca46eSDavid Howells struct coda_open_in {
322607ca46eSDavid Howells     struct coda_in_hdr ih;
323607ca46eSDavid Howells     struct CodaFid VFid;
324607ca46eSDavid Howells     int	flags;
325607ca46eSDavid Howells };
326607ca46eSDavid Howells 
327607ca46eSDavid Howells struct coda_open_out {
328607ca46eSDavid Howells     struct coda_out_hdr oh;
329607ca46eSDavid Howells     cdev_t	dev;
330607ca46eSDavid Howells     ino_t	inode;
331607ca46eSDavid Howells };
332607ca46eSDavid Howells 
333607ca46eSDavid Howells 
334607ca46eSDavid Howells /* coda_store: */
335607ca46eSDavid Howells struct coda_store_in {
336607ca46eSDavid Howells     struct coda_in_hdr ih;
337607ca46eSDavid Howells     struct CodaFid VFid;
338607ca46eSDavid Howells     int	flags;
339607ca46eSDavid Howells };
340607ca46eSDavid Howells 
341607ca46eSDavid Howells struct coda_store_out {
342607ca46eSDavid Howells     struct coda_out_hdr out;
343607ca46eSDavid Howells };
344607ca46eSDavid Howells 
345607ca46eSDavid Howells /* coda_release: */
346607ca46eSDavid Howells struct coda_release_in {
347607ca46eSDavid Howells     struct coda_in_hdr ih;
348607ca46eSDavid Howells     struct CodaFid VFid;
349607ca46eSDavid Howells     int	flags;
350607ca46eSDavid Howells };
351607ca46eSDavid Howells 
352607ca46eSDavid Howells struct coda_release_out {
353607ca46eSDavid Howells     struct coda_out_hdr out;
354607ca46eSDavid Howells };
355607ca46eSDavid Howells 
356607ca46eSDavid Howells /* coda_close: */
357607ca46eSDavid Howells struct coda_close_in {
358607ca46eSDavid Howells     struct coda_in_hdr ih;
359607ca46eSDavid Howells     struct CodaFid VFid;
360607ca46eSDavid Howells     int	flags;
361607ca46eSDavid Howells };
362607ca46eSDavid Howells 
363607ca46eSDavid Howells struct coda_close_out {
364607ca46eSDavid Howells     struct coda_out_hdr out;
365607ca46eSDavid Howells };
366607ca46eSDavid Howells 
367607ca46eSDavid Howells /* coda_ioctl: */
368607ca46eSDavid Howells struct coda_ioctl_in {
369607ca46eSDavid Howells     struct coda_in_hdr ih;
370607ca46eSDavid Howells     struct CodaFid VFid;
371607ca46eSDavid Howells     int	cmd;
372607ca46eSDavid Howells     int	len;
373607ca46eSDavid Howells     int	rwflag;
374607ca46eSDavid Howells     char *data;			/* Place holder for data. */
375607ca46eSDavid Howells };
376607ca46eSDavid Howells 
377607ca46eSDavid Howells struct coda_ioctl_out {
378607ca46eSDavid Howells     struct coda_out_hdr oh;
379607ca46eSDavid Howells     int	len;
380607ca46eSDavid Howells     caddr_t	data;		/* Place holder for data. */
381607ca46eSDavid Howells };
382607ca46eSDavid Howells 
383607ca46eSDavid Howells 
384607ca46eSDavid Howells /* coda_getattr: */
385607ca46eSDavid Howells struct coda_getattr_in {
386607ca46eSDavid Howells     struct coda_in_hdr ih;
387607ca46eSDavid Howells     struct CodaFid VFid;
388607ca46eSDavid Howells };
389607ca46eSDavid Howells 
390607ca46eSDavid Howells struct coda_getattr_out {
391607ca46eSDavid Howells     struct coda_out_hdr oh;
392607ca46eSDavid Howells     struct coda_vattr attr;
393607ca46eSDavid Howells };
394607ca46eSDavid Howells 
395607ca46eSDavid Howells 
396607ca46eSDavid Howells /* coda_setattr: NO_OUT */
397607ca46eSDavid Howells struct coda_setattr_in {
398607ca46eSDavid Howells     struct coda_in_hdr ih;
399607ca46eSDavid Howells     struct CodaFid VFid;
400607ca46eSDavid Howells     struct coda_vattr attr;
401607ca46eSDavid Howells };
402607ca46eSDavid Howells 
403607ca46eSDavid Howells struct coda_setattr_out {
404607ca46eSDavid Howells     struct coda_out_hdr out;
405607ca46eSDavid Howells };
406607ca46eSDavid Howells 
407607ca46eSDavid Howells /* coda_access: NO_OUT */
408607ca46eSDavid Howells struct coda_access_in {
409607ca46eSDavid Howells     struct coda_in_hdr ih;
410607ca46eSDavid Howells     struct CodaFid VFid;
411607ca46eSDavid Howells     int	flags;
412607ca46eSDavid Howells };
413607ca46eSDavid Howells 
414607ca46eSDavid Howells struct coda_access_out {
415607ca46eSDavid Howells     struct coda_out_hdr out;
416607ca46eSDavid Howells };
417607ca46eSDavid Howells 
418607ca46eSDavid Howells 
419607ca46eSDavid Howells /* lookup flags */
420607ca46eSDavid Howells #define CLU_CASE_SENSITIVE     0x01
421607ca46eSDavid Howells #define CLU_CASE_INSENSITIVE   0x02
422607ca46eSDavid Howells 
423607ca46eSDavid Howells /* coda_lookup: */
424607ca46eSDavid Howells struct  coda_lookup_in {
425607ca46eSDavid Howells     struct coda_in_hdr ih;
426607ca46eSDavid Howells     struct CodaFid VFid;
427607ca46eSDavid Howells     int         name;		/* Place holder for data. */
428607ca46eSDavid Howells     int         flags;
429607ca46eSDavid Howells };
430607ca46eSDavid Howells 
431607ca46eSDavid Howells struct coda_lookup_out {
432607ca46eSDavid Howells     struct coda_out_hdr oh;
433607ca46eSDavid Howells     struct CodaFid VFid;
434607ca46eSDavid Howells     int	vtype;
435607ca46eSDavid Howells };
436607ca46eSDavid Howells 
437607ca46eSDavid Howells 
438607ca46eSDavid Howells /* coda_create: */
439607ca46eSDavid Howells struct coda_create_in {
440607ca46eSDavid Howells     struct coda_in_hdr ih;
441607ca46eSDavid Howells     struct CodaFid VFid;
442607ca46eSDavid Howells     struct coda_vattr attr;
443607ca46eSDavid Howells     int excl;
444607ca46eSDavid Howells     int mode;
445607ca46eSDavid Howells     int 	name;		/* Place holder for data. */
446607ca46eSDavid Howells };
447607ca46eSDavid Howells 
448607ca46eSDavid Howells struct coda_create_out {
449607ca46eSDavid Howells     struct coda_out_hdr oh;
450607ca46eSDavid Howells     struct CodaFid VFid;
451607ca46eSDavid Howells     struct coda_vattr attr;
452607ca46eSDavid Howells };
453607ca46eSDavid Howells 
454607ca46eSDavid Howells 
455607ca46eSDavid Howells /* coda_remove: NO_OUT */
456607ca46eSDavid Howells struct coda_remove_in {
457607ca46eSDavid Howells     struct coda_in_hdr ih;
458607ca46eSDavid Howells     struct CodaFid VFid;
459607ca46eSDavid Howells     int name;		/* Place holder for data. */
460607ca46eSDavid Howells };
461607ca46eSDavid Howells 
462607ca46eSDavid Howells struct coda_remove_out {
463607ca46eSDavid Howells     struct coda_out_hdr out;
464607ca46eSDavid Howells };
465607ca46eSDavid Howells 
466607ca46eSDavid Howells /* coda_link: NO_OUT */
467607ca46eSDavid Howells struct coda_link_in {
468607ca46eSDavid Howells     struct coda_in_hdr ih;
469607ca46eSDavid Howells     struct CodaFid sourceFid;	/* cnode to link *to* */
470607ca46eSDavid Howells     struct CodaFid destFid;	/* Directory in which to place link */
471607ca46eSDavid Howells     int tname;		/* Place holder for data. */
472607ca46eSDavid Howells };
473607ca46eSDavid Howells 
474607ca46eSDavid Howells struct coda_link_out {
475607ca46eSDavid Howells     struct coda_out_hdr out;
476607ca46eSDavid Howells };
477607ca46eSDavid Howells 
478607ca46eSDavid Howells 
479607ca46eSDavid Howells /* coda_rename: NO_OUT */
480607ca46eSDavid Howells struct coda_rename_in {
481607ca46eSDavid Howells     struct coda_in_hdr ih;
482607ca46eSDavid Howells     struct CodaFid sourceFid;
483607ca46eSDavid Howells     int 	srcname;
484607ca46eSDavid Howells     struct CodaFid destFid;
485607ca46eSDavid Howells     int 	destname;
486607ca46eSDavid Howells };
487607ca46eSDavid Howells 
488607ca46eSDavid Howells struct coda_rename_out {
489607ca46eSDavid Howells     struct coda_out_hdr out;
490607ca46eSDavid Howells };
491607ca46eSDavid Howells 
492607ca46eSDavid Howells /* coda_mkdir: */
493607ca46eSDavid Howells struct coda_mkdir_in {
494607ca46eSDavid Howells     struct coda_in_hdr ih;
495607ca46eSDavid Howells     struct CodaFid VFid;
496607ca46eSDavid Howells     struct coda_vattr attr;
497607ca46eSDavid Howells     int	   name;		/* Place holder for data. */
498607ca46eSDavid Howells };
499607ca46eSDavid Howells 
500607ca46eSDavid Howells struct coda_mkdir_out {
501607ca46eSDavid Howells     struct coda_out_hdr oh;
502607ca46eSDavid Howells     struct CodaFid VFid;
503607ca46eSDavid Howells     struct coda_vattr attr;
504607ca46eSDavid Howells };
505607ca46eSDavid Howells 
506607ca46eSDavid Howells 
507607ca46eSDavid Howells /* coda_rmdir: NO_OUT */
508607ca46eSDavid Howells struct coda_rmdir_in {
509607ca46eSDavid Howells     struct coda_in_hdr ih;
510607ca46eSDavid Howells     struct CodaFid VFid;
511607ca46eSDavid Howells     int name;		/* Place holder for data. */
512607ca46eSDavid Howells };
513607ca46eSDavid Howells 
514607ca46eSDavid Howells struct coda_rmdir_out {
515607ca46eSDavid Howells     struct coda_out_hdr out;
516607ca46eSDavid Howells };
517607ca46eSDavid Howells 
518607ca46eSDavid Howells /* coda_symlink: NO_OUT */
519607ca46eSDavid Howells struct coda_symlink_in {
520607ca46eSDavid Howells     struct coda_in_hdr ih;
521607ca46eSDavid Howells     struct CodaFid VFid;	/* Directory to put symlink in */
522607ca46eSDavid Howells     int srcname;
523607ca46eSDavid Howells     struct coda_vattr attr;
524607ca46eSDavid Howells     int tname;
525607ca46eSDavid Howells };
526607ca46eSDavid Howells 
527607ca46eSDavid Howells struct coda_symlink_out {
528607ca46eSDavid Howells     struct coda_out_hdr out;
529607ca46eSDavid Howells };
530607ca46eSDavid Howells 
531607ca46eSDavid Howells /* coda_readlink: */
532607ca46eSDavid Howells struct coda_readlink_in {
533607ca46eSDavid Howells     struct coda_in_hdr ih;
534607ca46eSDavid Howells     struct CodaFid VFid;
535607ca46eSDavid Howells };
536607ca46eSDavid Howells 
537607ca46eSDavid Howells struct coda_readlink_out {
538607ca46eSDavid Howells     struct coda_out_hdr oh;
539607ca46eSDavid Howells     int	count;
540607ca46eSDavid Howells     caddr_t	data;		/* Place holder for data. */
541607ca46eSDavid Howells };
542607ca46eSDavid Howells 
543607ca46eSDavid Howells 
544607ca46eSDavid Howells /* coda_fsync: NO_OUT */
545607ca46eSDavid Howells struct coda_fsync_in {
546607ca46eSDavid Howells     struct coda_in_hdr ih;
547607ca46eSDavid Howells     struct CodaFid VFid;
548607ca46eSDavid Howells };
549607ca46eSDavid Howells 
550607ca46eSDavid Howells struct coda_fsync_out {
551607ca46eSDavid Howells     struct coda_out_hdr out;
552607ca46eSDavid Howells };
553607ca46eSDavid Howells 
554607ca46eSDavid Howells /* coda_vget: */
555607ca46eSDavid Howells struct coda_vget_in {
556607ca46eSDavid Howells     struct coda_in_hdr ih;
557607ca46eSDavid Howells     struct CodaFid VFid;
558607ca46eSDavid Howells };
559607ca46eSDavid Howells 
560607ca46eSDavid Howells struct coda_vget_out {
561607ca46eSDavid Howells     struct coda_out_hdr oh;
562607ca46eSDavid Howells     struct CodaFid VFid;
563607ca46eSDavid Howells     int	vtype;
564607ca46eSDavid Howells };
565607ca46eSDavid Howells 
566607ca46eSDavid Howells 
567607ca46eSDavid Howells /* CODA_SIGNAL is out-of-band, doesn't need data. */
568607ca46eSDavid Howells /* CODA_INVALIDATE is a venus->kernel call */
569607ca46eSDavid Howells /* CODA_FLUSH is a venus->kernel call */
570607ca46eSDavid Howells 
571607ca46eSDavid Howells /* coda_purgeuser: */
572607ca46eSDavid Howells /* CODA_PURGEUSER is a venus->kernel call */
573607ca46eSDavid Howells struct coda_purgeuser_out {
574607ca46eSDavid Howells     struct coda_out_hdr oh;
575607ca46eSDavid Howells     vuid_t uid;
576607ca46eSDavid Howells };
577607ca46eSDavid Howells 
578607ca46eSDavid Howells /* coda_zapfile: */
579607ca46eSDavid Howells /* CODA_ZAPFILE is a venus->kernel call */
580607ca46eSDavid Howells struct coda_zapfile_out {
581607ca46eSDavid Howells     struct coda_out_hdr oh;
582607ca46eSDavid Howells     struct CodaFid CodaFid;
583607ca46eSDavid Howells };
584607ca46eSDavid Howells 
585607ca46eSDavid Howells /* coda_zapdir: */
586607ca46eSDavid Howells /* CODA_ZAPDIR is a venus->kernel call */
587607ca46eSDavid Howells struct coda_zapdir_out {
588607ca46eSDavid Howells     struct coda_out_hdr oh;
589607ca46eSDavid Howells     struct CodaFid CodaFid;
590607ca46eSDavid Howells };
591607ca46eSDavid Howells 
592607ca46eSDavid Howells /* coda_purgefid: */
593607ca46eSDavid Howells /* CODA_PURGEFID is a venus->kernel call */
594607ca46eSDavid Howells struct coda_purgefid_out {
595607ca46eSDavid Howells     struct coda_out_hdr oh;
596607ca46eSDavid Howells     struct CodaFid CodaFid;
597607ca46eSDavid Howells };
598607ca46eSDavid Howells 
599607ca46eSDavid Howells /* coda_replace: */
600607ca46eSDavid Howells /* CODA_REPLACE is a venus->kernel call */
601607ca46eSDavid Howells struct coda_replace_out { /* coda_replace is a venus->kernel call */
602607ca46eSDavid Howells     struct coda_out_hdr oh;
603607ca46eSDavid Howells     struct CodaFid NewFid;
604607ca46eSDavid Howells     struct CodaFid OldFid;
605607ca46eSDavid Howells };
606607ca46eSDavid Howells 
607607ca46eSDavid Howells /* coda_open_by_fd: */
608607ca46eSDavid Howells struct coda_open_by_fd_in {
609607ca46eSDavid Howells     struct coda_in_hdr ih;
610607ca46eSDavid Howells     struct CodaFid VFid;
611607ca46eSDavid Howells     int        flags;
612607ca46eSDavid Howells };
613607ca46eSDavid Howells 
614607ca46eSDavid Howells struct coda_open_by_fd_out {
615607ca46eSDavid Howells     struct coda_out_hdr oh;
616607ca46eSDavid Howells     int fd;
617607ca46eSDavid Howells 
618607ca46eSDavid Howells #ifdef __KERNEL__
619607ca46eSDavid Howells     struct file *fh; /* not passed from userspace but used in-kernel only */
620607ca46eSDavid Howells #endif
621607ca46eSDavid Howells };
622607ca46eSDavid Howells 
623607ca46eSDavid Howells /* coda_open_by_path: */
624607ca46eSDavid Howells struct coda_open_by_path_in {
625607ca46eSDavid Howells     struct coda_in_hdr ih;
626607ca46eSDavid Howells     struct CodaFid VFid;
627607ca46eSDavid Howells     int	flags;
628607ca46eSDavid Howells };
629607ca46eSDavid Howells 
630607ca46eSDavid Howells struct coda_open_by_path_out {
631607ca46eSDavid Howells     struct coda_out_hdr oh;
632607ca46eSDavid Howells 	int path;
633607ca46eSDavid Howells };
634607ca46eSDavid Howells 
635607ca46eSDavid Howells /* coda_statfs: NO_IN */
636607ca46eSDavid Howells struct coda_statfs_in {
637607ca46eSDavid Howells     struct coda_in_hdr in;
638607ca46eSDavid Howells };
639607ca46eSDavid Howells 
640607ca46eSDavid Howells struct coda_statfs_out {
641607ca46eSDavid Howells     struct coda_out_hdr oh;
642607ca46eSDavid Howells     struct coda_statfs stat;
643607ca46eSDavid Howells };
644607ca46eSDavid Howells 
645*a9fba24cSPedro Cuadra #define CODA_ACCESS_TYPE_READ		1
646*a9fba24cSPedro Cuadra #define CODA_ACCESS_TYPE_WRITE		2
647*a9fba24cSPedro Cuadra #define CODA_ACCESS_TYPE_MMAP		3
648*a9fba24cSPedro Cuadra #define CODA_ACCESS_TYPE_READ_FINISH	4
649*a9fba24cSPedro Cuadra #define CODA_ACCESS_TYPE_WRITE_FINISH	5
650*a9fba24cSPedro Cuadra 
651*a9fba24cSPedro Cuadra /* coda_access_intent: NO_OUT */
652*a9fba24cSPedro Cuadra struct coda_access_intent_in {
653*a9fba24cSPedro Cuadra 	struct coda_in_hdr ih;
654*a9fba24cSPedro Cuadra 	struct CodaFid VFid;
655*a9fba24cSPedro Cuadra 	int count;
656*a9fba24cSPedro Cuadra 	int pos;
657*a9fba24cSPedro Cuadra 	int type;
658*a9fba24cSPedro Cuadra };
659*a9fba24cSPedro Cuadra 
660*a9fba24cSPedro Cuadra struct coda_access_intent_out {
661*a9fba24cSPedro Cuadra 	struct coda_out_hdr out;
662*a9fba24cSPedro Cuadra };
663*a9fba24cSPedro Cuadra 
664607ca46eSDavid Howells /*
665607ca46eSDavid Howells  * Occasionally, we don't cache the fid returned by CODA_LOOKUP.
666607ca46eSDavid Howells  * For instance, if the fid is inconsistent.
667607ca46eSDavid Howells  * This case is handled by setting the top bit of the type result parameter.
668607ca46eSDavid Howells  */
669607ca46eSDavid Howells #define CODA_NOCACHE          0x80000000
670607ca46eSDavid Howells 
671607ca46eSDavid Howells union inputArgs {
672607ca46eSDavid Howells     struct coda_in_hdr ih;		/* NB: every struct below begins with an ih */
673607ca46eSDavid Howells     struct coda_open_in coda_open;
674607ca46eSDavid Howells     struct coda_store_in coda_store;
675607ca46eSDavid Howells     struct coda_release_in coda_release;
676607ca46eSDavid Howells     struct coda_close_in coda_close;
677607ca46eSDavid Howells     struct coda_ioctl_in coda_ioctl;
678607ca46eSDavid Howells     struct coda_getattr_in coda_getattr;
679607ca46eSDavid Howells     struct coda_setattr_in coda_setattr;
680607ca46eSDavid Howells     struct coda_access_in coda_access;
681607ca46eSDavid Howells     struct coda_lookup_in coda_lookup;
682607ca46eSDavid Howells     struct coda_create_in coda_create;
683607ca46eSDavid Howells     struct coda_remove_in coda_remove;
684607ca46eSDavid Howells     struct coda_link_in coda_link;
685607ca46eSDavid Howells     struct coda_rename_in coda_rename;
686607ca46eSDavid Howells     struct coda_mkdir_in coda_mkdir;
687607ca46eSDavid Howells     struct coda_rmdir_in coda_rmdir;
688607ca46eSDavid Howells     struct coda_symlink_in coda_symlink;
689607ca46eSDavid Howells     struct coda_readlink_in coda_readlink;
690607ca46eSDavid Howells     struct coda_fsync_in coda_fsync;
691607ca46eSDavid Howells     struct coda_vget_in coda_vget;
692607ca46eSDavid Howells     struct coda_open_by_fd_in coda_open_by_fd;
693607ca46eSDavid Howells     struct coda_open_by_path_in coda_open_by_path;
694607ca46eSDavid Howells     struct coda_statfs_in coda_statfs;
695*a9fba24cSPedro Cuadra     struct coda_access_intent_in coda_access_intent;
696607ca46eSDavid Howells };
697607ca46eSDavid Howells 
698607ca46eSDavid Howells union outputArgs {
699607ca46eSDavid Howells     struct coda_out_hdr oh;		/* NB: every struct below begins with an oh */
700607ca46eSDavid Howells     struct coda_root_out coda_root;
701607ca46eSDavid Howells     struct coda_open_out coda_open;
702607ca46eSDavid Howells     struct coda_ioctl_out coda_ioctl;
703607ca46eSDavid Howells     struct coda_getattr_out coda_getattr;
704607ca46eSDavid Howells     struct coda_lookup_out coda_lookup;
705607ca46eSDavid Howells     struct coda_create_out coda_create;
706607ca46eSDavid Howells     struct coda_mkdir_out coda_mkdir;
707607ca46eSDavid Howells     struct coda_readlink_out coda_readlink;
708607ca46eSDavid Howells     struct coda_vget_out coda_vget;
709607ca46eSDavid Howells     struct coda_purgeuser_out coda_purgeuser;
710607ca46eSDavid Howells     struct coda_zapfile_out coda_zapfile;
711607ca46eSDavid Howells     struct coda_zapdir_out coda_zapdir;
712607ca46eSDavid Howells     struct coda_purgefid_out coda_purgefid;
713607ca46eSDavid Howells     struct coda_replace_out coda_replace;
714607ca46eSDavid Howells     struct coda_open_by_fd_out coda_open_by_fd;
715607ca46eSDavid Howells     struct coda_open_by_path_out coda_open_by_path;
716607ca46eSDavid Howells     struct coda_statfs_out coda_statfs;
717607ca46eSDavid Howells };
718607ca46eSDavid Howells 
719607ca46eSDavid Howells union coda_downcalls {
720607ca46eSDavid Howells     /* CODA_INVALIDATE is a venus->kernel call */
721607ca46eSDavid Howells     /* CODA_FLUSH is a venus->kernel call */
722607ca46eSDavid Howells     struct coda_purgeuser_out purgeuser;
723607ca46eSDavid Howells     struct coda_zapfile_out zapfile;
724607ca46eSDavid Howells     struct coda_zapdir_out zapdir;
725607ca46eSDavid Howells     struct coda_purgefid_out purgefid;
726607ca46eSDavid Howells     struct coda_replace_out replace;
727607ca46eSDavid Howells };
728607ca46eSDavid Howells 
729607ca46eSDavid Howells 
730607ca46eSDavid Howells /*
731607ca46eSDavid Howells  * Used for identifying usage of "Control" and pioctls
732607ca46eSDavid Howells  */
733607ca46eSDavid Howells 
734607ca46eSDavid Howells #define PIOCPARM_MASK 0x0000ffff
735607ca46eSDavid Howells struct ViceIoctl {
736607ca46eSDavid Howells         void __user *in;        /* Data to be transferred in */
737607ca46eSDavid Howells         void __user *out;       /* Data to be transferred out */
738607ca46eSDavid Howells         u_short in_size;        /* Size of input buffer <= 2K */
739607ca46eSDavid Howells         u_short out_size;       /* Maximum size of output buffer, <= 2K */
740607ca46eSDavid Howells };
741607ca46eSDavid Howells 
742607ca46eSDavid Howells struct PioctlData {
743607ca46eSDavid Howells         const char __user *path;
744607ca46eSDavid Howells         int follow;
745607ca46eSDavid Howells         struct ViceIoctl vi;
746607ca46eSDavid Howells };
747607ca46eSDavid Howells 
748607ca46eSDavid Howells #define CODA_CONTROL		".CONTROL"
749607ca46eSDavid Howells #define CODA_CONTROLLEN		8
750607ca46eSDavid Howells #define CTL_INO			-1
751607ca46eSDavid Howells 
752607ca46eSDavid Howells /* Data passed to mount */
753607ca46eSDavid Howells 
754607ca46eSDavid Howells #define CODA_MOUNT_VERSION 1
755607ca46eSDavid Howells 
756607ca46eSDavid Howells struct coda_mount_data {
757607ca46eSDavid Howells 	int		version;
758607ca46eSDavid Howells 	int		fd;       /* Opened device */
759607ca46eSDavid Howells };
760607ca46eSDavid Howells 
761607ca46eSDavid Howells #endif /* _UAPI_CODA_HEADER_ */
762