You may distribute this file under either of the two licenses that
follow at your discretion.
Copyright (c) 1987-1999 Carnegie Mellon University
Additional copyrights listed below
This code is distributed "AS IS" without warranty of any kind under
the terms of the GNU Library General Public Licence Version 2, as
shown in the file LICENSE, or under the license shown below. The
technical and financial contributors to Coda are listed in the file
Coda: an Experimental Distributed File System
Copyright (c) 1987-1999 Carnegie Mellon University
Permission to use, copy, modify and distribute this software and its
documentation is hereby granted, provided that both the copyright
notice and this permission notice appear in all copies of the
software, derivative works or modified versions, and any portions
thereof, and that both notices appear in supporting documentation, and
that credit is given to Carnegie Mellon University in all documents
and publicity pertaining to direct or indirect use of this code or its
CODA IS AN EXPERIMENTAL SOFTWARE SYSTEM AND IS KNOWN TO HAVE BUGS,
SOME OF WHICH MAY HAVE SERIOUS CONSEQUENCES. CARNEGIE MELLON ALLOWS
FREE USE OF THIS SOFTWARE IN ITS "AS IS" CONDITION. CARNEGIE MELLON
DISCLAIMS ANY LIABILITY OF ANY KIND FOR ANY DAMAGES WHATSOEVER
RESULTING DIRECTLY OR INDIRECTLY FROM THE USE OF THIS SOFTWARE OR OF
Carnegie Mellon encourages users of this software to return any
improvements or extensions that they make, and to grant Carnegie
Mellon the rights to redistribute these changes without encumbrance.
* Based on cfs.h from Mach, but revamped for increased simplicity.
/* Catch new _KERNEL defn for NetBSD and DJGPP/__CYGWIN32__ */
#if defined(__NetBSD__) || \
((defined(DJGPP) || defined(__CYGWIN32__)) && !defined(KERNEL))
#define CODA_MAXSYMLINKS 10
#if defined(DJGPP) || defined(__CYGWIN32__)
typedef unsigned long u_long;
typedef unsigned int u_int;
typedef unsigned short u_short;
typedef unsigned __int64 u_quad_t;
typedef unsigned long long u_quad_t;
#else /* DJGPP but not KERNEL */
typedef unsigned long long u_quad_t;
#if !defined(_UQUAD_T_) && (!defined(__GLIBC__) || __GLIBC__ < 2)
typedef unsigned long long u_quad_t;
time_t tv_sec; /* seconds */
long tv_nsec; /* nanoseconds */
#ifndef __BIT_TYPES_DEFINED__
#define __BIT_TYPES_DEFINED__
typedef signed char int8_t;
typedef unsigned char u_int8_t;
typedef unsigned short u_int16_t;
typedef unsigned int u_int32_t;
#define CODA_MAXNAMLEN 255
#define CODA_MAXPATHLEN 1024
#define CODA_MAXSYMLINK 10
/* these are Coda's version of O_RDONLY etc combinations
* to deal with VFS open modes
/* these are to find mode bits in Venus */
/* for access Venus will use */
#define C_A_C_OK 8 /* Test for writing upon create. */
#define C_A_R_OK 4 /* Test for read permission. */
#define C_A_W_OK 2 /* Test for write permission. */
#define C_A_X_OK 1 /* Test for execute permission. */
#define C_A_F_OK 0 /* Test for existence. */
#define _VENUS_DIRENT_T_ 1
u_int32_t d_fileno; /* file number of entry */
u_int16_t d_reclen; /* length of this record */
u_int8_t d_type; /* file type, see below */
u_int8_t d_namlen; /* length of string in d_name */
char d_name[CODA_MAXNAMLEN + 1];/* name must be no longer than this */
#define DIRSIZ(dp) ((sizeof (struct venus_dirent) - (CODA_MAXNAMLEN+1)) + \
(((dp)->d_namlen+1 + 3) &~ 3))
* Convert between stat structure types and directory types.
#define IFTOCDT(mode) (((mode) & 0170000) >> 12)
#define CDTTOIF(dirtype) ((dirtype) << 12)
typedef u_int32_t vuid_t;
typedef u_int32_t vgid_t;
(fid ? (fid->opaque[3] ^ (fid->opaque[2]<<10) ^ (fid->opaque[1]<<20) ^ fid->opaque[0]) : 0)
* Vnode types. VNON means no type.
enum coda_vtype { C_VNON, C_VREG, C_VDIR, C_VBLK, C_VCHR, C_VLNK, C_VSOCK, C_VFIFO, C_VBAD };
long va_type; /* vnode type (for create) */
u_short va_mode; /* files access mode and type */
short va_nlink; /* number of references to file */
vuid_t va_uid; /* owner user id */
vgid_t va_gid; /* owner group id */
long va_fileid; /* file id */
u_quad_t va_size; /* file size in bytes */
long va_blocksize; /* blocksize preferred for i/o */
struct timespec va_atime; /* time of last access */
struct timespec va_mtime; /* time of last modification */
struct timespec va_ctime; /* time file changed */
u_long va_gen; /* generation number of file */
u_long va_flags; /* flags defined for file */
cdev_t va_rdev; /* device special file represents */
u_quad_t va_bytes; /* bytes of disk space held by file */
u_quad_t va_filerev; /* file modification number */
/* structure used by CODA_STATFS for getting cache information from venus */
* Kernel <--> Venus communications.
#define CODA_OPEN_BY_FD 3
#define CODA_REPLACE 24 /* DOWNCALL */
#define CODA_FLUSH 25 /* DOWNCALL */
#define CODA_PURGEUSER 26 /* DOWNCALL */
#define CODA_ZAPFILE 27 /* DOWNCALL */
#define CODA_ZAPDIR 28 /* DOWNCALL */
#define CODA_PURGEFID 30 /* DOWNCALL */
#define CODA_OPEN_BY_PATH 31
#define CODA_REINTEGRATE 33
#define DOWNCALL(opcode) (opcode >= CODA_REPLACE && opcode <= CODA_PURGEFID)
#define VC_MAXDATASIZE 8192
#define VC_MAXMSGSIZE sizeof(union inputArgs)+sizeof(union outputArgs) +\
#define CIOC_KERNEL_VERSION _IOWR('c', 10, size_t)
#define CODA_KERNEL_VERSION 3 /* 128-bit file identifiers */
* Venus <-> Coda RPC arguments
u_int32_t unique; /* Keep multiple outstanding msgs distinct */
/* Really important that opcode and unique are 1st two fields! */
struct coda_release_out {
char *data; /* Place holder for data. */
caddr_t data; /* Place holder for data. */
struct coda_getattr_out {
/* coda_setattr: NO_OUT */
struct coda_setattr_out {
/* coda_access: NO_OUT */
#define CLU_CASE_SENSITIVE 0x01
#define CLU_CASE_INSENSITIVE 0x02
int name; /* Place holder for data. */
int name; /* Place holder for data. */
/* coda_remove: NO_OUT */
int name; /* Place holder for data. */
struct CodaFid sourceFid; /* cnode to link *to* */
struct CodaFid destFid; /* Directory in which to place link */
int tname; /* Place holder for data. */
/* coda_rename: NO_OUT */
struct CodaFid sourceFid;
int name; /* Place holder for data. */