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