2 You may distribute this file under either of the two licenses that
3 follow at your discretion.
11 Copyright (c) 1987-1999 Carnegie Mellon University
12 Additional copyrights listed below
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
25 Coda: an Experimental Distributed File System
28 Copyright (c) 1987-1999 Carnegie Mellon University
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
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
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.
54 * Based on cfs.h from Mach, but revamped for increased simplicity.
55 * Linux modifications by
56 * Peter Braam, Aug 1996
59 #ifndef _UAPI_CODA_HEADER_
60 #define _UAPI_CODA_HEADER_
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>
69 #ifndef CODA_MAXSYMLINKS
70 #define CODA_MAXSYMLINKS 10
73 #if defined(DJGPP) || defined(__CYGWIN32__)
75 typedef unsigned long u_long
;
76 typedef unsigned int u_int
;
77 typedef unsigned short u_short
;
80 typedef void * caddr_t
;
82 typedef unsigned __int64 u_quad_t
;
84 typedef unsigned long long u_quad_t
;
89 #else /* DJGPP but not KERNEL */
91 typedef unsigned long long u_quad_t
;
96 #if defined(__linux__)
97 #include <linux/time.h>
98 #define cdev_t u_quad_t
100 #if !defined(_UQUAD_T_) && (!defined(__GLIBC__) || __GLIBC__ < 2)
102 typedef unsigned long long u_quad_t
;
104 #endif /* __KERNEL__ */
109 #ifndef __BIT_TYPES_DEFINED__
110 #define __BIT_TYPES_DEFINED__
111 typedef signed char int8_t;
112 typedef unsigned char u_int8_t
;
113 typedef short int16_t;
114 typedef unsigned short u_int16_t
;
116 typedef unsigned int u_int32_t
;
123 #define CODA_MAXNAMLEN 255
124 #define CODA_MAXPATHLEN 1024
125 #define CODA_MAXSYMLINK 10
127 /* these are Coda's version of O_RDONLY etc combinations
128 * to deal with VFS open modes
130 #define C_O_READ 0x001
131 #define C_O_WRITE 0x002
132 #define C_O_TRUNC 0x010
133 #define C_O_EXCL 0x100
134 #define C_O_CREAT 0x200
136 /* these are to find mode bits in Venus */
137 #define C_M_READ 00400
138 #define C_M_WRITE 00200
140 /* for access Venus will use */
141 #define C_A_C_OK 8 /* Test for writing upon create. */
142 #define C_A_R_OK 4 /* Test for read permission. */
143 #define C_A_W_OK 2 /* Test for write permission. */
144 #define C_A_X_OK 1 /* Test for execute permission. */
145 #define C_A_F_OK 0 /* Test for existence. */
149 #ifndef _VENUS_DIRENT_T_
150 #define _VENUS_DIRENT_T_ 1
151 struct venus_dirent
{
152 u_int32_t d_fileno
; /* file number of entry */
153 u_int16_t d_reclen
; /* length of this record */
154 u_int8_t d_type
; /* file type, see below */
155 u_int8_t d_namlen
; /* length of string in d_name */
156 char d_name
[CODA_MAXNAMLEN
+ 1];/* name must be no longer than this */
159 #define DIRSIZ(dp) ((sizeof (struct venus_dirent) - (CODA_MAXNAMLEN+1)) + \
160 (((dp)->d_namlen+1 + 3) &~ 3))
165 #define CDT_UNKNOWN 0
176 * Convert between stat structure types and directory types.
178 #define IFTOCDT(mode) (((mode) & 0170000) >> 12)
179 #define CDTTOIF(dirtype) ((dirtype) << 12)
185 typedef u_int32_t vuid_t
;
186 typedef u_int32_t vgid_t
;
193 #define coda_f2i(fid)\
194 (fid ? (fid->opaque[3] ^ (fid->opaque[2]<<10) ^ (fid->opaque[1]<<20) ^ fid->opaque[0]) : 0)
196 #ifndef _VENUS_VATTR_T_
197 #define _VENUS_VATTR_T_
199 * Vnode types. VNON means no type.
201 enum coda_vtype
{ C_VNON
, C_VREG
, C_VDIR
, C_VBLK
, C_VCHR
, C_VLNK
, C_VSOCK
, C_VFIFO
, C_VBAD
};
203 struct coda_timespec
{
204 int64_t tv_sec
; /* seconds */
205 long tv_nsec
; /* nanoseconds */
209 long va_type
; /* vnode type (for create) */
210 u_short va_mode
; /* files access mode and type */
211 short va_nlink
; /* number of references to file */
212 vuid_t va_uid
; /* owner user id */
213 vgid_t va_gid
; /* owner group id */
214 long va_fileid
; /* file id */
215 u_quad_t va_size
; /* file size in bytes */
216 long va_blocksize
; /* blocksize preferred for i/o */
217 struct coda_timespec va_atime
; /* time of last access */
218 struct coda_timespec va_mtime
; /* time of last modification */
219 struct coda_timespec va_ctime
; /* time file changed */
220 u_long va_gen
; /* generation number of file */
221 u_long va_flags
; /* flags defined for file */
222 cdev_t va_rdev
; /* device special file represents */
223 u_quad_t va_bytes
; /* bytes of disk space held by file */
224 u_quad_t va_filerev
; /* file modification number */
229 /* structure used by CODA_STATFS for getting cache information from venus */
239 * Kernel <--> Venus communications.
243 #define CODA_OPEN_BY_FD 3
247 #define CODA_GETATTR 7
248 #define CODA_SETATTR 8
249 #define CODA_ACCESS 9
250 #define CODA_LOOKUP 10
251 #define CODA_CREATE 11
252 #define CODA_REMOVE 12
254 #define CODA_RENAME 14
255 #define CODA_MKDIR 15
256 #define CODA_RMDIR 16
257 #define CODA_SYMLINK 18
258 #define CODA_READLINK 19
259 #define CODA_FSYNC 20
261 #define CODA_SIGNAL 23
262 #define CODA_REPLACE 24 /* DOWNCALL */
263 #define CODA_FLUSH 25 /* DOWNCALL */
264 #define CODA_PURGEUSER 26 /* DOWNCALL */
265 #define CODA_ZAPFILE 27 /* DOWNCALL */
266 #define CODA_ZAPDIR 28 /* DOWNCALL */
267 #define CODA_PURGEFID 30 /* DOWNCALL */
268 #define CODA_OPEN_BY_PATH 31
269 #define CODA_RESOLVE 32
270 #define CODA_REINTEGRATE 33
271 #define CODA_STATFS 34
272 #define CODA_STORE 35
273 #define CODA_RELEASE 36
274 #define CODA_ACCESS_INTENT 37
275 #define CODA_NCALLS 38
277 #define DOWNCALL(opcode) (opcode >= CODA_REPLACE && opcode <= CODA_PURGEFID)
279 #define VC_MAXDATASIZE 8192
280 #define VC_MAXMSGSIZE sizeof(union inputArgs)+sizeof(union outputArgs) +\
283 #define CIOC_KERNEL_VERSION _IOWR('c', 10, size_t)
285 // CODA_KERNEL_VERSION 0 /* don't care about kernel version number */
286 // CODA_KERNEL_VERSION 1 /* The old venus 4.6 compatible interface */
287 // CODA_KERNEL_VERSION 2 /* venus_lookup gets an extra parameter */
288 // CODA_KERNEL_VERSION 3 /* 128-bit file identifiers */
289 // CODA_KERNEL_VERSION 4 /* 64-bit timespec */
290 #define CODA_KERNEL_VERSION 5 /* access intent support */
293 * Venus <-> Coda RPC arguments
297 u_int32_t unique
; /* Keep multiple outstanding msgs distinct */
303 /* Really important that opcode and unique are 1st two fields! */
304 struct coda_out_hdr
{
310 /* coda_root: NO_IN */
311 struct coda_root_out
{
312 struct coda_out_hdr oh
;
316 struct coda_root_in
{
317 struct coda_in_hdr in
;
321 struct coda_open_in
{
322 struct coda_in_hdr ih
;
327 struct coda_open_out
{
328 struct coda_out_hdr oh
;
335 struct coda_store_in
{
336 struct coda_in_hdr ih
;
341 struct coda_store_out
{
342 struct coda_out_hdr out
;
346 struct coda_release_in
{
347 struct coda_in_hdr ih
;
352 struct coda_release_out
{
353 struct coda_out_hdr out
;
357 struct coda_close_in
{
358 struct coda_in_hdr ih
;
363 struct coda_close_out
{
364 struct coda_out_hdr out
;
368 struct coda_ioctl_in
{
369 struct coda_in_hdr ih
;
374 char *data
; /* Place holder for data. */
377 struct coda_ioctl_out
{
378 struct coda_out_hdr oh
;
380 caddr_t data
; /* Place holder for data. */
385 struct coda_getattr_in
{
386 struct coda_in_hdr ih
;
390 struct coda_getattr_out
{
391 struct coda_out_hdr oh
;
392 struct coda_vattr attr
;
396 /* coda_setattr: NO_OUT */
397 struct coda_setattr_in
{
398 struct coda_in_hdr ih
;
400 struct coda_vattr attr
;
403 struct coda_setattr_out
{
404 struct coda_out_hdr out
;
407 /* coda_access: NO_OUT */
408 struct coda_access_in
{
409 struct coda_in_hdr ih
;
414 struct coda_access_out
{
415 struct coda_out_hdr out
;
420 #define CLU_CASE_SENSITIVE 0x01
421 #define CLU_CASE_INSENSITIVE 0x02
424 struct coda_lookup_in
{
425 struct coda_in_hdr ih
;
427 int name
; /* Place holder for data. */
431 struct coda_lookup_out
{
432 struct coda_out_hdr oh
;
439 struct coda_create_in
{
440 struct coda_in_hdr ih
;
442 struct coda_vattr attr
;
445 int name
; /* Place holder for data. */
448 struct coda_create_out
{
449 struct coda_out_hdr oh
;
451 struct coda_vattr attr
;
455 /* coda_remove: NO_OUT */
456 struct coda_remove_in
{
457 struct coda_in_hdr ih
;
459 int name
; /* Place holder for data. */
462 struct coda_remove_out
{
463 struct coda_out_hdr out
;
466 /* coda_link: NO_OUT */
467 struct coda_link_in
{
468 struct coda_in_hdr ih
;
469 struct CodaFid sourceFid
; /* cnode to link *to* */
470 struct CodaFid destFid
; /* Directory in which to place link */
471 int tname
; /* Place holder for data. */
474 struct coda_link_out
{
475 struct coda_out_hdr out
;
479 /* coda_rename: NO_OUT */
480 struct coda_rename_in
{
481 struct coda_in_hdr ih
;
482 struct CodaFid sourceFid
;
484 struct CodaFid destFid
;
488 struct coda_rename_out
{
489 struct coda_out_hdr out
;
493 struct coda_mkdir_in
{
494 struct coda_in_hdr ih
;
496 struct coda_vattr attr
;
497 int name
; /* Place holder for data. */
500 struct coda_mkdir_out
{
501 struct coda_out_hdr oh
;
503 struct coda_vattr attr
;
507 /* coda_rmdir: NO_OUT */
508 struct coda_rmdir_in
{
509 struct coda_in_hdr ih
;
511 int name
; /* Place holder for data. */
514 struct coda_rmdir_out
{
515 struct coda_out_hdr out
;
518 /* coda_symlink: NO_OUT */
519 struct coda_symlink_in
{
520 struct coda_in_hdr ih
;
521 struct CodaFid VFid
; /* Directory to put symlink in */
523 struct coda_vattr attr
;
527 struct coda_symlink_out
{
528 struct coda_out_hdr out
;
532 struct coda_readlink_in
{
533 struct coda_in_hdr ih
;
537 struct coda_readlink_out
{
538 struct coda_out_hdr oh
;
540 caddr_t data
; /* Place holder for data. */
544 /* coda_fsync: NO_OUT */
545 struct coda_fsync_in
{
546 struct coda_in_hdr ih
;
550 struct coda_fsync_out
{
551 struct coda_out_hdr out
;
555 struct coda_vget_in
{
556 struct coda_in_hdr ih
;
560 struct coda_vget_out
{
561 struct coda_out_hdr oh
;
567 /* CODA_SIGNAL is out-of-band, doesn't need data. */
568 /* CODA_INVALIDATE is a venus->kernel call */
569 /* CODA_FLUSH is a venus->kernel call */
571 /* coda_purgeuser: */
572 /* CODA_PURGEUSER is a venus->kernel call */
573 struct coda_purgeuser_out
{
574 struct coda_out_hdr oh
;
579 /* CODA_ZAPFILE is a venus->kernel call */
580 struct coda_zapfile_out
{
581 struct coda_out_hdr oh
;
582 struct CodaFid CodaFid
;
586 /* CODA_ZAPDIR is a venus->kernel call */
587 struct coda_zapdir_out
{
588 struct coda_out_hdr oh
;
589 struct CodaFid CodaFid
;
593 /* CODA_PURGEFID is a venus->kernel call */
594 struct coda_purgefid_out
{
595 struct coda_out_hdr oh
;
596 struct CodaFid CodaFid
;
600 /* CODA_REPLACE is a venus->kernel call */
601 struct coda_replace_out
{ /* coda_replace is a venus->kernel call */
602 struct coda_out_hdr oh
;
603 struct CodaFid NewFid
;
604 struct CodaFid OldFid
;
607 /* coda_open_by_fd: */
608 struct coda_open_by_fd_in
{
609 struct coda_in_hdr ih
;
614 struct coda_open_by_fd_out
{
615 struct coda_out_hdr oh
;
619 struct file
*fh
; /* not passed from userspace but used in-kernel only */
623 /* coda_open_by_path: */
624 struct coda_open_by_path_in
{
625 struct coda_in_hdr ih
;
630 struct coda_open_by_path_out
{
631 struct coda_out_hdr oh
;
635 /* coda_statfs: NO_IN */
636 struct coda_statfs_in
{
637 struct coda_in_hdr in
;
640 struct coda_statfs_out
{
641 struct coda_out_hdr oh
;
642 struct coda_statfs stat
;
645 #define CODA_ACCESS_TYPE_READ 1
646 #define CODA_ACCESS_TYPE_WRITE 2
647 #define CODA_ACCESS_TYPE_MMAP 3
648 #define CODA_ACCESS_TYPE_READ_FINISH 4
649 #define CODA_ACCESS_TYPE_WRITE_FINISH 5
651 /* coda_access_intent: NO_OUT */
652 struct coda_access_intent_in
{
653 struct coda_in_hdr ih
;
660 struct coda_access_intent_out
{
661 struct coda_out_hdr out
;
665 * Occasionally, we don't cache the fid returned by CODA_LOOKUP.
666 * For instance, if the fid is inconsistent.
667 * This case is handled by setting the top bit of the type result parameter.
669 #define CODA_NOCACHE 0x80000000
672 struct coda_in_hdr ih
; /* NB: every struct below begins with an ih */
673 struct coda_open_in coda_open
;
674 struct coda_store_in coda_store
;
675 struct coda_release_in coda_release
;
676 struct coda_close_in coda_close
;
677 struct coda_ioctl_in coda_ioctl
;
678 struct coda_getattr_in coda_getattr
;
679 struct coda_setattr_in coda_setattr
;
680 struct coda_access_in coda_access
;
681 struct coda_lookup_in coda_lookup
;
682 struct coda_create_in coda_create
;
683 struct coda_remove_in coda_remove
;
684 struct coda_link_in coda_link
;
685 struct coda_rename_in coda_rename
;
686 struct coda_mkdir_in coda_mkdir
;
687 struct coda_rmdir_in coda_rmdir
;
688 struct coda_symlink_in coda_symlink
;
689 struct coda_readlink_in coda_readlink
;
690 struct coda_fsync_in coda_fsync
;
691 struct coda_vget_in coda_vget
;
692 struct coda_open_by_fd_in coda_open_by_fd
;
693 struct coda_open_by_path_in coda_open_by_path
;
694 struct coda_statfs_in coda_statfs
;
695 struct coda_access_intent_in coda_access_intent
;
699 struct coda_out_hdr oh
; /* NB: every struct below begins with an oh */
700 struct coda_root_out coda_root
;
701 struct coda_open_out coda_open
;
702 struct coda_ioctl_out coda_ioctl
;
703 struct coda_getattr_out coda_getattr
;
704 struct coda_lookup_out coda_lookup
;
705 struct coda_create_out coda_create
;
706 struct coda_mkdir_out coda_mkdir
;
707 struct coda_readlink_out coda_readlink
;
708 struct coda_vget_out coda_vget
;
709 struct coda_purgeuser_out coda_purgeuser
;
710 struct coda_zapfile_out coda_zapfile
;
711 struct coda_zapdir_out coda_zapdir
;
712 struct coda_purgefid_out coda_purgefid
;
713 struct coda_replace_out coda_replace
;
714 struct coda_open_by_fd_out coda_open_by_fd
;
715 struct coda_open_by_path_out coda_open_by_path
;
716 struct coda_statfs_out coda_statfs
;
719 union coda_downcalls
{
720 /* CODA_INVALIDATE is a venus->kernel call */
721 /* CODA_FLUSH is a venus->kernel call */
722 struct coda_purgeuser_out purgeuser
;
723 struct coda_zapfile_out zapfile
;
724 struct coda_zapdir_out zapdir
;
725 struct coda_purgefid_out purgefid
;
726 struct coda_replace_out replace
;
731 * Used for identifying usage of "Control" and pioctls
734 #define PIOCPARM_MASK 0x0000ffff
736 void __user
*in
; /* Data to be transferred in */
737 void __user
*out
; /* Data to be transferred out */
738 u_short in_size
; /* Size of input buffer <= 2K */
739 u_short out_size
; /* Maximum size of output buffer, <= 2K */
743 const char __user
*path
;
748 #define CODA_CONTROL ".CONTROL"
749 #define CODA_CONTROLLEN 8
752 /* Data passed to mount */
754 #define CODA_MOUNT_VERSION 1
756 struct coda_mount_data
{
758 int fd
; /* Opened device */
761 #endif /* _UAPI_CODA_HEADER_ */