Home | History | Annotate | Line # | Download | only in coda
coda.h revision 1.3
      1  1.3  rvb /*	$NetBSD: coda.h,v 1.3 1998/09/12 15:05:50 rvb Exp $	*/
      2  1.2  rvb 
      3  1.1  rvb /*
      4  1.2  rvb  *
      5  1.2  rvb  *             Coda: an Experimental Distributed File System
      6  1.2  rvb  *                              Release 3.1
      7  1.2  rvb  *
      8  1.2  rvb  *           Copyright (c) 1987-1998 Carnegie Mellon University
      9  1.2  rvb  *                          All Rights Reserved
     10  1.2  rvb  *
     11  1.2  rvb  * Permission  to  use, copy, modify and distribute this software and its
     12  1.2  rvb  * documentation is hereby granted,  provided  that  both  the  copyright
     13  1.2  rvb  * notice  and  this  permission  notice  appear  in  all  copies  of the
     14  1.2  rvb  * software, derivative works or  modified  versions,  and  any  portions
     15  1.2  rvb  * thereof, and that both notices appear in supporting documentation, and
     16  1.2  rvb  * that credit is given to Carnegie Mellon University  in  all  documents
     17  1.2  rvb  * and publicity pertaining to direct or indirect use of this code or its
     18  1.2  rvb  * derivatives.
     19  1.2  rvb  *
     20  1.2  rvb  * CODA IS AN EXPERIMENTAL SOFTWARE SYSTEM AND IS  KNOWN  TO  HAVE  BUGS,
     21  1.2  rvb  * SOME  OF  WHICH MAY HAVE SERIOUS CONSEQUENCES.  CARNEGIE MELLON ALLOWS
     22  1.2  rvb  * FREE USE OF THIS SOFTWARE IN ITS "AS IS" CONDITION.   CARNEGIE  MELLON
     23  1.2  rvb  * DISCLAIMS  ANY  LIABILITY  OF  ANY  KIND  FOR  ANY  DAMAGES WHATSOEVER
     24  1.2  rvb  * RESULTING DIRECTLY OR INDIRECTLY FROM THE USE OF THIS SOFTWARE  OR  OF
     25  1.2  rvb  * ANY DERIVATIVE WORK.
     26  1.2  rvb  *
     27  1.2  rvb  * Carnegie  Mellon  encourages  users  of  this  software  to return any
     28  1.2  rvb  * improvements or extensions that  they  make,  and  to  grant  Carnegie
     29  1.2  rvb  * Mellon the rights to redistribute these changes without encumbrance.
     30  1.2  rvb  *
     31  1.2  rvb  * 	@(#) cfs/coda.h,v 1.1.1.1 1998/08/29 21:26:46 rvb Exp
     32  1.2  rvb  */
     33  1.1  rvb 
     34  1.1  rvb /*
     35  1.1  rvb  *
     36  1.1  rvb  * Based on cfs.h from Mach, but revamped for increased simplicity.
     37  1.1  rvb  * Linux modifications by Peter Braam, Aug 1996
     38  1.1  rvb  */
     39  1.1  rvb 
     40  1.3  rvb #ifndef _CODA_HEADER_
     41  1.3  rvb #define _CODA_HEADER_
     42  1.1  rvb 
     43  1.1  rvb 
     44  1.1  rvb 
     45  1.1  rvb /* Catch new _KERNEL defn for NetBSD */
     46  1.1  rvb #ifdef __NetBSD__
     47  1.1  rvb #include <sys/types.h>
     48  1.1  rvb #endif
     49  1.1  rvb 
     50  1.1  rvb #if defined(__linux__) || defined(__CYGWIN32__)
     51  1.1  rvb #define cdev_t u_quad_t
     52  1.1  rvb #if !defined(_UQUAD_T_) && (!defined(__GLIBC__) || __GLIBC__ < 2)
     53  1.1  rvb #define _UQUAD_T_ 1
     54  1.1  rvb typedef unsigned long long u_quad_t;
     55  1.1  rvb #endif
     56  1.1  rvb #else
     57  1.1  rvb #define cdev_t dev_t
     58  1.1  rvb #endif
     59  1.1  rvb 
     60  1.1  rvb #ifdef __CYGWIN32__
     61  1.1  rvb typedef unsigned char u_int8_t;
     62  1.1  rvb struct timespec {
     63  1.1  rvb         time_t  tv_sec;         /* seconds */
     64  1.1  rvb         long    tv_nsec;        /* nanoseconds */
     65  1.1  rvb };
     66  1.1  rvb #endif
     67  1.1  rvb 
     68  1.1  rvb 
     69  1.1  rvb /*
     70  1.3  rvb  * Coda constants
     71  1.1  rvb  */
     72  1.3  rvb #define CODA_MAXNAMLEN   255
     73  1.3  rvb #define CODA_MAXPATHLEN  1024
     74  1.3  rvb #define CODA_MAXSYMLINK  10
     75  1.1  rvb 
     76  1.1  rvb /* these are Coda's version of O_RDONLY etc combinations
     77  1.1  rvb  * to deal with VFS open modes
     78  1.1  rvb  */
     79  1.1  rvb #define	C_O_READ	0x001
     80  1.1  rvb #define	C_O_WRITE       0x002
     81  1.1  rvb #define C_O_TRUNC       0x010
     82  1.1  rvb #define C_O_EXCL	0x100
     83  1.1  rvb 
     84  1.1  rvb /* these are to find mode bits in Venus */
     85  1.1  rvb #define C_M_READ  00400
     86  1.1  rvb #define C_M_WRITE 00200
     87  1.1  rvb 
     88  1.1  rvb /* for access Venus will use */
     89  1.1  rvb #define C_A_R_OK    4               /* Test for read permission.  */
     90  1.1  rvb #define C_A_W_OK    2               /* Test for write permission.  */
     91  1.1  rvb #define C_A_X_OK    1               /* Test for execute permission.  */
     92  1.1  rvb #define C_A_F_OK    0               /* Test for existence.  */
     93  1.1  rvb 
     94  1.1  rvb 
     95  1.1  rvb 
     96  1.1  rvb #ifndef _VENUS_DIRENT_T_
     97  1.1  rvb #define _VENUS_DIRENT_T_ 1
     98  1.1  rvb struct venus_dirent {
     99  1.1  rvb         unsigned long	d_fileno;		/* file number of entry */
    100  1.1  rvb         unsigned short	d_reclen;		/* length of this record */
    101  1.1  rvb         char 		d_type;			/* file type, see below */
    102  1.1  rvb         char		d_namlen;		/* length of string in d_name */
    103  1.3  rvb         char		d_name[CODA_MAXNAMLEN + 1];/* name must be no longer than this */
    104  1.1  rvb };
    105  1.1  rvb #undef DIRSIZ
    106  1.3  rvb #define DIRSIZ(dp)      ((sizeof (struct venus_dirent) - (CODA_MAXNAMLEN+1)) + \
    107  1.1  rvb                          (((dp)->d_namlen+1 + 3) &~ 3))
    108  1.1  rvb 
    109  1.1  rvb /*
    110  1.1  rvb  * File types
    111  1.1  rvb  */
    112  1.1  rvb #define	CDT_UNKNOWN	 0
    113  1.1  rvb #define	CDT_FIFO		 1
    114  1.1  rvb #define	CDT_CHR		 2
    115  1.1  rvb #define	CDT_DIR		 4
    116  1.1  rvb #define	CDT_BLK		 6
    117  1.1  rvb #define	CDT_REG		 8
    118  1.1  rvb #define	CDT_LNK		10
    119  1.1  rvb #define	CDT_SOCK		12
    120  1.1  rvb #define	CDT_WHT		14
    121  1.1  rvb 
    122  1.1  rvb /*
    123  1.1  rvb  * Convert between stat structure types and directory types.
    124  1.1  rvb  */
    125  1.1  rvb #define	IFTOCDT(mode)	(((mode) & 0170000) >> 12)
    126  1.1  rvb #define	CDTTOIF(dirtype)	((dirtype) << 12)
    127  1.1  rvb 
    128  1.1  rvb #endif
    129  1.1  rvb 
    130  1.1  rvb #ifndef	_FID_T_
    131  1.1  rvb #define _FID_T_	1
    132  1.1  rvb typedef u_long VolumeId;
    133  1.1  rvb typedef u_long VnodeId;
    134  1.1  rvb typedef u_long Unique_t;
    135  1.1  rvb typedef u_long FileVersion;
    136  1.1  rvb #endif
    137  1.1  rvb 
    138  1.1  rvb #ifndef	_VICEFID_T_
    139  1.1  rvb #define _VICEFID_T_	1
    140  1.1  rvb typedef struct ViceFid {
    141  1.1  rvb     VolumeId Volume;
    142  1.1  rvb     VnodeId Vnode;
    143  1.1  rvb     Unique_t Unique;
    144  1.1  rvb } ViceFid;
    145  1.1  rvb #endif	/* VICEFID */
    146  1.1  rvb 
    147  1.1  rvb #ifdef	__linux__
    148  1.1  rvb static inline ino_t coda_f2i(struct ViceFid *fid)
    149  1.1  rvb {
    150  1.1  rvb       if ( fid ) {
    151  1.1  rvb               return (fid->Unique + (fid->Vnode << 10) + (fid->Volume << 20));
    152  1.1  rvb       } else {
    153  1.1  rvb               return 0;
    154  1.1  rvb       }
    155  1.1  rvb }
    156  1.1  rvb #endif
    157  1.1  rvb 
    158  1.1  rvb #ifndef _VUID_T_
    159  1.1  rvb #define _VUID_T_
    160  1.1  rvb typedef u_long vuid_t;
    161  1.1  rvb typedef u_long vgid_t;
    162  1.1  rvb #endif /*_VUID_T_ */
    163  1.1  rvb 
    164  1.1  rvb #ifndef _CODACRED_T_
    165  1.1  rvb #define _CODACRED_T_
    166  1.1  rvb struct coda_cred {
    167  1.1  rvb     vuid_t cr_uid, cr_euid, cr_suid, cr_fsuid; /* Real, efftve, set, fs uid*/
    168  1.1  rvb #if	defined(__NetBSD__) || defined(__FreeBSD__)
    169  1.1  rvb     vgid_t cr_groupid, cr_egid, cr_sgid, cr_fsgid; /* same for groups */
    170  1.1  rvb #else
    171  1.1  rvb     vgid_t cr_gid,     cr_egid, cr_sgid, cr_fsgid; /* same for groups */
    172  1.1  rvb #endif
    173  1.1  rvb };
    174  1.1  rvb #endif
    175  1.1  rvb 
    176  1.1  rvb #ifndef _VENUS_VATTR_T_
    177  1.1  rvb #define _VENUS_VATTR_T_
    178  1.1  rvb /*
    179  1.1  rvb  * Vnode types.  VNON means no type.
    180  1.1  rvb  */
    181  1.1  rvb enum coda_vtype	{ C_VNON, C_VREG, C_VDIR, C_VBLK, C_VCHR, C_VLNK, C_VSOCK, C_VFIFO, C_VBAD };
    182  1.1  rvb 
    183  1.1  rvb struct coda_vattr {
    184  1.1  rvb 	enum coda_vtype	va_type;	/* vnode type (for create) */
    185  1.1  rvb 	u_short		va_mode;	/* files access mode and type */
    186  1.1  rvb 	short		va_nlink;	/* number of references to file */
    187  1.1  rvb 	vuid_t		va_uid;		/* owner user id */
    188  1.1  rvb 	vgid_t		va_gid;		/* owner group id */
    189  1.1  rvb 	long		va_fileid;	/* file id */
    190  1.1  rvb 	u_quad_t	va_size;	/* file size in bytes */
    191  1.1  rvb 	long		va_blocksize;	/* blocksize preferred for i/o */
    192  1.1  rvb 	struct timespec	va_atime;	/* time of last access */
    193  1.1  rvb 	struct timespec	va_mtime;	/* time of last modification */
    194  1.1  rvb 	struct timespec	va_ctime;	/* time file changed */
    195  1.1  rvb 	u_long		va_gen;		/* generation number of file */
    196  1.1  rvb 	u_long		va_flags;	/* flags defined for file */
    197  1.1  rvb 	cdev_t	        va_rdev;	/* device special file represents */
    198  1.1  rvb 	u_quad_t	va_bytes;	/* bytes of disk space held by file */
    199  1.1  rvb 	u_quad_t	va_filerev;	/* file modification number */
    200  1.1  rvb };
    201  1.1  rvb 
    202  1.1  rvb #endif
    203  1.1  rvb 
    204  1.1  rvb /*
    205  1.1  rvb  * Kernel <--> Venus communications.
    206  1.1  rvb  */
    207  1.1  rvb 
    208  1.3  rvb #define CODA_ROOT	((u_long) 2)
    209  1.3  rvb #define CODA_SYNC	((u_long) 3)
    210  1.3  rvb #define CODA_OPEN	((u_long) 4)
    211  1.3  rvb #define CODA_CLOSE	((u_long) 5)
    212  1.3  rvb #define CODA_IOCTL	((u_long) 6)
    213  1.3  rvb #define CODA_GETATTR	((u_long) 7)
    214  1.3  rvb #define CODA_SETATTR	((u_long) 8)
    215  1.3  rvb #define CODA_ACCESS	((u_long) 9)
    216  1.3  rvb #define CODA_LOOKUP	((u_long) 10)
    217  1.3  rvb #define CODA_CREATE	((u_long) 11)
    218  1.3  rvb #define CODA_REMOVE	((u_long) 12)
    219  1.3  rvb #define CODA_LINK	((u_long) 13)
    220  1.3  rvb #define CODA_RENAME	((u_long) 14)
    221  1.3  rvb #define CODA_MKDIR	((u_long) 15)
    222  1.3  rvb #define CODA_RMDIR	((u_long) 16)
    223  1.3  rvb #define CODA_READDIR	((u_long) 17)
    224  1.3  rvb #define CODA_SYMLINK	((u_long) 18)
    225  1.3  rvb #define CODA_READLINK	((u_long) 19)
    226  1.3  rvb #define CODA_FSYNC	((u_long) 20)
    227  1.3  rvb #define CODA_INACTIVE	((u_long) 21)
    228  1.3  rvb #define CODA_VGET	((u_long) 22)
    229  1.3  rvb #define CODA_SIGNAL	((u_long) 23)
    230  1.3  rvb #define CODA_REPLACE	((u_long) 24)
    231  1.3  rvb #define CODA_FLUSH       ((u_long) 25)
    232  1.3  rvb #define CODA_PURGEUSER   ((u_long) 26)
    233  1.3  rvb #define CODA_ZAPFILE     ((u_long) 27)
    234  1.3  rvb #define CODA_ZAPDIR      ((u_long) 28)
    235  1.3  rvb #define CODA_ZAPVNODE    ((u_long) 29)
    236  1.3  rvb #define CODA_PURGEFID    ((u_long) 30)
    237  1.3  rvb #define CODA_NCALLS 31
    238  1.1  rvb 
    239  1.3  rvb #define DOWNCALL(opcode) (opcode >= CODA_REPLACE && opcode <= CODA_PURGEFID)
    240  1.1  rvb 
    241  1.1  rvb #define VC_MAXDATASIZE	    8192
    242  1.1  rvb #define VC_MAXMSGSIZE      sizeof(union inputArgs)+sizeof(union outputArgs) +\
    243  1.1  rvb                             VC_MAXDATASIZE
    244  1.1  rvb 
    245  1.1  rvb 
    246  1.1  rvb 
    247  1.1  rvb /*
    248  1.1  rvb  *        Venus <-> Coda  RPC arguments
    249  1.1  rvb  */
    250  1.3  rvb struct coda_in_hdr {
    251  1.1  rvb     unsigned long opcode;
    252  1.1  rvb     unsigned long unique;	    /* Keep multiple outstanding msgs distinct */
    253  1.1  rvb     u_short pid;		    /* Common to all */
    254  1.1  rvb     u_short pgid;		    /* Common to all */
    255  1.1  rvb     u_short sid;                    /* Common to all */
    256  1.1  rvb     struct coda_cred cred;	    /* Common to all */
    257  1.1  rvb };
    258  1.1  rvb 
    259  1.1  rvb /* Really important that opcode and unique are 1st two fields! */
    260  1.3  rvb struct coda_out_hdr {
    261  1.1  rvb     unsigned long opcode;
    262  1.1  rvb     unsigned long unique;
    263  1.1  rvb     unsigned long result;
    264  1.1  rvb };
    265  1.1  rvb 
    266  1.3  rvb /* coda_root: NO_IN */
    267  1.3  rvb struct coda_root_out {
    268  1.3  rvb     struct coda_out_hdr oh;
    269  1.1  rvb     ViceFid VFid;
    270  1.1  rvb };
    271  1.1  rvb 
    272  1.3  rvb struct coda_root_in {
    273  1.3  rvb     struct coda_in_hdr in;
    274  1.1  rvb };
    275  1.1  rvb 
    276  1.3  rvb /* coda_sync: */
    277  1.3  rvb /* Nothing needed for coda_sync */
    278  1.1  rvb 
    279  1.3  rvb /* coda_open: */
    280  1.3  rvb struct coda_open_in {
    281  1.3  rvb     struct coda_in_hdr ih;
    282  1.1  rvb     ViceFid	VFid;
    283  1.1  rvb     int	flags;
    284  1.1  rvb };
    285  1.1  rvb 
    286  1.3  rvb struct coda_open_out {
    287  1.3  rvb     struct coda_out_hdr oh;
    288  1.1  rvb     cdev_t	dev;
    289  1.1  rvb     ino_t	inode;
    290  1.1  rvb };
    291  1.1  rvb 
    292  1.1  rvb 
    293  1.3  rvb /* coda_close: */
    294  1.3  rvb struct coda_close_in {
    295  1.3  rvb     struct coda_in_hdr ih;
    296  1.1  rvb     ViceFid	VFid;
    297  1.1  rvb     int	flags;
    298  1.1  rvb };
    299  1.1  rvb 
    300  1.3  rvb struct coda_close_out {
    301  1.3  rvb     struct coda_out_hdr out;
    302  1.1  rvb };
    303  1.1  rvb 
    304  1.3  rvb /* coda_ioctl: */
    305  1.3  rvb struct coda_ioctl_in {
    306  1.3  rvb     struct coda_in_hdr ih;
    307  1.1  rvb     ViceFid VFid;
    308  1.1  rvb     int	cmd;
    309  1.1  rvb     int	len;
    310  1.1  rvb     int	rwflag;
    311  1.1  rvb     char *data;			/* Place holder for data. */
    312  1.1  rvb };
    313  1.1  rvb 
    314  1.3  rvb struct coda_ioctl_out {
    315  1.3  rvb     struct coda_out_hdr oh;
    316  1.1  rvb     int	len;
    317  1.1  rvb     caddr_t	data;		/* Place holder for data. */
    318  1.1  rvb };
    319  1.1  rvb 
    320  1.1  rvb 
    321  1.3  rvb /* coda_getattr: */
    322  1.3  rvb struct coda_getattr_in {
    323  1.3  rvb     struct coda_in_hdr ih;
    324  1.1  rvb     ViceFid VFid;
    325  1.1  rvb };
    326  1.1  rvb 
    327  1.3  rvb struct coda_getattr_out {
    328  1.3  rvb     struct coda_out_hdr oh;
    329  1.1  rvb     struct coda_vattr attr;
    330  1.1  rvb };
    331  1.1  rvb 
    332  1.1  rvb 
    333  1.3  rvb /* coda_setattr: NO_OUT */
    334  1.3  rvb struct coda_setattr_in {
    335  1.3  rvb     struct coda_in_hdr ih;
    336  1.1  rvb     ViceFid VFid;
    337  1.1  rvb     struct coda_vattr attr;
    338  1.1  rvb };
    339  1.1  rvb 
    340  1.3  rvb struct coda_setattr_out {
    341  1.3  rvb     struct coda_out_hdr out;
    342  1.1  rvb };
    343  1.1  rvb 
    344  1.3  rvb /* coda_access: NO_OUT */
    345  1.3  rvb struct coda_access_in {
    346  1.3  rvb     struct coda_in_hdr ih;
    347  1.1  rvb     ViceFid	VFid;
    348  1.1  rvb     int	flags;
    349  1.1  rvb };
    350  1.1  rvb 
    351  1.3  rvb struct coda_access_out {
    352  1.3  rvb     struct coda_out_hdr out;
    353  1.1  rvb };
    354  1.1  rvb 
    355  1.3  rvb /* coda_lookup: */
    356  1.3  rvb struct  coda_lookup_in {
    357  1.3  rvb     struct coda_in_hdr ih;
    358  1.1  rvb     ViceFid	VFid;
    359  1.1  rvb     int         name;		/* Place holder for data. */
    360  1.1  rvb };
    361  1.1  rvb 
    362  1.3  rvb struct coda_lookup_out {
    363  1.3  rvb     struct coda_out_hdr oh;
    364  1.1  rvb     ViceFid VFid;
    365  1.1  rvb     int	vtype;
    366  1.1  rvb };
    367  1.1  rvb 
    368  1.1  rvb 
    369  1.3  rvb /* coda_create: */
    370  1.3  rvb struct coda_create_in {
    371  1.3  rvb     struct coda_in_hdr ih;
    372  1.1  rvb     ViceFid VFid;
    373  1.1  rvb     struct coda_vattr attr;
    374  1.1  rvb     int excl;
    375  1.1  rvb     int mode;
    376  1.1  rvb     int 	name;		/* Place holder for data. */
    377  1.1  rvb };
    378  1.1  rvb 
    379  1.3  rvb struct coda_create_out {
    380  1.3  rvb     struct coda_out_hdr oh;
    381  1.1  rvb     ViceFid VFid;
    382  1.1  rvb     struct coda_vattr attr;
    383  1.1  rvb };
    384  1.1  rvb 
    385  1.1  rvb 
    386  1.3  rvb /* coda_remove: NO_OUT */
    387  1.3  rvb struct coda_remove_in {
    388  1.3  rvb     struct coda_in_hdr ih;
    389  1.1  rvb     ViceFid	VFid;
    390  1.1  rvb     int name;		/* Place holder for data. */
    391  1.1  rvb };
    392  1.1  rvb 
    393  1.3  rvb struct coda_remove_out {
    394  1.3  rvb     struct coda_out_hdr out;
    395  1.1  rvb };
    396  1.1  rvb 
    397  1.3  rvb /* coda_link: NO_OUT */
    398  1.3  rvb struct coda_link_in {
    399  1.3  rvb     struct coda_in_hdr ih;
    400  1.1  rvb     ViceFid sourceFid;          /* cnode to link *to* */
    401  1.1  rvb     ViceFid destFid;            /* Directory in which to place link */
    402  1.1  rvb     int tname;		/* Place holder for data. */
    403  1.1  rvb };
    404  1.1  rvb 
    405  1.3  rvb struct coda_link_out {
    406  1.3  rvb     struct coda_out_hdr out;
    407  1.1  rvb };
    408  1.1  rvb 
    409  1.1  rvb 
    410  1.3  rvb /* coda_rename: NO_OUT */
    411  1.3  rvb struct coda_rename_in {
    412  1.3  rvb     struct coda_in_hdr ih;
    413  1.1  rvb     ViceFid	sourceFid;
    414  1.1  rvb     int 	srcname;
    415  1.1  rvb     ViceFid destFid;
    416  1.1  rvb     int 	destname;
    417  1.1  rvb };
    418  1.1  rvb 
    419  1.3  rvb struct coda_rename_out {
    420  1.3  rvb     struct coda_out_hdr out;
    421  1.1  rvb };
    422  1.1  rvb 
    423  1.3  rvb /* coda_mkdir: */
    424  1.3  rvb struct coda_mkdir_in {
    425  1.3  rvb     struct coda_in_hdr ih;
    426  1.1  rvb     ViceFid	VFid;
    427  1.1  rvb     struct coda_vattr attr;
    428  1.1  rvb     int	   name;		/* Place holder for data. */
    429  1.1  rvb };
    430  1.1  rvb 
    431  1.3  rvb struct coda_mkdir_out {
    432  1.3  rvb     struct coda_out_hdr oh;
    433  1.1  rvb     ViceFid VFid;
    434  1.1  rvb     struct coda_vattr attr;
    435  1.1  rvb };
    436  1.1  rvb 
    437  1.1  rvb 
    438  1.3  rvb /* coda_rmdir: NO_OUT */
    439  1.3  rvb struct coda_rmdir_in {
    440  1.3  rvb     struct coda_in_hdr ih;
    441  1.1  rvb     ViceFid	VFid;
    442  1.1  rvb     int name;		/* Place holder for data. */
    443  1.1  rvb };
    444  1.1  rvb 
    445  1.3  rvb struct coda_rmdir_out {
    446  1.3  rvb     struct coda_out_hdr out;
    447  1.1  rvb };
    448  1.1  rvb 
    449  1.3  rvb /* coda_readdir: */
    450  1.3  rvb struct coda_readdir_in {
    451  1.3  rvb     struct coda_in_hdr ih;
    452  1.1  rvb     ViceFid	VFid;
    453  1.1  rvb     int	count;
    454  1.1  rvb     int	offset;
    455  1.1  rvb };
    456  1.1  rvb 
    457  1.3  rvb struct coda_readdir_out {
    458  1.3  rvb     struct coda_out_hdr oh;
    459  1.1  rvb     int	size;
    460  1.1  rvb     caddr_t	data;		/* Place holder for data. */
    461  1.1  rvb };
    462  1.1  rvb 
    463  1.3  rvb /* coda_symlink: NO_OUT */
    464  1.3  rvb struct coda_symlink_in {
    465  1.3  rvb     struct coda_in_hdr ih;
    466  1.1  rvb     ViceFid	VFid;          /* Directory to put symlink in */
    467  1.1  rvb     int srcname;
    468  1.1  rvb     struct coda_vattr attr;
    469  1.1  rvb     int tname;
    470  1.1  rvb };
    471  1.1  rvb 
    472  1.3  rvb struct coda_symlink_out {
    473  1.3  rvb     struct coda_out_hdr out;
    474  1.1  rvb };
    475  1.1  rvb 
    476  1.3  rvb /* coda_readlink: */
    477  1.3  rvb struct coda_readlink_in {
    478  1.3  rvb     struct coda_in_hdr ih;
    479  1.1  rvb     ViceFid VFid;
    480  1.1  rvb };
    481  1.1  rvb 
    482  1.3  rvb struct coda_readlink_out {
    483  1.3  rvb     struct coda_out_hdr oh;
    484  1.1  rvb     int	count;
    485  1.1  rvb     caddr_t	data;		/* Place holder for data. */
    486  1.1  rvb };
    487  1.1  rvb 
    488  1.1  rvb 
    489  1.3  rvb /* coda_fsync: NO_OUT */
    490  1.3  rvb struct coda_fsync_in {
    491  1.3  rvb     struct coda_in_hdr ih;
    492  1.1  rvb     ViceFid VFid;
    493  1.1  rvb };
    494  1.1  rvb 
    495  1.3  rvb struct coda_fsync_out {
    496  1.3  rvb     struct coda_out_hdr out;
    497  1.1  rvb };
    498  1.1  rvb 
    499  1.3  rvb /* coda_inactive: NO_OUT */
    500  1.3  rvb struct coda_inactive_in {
    501  1.3  rvb     struct coda_in_hdr ih;
    502  1.1  rvb     ViceFid VFid;
    503  1.1  rvb };
    504  1.1  rvb 
    505  1.3  rvb /* coda_vget: */
    506  1.3  rvb struct coda_vget_in {
    507  1.3  rvb     struct coda_in_hdr ih;
    508  1.1  rvb     ViceFid VFid;
    509  1.1  rvb };
    510  1.1  rvb 
    511  1.3  rvb struct coda_vget_out {
    512  1.3  rvb     struct coda_out_hdr oh;
    513  1.1  rvb     ViceFid VFid;
    514  1.1  rvb     int	vtype;
    515  1.1  rvb };
    516  1.1  rvb 
    517  1.1  rvb 
    518  1.3  rvb /* CODA_SIGNAL is out-of-band, doesn't need data. */
    519  1.3  rvb /* CODA_INVALIDATE is a venus->kernel call */
    520  1.3  rvb /* CODA_FLUSH is a venus->kernel call */
    521  1.3  rvb 
    522  1.3  rvb /* coda_purgeuser: */
    523  1.3  rvb /* CODA_PURGEUSER is a venus->kernel call */
    524  1.3  rvb struct coda_purgeuser_out {
    525  1.3  rvb     struct coda_out_hdr oh;
    526  1.1  rvb     struct coda_cred cred;
    527  1.1  rvb };
    528  1.1  rvb 
    529  1.3  rvb /* coda_zapfile: */
    530  1.3  rvb /* CODA_ZAPFILE is a venus->kernel call */
    531  1.3  rvb struct coda_zapfile_out {
    532  1.3  rvb     struct coda_out_hdr oh;
    533  1.1  rvb     ViceFid CodaFid;
    534  1.1  rvb };
    535  1.1  rvb 
    536  1.3  rvb /* coda_zapdir: */
    537  1.3  rvb /* CODA_ZAPDIR is a venus->kernel call */
    538  1.3  rvb struct coda_zapdir_out {
    539  1.3  rvb     struct coda_out_hdr oh;
    540  1.1  rvb     ViceFid CodaFid;
    541  1.1  rvb };
    542  1.1  rvb 
    543  1.3  rvb /* coda_zapnode: */
    544  1.3  rvb /* CODA_ZAPVNODE is a venus->kernel call */
    545  1.3  rvb struct coda_zapvnode_out {
    546  1.3  rvb     struct coda_out_hdr oh;
    547  1.1  rvb     struct coda_cred cred;
    548  1.1  rvb     ViceFid VFid;
    549  1.1  rvb };
    550  1.1  rvb 
    551  1.3  rvb /* coda_purgefid: */
    552  1.3  rvb /* CODA_PURGEFID is a venus->kernel call */
    553  1.3  rvb struct coda_purgefid_out {
    554  1.3  rvb     struct coda_out_hdr oh;
    555  1.1  rvb     ViceFid CodaFid;
    556  1.1  rvb };
    557  1.1  rvb 
    558  1.3  rvb /* coda_rdwr: */
    559  1.3  rvb struct coda_rdwr_in {
    560  1.3  rvb     struct coda_in_hdr ih;
    561  1.1  rvb     ViceFid	VFid;
    562  1.1  rvb     int	rwflag;
    563  1.1  rvb     int	count;
    564  1.1  rvb     int	offset;
    565  1.1  rvb     int	ioflag;
    566  1.1  rvb     caddr_t	data;		/* Place holder for data. */
    567  1.1  rvb };
    568  1.1  rvb 
    569  1.3  rvb struct coda_rdwr_out {
    570  1.3  rvb     struct coda_out_hdr oh;
    571  1.1  rvb     int	rwflag;
    572  1.1  rvb     int	count;
    573  1.1  rvb     caddr_t	data;	/* Place holder for data. */
    574  1.1  rvb };
    575  1.1  rvb 
    576  1.1  rvb 
    577  1.3  rvb /* coda_replace: */
    578  1.3  rvb /* CODA_REPLACE is a venus->kernel call */
    579  1.3  rvb struct coda_replace_out { /* coda_replace is a venus->kernel call */
    580  1.3  rvb     struct coda_out_hdr oh;
    581  1.1  rvb     ViceFid NewFid;
    582  1.1  rvb     ViceFid OldFid;
    583  1.1  rvb };
    584  1.1  rvb 
    585  1.1  rvb /*
    586  1.3  rvb  * Occasionally, don't cache the fid returned by CODA_LOOKUP. For instance, if
    587  1.1  rvb  * the fid is inconsistent. This case is handled by setting the top bit of the
    588  1.1  rvb  * return result parameter.
    589  1.1  rvb  */
    590  1.3  rvb #define CODA_NOCACHE          0x80000000
    591  1.1  rvb 
    592  1.1  rvb union inputArgs {
    593  1.3  rvb     struct coda_in_hdr ih;		/* NB: every struct below begins with an ih */
    594  1.3  rvb     struct coda_open_in coda_open;
    595  1.3  rvb     struct coda_close_in coda_close;
    596  1.3  rvb     struct coda_ioctl_in coda_ioctl;
    597  1.3  rvb     struct coda_getattr_in coda_getattr;
    598  1.3  rvb     struct coda_setattr_in coda_setattr;
    599  1.3  rvb     struct coda_access_in coda_access;
    600  1.3  rvb     struct coda_lookup_in coda_lookup;
    601  1.3  rvb     struct coda_create_in coda_create;
    602  1.3  rvb     struct coda_remove_in coda_remove;
    603  1.3  rvb     struct coda_link_in coda_link;
    604  1.3  rvb     struct coda_rename_in coda_rename;
    605  1.3  rvb     struct coda_mkdir_in coda_mkdir;
    606  1.3  rvb     struct coda_rmdir_in coda_rmdir;
    607  1.3  rvb     struct coda_readdir_in coda_readdir;
    608  1.3  rvb     struct coda_symlink_in coda_symlink;
    609  1.3  rvb     struct coda_readlink_in coda_readlink;
    610  1.3  rvb     struct coda_fsync_in coda_fsync;
    611  1.3  rvb     struct coda_inactive_in coda_inactive;
    612  1.3  rvb     struct coda_vget_in coda_vget;
    613  1.3  rvb     struct coda_rdwr_in coda_rdwr;
    614  1.1  rvb };
    615  1.1  rvb 
    616  1.1  rvb union outputArgs {
    617  1.3  rvb     struct coda_out_hdr oh;		/* NB: every struct below begins with an oh */
    618  1.3  rvb     struct coda_root_out coda_root;
    619  1.3  rvb     struct coda_open_out coda_open;
    620  1.3  rvb     struct coda_ioctl_out coda_ioctl;
    621  1.3  rvb     struct coda_getattr_out coda_getattr;
    622  1.3  rvb     struct coda_lookup_out coda_lookup;
    623  1.3  rvb     struct coda_create_out coda_create;
    624  1.3  rvb     struct coda_mkdir_out coda_mkdir;
    625  1.3  rvb     struct coda_readdir_out coda_readdir;
    626  1.3  rvb     struct coda_readlink_out coda_readlink;
    627  1.3  rvb     struct coda_vget_out coda_vget;
    628  1.3  rvb     struct coda_purgeuser_out coda_purgeuser;
    629  1.3  rvb     struct coda_zapfile_out coda_zapfile;
    630  1.3  rvb     struct coda_zapdir_out coda_zapdir;
    631  1.3  rvb     struct coda_zapvnode_out coda_zapvnode;
    632  1.3  rvb     struct coda_purgefid_out coda_purgefid;
    633  1.3  rvb     struct coda_rdwr_out coda_rdwr;
    634  1.3  rvb     struct coda_replace_out coda_replace;
    635  1.1  rvb };
    636  1.1  rvb 
    637  1.3  rvb union coda_downcalls {
    638  1.3  rvb     /* CODA_INVALIDATE is a venus->kernel call */
    639  1.3  rvb     /* CODA_FLUSH is a venus->kernel call */
    640  1.3  rvb     struct coda_purgeuser_out purgeuser;
    641  1.3  rvb     struct coda_zapfile_out zapfile;
    642  1.3  rvb     struct coda_zapdir_out zapdir;
    643  1.3  rvb     struct coda_zapvnode_out zapvnode;
    644  1.3  rvb     struct coda_purgefid_out purgefid;
    645  1.3  rvb     struct coda_replace_out replace;
    646  1.1  rvb };
    647  1.1  rvb 
    648  1.1  rvb 
    649  1.1  rvb /*
    650  1.1  rvb  * Used for identifying usage of "Control" and pioctls
    651  1.1  rvb  */
    652  1.1  rvb 
    653  1.1  rvb #define PIOCPARM_MASK 0x0000ffff
    654  1.1  rvb struct ViceIoctl {
    655  1.1  rvb         caddr_t in, out;        /* Data to be transferred in, or out */
    656  1.1  rvb         short in_size;          /* Size of input buffer <= 2K */
    657  1.1  rvb         short out_size;         /* Maximum size of output buffer, <= 2K */
    658  1.1  rvb };
    659  1.1  rvb 
    660  1.1  rvb struct PioctlData {
    661  1.1  rvb         const char *path;
    662  1.1  rvb         int follow;
    663  1.1  rvb         struct ViceIoctl vi;
    664  1.1  rvb };
    665  1.1  rvb 
    666  1.3  rvb #define	CODA_CONTROL		".CONTROL"
    667  1.3  rvb #define CODA_CONTROLLEN           8
    668  1.1  rvb #define	CTL_VOL			-1
    669  1.1  rvb #define	CTL_VNO			-1
    670  1.1  rvb #define	CTL_UNI			-1
    671  1.1  rvb #define CTL_INO                 -1
    672  1.1  rvb #define	CTL_FILE		"/coda/.CONTROL"
    673  1.1  rvb 
    674  1.1  rvb 
    675  1.1  rvb #define	IS_CTL_FID(fidp)	((fidp)->Volume == CTL_VOL &&\
    676  1.1  rvb 				 (fidp)->Vnode == CTL_VNO &&\
    677  1.1  rvb 				 (fidp)->Unique == CTL_UNI)
    678  1.1  rvb #endif
    679  1.1  rvb 
    680