coda.h revision 1.1 1 1.1 rvb /*
2 1.1 rvb
3 1.1 rvb Coda: an Experimental Distributed File System
4 1.1 rvb Release 3.1
5 1.1 rvb
6 1.1 rvb Copyright (c) 1987-1998 Carnegie Mellon University
7 1.1 rvb All Rights Reserved
8 1.1 rvb
9 1.1 rvb Permission to use, copy, modify and distribute this software and its
10 1.1 rvb documentation is hereby granted, provided that both the copyright
11 1.1 rvb notice and this permission notice appear in all copies of the
12 1.1 rvb software, derivative works or modified versions, and any portions
13 1.1 rvb thereof, and that both notices appear in supporting documentation, and
14 1.1 rvb that credit is given to Carnegie Mellon University in all documents
15 1.1 rvb and publicity pertaining to direct or indirect use of this code or its
16 1.1 rvb derivatives.
17 1.1 rvb
18 1.1 rvb CODA IS AN EXPERIMENTAL SOFTWARE SYSTEM AND IS KNOWN TO HAVE BUGS,
19 1.1 rvb SOME OF WHICH MAY HAVE SERIOUS CONSEQUENCES. CARNEGIE MELLON ALLOWS
20 1.1 rvb FREE USE OF THIS SOFTWARE IN ITS "AS IS" CONDITION. CARNEGIE MELLON
21 1.1 rvb DISCLAIMS ANY LIABILITY OF ANY KIND FOR ANY DAMAGES WHATSOEVER
22 1.1 rvb RESULTING DIRECTLY OR INDIRECTLY FROM THE USE OF THIS SOFTWARE OR OF
23 1.1 rvb ANY DERIVATIVE WORK.
24 1.1 rvb
25 1.1 rvb Carnegie Mellon encourages users of this software to return any
26 1.1 rvb improvements or extensions that they make, and to grant Carnegie
27 1.1 rvb Mellon the rights to redistribute these changes without encumbrance.
28 1.1 rvb */
29 1.1 rvb
30 1.1 rvb /* $Header: /tank/opengrok/rsync2/NetBSD/src/sys/coda/coda.h,v 1.1 1998/08/29 21:26:46 rvb Exp $ */
31 1.1 rvb
32 1.1 rvb /*
33 1.1 rvb *
34 1.1 rvb * Based on cfs.h from Mach, but revamped for increased simplicity.
35 1.1 rvb * Linux modifications by Peter Braam, Aug 1996
36 1.1 rvb */
37 1.1 rvb
38 1.1 rvb #ifndef _CFS_HEADER_
39 1.1 rvb #define _CFS_HEADER_
40 1.1 rvb
41 1.1 rvb
42 1.1 rvb
43 1.1 rvb /* Catch new _KERNEL defn for NetBSD */
44 1.1 rvb #ifdef __NetBSD__
45 1.1 rvb #include <sys/types.h>
46 1.1 rvb #endif
47 1.1 rvb
48 1.1 rvb #if defined(__linux__) || defined(__CYGWIN32__)
49 1.1 rvb #define cdev_t u_quad_t
50 1.1 rvb #if !defined(_UQUAD_T_) && (!defined(__GLIBC__) || __GLIBC__ < 2)
51 1.1 rvb #define _UQUAD_T_ 1
52 1.1 rvb typedef unsigned long long u_quad_t;
53 1.1 rvb #endif
54 1.1 rvb #else
55 1.1 rvb #define cdev_t dev_t
56 1.1 rvb #endif
57 1.1 rvb
58 1.1 rvb #ifdef __CYGWIN32__
59 1.1 rvb typedef unsigned char u_int8_t;
60 1.1 rvb struct timespec {
61 1.1 rvb time_t tv_sec; /* seconds */
62 1.1 rvb long tv_nsec; /* nanoseconds */
63 1.1 rvb };
64 1.1 rvb #endif
65 1.1 rvb
66 1.1 rvb
67 1.1 rvb /*
68 1.1 rvb * Cfs constants
69 1.1 rvb */
70 1.1 rvb #define CFS_MAXNAMLEN 255
71 1.1 rvb #define CFS_MAXPATHLEN 1024
72 1.1 rvb #define CFS_MAXSYMLINK 10
73 1.1 rvb
74 1.1 rvb /* these are Coda's version of O_RDONLY etc combinations
75 1.1 rvb * to deal with VFS open modes
76 1.1 rvb */
77 1.1 rvb #define C_O_READ 0x001
78 1.1 rvb #define C_O_WRITE 0x002
79 1.1 rvb #define C_O_TRUNC 0x010
80 1.1 rvb #define C_O_EXCL 0x100
81 1.1 rvb
82 1.1 rvb /* these are to find mode bits in Venus */
83 1.1 rvb #define C_M_READ 00400
84 1.1 rvb #define C_M_WRITE 00200
85 1.1 rvb
86 1.1 rvb /* for access Venus will use */
87 1.1 rvb #define C_A_R_OK 4 /* Test for read permission. */
88 1.1 rvb #define C_A_W_OK 2 /* Test for write permission. */
89 1.1 rvb #define C_A_X_OK 1 /* Test for execute permission. */
90 1.1 rvb #define C_A_F_OK 0 /* Test for existence. */
91 1.1 rvb
92 1.1 rvb
93 1.1 rvb
94 1.1 rvb #ifndef _VENUS_DIRENT_T_
95 1.1 rvb #define _VENUS_DIRENT_T_ 1
96 1.1 rvb struct venus_dirent {
97 1.1 rvb unsigned long d_fileno; /* file number of entry */
98 1.1 rvb unsigned short d_reclen; /* length of this record */
99 1.1 rvb char d_type; /* file type, see below */
100 1.1 rvb char d_namlen; /* length of string in d_name */
101 1.1 rvb char d_name[CFS_MAXNAMLEN + 1];/* name must be no longer than this */
102 1.1 rvb };
103 1.1 rvb #undef DIRSIZ
104 1.1 rvb #define DIRSIZ(dp) ((sizeof (struct venus_dirent) - (CFS_MAXNAMLEN+1)) + \
105 1.1 rvb (((dp)->d_namlen+1 + 3) &~ 3))
106 1.1 rvb
107 1.1 rvb /*
108 1.1 rvb * File types
109 1.1 rvb */
110 1.1 rvb #define CDT_UNKNOWN 0
111 1.1 rvb #define CDT_FIFO 1
112 1.1 rvb #define CDT_CHR 2
113 1.1 rvb #define CDT_DIR 4
114 1.1 rvb #define CDT_BLK 6
115 1.1 rvb #define CDT_REG 8
116 1.1 rvb #define CDT_LNK 10
117 1.1 rvb #define CDT_SOCK 12
118 1.1 rvb #define CDT_WHT 14
119 1.1 rvb
120 1.1 rvb /*
121 1.1 rvb * Convert between stat structure types and directory types.
122 1.1 rvb */
123 1.1 rvb #define IFTOCDT(mode) (((mode) & 0170000) >> 12)
124 1.1 rvb #define CDTTOIF(dirtype) ((dirtype) << 12)
125 1.1 rvb
126 1.1 rvb #endif
127 1.1 rvb
128 1.1 rvb #ifndef _FID_T_
129 1.1 rvb #define _FID_T_ 1
130 1.1 rvb typedef u_long VolumeId;
131 1.1 rvb typedef u_long VnodeId;
132 1.1 rvb typedef u_long Unique_t;
133 1.1 rvb typedef u_long FileVersion;
134 1.1 rvb #endif
135 1.1 rvb
136 1.1 rvb #ifndef _VICEFID_T_
137 1.1 rvb #define _VICEFID_T_ 1
138 1.1 rvb typedef struct ViceFid {
139 1.1 rvb VolumeId Volume;
140 1.1 rvb VnodeId Vnode;
141 1.1 rvb Unique_t Unique;
142 1.1 rvb } ViceFid;
143 1.1 rvb #endif /* VICEFID */
144 1.1 rvb
145 1.1 rvb #ifdef __linux__
146 1.1 rvb static inline ino_t coda_f2i(struct ViceFid *fid)
147 1.1 rvb {
148 1.1 rvb if ( fid ) {
149 1.1 rvb return (fid->Unique + (fid->Vnode << 10) + (fid->Volume << 20));
150 1.1 rvb } else {
151 1.1 rvb return 0;
152 1.1 rvb }
153 1.1 rvb }
154 1.1 rvb #endif
155 1.1 rvb
156 1.1 rvb #ifndef _VUID_T_
157 1.1 rvb #define _VUID_T_
158 1.1 rvb typedef u_long vuid_t;
159 1.1 rvb typedef u_long vgid_t;
160 1.1 rvb #endif /*_VUID_T_ */
161 1.1 rvb
162 1.1 rvb #ifndef _CODACRED_T_
163 1.1 rvb #define _CODACRED_T_
164 1.1 rvb struct coda_cred {
165 1.1 rvb vuid_t cr_uid, cr_euid, cr_suid, cr_fsuid; /* Real, efftve, set, fs uid*/
166 1.1 rvb #if defined(__NetBSD__) || defined(__FreeBSD__)
167 1.1 rvb vgid_t cr_groupid, cr_egid, cr_sgid, cr_fsgid; /* same for groups */
168 1.1 rvb #else
169 1.1 rvb vgid_t cr_gid, cr_egid, cr_sgid, cr_fsgid; /* same for groups */
170 1.1 rvb #endif
171 1.1 rvb };
172 1.1 rvb #endif
173 1.1 rvb
174 1.1 rvb #ifndef _VENUS_VATTR_T_
175 1.1 rvb #define _VENUS_VATTR_T_
176 1.1 rvb /*
177 1.1 rvb * Vnode types. VNON means no type.
178 1.1 rvb */
179 1.1 rvb enum coda_vtype { C_VNON, C_VREG, C_VDIR, C_VBLK, C_VCHR, C_VLNK, C_VSOCK, C_VFIFO, C_VBAD };
180 1.1 rvb
181 1.1 rvb struct coda_vattr {
182 1.1 rvb enum coda_vtype va_type; /* vnode type (for create) */
183 1.1 rvb u_short va_mode; /* files access mode and type */
184 1.1 rvb short va_nlink; /* number of references to file */
185 1.1 rvb vuid_t va_uid; /* owner user id */
186 1.1 rvb vgid_t va_gid; /* owner group id */
187 1.1 rvb long va_fileid; /* file id */
188 1.1 rvb u_quad_t va_size; /* file size in bytes */
189 1.1 rvb long va_blocksize; /* blocksize preferred for i/o */
190 1.1 rvb struct timespec va_atime; /* time of last access */
191 1.1 rvb struct timespec va_mtime; /* time of last modification */
192 1.1 rvb struct timespec va_ctime; /* time file changed */
193 1.1 rvb u_long va_gen; /* generation number of file */
194 1.1 rvb u_long va_flags; /* flags defined for file */
195 1.1 rvb cdev_t va_rdev; /* device special file represents */
196 1.1 rvb u_quad_t va_bytes; /* bytes of disk space held by file */
197 1.1 rvb u_quad_t va_filerev; /* file modification number */
198 1.1 rvb };
199 1.1 rvb
200 1.1 rvb #endif
201 1.1 rvb
202 1.1 rvb /*
203 1.1 rvb * Kernel <--> Venus communications.
204 1.1 rvb */
205 1.1 rvb
206 1.1 rvb #define CFS_ROOT ((u_long) 2)
207 1.1 rvb #define CFS_SYNC ((u_long) 3)
208 1.1 rvb #define CFS_OPEN ((u_long) 4)
209 1.1 rvb #define CFS_CLOSE ((u_long) 5)
210 1.1 rvb #define CFS_IOCTL ((u_long) 6)
211 1.1 rvb #define CFS_GETATTR ((u_long) 7)
212 1.1 rvb #define CFS_SETATTR ((u_long) 8)
213 1.1 rvb #define CFS_ACCESS ((u_long) 9)
214 1.1 rvb #define CFS_LOOKUP ((u_long) 10)
215 1.1 rvb #define CFS_CREATE ((u_long) 11)
216 1.1 rvb #define CFS_REMOVE ((u_long) 12)
217 1.1 rvb #define CFS_LINK ((u_long) 13)
218 1.1 rvb #define CFS_RENAME ((u_long) 14)
219 1.1 rvb #define CFS_MKDIR ((u_long) 15)
220 1.1 rvb #define CFS_RMDIR ((u_long) 16)
221 1.1 rvb #define CFS_READDIR ((u_long) 17)
222 1.1 rvb #define CFS_SYMLINK ((u_long) 18)
223 1.1 rvb #define CFS_READLINK ((u_long) 19)
224 1.1 rvb #define CFS_FSYNC ((u_long) 20)
225 1.1 rvb #define CFS_INACTIVE ((u_long) 21)
226 1.1 rvb #define CFS_VGET ((u_long) 22)
227 1.1 rvb #define CFS_SIGNAL ((u_long) 23)
228 1.1 rvb #define CFS_REPLACE ((u_long) 24)
229 1.1 rvb #define CFS_FLUSH ((u_long) 25)
230 1.1 rvb #define CFS_PURGEUSER ((u_long) 26)
231 1.1 rvb #define CFS_ZAPFILE ((u_long) 27)
232 1.1 rvb #define CFS_ZAPDIR ((u_long) 28)
233 1.1 rvb #define CFS_ZAPVNODE ((u_long) 29)
234 1.1 rvb #define CFS_PURGEFID ((u_long) 30)
235 1.1 rvb #define CFS_NCALLS 31
236 1.1 rvb
237 1.1 rvb #define DOWNCALL(opcode) (opcode >= CFS_REPLACE && opcode <= CFS_PURGEFID)
238 1.1 rvb
239 1.1 rvb #define VC_MAXDATASIZE 8192
240 1.1 rvb #define VC_MAXMSGSIZE sizeof(union inputArgs)+sizeof(union outputArgs) +\
241 1.1 rvb VC_MAXDATASIZE
242 1.1 rvb
243 1.1 rvb
244 1.1 rvb
245 1.1 rvb /*
246 1.1 rvb * Venus <-> Coda RPC arguments
247 1.1 rvb */
248 1.1 rvb struct cfs_in_hdr {
249 1.1 rvb unsigned long opcode;
250 1.1 rvb unsigned long unique; /* Keep multiple outstanding msgs distinct */
251 1.1 rvb u_short pid; /* Common to all */
252 1.1 rvb u_short pgid; /* Common to all */
253 1.1 rvb u_short sid; /* Common to all */
254 1.1 rvb struct coda_cred cred; /* Common to all */
255 1.1 rvb };
256 1.1 rvb
257 1.1 rvb /* Really important that opcode and unique are 1st two fields! */
258 1.1 rvb struct cfs_out_hdr {
259 1.1 rvb unsigned long opcode;
260 1.1 rvb unsigned long unique;
261 1.1 rvb unsigned long result;
262 1.1 rvb };
263 1.1 rvb
264 1.1 rvb /* cfs_root: NO_IN */
265 1.1 rvb struct cfs_root_out {
266 1.1 rvb struct cfs_out_hdr oh;
267 1.1 rvb ViceFid VFid;
268 1.1 rvb };
269 1.1 rvb
270 1.1 rvb struct cfs_root_in {
271 1.1 rvb struct cfs_in_hdr in;
272 1.1 rvb };
273 1.1 rvb
274 1.1 rvb /* cfs_sync: */
275 1.1 rvb /* Nothing needed for cfs_sync */
276 1.1 rvb
277 1.1 rvb /* cfs_open: */
278 1.1 rvb struct cfs_open_in {
279 1.1 rvb struct cfs_in_hdr ih;
280 1.1 rvb ViceFid VFid;
281 1.1 rvb int flags;
282 1.1 rvb };
283 1.1 rvb
284 1.1 rvb struct cfs_open_out {
285 1.1 rvb struct cfs_out_hdr oh;
286 1.1 rvb cdev_t dev;
287 1.1 rvb ino_t inode;
288 1.1 rvb };
289 1.1 rvb
290 1.1 rvb
291 1.1 rvb /* cfs_close: */
292 1.1 rvb struct cfs_close_in {
293 1.1 rvb struct cfs_in_hdr ih;
294 1.1 rvb ViceFid VFid;
295 1.1 rvb int flags;
296 1.1 rvb };
297 1.1 rvb
298 1.1 rvb struct cfs_close_out {
299 1.1 rvb struct cfs_out_hdr out;
300 1.1 rvb };
301 1.1 rvb
302 1.1 rvb /* cfs_ioctl: */
303 1.1 rvb struct cfs_ioctl_in {
304 1.1 rvb struct cfs_in_hdr ih;
305 1.1 rvb ViceFid VFid;
306 1.1 rvb int cmd;
307 1.1 rvb int len;
308 1.1 rvb int rwflag;
309 1.1 rvb char *data; /* Place holder for data. */
310 1.1 rvb };
311 1.1 rvb
312 1.1 rvb struct cfs_ioctl_out {
313 1.1 rvb struct cfs_out_hdr oh;
314 1.1 rvb int len;
315 1.1 rvb caddr_t data; /* Place holder for data. */
316 1.1 rvb };
317 1.1 rvb
318 1.1 rvb
319 1.1 rvb /* cfs_getattr: */
320 1.1 rvb struct cfs_getattr_in {
321 1.1 rvb struct cfs_in_hdr ih;
322 1.1 rvb ViceFid VFid;
323 1.1 rvb };
324 1.1 rvb
325 1.1 rvb struct cfs_getattr_out {
326 1.1 rvb struct cfs_out_hdr oh;
327 1.1 rvb struct coda_vattr attr;
328 1.1 rvb };
329 1.1 rvb
330 1.1 rvb
331 1.1 rvb /* cfs_setattr: NO_OUT */
332 1.1 rvb struct cfs_setattr_in {
333 1.1 rvb struct cfs_in_hdr ih;
334 1.1 rvb ViceFid VFid;
335 1.1 rvb struct coda_vattr attr;
336 1.1 rvb };
337 1.1 rvb
338 1.1 rvb struct cfs_setattr_out {
339 1.1 rvb struct cfs_out_hdr out;
340 1.1 rvb };
341 1.1 rvb
342 1.1 rvb /* cfs_access: NO_OUT */
343 1.1 rvb struct cfs_access_in {
344 1.1 rvb struct cfs_in_hdr ih;
345 1.1 rvb ViceFid VFid;
346 1.1 rvb int flags;
347 1.1 rvb };
348 1.1 rvb
349 1.1 rvb struct cfs_access_out {
350 1.1 rvb struct cfs_out_hdr out;
351 1.1 rvb };
352 1.1 rvb
353 1.1 rvb /* cfs_lookup: */
354 1.1 rvb struct cfs_lookup_in {
355 1.1 rvb struct cfs_in_hdr ih;
356 1.1 rvb ViceFid VFid;
357 1.1 rvb int name; /* Place holder for data. */
358 1.1 rvb };
359 1.1 rvb
360 1.1 rvb struct cfs_lookup_out {
361 1.1 rvb struct cfs_out_hdr oh;
362 1.1 rvb ViceFid VFid;
363 1.1 rvb int vtype;
364 1.1 rvb };
365 1.1 rvb
366 1.1 rvb
367 1.1 rvb /* cfs_create: */
368 1.1 rvb struct cfs_create_in {
369 1.1 rvb struct cfs_in_hdr ih;
370 1.1 rvb ViceFid VFid;
371 1.1 rvb struct coda_vattr attr;
372 1.1 rvb int excl;
373 1.1 rvb int mode;
374 1.1 rvb int name; /* Place holder for data. */
375 1.1 rvb };
376 1.1 rvb
377 1.1 rvb struct cfs_create_out {
378 1.1 rvb struct cfs_out_hdr oh;
379 1.1 rvb ViceFid VFid;
380 1.1 rvb struct coda_vattr attr;
381 1.1 rvb };
382 1.1 rvb
383 1.1 rvb
384 1.1 rvb /* cfs_remove: NO_OUT */
385 1.1 rvb struct cfs_remove_in {
386 1.1 rvb struct cfs_in_hdr ih;
387 1.1 rvb ViceFid VFid;
388 1.1 rvb int name; /* Place holder for data. */
389 1.1 rvb };
390 1.1 rvb
391 1.1 rvb struct cfs_remove_out {
392 1.1 rvb struct cfs_out_hdr out;
393 1.1 rvb };
394 1.1 rvb
395 1.1 rvb /* cfs_link: NO_OUT */
396 1.1 rvb struct cfs_link_in {
397 1.1 rvb struct cfs_in_hdr ih;
398 1.1 rvb ViceFid sourceFid; /* cnode to link *to* */
399 1.1 rvb ViceFid destFid; /* Directory in which to place link */
400 1.1 rvb int tname; /* Place holder for data. */
401 1.1 rvb };
402 1.1 rvb
403 1.1 rvb struct cfs_link_out {
404 1.1 rvb struct cfs_out_hdr out;
405 1.1 rvb };
406 1.1 rvb
407 1.1 rvb
408 1.1 rvb /* cfs_rename: NO_OUT */
409 1.1 rvb struct cfs_rename_in {
410 1.1 rvb struct cfs_in_hdr ih;
411 1.1 rvb ViceFid sourceFid;
412 1.1 rvb int srcname;
413 1.1 rvb ViceFid destFid;
414 1.1 rvb int destname;
415 1.1 rvb };
416 1.1 rvb
417 1.1 rvb struct cfs_rename_out {
418 1.1 rvb struct cfs_out_hdr out;
419 1.1 rvb };
420 1.1 rvb
421 1.1 rvb /* cfs_mkdir: */
422 1.1 rvb struct cfs_mkdir_in {
423 1.1 rvb struct cfs_in_hdr ih;
424 1.1 rvb ViceFid VFid;
425 1.1 rvb struct coda_vattr attr;
426 1.1 rvb int name; /* Place holder for data. */
427 1.1 rvb };
428 1.1 rvb
429 1.1 rvb struct cfs_mkdir_out {
430 1.1 rvb struct cfs_out_hdr oh;
431 1.1 rvb ViceFid VFid;
432 1.1 rvb struct coda_vattr attr;
433 1.1 rvb };
434 1.1 rvb
435 1.1 rvb
436 1.1 rvb /* cfs_rmdir: NO_OUT */
437 1.1 rvb struct cfs_rmdir_in {
438 1.1 rvb struct cfs_in_hdr ih;
439 1.1 rvb ViceFid VFid;
440 1.1 rvb int name; /* Place holder for data. */
441 1.1 rvb };
442 1.1 rvb
443 1.1 rvb struct cfs_rmdir_out {
444 1.1 rvb struct cfs_out_hdr out;
445 1.1 rvb };
446 1.1 rvb
447 1.1 rvb /* cfs_readdir: */
448 1.1 rvb struct cfs_readdir_in {
449 1.1 rvb struct cfs_in_hdr ih;
450 1.1 rvb ViceFid VFid;
451 1.1 rvb int count;
452 1.1 rvb int offset;
453 1.1 rvb };
454 1.1 rvb
455 1.1 rvb struct cfs_readdir_out {
456 1.1 rvb struct cfs_out_hdr oh;
457 1.1 rvb int size;
458 1.1 rvb caddr_t data; /* Place holder for data. */
459 1.1 rvb };
460 1.1 rvb
461 1.1 rvb /* cfs_symlink: NO_OUT */
462 1.1 rvb struct cfs_symlink_in {
463 1.1 rvb struct cfs_in_hdr ih;
464 1.1 rvb ViceFid VFid; /* Directory to put symlink in */
465 1.1 rvb int srcname;
466 1.1 rvb struct coda_vattr attr;
467 1.1 rvb int tname;
468 1.1 rvb };
469 1.1 rvb
470 1.1 rvb struct cfs_symlink_out {
471 1.1 rvb struct cfs_out_hdr out;
472 1.1 rvb };
473 1.1 rvb
474 1.1 rvb /* cfs_readlink: */
475 1.1 rvb struct cfs_readlink_in {
476 1.1 rvb struct cfs_in_hdr ih;
477 1.1 rvb ViceFid VFid;
478 1.1 rvb };
479 1.1 rvb
480 1.1 rvb struct cfs_readlink_out {
481 1.1 rvb struct cfs_out_hdr oh;
482 1.1 rvb int count;
483 1.1 rvb caddr_t data; /* Place holder for data. */
484 1.1 rvb };
485 1.1 rvb
486 1.1 rvb
487 1.1 rvb /* cfs_fsync: NO_OUT */
488 1.1 rvb struct cfs_fsync_in {
489 1.1 rvb struct cfs_in_hdr ih;
490 1.1 rvb ViceFid VFid;
491 1.1 rvb };
492 1.1 rvb
493 1.1 rvb struct cfs_fsync_out {
494 1.1 rvb struct cfs_out_hdr out;
495 1.1 rvb };
496 1.1 rvb
497 1.1 rvb /* cfs_inactive: NO_OUT */
498 1.1 rvb struct cfs_inactive_in {
499 1.1 rvb struct cfs_in_hdr ih;
500 1.1 rvb ViceFid VFid;
501 1.1 rvb };
502 1.1 rvb
503 1.1 rvb /* cfs_vget: */
504 1.1 rvb struct cfs_vget_in {
505 1.1 rvb struct cfs_in_hdr ih;
506 1.1 rvb ViceFid VFid;
507 1.1 rvb };
508 1.1 rvb
509 1.1 rvb struct cfs_vget_out {
510 1.1 rvb struct cfs_out_hdr oh;
511 1.1 rvb ViceFid VFid;
512 1.1 rvb int vtype;
513 1.1 rvb };
514 1.1 rvb
515 1.1 rvb
516 1.1 rvb /* CFS_SIGNAL is out-of-band, doesn't need data. */
517 1.1 rvb /* CFS_INVALIDATE is a venus->kernel call */
518 1.1 rvb /* CFS_FLUSH is a venus->kernel call */
519 1.1 rvb
520 1.1 rvb /* cfs_purgeuser: */
521 1.1 rvb /* CFS_PURGEUSER is a venus->kernel call */
522 1.1 rvb struct cfs_purgeuser_out {
523 1.1 rvb struct cfs_out_hdr oh;
524 1.1 rvb struct coda_cred cred;
525 1.1 rvb };
526 1.1 rvb
527 1.1 rvb /* cfs_zapfile: */
528 1.1 rvb /* CFS_ZAPFILE is a venus->kernel call */
529 1.1 rvb struct cfs_zapfile_out {
530 1.1 rvb struct cfs_out_hdr oh;
531 1.1 rvb ViceFid CodaFid;
532 1.1 rvb };
533 1.1 rvb
534 1.1 rvb /* cfs_zapdir: */
535 1.1 rvb /* CFS_ZAPDIR is a venus->kernel call */
536 1.1 rvb struct cfs_zapdir_out {
537 1.1 rvb struct cfs_out_hdr oh;
538 1.1 rvb ViceFid CodaFid;
539 1.1 rvb };
540 1.1 rvb
541 1.1 rvb /* cfs_zapnode: */
542 1.1 rvb /* CFS_ZAPVNODE is a venus->kernel call */
543 1.1 rvb struct cfs_zapvnode_out {
544 1.1 rvb struct cfs_out_hdr oh;
545 1.1 rvb struct coda_cred cred;
546 1.1 rvb ViceFid VFid;
547 1.1 rvb };
548 1.1 rvb
549 1.1 rvb /* cfs_purgefid: */
550 1.1 rvb /* CFS_PURGEFID is a venus->kernel call */
551 1.1 rvb struct cfs_purgefid_out {
552 1.1 rvb struct cfs_out_hdr oh;
553 1.1 rvb ViceFid CodaFid;
554 1.1 rvb };
555 1.1 rvb
556 1.1 rvb /* cfs_rdwr: */
557 1.1 rvb struct cfs_rdwr_in {
558 1.1 rvb struct cfs_in_hdr ih;
559 1.1 rvb ViceFid VFid;
560 1.1 rvb int rwflag;
561 1.1 rvb int count;
562 1.1 rvb int offset;
563 1.1 rvb int ioflag;
564 1.1 rvb caddr_t data; /* Place holder for data. */
565 1.1 rvb };
566 1.1 rvb
567 1.1 rvb struct cfs_rdwr_out {
568 1.1 rvb struct cfs_out_hdr oh;
569 1.1 rvb int rwflag;
570 1.1 rvb int count;
571 1.1 rvb caddr_t data; /* Place holder for data. */
572 1.1 rvb };
573 1.1 rvb
574 1.1 rvb
575 1.1 rvb /* cfs_replace: */
576 1.1 rvb /* CFS_REPLACE is a venus->kernel call */
577 1.1 rvb struct cfs_replace_out { /* cfs_replace is a venus->kernel call */
578 1.1 rvb struct cfs_out_hdr oh;
579 1.1 rvb ViceFid NewFid;
580 1.1 rvb ViceFid OldFid;
581 1.1 rvb };
582 1.1 rvb
583 1.1 rvb /*
584 1.1 rvb * Occasionally, don't cache the fid returned by CFS_LOOKUP. For instance, if
585 1.1 rvb * the fid is inconsistent. This case is handled by setting the top bit of the
586 1.1 rvb * return result parameter.
587 1.1 rvb */
588 1.1 rvb #define CFS_NOCACHE 0x80000000
589 1.1 rvb
590 1.1 rvb union inputArgs {
591 1.1 rvb struct cfs_in_hdr ih; /* NB: every struct below begins with an ih */
592 1.1 rvb struct cfs_open_in cfs_open;
593 1.1 rvb struct cfs_close_in cfs_close;
594 1.1 rvb struct cfs_ioctl_in cfs_ioctl;
595 1.1 rvb struct cfs_getattr_in cfs_getattr;
596 1.1 rvb struct cfs_setattr_in cfs_setattr;
597 1.1 rvb struct cfs_access_in cfs_access;
598 1.1 rvb struct cfs_lookup_in cfs_lookup;
599 1.1 rvb struct cfs_create_in cfs_create;
600 1.1 rvb struct cfs_remove_in cfs_remove;
601 1.1 rvb struct cfs_link_in cfs_link;
602 1.1 rvb struct cfs_rename_in cfs_rename;
603 1.1 rvb struct cfs_mkdir_in cfs_mkdir;
604 1.1 rvb struct cfs_rmdir_in cfs_rmdir;
605 1.1 rvb struct cfs_readdir_in cfs_readdir;
606 1.1 rvb struct cfs_symlink_in cfs_symlink;
607 1.1 rvb struct cfs_readlink_in cfs_readlink;
608 1.1 rvb struct cfs_fsync_in cfs_fsync;
609 1.1 rvb struct cfs_inactive_in cfs_inactive;
610 1.1 rvb struct cfs_vget_in cfs_vget;
611 1.1 rvb struct cfs_rdwr_in cfs_rdwr;
612 1.1 rvb };
613 1.1 rvb
614 1.1 rvb union outputArgs {
615 1.1 rvb struct cfs_out_hdr oh; /* NB: every struct below begins with an oh */
616 1.1 rvb struct cfs_root_out cfs_root;
617 1.1 rvb struct cfs_open_out cfs_open;
618 1.1 rvb struct cfs_ioctl_out cfs_ioctl;
619 1.1 rvb struct cfs_getattr_out cfs_getattr;
620 1.1 rvb struct cfs_lookup_out cfs_lookup;
621 1.1 rvb struct cfs_create_out cfs_create;
622 1.1 rvb struct cfs_mkdir_out cfs_mkdir;
623 1.1 rvb struct cfs_readdir_out cfs_readdir;
624 1.1 rvb struct cfs_readlink_out cfs_readlink;
625 1.1 rvb struct cfs_vget_out cfs_vget;
626 1.1 rvb struct cfs_purgeuser_out cfs_purgeuser;
627 1.1 rvb struct cfs_zapfile_out cfs_zapfile;
628 1.1 rvb struct cfs_zapdir_out cfs_zapdir;
629 1.1 rvb struct cfs_zapvnode_out cfs_zapvnode;
630 1.1 rvb struct cfs_purgefid_out cfs_purgefid;
631 1.1 rvb struct cfs_rdwr_out cfs_rdwr;
632 1.1 rvb struct cfs_replace_out cfs_replace;
633 1.1 rvb };
634 1.1 rvb
635 1.1 rvb union cfs_downcalls {
636 1.1 rvb /* CFS_INVALIDATE is a venus->kernel call */
637 1.1 rvb /* CFS_FLUSH is a venus->kernel call */
638 1.1 rvb struct cfs_purgeuser_out purgeuser;
639 1.1 rvb struct cfs_zapfile_out zapfile;
640 1.1 rvb struct cfs_zapdir_out zapdir;
641 1.1 rvb struct cfs_zapvnode_out zapvnode;
642 1.1 rvb struct cfs_purgefid_out purgefid;
643 1.1 rvb struct cfs_replace_out replace;
644 1.1 rvb };
645 1.1 rvb
646 1.1 rvb
647 1.1 rvb /*
648 1.1 rvb * Used for identifying usage of "Control" and pioctls
649 1.1 rvb */
650 1.1 rvb
651 1.1 rvb #define PIOCPARM_MASK 0x0000ffff
652 1.1 rvb struct ViceIoctl {
653 1.1 rvb caddr_t in, out; /* Data to be transferred in, or out */
654 1.1 rvb short in_size; /* Size of input buffer <= 2K */
655 1.1 rvb short out_size; /* Maximum size of output buffer, <= 2K */
656 1.1 rvb };
657 1.1 rvb
658 1.1 rvb struct PioctlData {
659 1.1 rvb const char *path;
660 1.1 rvb int follow;
661 1.1 rvb struct ViceIoctl vi;
662 1.1 rvb };
663 1.1 rvb
664 1.1 rvb #define CFS_CONTROL ".CONTROL"
665 1.1 rvb #define CFS_CONTROLLEN 8
666 1.1 rvb #define CTL_VOL -1
667 1.1 rvb #define CTL_VNO -1
668 1.1 rvb #define CTL_UNI -1
669 1.1 rvb #define CTL_INO -1
670 1.1 rvb #define CTL_FILE "/coda/.CONTROL"
671 1.1 rvb
672 1.1 rvb
673 1.1 rvb #define IS_CTL_FID(fidp) ((fidp)->Volume == CTL_VOL &&\
674 1.1 rvb (fidp)->Vnode == CTL_VNO &&\
675 1.1 rvb (fidp)->Unique == CTL_UNI)
676 1.1 rvb #endif
677 1.1 rvb
678