1 /**************************************************************************** 2 **************************************************************************** 3 *** 4 *** This header was automatically generated from a Linux kernel header 5 *** of the same name, to make information necessary for userspace to 6 *** call into the kernel available to libc. It contains only constants, 7 *** structures, and macros generated from the original header, and thus, 8 *** contains no copyrightable information. 9 *** 10 **************************************************************************** 11 ****************************************************************************/ 12 #ifndef _CODA_HEADER_ 13 #define _CODA_HEADER_ 14 15 #if defined(__NetBSD__) || (defined(DJGPP) || defined(__CYGWIN32__)) && !defined(KERNEL) 16 #include <sys/types.h> 17 #endif 18 19 #ifndef CODA_MAXSYMLINKS 20 #define CODA_MAXSYMLINKS 10 21 #endif 22 23 #if defined(DJGPP) || defined(__CYGWIN32__) 24 #ifdef KERNEL 25 typedef unsigned long u_long; 26 typedef unsigned int u_int; 27 typedef unsigned short u_short; 28 typedef u_long ino_t; 29 typedef u_long dev_t; 30 typedef void * caddr_t; 31 #ifdef DOS 32 typedef unsigned __int64 u_quad_t; 33 #else 34 typedef unsigned long long u_quad_t; 35 #endif 36 37 #define inline 38 39 struct timespec { 40 long ts_sec; 41 long ts_nsec; 42 }; 43 #else 44 #include <sys/time.h> 45 typedef unsigned long long u_quad_t; 46 #endif 47 #endif 48 49 #ifdef __linux__ 50 #include <linux/time.h> 51 #define cdev_t u_quad_t 52 #if !defined(_UQUAD_T_) && (!defined(__GLIBC__) || __GLIBC__ < 2) 53 #define _UQUAD_T_ 1 54 typedef unsigned long long u_quad_t; 55 #endif 56 #else 57 #define cdev_t dev_t 58 #endif 59 60 #ifdef __CYGWIN32__ 61 struct timespec { 62 time_t tv_sec; 63 long tv_nsec; 64 }; 65 #endif 66 67 #ifndef __BIT_TYPES_DEFINED__ 68 #define __BIT_TYPES_DEFINED__ 69 typedef signed char int8_t; 70 typedef unsigned char u_int8_t; 71 typedef short int16_t; 72 typedef unsigned short u_int16_t; 73 typedef int int32_t; 74 typedef unsigned int u_int32_t; 75 #endif 76 77 #define CODA_MAXNAMLEN 255 78 #define CODA_MAXPATHLEN 1024 79 #define CODA_MAXSYMLINK 10 80 81 #define C_O_READ 0x001 82 #define C_O_WRITE 0x002 83 #define C_O_TRUNC 0x010 84 #define C_O_EXCL 0x100 85 #define C_O_CREAT 0x200 86 87 #define C_M_READ 00400 88 #define C_M_WRITE 00200 89 90 #define C_A_C_OK 8 91 #define C_A_R_OK 4 92 #define C_A_W_OK 2 93 #define C_A_X_OK 1 94 #define C_A_F_OK 0 95 96 #ifndef _VENUS_DIRENT_T_ 97 #define _VENUS_DIRENT_T_ 1 98 struct venus_dirent { 99 u_int32_t d_fileno; 100 u_int16_t d_reclen; 101 u_int8_t d_type; 102 u_int8_t d_namlen; 103 char d_name[CODA_MAXNAMLEN + 1]; 104 }; 105 #undef DIRSIZ 106 #define DIRSIZ(dp) ((sizeof (struct venus_dirent) - (CODA_MAXNAMLEN+1)) + (((dp)->d_namlen+1 + 3) &~ 3)) 107 108 #define CDT_UNKNOWN 0 109 #define CDT_FIFO 1 110 #define CDT_CHR 2 111 #define CDT_DIR 4 112 #define CDT_BLK 6 113 #define CDT_REG 8 114 #define CDT_LNK 10 115 #define CDT_SOCK 12 116 #define CDT_WHT 14 117 118 #define IFTOCDT(mode) (((mode) & 0170000) >> 12) 119 #define CDTTOIF(dirtype) ((dirtype) << 12) 120 121 #endif 122 123 #ifndef _VUID_T_ 124 #define _VUID_T_ 125 typedef u_int32_t vuid_t; 126 typedef u_int32_t vgid_t; 127 #endif 128 129 struct CodaFid { 130 u_int32_t opaque[4]; 131 }; 132 133 #define coda_f2i(fid) (fid ? (fid->opaque[3] ^ (fid->opaque[2]<<10) ^ (fid->opaque[1]<<20) ^ fid->opaque[0]) : 0) 134 135 #ifndef _VENUS_VATTR_T_ 136 #define _VENUS_VATTR_T_ 137 138 enum coda_vtype { C_VNON, C_VREG, C_VDIR, C_VBLK, C_VCHR, C_VLNK, C_VSOCK, C_VFIFO, C_VBAD }; 139 140 struct coda_vattr { 141 long va_type; 142 u_short va_mode; 143 short va_nlink; 144 vuid_t va_uid; 145 vgid_t va_gid; 146 long va_fileid; 147 u_quad_t va_size; 148 long va_blocksize; 149 struct timespec va_atime; 150 struct timespec va_mtime; 151 struct timespec va_ctime; 152 u_long va_gen; 153 u_long va_flags; 154 cdev_t va_rdev; 155 u_quad_t va_bytes; 156 u_quad_t va_filerev; 157 }; 158 159 #endif 160 161 struct coda_statfs { 162 int32_t f_blocks; 163 int32_t f_bfree; 164 int32_t f_bavail; 165 int32_t f_files; 166 int32_t f_ffree; 167 }; 168 169 #define CODA_ROOT 2 170 #define CODA_OPEN_BY_FD 3 171 #define CODA_OPEN 4 172 #define CODA_CLOSE 5 173 #define CODA_IOCTL 6 174 #define CODA_GETATTR 7 175 #define CODA_SETATTR 8 176 #define CODA_ACCESS 9 177 #define CODA_LOOKUP 10 178 #define CODA_CREATE 11 179 #define CODA_REMOVE 12 180 #define CODA_LINK 13 181 #define CODA_RENAME 14 182 #define CODA_MKDIR 15 183 #define CODA_RMDIR 16 184 #define CODA_SYMLINK 18 185 #define CODA_READLINK 19 186 #define CODA_FSYNC 20 187 #define CODA_VGET 22 188 #define CODA_SIGNAL 23 189 #define CODA_REPLACE 24 190 #define CODA_FLUSH 25 191 #define CODA_PURGEUSER 26 192 #define CODA_ZAPFILE 27 193 #define CODA_ZAPDIR 28 194 #define CODA_PURGEFID 30 195 #define CODA_OPEN_BY_PATH 31 196 #define CODA_RESOLVE 32 197 #define CODA_REINTEGRATE 33 198 #define CODA_STATFS 34 199 #define CODA_STORE 35 200 #define CODA_RELEASE 36 201 #define CODA_NCALLS 37 202 203 #define DOWNCALL(opcode) (opcode >= CODA_REPLACE && opcode <= CODA_PURGEFID) 204 205 #define VC_MAXDATASIZE 8192 206 #define VC_MAXMSGSIZE sizeof(union inputArgs)+sizeof(union outputArgs) + VC_MAXDATASIZE 207 208 #define CIOC_KERNEL_VERSION _IOWR('c', 10, size_t) 209 210 #define CODA_KERNEL_VERSION 3 211 212 struct coda_in_hdr { 213 u_int32_t opcode; 214 u_int32_t unique; 215 pid_t pid; 216 pid_t pgid; 217 vuid_t uid; 218 }; 219 220 struct coda_out_hdr { 221 u_int32_t opcode; 222 u_int32_t unique; 223 u_int32_t result; 224 }; 225 226 struct coda_root_out { 227 struct coda_out_hdr oh; 228 struct CodaFid VFid; 229 }; 230 231 struct coda_root_in { 232 struct coda_in_hdr in; 233 }; 234 235 struct coda_open_in { 236 struct coda_in_hdr ih; 237 struct CodaFid VFid; 238 int flags; 239 }; 240 241 struct coda_open_out { 242 struct coda_out_hdr oh; 243 cdev_t dev; 244 ino_t inode; 245 }; 246 247 struct coda_store_in { 248 struct coda_in_hdr ih; 249 struct CodaFid VFid; 250 int flags; 251 }; 252 253 struct coda_store_out { 254 struct coda_out_hdr out; 255 }; 256 257 struct coda_release_in { 258 struct coda_in_hdr ih; 259 struct CodaFid VFid; 260 int flags; 261 }; 262 263 struct coda_release_out { 264 struct coda_out_hdr out; 265 }; 266 267 struct coda_close_in { 268 struct coda_in_hdr ih; 269 struct CodaFid VFid; 270 int flags; 271 }; 272 273 struct coda_close_out { 274 struct coda_out_hdr out; 275 }; 276 277 struct coda_ioctl_in { 278 struct coda_in_hdr ih; 279 struct CodaFid VFid; 280 int cmd; 281 int len; 282 int rwflag; 283 char *data; 284 }; 285 286 struct coda_ioctl_out { 287 struct coda_out_hdr oh; 288 int len; 289 caddr_t data; 290 }; 291 292 struct coda_getattr_in { 293 struct coda_in_hdr ih; 294 struct CodaFid VFid; 295 }; 296 297 struct coda_getattr_out { 298 struct coda_out_hdr oh; 299 struct coda_vattr attr; 300 }; 301 302 struct coda_setattr_in { 303 struct coda_in_hdr ih; 304 struct CodaFid VFid; 305 struct coda_vattr attr; 306 }; 307 308 struct coda_setattr_out { 309 struct coda_out_hdr out; 310 }; 311 312 struct coda_access_in { 313 struct coda_in_hdr ih; 314 struct CodaFid VFid; 315 int flags; 316 }; 317 318 struct coda_access_out { 319 struct coda_out_hdr out; 320 }; 321 322 #define CLU_CASE_SENSITIVE 0x01 323 #define CLU_CASE_INSENSITIVE 0x02 324 325 struct coda_lookup_in { 326 struct coda_in_hdr ih; 327 struct CodaFid VFid; 328 int name; 329 int flags; 330 }; 331 332 struct coda_lookup_out { 333 struct coda_out_hdr oh; 334 struct CodaFid VFid; 335 int vtype; 336 }; 337 338 struct coda_create_in { 339 struct coda_in_hdr ih; 340 struct CodaFid VFid; 341 struct coda_vattr attr; 342 int excl; 343 int mode; 344 int name; 345 }; 346 347 struct coda_create_out { 348 struct coda_out_hdr oh; 349 struct CodaFid VFid; 350 struct coda_vattr attr; 351 }; 352 353 struct coda_remove_in { 354 struct coda_in_hdr ih; 355 struct CodaFid VFid; 356 int name; 357 }; 358 359 struct coda_remove_out { 360 struct coda_out_hdr out; 361 }; 362 363 struct coda_link_in { 364 struct coda_in_hdr ih; 365 struct CodaFid sourceFid; 366 struct CodaFid destFid; 367 int tname; 368 }; 369 370 struct coda_link_out { 371 struct coda_out_hdr out; 372 }; 373 374 struct coda_rename_in { 375 struct coda_in_hdr ih; 376 struct CodaFid sourceFid; 377 int srcname; 378 struct CodaFid destFid; 379 int destname; 380 }; 381 382 struct coda_rename_out { 383 struct coda_out_hdr out; 384 }; 385 386 struct coda_mkdir_in { 387 struct coda_in_hdr ih; 388 struct CodaFid VFid; 389 struct coda_vattr attr; 390 int name; 391 }; 392 393 struct coda_mkdir_out { 394 struct coda_out_hdr oh; 395 struct CodaFid VFid; 396 struct coda_vattr attr; 397 }; 398 399 struct coda_rmdir_in { 400 struct coda_in_hdr ih; 401 struct CodaFid VFid; 402 int name; 403 }; 404 405 struct coda_rmdir_out { 406 struct coda_out_hdr out; 407 }; 408 409 struct coda_symlink_in { 410 struct coda_in_hdr ih; 411 struct CodaFid VFid; 412 int srcname; 413 struct coda_vattr attr; 414 int tname; 415 }; 416 417 struct coda_symlink_out { 418 struct coda_out_hdr out; 419 }; 420 421 struct coda_readlink_in { 422 struct coda_in_hdr ih; 423 struct CodaFid VFid; 424 }; 425 426 struct coda_readlink_out { 427 struct coda_out_hdr oh; 428 int count; 429 caddr_t data; 430 }; 431 432 struct coda_fsync_in { 433 struct coda_in_hdr ih; 434 struct CodaFid VFid; 435 }; 436 437 struct coda_fsync_out { 438 struct coda_out_hdr out; 439 }; 440 441 struct coda_vget_in { 442 struct coda_in_hdr ih; 443 struct CodaFid VFid; 444 }; 445 446 struct coda_vget_out { 447 struct coda_out_hdr oh; 448 struct CodaFid VFid; 449 int vtype; 450 }; 451 452 struct coda_purgeuser_out { 453 struct coda_out_hdr oh; 454 vuid_t uid; 455 }; 456 457 struct coda_zapfile_out { 458 struct coda_out_hdr oh; 459 struct CodaFid CodaFid; 460 }; 461 462 struct coda_zapdir_out { 463 struct coda_out_hdr oh; 464 struct CodaFid CodaFid; 465 }; 466 467 struct coda_purgefid_out { 468 struct coda_out_hdr oh; 469 struct CodaFid CodaFid; 470 }; 471 472 struct coda_replace_out { 473 struct coda_out_hdr oh; 474 struct CodaFid NewFid; 475 struct CodaFid OldFid; 476 }; 477 478 struct coda_open_by_fd_in { 479 struct coda_in_hdr ih; 480 struct CodaFid VFid; 481 int flags; 482 }; 483 484 struct coda_open_by_fd_out { 485 struct coda_out_hdr oh; 486 int fd; 487 488 }; 489 490 struct coda_open_by_path_in { 491 struct coda_in_hdr ih; 492 struct CodaFid VFid; 493 int flags; 494 }; 495 496 struct coda_open_by_path_out { 497 struct coda_out_hdr oh; 498 int path; 499 }; 500 501 struct coda_statfs_in { 502 struct coda_in_hdr in; 503 }; 504 505 struct coda_statfs_out { 506 struct coda_out_hdr oh; 507 struct coda_statfs stat; 508 }; 509 510 #define CODA_NOCACHE 0x80000000 511 512 union inputArgs { 513 struct coda_in_hdr ih; 514 struct coda_open_in coda_open; 515 struct coda_store_in coda_store; 516 struct coda_release_in coda_release; 517 struct coda_close_in coda_close; 518 struct coda_ioctl_in coda_ioctl; 519 struct coda_getattr_in coda_getattr; 520 struct coda_setattr_in coda_setattr; 521 struct coda_access_in coda_access; 522 struct coda_lookup_in coda_lookup; 523 struct coda_create_in coda_create; 524 struct coda_remove_in coda_remove; 525 struct coda_link_in coda_link; 526 struct coda_rename_in coda_rename; 527 struct coda_mkdir_in coda_mkdir; 528 struct coda_rmdir_in coda_rmdir; 529 struct coda_symlink_in coda_symlink; 530 struct coda_readlink_in coda_readlink; 531 struct coda_fsync_in coda_fsync; 532 struct coda_vget_in coda_vget; 533 struct coda_open_by_fd_in coda_open_by_fd; 534 struct coda_open_by_path_in coda_open_by_path; 535 struct coda_statfs_in coda_statfs; 536 }; 537 538 union outputArgs { 539 struct coda_out_hdr oh; 540 struct coda_root_out coda_root; 541 struct coda_open_out coda_open; 542 struct coda_ioctl_out coda_ioctl; 543 struct coda_getattr_out coda_getattr; 544 struct coda_lookup_out coda_lookup; 545 struct coda_create_out coda_create; 546 struct coda_mkdir_out coda_mkdir; 547 struct coda_readlink_out coda_readlink; 548 struct coda_vget_out coda_vget; 549 struct coda_purgeuser_out coda_purgeuser; 550 struct coda_zapfile_out coda_zapfile; 551 struct coda_zapdir_out coda_zapdir; 552 struct coda_purgefid_out coda_purgefid; 553 struct coda_replace_out coda_replace; 554 struct coda_open_by_fd_out coda_open_by_fd; 555 struct coda_open_by_path_out coda_open_by_path; 556 struct coda_statfs_out coda_statfs; 557 }; 558 559 union coda_downcalls { 560 561 struct coda_purgeuser_out purgeuser; 562 struct coda_zapfile_out zapfile; 563 struct coda_zapdir_out zapdir; 564 struct coda_purgefid_out purgefid; 565 struct coda_replace_out replace; 566 }; 567 568 #define PIOCPARM_MASK 0x0000ffff 569 struct ViceIoctl { 570 void __user *in; 571 void __user *out; 572 u_short in_size; 573 u_short out_size; 574 }; 575 576 struct PioctlData { 577 const char __user *path; 578 int follow; 579 struct ViceIoctl vi; 580 }; 581 582 #define CODA_CONTROL ".CONTROL" 583 #define CODA_CONTROLLEN 8 584 #define CTL_INO -1 585 586 #define CODA_MOUNT_VERSION 1 587 588 struct coda_mount_data { 589 int version; 590 int fd; 591 }; 592 593 #endif 594 595