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