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