coda.h revision 1.7 1 1.7 phil /* $NetBSD: coda.h,v 1.7 2002/03/27 05:10:40 phil Exp $ */
2 1.2 rvb
3 1.1 rvb /*
4 1.2 rvb *
5 1.2 rvb * Coda: an Experimental Distributed File System
6 1.2 rvb * Release 3.1
7 1.2 rvb *
8 1.2 rvb * Copyright (c) 1987-1998 Carnegie Mellon University
9 1.2 rvb * All Rights Reserved
10 1.2 rvb *
11 1.2 rvb * Permission to use, copy, modify and distribute this software and its
12 1.2 rvb * documentation is hereby granted, provided that both the copyright
13 1.2 rvb * notice and this permission notice appear in all copies of the
14 1.2 rvb * software, derivative works or modified versions, and any portions
15 1.2 rvb * thereof, and that both notices appear in supporting documentation, and
16 1.2 rvb * that credit is given to Carnegie Mellon University in all documents
17 1.2 rvb * and publicity pertaining to direct or indirect use of this code or its
18 1.2 rvb * derivatives.
19 1.2 rvb *
20 1.2 rvb * CODA IS AN EXPERIMENTAL SOFTWARE SYSTEM AND IS KNOWN TO HAVE BUGS,
21 1.2 rvb * SOME OF WHICH MAY HAVE SERIOUS CONSEQUENCES. CARNEGIE MELLON ALLOWS
22 1.2 rvb * FREE USE OF THIS SOFTWARE IN ITS "AS IS" CONDITION. CARNEGIE MELLON
23 1.2 rvb * DISCLAIMS ANY LIABILITY OF ANY KIND FOR ANY DAMAGES WHATSOEVER
24 1.2 rvb * RESULTING DIRECTLY OR INDIRECTLY FROM THE USE OF THIS SOFTWARE OR OF
25 1.2 rvb * ANY DERIVATIVE WORK.
26 1.2 rvb *
27 1.2 rvb * Carnegie Mellon encourages users of this software to return any
28 1.2 rvb * improvements or extensions that they make, and to grant Carnegie
29 1.2 rvb * Mellon the rights to redistribute these changes without encumbrance.
30 1.2 rvb *
31 1.4 rvb * @(#) coda/coda.h,v 1.1.1.1 1998/08/29 21:26:46 rvb Exp
32 1.2 rvb */
33 1.1 rvb
34 1.6 rvb
35 1.1 rvb /*
36 1.1 rvb *
37 1.1 rvb * Based on cfs.h from Mach, but revamped for increased simplicity.
38 1.1 rvb * Linux modifications by Peter Braam, Aug 1996
39 1.1 rvb */
40 1.1 rvb
41 1.3 rvb #ifndef _CODA_HEADER_
42 1.3 rvb #define _CODA_HEADER_
43 1.1 rvb
44 1.1 rvb
45 1.1 rvb
46 1.1 rvb /* Catch new _KERNEL defn for NetBSD */
47 1.1 rvb #ifdef __NetBSD__
48 1.1 rvb #include <sys/types.h>
49 1.1 rvb #endif
50 1.1 rvb
51 1.5 rvb #ifndef CODA_MAXSYMLINKS
52 1.5 rvb #define CODA_MAXSYMLINKS 10
53 1.5 rvb #endif
54 1.5 rvb
55 1.5 rvb #if defined(DJGPP) || defined(__CYGWIN32__)
56 1.5 rvb #ifdef KERNEL
57 1.5 rvb typedef unsigned long u_long;
58 1.5 rvb typedef unsigned int u_int;
59 1.5 rvb typedef unsigned short u_short;
60 1.5 rvb typedef u_long ino_t;
61 1.5 rvb typedef u_long dev_t;
62 1.5 rvb typedef void * caddr_t;
63 1.6 rvb #ifdef DOS
64 1.6 rvb typedef unsigned __int64 u_quad_t;
65 1.6 rvb #else
66 1.5 rvb typedef unsigned long long u_quad_t;
67 1.6 rvb #endif
68 1.5 rvb
69 1.5 rvb #define inline
70 1.5 rvb
71 1.5 rvb struct timespec {
72 1.5 rvb long ts_sec;
73 1.5 rvb long ts_nsec;
74 1.5 rvb };
75 1.5 rvb #else /* DJGPP but not KERNEL */
76 1.5 rvb #include <sys/types.h>
77 1.5 rvb #include <sys/time.h>
78 1.5 rvb typedef unsigned long long u_quad_t;
79 1.5 rvb #endif /* !KERNEL */
80 1.5 rvb #endif /* !DJGPP */
81 1.5 rvb
82 1.5 rvb
83 1.5 rvb #if defined(__linux__)
84 1.1 rvb #define cdev_t u_quad_t
85 1.1 rvb #if !defined(_UQUAD_T_) && (!defined(__GLIBC__) || __GLIBC__ < 2)
86 1.1 rvb #define _UQUAD_T_ 1
87 1.1 rvb typedef unsigned long long u_quad_t;
88 1.5 rvb #endif
89 1.1 rvb #else
90 1.1 rvb #define cdev_t dev_t
91 1.1 rvb #endif
92 1.1 rvb
93 1.1 rvb
94 1.1 rvb /*
95 1.5 rvb * Cfs constants
96 1.1 rvb */
97 1.3 rvb #define CODA_MAXNAMLEN 255
98 1.3 rvb #define CODA_MAXPATHLEN 1024
99 1.3 rvb #define CODA_MAXSYMLINK 10
100 1.1 rvb
101 1.1 rvb /* these are Coda's version of O_RDONLY etc combinations
102 1.1 rvb * to deal with VFS open modes
103 1.1 rvb */
104 1.1 rvb #define C_O_READ 0x001
105 1.1 rvb #define C_O_WRITE 0x002
106 1.1 rvb #define C_O_TRUNC 0x010
107 1.1 rvb #define C_O_EXCL 0x100
108 1.5 rvb #define C_O_CREAT 0x200
109 1.1 rvb
110 1.1 rvb /* these are to find mode bits in Venus */
111 1.1 rvb #define C_M_READ 00400
112 1.1 rvb #define C_M_WRITE 00200
113 1.1 rvb
114 1.1 rvb /* for access Venus will use */
115 1.5 rvb #define C_A_C_OK 8 /* Test for writing upon create. */
116 1.1 rvb #define C_A_R_OK 4 /* Test for read permission. */
117 1.1 rvb #define C_A_W_OK 2 /* Test for write permission. */
118 1.1 rvb #define C_A_X_OK 1 /* Test for execute permission. */
119 1.1 rvb #define C_A_F_OK 0 /* Test for existence. */
120 1.1 rvb
121 1.1 rvb
122 1.1 rvb
123 1.1 rvb #ifndef _VENUS_DIRENT_T_
124 1.1 rvb #define _VENUS_DIRENT_T_ 1
125 1.1 rvb struct venus_dirent {
126 1.1 rvb unsigned long d_fileno; /* file number of entry */
127 1.1 rvb unsigned short d_reclen; /* length of this record */
128 1.1 rvb char d_type; /* file type, see below */
129 1.1 rvb char d_namlen; /* length of string in d_name */
130 1.3 rvb char d_name[CODA_MAXNAMLEN + 1];/* name must be no longer than this */
131 1.1 rvb };
132 1.1 rvb #undef DIRSIZ
133 1.3 rvb #define DIRSIZ(dp) ((sizeof (struct venus_dirent) - (CODA_MAXNAMLEN+1)) + \
134 1.1 rvb (((dp)->d_namlen+1 + 3) &~ 3))
135 1.1 rvb
136 1.1 rvb /*
137 1.1 rvb * File types
138 1.1 rvb */
139 1.1 rvb #define CDT_UNKNOWN 0
140 1.5 rvb #define CDT_FIFO 1
141 1.1 rvb #define CDT_CHR 2
142 1.1 rvb #define CDT_DIR 4
143 1.1 rvb #define CDT_BLK 6
144 1.1 rvb #define CDT_REG 8
145 1.1 rvb #define CDT_LNK 10
146 1.5 rvb #define CDT_SOCK 12
147 1.1 rvb #define CDT_WHT 14
148 1.1 rvb
149 1.1 rvb /*
150 1.1 rvb * Convert between stat structure types and directory types.
151 1.1 rvb */
152 1.1 rvb #define IFTOCDT(mode) (((mode) & 0170000) >> 12)
153 1.1 rvb #define CDTTOIF(dirtype) ((dirtype) << 12)
154 1.1 rvb
155 1.1 rvb #endif
156 1.1 rvb
157 1.1 rvb #ifndef _FID_T_
158 1.1 rvb #define _FID_T_ 1
159 1.1 rvb typedef u_long VolumeId;
160 1.1 rvb typedef u_long VnodeId;
161 1.1 rvb typedef u_long Unique_t;
162 1.1 rvb typedef u_long FileVersion;
163 1.1 rvb #endif
164 1.1 rvb
165 1.1 rvb #ifndef _VICEFID_T_
166 1.1 rvb #define _VICEFID_T_ 1
167 1.1 rvb typedef struct ViceFid {
168 1.1 rvb VolumeId Volume;
169 1.1 rvb VnodeId Vnode;
170 1.1 rvb Unique_t Unique;
171 1.1 rvb } ViceFid;
172 1.1 rvb #endif /* VICEFID */
173 1.1 rvb
174 1.5 rvb
175 1.5 rvb #ifdef __linux__
176 1.5 rvb static __inline__ ino_t coda_f2i(struct ViceFid *fid)
177 1.1 rvb {
178 1.5 rvb if ( ! fid )
179 1.5 rvb return 0;
180 1.5 rvb if (fid->Vnode == 0xfffffffe || fid->Vnode == 0xffffffff)
181 1.5 rvb return ((fid->Volume << 20) | (fid->Unique & 0xfffff));
182 1.5 rvb else
183 1.5 rvb return (fid->Unique + (fid->Vnode<<10) + (fid->Volume<<20));
184 1.1 rvb }
185 1.5 rvb
186 1.5 rvb #else
187 1.5 rvb #define coda_f2i(fid)\
188 1.6 rvb ((fid) ? ((fid)->Unique + ((fid)->Vnode<<10) + ((fid)->Volume<<20)) : 0)
189 1.1 rvb #endif
190 1.1 rvb
191 1.5 rvb
192 1.5 rvb #ifndef __BIT_TYPES_DEFINED__
193 1.5 rvb #define u_int32_t unsigned int
194 1.5 rvb #endif
195 1.5 rvb
196 1.5 rvb
197 1.1 rvb #ifndef _VUID_T_
198 1.1 rvb #define _VUID_T_
199 1.5 rvb typedef u_int32_t vuid_t;
200 1.5 rvb typedef u_int32_t vgid_t;
201 1.1 rvb #endif /*_VUID_T_ */
202 1.1 rvb
203 1.1 rvb #ifndef _CODACRED_T_
204 1.1 rvb #define _CODACRED_T_
205 1.1 rvb struct coda_cred {
206 1.1 rvb vuid_t cr_uid, cr_euid, cr_suid, cr_fsuid; /* Real, efftve, set, fs uid*/
207 1.5 rvb vgid_t cr_groupid, cr_egid, cr_sgid, cr_fsgid; /* same for groups */
208 1.1 rvb };
209 1.1 rvb #endif
210 1.1 rvb
211 1.1 rvb #ifndef _VENUS_VATTR_T_
212 1.1 rvb #define _VENUS_VATTR_T_
213 1.1 rvb /*
214 1.1 rvb * Vnode types. VNON means no type.
215 1.1 rvb */
216 1.1 rvb enum coda_vtype { C_VNON, C_VREG, C_VDIR, C_VBLK, C_VCHR, C_VLNK, C_VSOCK, C_VFIFO, C_VBAD };
217 1.1 rvb
218 1.1 rvb struct coda_vattr {
219 1.5 rvb int va_type; /* vnode type (for create) */
220 1.1 rvb u_short va_mode; /* files access mode and type */
221 1.1 rvb short va_nlink; /* number of references to file */
222 1.1 rvb vuid_t va_uid; /* owner user id */
223 1.1 rvb vgid_t va_gid; /* owner group id */
224 1.1 rvb long va_fileid; /* file id */
225 1.1 rvb u_quad_t va_size; /* file size in bytes */
226 1.1 rvb long va_blocksize; /* blocksize preferred for i/o */
227 1.1 rvb struct timespec va_atime; /* time of last access */
228 1.1 rvb struct timespec va_mtime; /* time of last modification */
229 1.1 rvb struct timespec va_ctime; /* time file changed */
230 1.1 rvb u_long va_gen; /* generation number of file */
231 1.1 rvb u_long va_flags; /* flags defined for file */
232 1.1 rvb cdev_t va_rdev; /* device special file represents */
233 1.1 rvb u_quad_t va_bytes; /* bytes of disk space held by file */
234 1.1 rvb u_quad_t va_filerev; /* file modification number */
235 1.1 rvb };
236 1.1 rvb
237 1.1 rvb #endif
238 1.1 rvb
239 1.7 phil /* structure used by CODA_STATFS for getting cache information from venus */
240 1.7 phil struct coda_statfs {
241 1.7 phil int32_t f_blocks;
242 1.7 phil int32_t f_bfree;
243 1.7 phil int32_t f_bavail;
244 1.7 phil int32_t f_files;
245 1.7 phil int32_t f_ffree;
246 1.7 phil };
247 1.7 phil
248 1.1 rvb /*
249 1.1 rvb * Kernel <--> Venus communications.
250 1.1 rvb */
251 1.1 rvb
252 1.5 rvb #define CODA_ROOT 2
253 1.5 rvb #define CODA_SYNC 3
254 1.5 rvb #define CODA_OPEN 4
255 1.5 rvb #define CODA_CLOSE 5
256 1.5 rvb #define CODA_IOCTL 6
257 1.5 rvb #define CODA_GETATTR 7
258 1.5 rvb #define CODA_SETATTR 8
259 1.5 rvb #define CODA_ACCESS 9
260 1.5 rvb #define CODA_LOOKUP 10
261 1.5 rvb #define CODA_CREATE 11
262 1.5 rvb #define CODA_REMOVE 12
263 1.5 rvb #define CODA_LINK 13
264 1.5 rvb #define CODA_RENAME 14
265 1.5 rvb #define CODA_MKDIR 15
266 1.5 rvb #define CODA_RMDIR 16
267 1.5 rvb #define CODA_READDIR 17
268 1.5 rvb #define CODA_SYMLINK 18
269 1.5 rvb #define CODA_READLINK 19
270 1.5 rvb #define CODA_FSYNC 20
271 1.5 rvb #define CODA_INACTIVE 21
272 1.5 rvb #define CODA_VGET 22
273 1.5 rvb #define CODA_SIGNAL 23
274 1.5 rvb #define CODA_REPLACE 24
275 1.5 rvb #define CODA_FLUSH 25
276 1.5 rvb #define CODA_PURGEUSER 26
277 1.5 rvb #define CODA_ZAPFILE 27
278 1.5 rvb #define CODA_ZAPDIR 28
279 1.5 rvb #define CODA_PURGEFID 30
280 1.5 rvb #define CODA_OPEN_BY_PATH 31
281 1.5 rvb #define CODA_RESOLVE 32
282 1.5 rvb #define CODA_REINTEGRATE 33
283 1.7 phil #define CODA_STATFS 34
284 1.7 phil #define CODA_NCALLS 35
285 1.1 rvb
286 1.3 rvb #define DOWNCALL(opcode) (opcode >= CODA_REPLACE && opcode <= CODA_PURGEFID)
287 1.1 rvb
288 1.1 rvb #define VC_MAXDATASIZE 8192
289 1.1 rvb #define VC_MAXMSGSIZE sizeof(union inputArgs)+sizeof(union outputArgs) +\
290 1.1 rvb VC_MAXDATASIZE
291 1.1 rvb
292 1.6 rvb #define CIOC_KERNEL_VERSION _IOWR('c', 10, sizeof (int))
293 1.6 rvb #if 0
294 1.6 rvb /* don't care about kernel version number */
295 1.6 rvb #define CODA_KERNEL_VERSION 0
296 1.6 rvb /* The old venus 4.6 compatible interface */
297 1.6 rvb #define CODA_KERNEL_VERSION 1
298 1.6 rvb #endif
299 1.6 rvb /* venus_lookup gets an extra parameter to aid windows.*/
300 1.6 rvb #define CODA_KERNEL_VERSION 2
301 1.1 rvb
302 1.1 rvb /*
303 1.1 rvb * Venus <-> Coda RPC arguments
304 1.1 rvb */
305 1.3 rvb struct coda_in_hdr {
306 1.1 rvb unsigned long opcode;
307 1.1 rvb unsigned long unique; /* Keep multiple outstanding msgs distinct */
308 1.1 rvb u_short pid; /* Common to all */
309 1.1 rvb u_short pgid; /* Common to all */
310 1.1 rvb u_short sid; /* Common to all */
311 1.1 rvb struct coda_cred cred; /* Common to all */
312 1.1 rvb };
313 1.1 rvb
314 1.1 rvb /* Really important that opcode and unique are 1st two fields! */
315 1.3 rvb struct coda_out_hdr {
316 1.1 rvb unsigned long opcode;
317 1.1 rvb unsigned long unique;
318 1.1 rvb unsigned long result;
319 1.1 rvb };
320 1.1 rvb
321 1.3 rvb /* coda_root: NO_IN */
322 1.3 rvb struct coda_root_out {
323 1.3 rvb struct coda_out_hdr oh;
324 1.1 rvb ViceFid VFid;
325 1.1 rvb };
326 1.1 rvb
327 1.3 rvb struct coda_root_in {
328 1.3 rvb struct coda_in_hdr in;
329 1.1 rvb };
330 1.1 rvb
331 1.3 rvb /* coda_sync: */
332 1.3 rvb /* Nothing needed for coda_sync */
333 1.1 rvb
334 1.3 rvb /* coda_open: */
335 1.3 rvb struct coda_open_in {
336 1.3 rvb struct coda_in_hdr ih;
337 1.1 rvb ViceFid VFid;
338 1.1 rvb int flags;
339 1.1 rvb };
340 1.1 rvb
341 1.3 rvb struct coda_open_out {
342 1.3 rvb struct coda_out_hdr oh;
343 1.1 rvb cdev_t dev;
344 1.1 rvb ino_t inode;
345 1.1 rvb };
346 1.1 rvb
347 1.1 rvb
348 1.3 rvb /* coda_close: */
349 1.3 rvb struct coda_close_in {
350 1.3 rvb struct coda_in_hdr ih;
351 1.1 rvb ViceFid VFid;
352 1.1 rvb int flags;
353 1.1 rvb };
354 1.1 rvb
355 1.3 rvb struct coda_close_out {
356 1.3 rvb struct coda_out_hdr out;
357 1.1 rvb };
358 1.1 rvb
359 1.3 rvb /* coda_ioctl: */
360 1.3 rvb struct coda_ioctl_in {
361 1.3 rvb struct coda_in_hdr ih;
362 1.1 rvb ViceFid VFid;
363 1.1 rvb int cmd;
364 1.1 rvb int len;
365 1.1 rvb int rwflag;
366 1.1 rvb char *data; /* Place holder for data. */
367 1.1 rvb };
368 1.1 rvb
369 1.3 rvb struct coda_ioctl_out {
370 1.3 rvb struct coda_out_hdr oh;
371 1.1 rvb int len;
372 1.1 rvb caddr_t data; /* Place holder for data. */
373 1.1 rvb };
374 1.1 rvb
375 1.1 rvb
376 1.3 rvb /* coda_getattr: */
377 1.3 rvb struct coda_getattr_in {
378 1.3 rvb struct coda_in_hdr ih;
379 1.1 rvb ViceFid VFid;
380 1.1 rvb };
381 1.1 rvb
382 1.3 rvb struct coda_getattr_out {
383 1.3 rvb struct coda_out_hdr oh;
384 1.1 rvb struct coda_vattr attr;
385 1.1 rvb };
386 1.1 rvb
387 1.1 rvb
388 1.3 rvb /* coda_setattr: NO_OUT */
389 1.3 rvb struct coda_setattr_in {
390 1.3 rvb struct coda_in_hdr ih;
391 1.1 rvb ViceFid VFid;
392 1.1 rvb struct coda_vattr attr;
393 1.1 rvb };
394 1.1 rvb
395 1.3 rvb struct coda_setattr_out {
396 1.3 rvb struct coda_out_hdr out;
397 1.1 rvb };
398 1.1 rvb
399 1.3 rvb /* coda_access: NO_OUT */
400 1.3 rvb struct coda_access_in {
401 1.3 rvb struct coda_in_hdr ih;
402 1.1 rvb ViceFid VFid;
403 1.1 rvb int flags;
404 1.1 rvb };
405 1.1 rvb
406 1.3 rvb struct coda_access_out {
407 1.3 rvb struct coda_out_hdr out;
408 1.1 rvb };
409 1.1 rvb
410 1.6 rvb
411 1.6 rvb /* lookup flags */
412 1.6 rvb #define CLU_CASE_SENSITIVE 0x01
413 1.6 rvb #define CLU_CASE_INSENSITIVE 0x02
414 1.6 rvb
415 1.3 rvb /* coda_lookup: */
416 1.3 rvb struct coda_lookup_in {
417 1.3 rvb struct coda_in_hdr ih;
418 1.1 rvb ViceFid VFid;
419 1.1 rvb int name; /* Place holder for data. */
420 1.6 rvb int flags;
421 1.1 rvb };
422 1.1 rvb
423 1.3 rvb struct coda_lookup_out {
424 1.3 rvb struct coda_out_hdr oh;
425 1.1 rvb ViceFid VFid;
426 1.1 rvb int vtype;
427 1.1 rvb };
428 1.1 rvb
429 1.1 rvb
430 1.3 rvb /* coda_create: */
431 1.3 rvb struct coda_create_in {
432 1.3 rvb struct coda_in_hdr ih;
433 1.1 rvb ViceFid VFid;
434 1.1 rvb struct coda_vattr attr;
435 1.1 rvb int excl;
436 1.1 rvb int mode;
437 1.1 rvb int name; /* Place holder for data. */
438 1.1 rvb };
439 1.1 rvb
440 1.3 rvb struct coda_create_out {
441 1.3 rvb struct coda_out_hdr oh;
442 1.1 rvb ViceFid VFid;
443 1.1 rvb struct coda_vattr attr;
444 1.1 rvb };
445 1.1 rvb
446 1.1 rvb
447 1.3 rvb /* coda_remove: NO_OUT */
448 1.3 rvb struct coda_remove_in {
449 1.3 rvb struct coda_in_hdr ih;
450 1.1 rvb ViceFid VFid;
451 1.1 rvb int name; /* Place holder for data. */
452 1.1 rvb };
453 1.1 rvb
454 1.3 rvb struct coda_remove_out {
455 1.3 rvb struct coda_out_hdr out;
456 1.1 rvb };
457 1.1 rvb
458 1.3 rvb /* coda_link: NO_OUT */
459 1.3 rvb struct coda_link_in {
460 1.3 rvb struct coda_in_hdr ih;
461 1.1 rvb ViceFid sourceFid; /* cnode to link *to* */
462 1.1 rvb ViceFid destFid; /* Directory in which to place link */
463 1.1 rvb int tname; /* Place holder for data. */
464 1.1 rvb };
465 1.1 rvb
466 1.3 rvb struct coda_link_out {
467 1.3 rvb struct coda_out_hdr out;
468 1.1 rvb };
469 1.1 rvb
470 1.1 rvb
471 1.3 rvb /* coda_rename: NO_OUT */
472 1.3 rvb struct coda_rename_in {
473 1.3 rvb struct coda_in_hdr ih;
474 1.1 rvb ViceFid sourceFid;
475 1.1 rvb int srcname;
476 1.1 rvb ViceFid destFid;
477 1.1 rvb int destname;
478 1.1 rvb };
479 1.1 rvb
480 1.3 rvb struct coda_rename_out {
481 1.3 rvb struct coda_out_hdr out;
482 1.1 rvb };
483 1.1 rvb
484 1.3 rvb /* coda_mkdir: */
485 1.3 rvb struct coda_mkdir_in {
486 1.3 rvb struct coda_in_hdr ih;
487 1.1 rvb ViceFid VFid;
488 1.1 rvb struct coda_vattr attr;
489 1.1 rvb int name; /* Place holder for data. */
490 1.1 rvb };
491 1.1 rvb
492 1.3 rvb struct coda_mkdir_out {
493 1.3 rvb struct coda_out_hdr oh;
494 1.1 rvb ViceFid VFid;
495 1.1 rvb struct coda_vattr attr;
496 1.1 rvb };
497 1.1 rvb
498 1.1 rvb
499 1.3 rvb /* coda_rmdir: NO_OUT */
500 1.3 rvb struct coda_rmdir_in {
501 1.3 rvb struct coda_in_hdr ih;
502 1.1 rvb ViceFid VFid;
503 1.1 rvb int name; /* Place holder for data. */
504 1.1 rvb };
505 1.1 rvb
506 1.3 rvb struct coda_rmdir_out {
507 1.3 rvb struct coda_out_hdr out;
508 1.1 rvb };
509 1.1 rvb
510 1.3 rvb /* coda_readdir: */
511 1.3 rvb struct coda_readdir_in {
512 1.3 rvb struct coda_in_hdr ih;
513 1.1 rvb ViceFid VFid;
514 1.1 rvb int count;
515 1.1 rvb int offset;
516 1.1 rvb };
517 1.1 rvb
518 1.3 rvb struct coda_readdir_out {
519 1.3 rvb struct coda_out_hdr oh;
520 1.1 rvb int size;
521 1.1 rvb caddr_t data; /* Place holder for data. */
522 1.1 rvb };
523 1.1 rvb
524 1.3 rvb /* coda_symlink: NO_OUT */
525 1.3 rvb struct coda_symlink_in {
526 1.3 rvb struct coda_in_hdr ih;
527 1.1 rvb ViceFid VFid; /* Directory to put symlink in */
528 1.1 rvb int srcname;
529 1.1 rvb struct coda_vattr attr;
530 1.1 rvb int tname;
531 1.1 rvb };
532 1.1 rvb
533 1.3 rvb struct coda_symlink_out {
534 1.3 rvb struct coda_out_hdr out;
535 1.1 rvb };
536 1.1 rvb
537 1.3 rvb /* coda_readlink: */
538 1.3 rvb struct coda_readlink_in {
539 1.3 rvb struct coda_in_hdr ih;
540 1.1 rvb ViceFid VFid;
541 1.1 rvb };
542 1.1 rvb
543 1.3 rvb struct coda_readlink_out {
544 1.3 rvb struct coda_out_hdr oh;
545 1.1 rvb int count;
546 1.1 rvb caddr_t data; /* Place holder for data. */
547 1.1 rvb };
548 1.1 rvb
549 1.1 rvb
550 1.3 rvb /* coda_fsync: NO_OUT */
551 1.3 rvb struct coda_fsync_in {
552 1.3 rvb struct coda_in_hdr ih;
553 1.1 rvb ViceFid VFid;
554 1.1 rvb };
555 1.1 rvb
556 1.3 rvb struct coda_fsync_out {
557 1.3 rvb struct coda_out_hdr out;
558 1.1 rvb };
559 1.1 rvb
560 1.3 rvb /* coda_inactive: NO_OUT */
561 1.3 rvb struct coda_inactive_in {
562 1.3 rvb struct coda_in_hdr ih;
563 1.1 rvb ViceFid VFid;
564 1.1 rvb };
565 1.1 rvb
566 1.3 rvb /* coda_vget: */
567 1.3 rvb struct coda_vget_in {
568 1.3 rvb struct coda_in_hdr ih;
569 1.1 rvb ViceFid VFid;
570 1.1 rvb };
571 1.1 rvb
572 1.3 rvb struct coda_vget_out {
573 1.3 rvb struct coda_out_hdr oh;
574 1.1 rvb ViceFid VFid;
575 1.1 rvb int vtype;
576 1.1 rvb };
577 1.1 rvb
578 1.1 rvb
579 1.3 rvb /* CODA_SIGNAL is out-of-band, doesn't need data. */
580 1.3 rvb /* CODA_INVALIDATE is a venus->kernel call */
581 1.3 rvb /* CODA_FLUSH is a venus->kernel call */
582 1.3 rvb
583 1.3 rvb /* coda_purgeuser: */
584 1.3 rvb /* CODA_PURGEUSER is a venus->kernel call */
585 1.3 rvb struct coda_purgeuser_out {
586 1.3 rvb struct coda_out_hdr oh;
587 1.1 rvb struct coda_cred cred;
588 1.1 rvb };
589 1.1 rvb
590 1.3 rvb /* coda_zapfile: */
591 1.3 rvb /* CODA_ZAPFILE is a venus->kernel call */
592 1.3 rvb struct coda_zapfile_out {
593 1.3 rvb struct coda_out_hdr oh;
594 1.1 rvb ViceFid CodaFid;
595 1.1 rvb };
596 1.1 rvb
597 1.3 rvb /* coda_zapdir: */
598 1.3 rvb /* CODA_ZAPDIR is a venus->kernel call */
599 1.3 rvb struct coda_zapdir_out {
600 1.3 rvb struct coda_out_hdr oh;
601 1.1 rvb ViceFid CodaFid;
602 1.1 rvb };
603 1.1 rvb
604 1.3 rvb /* coda_zapnode: */
605 1.3 rvb /* CODA_ZAPVNODE is a venus->kernel call */
606 1.3 rvb struct coda_zapvnode_out {
607 1.3 rvb struct coda_out_hdr oh;
608 1.1 rvb struct coda_cred cred;
609 1.1 rvb ViceFid VFid;
610 1.1 rvb };
611 1.1 rvb
612 1.3 rvb /* coda_purgefid: */
613 1.3 rvb /* CODA_PURGEFID is a venus->kernel call */
614 1.3 rvb struct coda_purgefid_out {
615 1.3 rvb struct coda_out_hdr oh;
616 1.1 rvb ViceFid CodaFid;
617 1.1 rvb };
618 1.1 rvb
619 1.3 rvb /* coda_rdwr: */
620 1.3 rvb struct coda_rdwr_in {
621 1.3 rvb struct coda_in_hdr ih;
622 1.1 rvb ViceFid VFid;
623 1.1 rvb int rwflag;
624 1.1 rvb int count;
625 1.1 rvb int offset;
626 1.1 rvb int ioflag;
627 1.1 rvb caddr_t data; /* Place holder for data. */
628 1.1 rvb };
629 1.1 rvb
630 1.3 rvb struct coda_rdwr_out {
631 1.3 rvb struct coda_out_hdr oh;
632 1.1 rvb int rwflag;
633 1.1 rvb int count;
634 1.1 rvb caddr_t data; /* Place holder for data. */
635 1.1 rvb };
636 1.1 rvb
637 1.1 rvb
638 1.3 rvb /* coda_replace: */
639 1.3 rvb /* CODA_REPLACE is a venus->kernel call */
640 1.3 rvb struct coda_replace_out { /* coda_replace is a venus->kernel call */
641 1.3 rvb struct coda_out_hdr oh;
642 1.1 rvb ViceFid NewFid;
643 1.1 rvb ViceFid OldFid;
644 1.1 rvb };
645 1.1 rvb
646 1.5 rvb /* coda_open_by_path: */
647 1.5 rvb struct coda_open_by_path_in {
648 1.5 rvb struct coda_in_hdr ih;
649 1.5 rvb ViceFid VFid;
650 1.5 rvb int flags;
651 1.5 rvb };
652 1.5 rvb
653 1.5 rvb struct coda_open_by_path_out {
654 1.5 rvb struct coda_out_hdr oh;
655 1.5 rvb int path;
656 1.5 rvb };
657 1.5 rvb
658 1.7 phil /* coda_statfs: NO_IN */
659 1.7 phil struct coda_statfs_in {
660 1.7 phil struct coda_in_hdr ih;
661 1.7 phil };
662 1.7 phil
663 1.7 phil struct coda_statfs_out {
664 1.7 phil struct coda_out_hdr oh;
665 1.7 phil struct coda_statfs stat;
666 1.7 phil };
667 1.7 phil
668 1.1 rvb /*
669 1.5 rvb * Occasionally, we don't cache the fid returned by CODA_LOOKUP.
670 1.5 rvb * For instance, if the fid is inconsistent.
671 1.5 rvb * This case is handled by setting the top bit of the type result parameter.
672 1.1 rvb */
673 1.3 rvb #define CODA_NOCACHE 0x80000000
674 1.1 rvb
675 1.1 rvb union inputArgs {
676 1.3 rvb struct coda_in_hdr ih; /* NB: every struct below begins with an ih */
677 1.3 rvb struct coda_open_in coda_open;
678 1.3 rvb struct coda_close_in coda_close;
679 1.3 rvb struct coda_ioctl_in coda_ioctl;
680 1.3 rvb struct coda_getattr_in coda_getattr;
681 1.3 rvb struct coda_setattr_in coda_setattr;
682 1.3 rvb struct coda_access_in coda_access;
683 1.3 rvb struct coda_lookup_in coda_lookup;
684 1.3 rvb struct coda_create_in coda_create;
685 1.3 rvb struct coda_remove_in coda_remove;
686 1.3 rvb struct coda_link_in coda_link;
687 1.3 rvb struct coda_rename_in coda_rename;
688 1.3 rvb struct coda_mkdir_in coda_mkdir;
689 1.3 rvb struct coda_rmdir_in coda_rmdir;
690 1.3 rvb struct coda_readdir_in coda_readdir;
691 1.3 rvb struct coda_symlink_in coda_symlink;
692 1.3 rvb struct coda_readlink_in coda_readlink;
693 1.3 rvb struct coda_fsync_in coda_fsync;
694 1.3 rvb struct coda_inactive_in coda_inactive;
695 1.3 rvb struct coda_vget_in coda_vget;
696 1.3 rvb struct coda_rdwr_in coda_rdwr;
697 1.7 phil struct coda_open_by_path_in coda_open_by_path;
698 1.7 phil struct coda_statfs_in coda_statfs;
699 1.1 rvb };
700 1.1 rvb
701 1.1 rvb union outputArgs {
702 1.3 rvb struct coda_out_hdr oh; /* NB: every struct below begins with an oh */
703 1.3 rvb struct coda_root_out coda_root;
704 1.3 rvb struct coda_open_out coda_open;
705 1.3 rvb struct coda_ioctl_out coda_ioctl;
706 1.3 rvb struct coda_getattr_out coda_getattr;
707 1.3 rvb struct coda_lookup_out coda_lookup;
708 1.3 rvb struct coda_create_out coda_create;
709 1.3 rvb struct coda_mkdir_out coda_mkdir;
710 1.3 rvb struct coda_readdir_out coda_readdir;
711 1.3 rvb struct coda_readlink_out coda_readlink;
712 1.3 rvb struct coda_vget_out coda_vget;
713 1.3 rvb struct coda_purgeuser_out coda_purgeuser;
714 1.3 rvb struct coda_zapfile_out coda_zapfile;
715 1.3 rvb struct coda_zapdir_out coda_zapdir;
716 1.3 rvb struct coda_zapvnode_out coda_zapvnode;
717 1.3 rvb struct coda_purgefid_out coda_purgefid;
718 1.3 rvb struct coda_rdwr_out coda_rdwr;
719 1.3 rvb struct coda_replace_out coda_replace;
720 1.7 phil struct coda_open_by_path_out coda_open_by_path;
721 1.7 phil struct coda_statfs_out coda_statfs;
722 1.1 rvb };
723 1.1 rvb
724 1.3 rvb union coda_downcalls {
725 1.3 rvb /* CODA_INVALIDATE is a venus->kernel call */
726 1.3 rvb /* CODA_FLUSH is a venus->kernel call */
727 1.3 rvb struct coda_purgeuser_out purgeuser;
728 1.3 rvb struct coda_zapfile_out zapfile;
729 1.3 rvb struct coda_zapdir_out zapdir;
730 1.3 rvb struct coda_zapvnode_out zapvnode;
731 1.3 rvb struct coda_purgefid_out purgefid;
732 1.3 rvb struct coda_replace_out replace;
733 1.1 rvb };
734 1.1 rvb
735 1.1 rvb
736 1.1 rvb /*
737 1.1 rvb * Used for identifying usage of "Control" and pioctls
738 1.1 rvb */
739 1.1 rvb
740 1.1 rvb #define PIOCPARM_MASK 0x0000ffff
741 1.1 rvb struct ViceIoctl {
742 1.1 rvb caddr_t in, out; /* Data to be transferred in, or out */
743 1.1 rvb short in_size; /* Size of input buffer <= 2K */
744 1.1 rvb short out_size; /* Maximum size of output buffer, <= 2K */
745 1.1 rvb };
746 1.1 rvb
747 1.6 rvb #if defined(__CYGWIN32__) || defined(DJGPP)
748 1.1 rvb struct PioctlData {
749 1.6 rvb unsigned long cmd;
750 1.1 rvb const char *path;
751 1.1 rvb int follow;
752 1.1 rvb struct ViceIoctl vi;
753 1.1 rvb };
754 1.6 rvb #else
755 1.6 rvb struct PioctlData {
756 1.6 rvb const char *path;
757 1.6 rvb int follow;
758 1.6 rvb struct ViceIoctl vi;
759 1.6 rvb };
760 1.6 rvb #endif
761 1.1 rvb
762 1.3 rvb #define CODA_CONTROL ".CONTROL"
763 1.3 rvb #define CODA_CONTROLLEN 8
764 1.1 rvb #define CTL_VOL -1
765 1.1 rvb #define CTL_VNO -1
766 1.1 rvb #define CTL_UNI -1
767 1.1 rvb #define CTL_INO -1
768 1.1 rvb #define CTL_FILE "/coda/.CONTROL"
769 1.1 rvb
770 1.1 rvb
771 1.1 rvb #define IS_CTL_FID(fidp) ((fidp)->Volume == CTL_VOL &&\
772 1.1 rvb (fidp)->Vnode == CTL_VNO &&\
773 1.1 rvb (fidp)->Unique == CTL_UNI)
774 1.1 rvb #endif
775 1.1 rvb
776