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