attempt-more-portable-64bit-type-support-for-namei-fileserver-20010403
[openafs.git] / src / util / vice.h
1 /*
2  * Copyright 2000, International Business Machines Corporation and others.
3  * All Rights Reserved.
4  * 
5  * This software has been released under the terms of the IBM Public
6  * License.  For details, see the LICENSE file in the top-level source
7  * directory or online at http://www.openafs.org/dl/license10.html
8  */
9
10 #if !defined(lint) && !defined(LOCORE)  && defined(RCS_HDRS)
11 #endif
12 /*
13  * /usr/include/sys/vice.h
14  *
15  * Definitions required by user processes needing extended vice facilities
16  * of the kernel.
17  * 
18  * NOTE:  /usr/include/sys/remote.h contains definitions common between
19  *              Venus and the kernel.
20  *          /usr/local/include/viceioctl.h contains ioctl definitions common
21  *              between user processes and Venus.
22  */
23 #include <afs/param.h>
24 #ifdef AFS_SUN5_ENV
25 #include <sys/ioccom.h>
26 #endif
27
28 #if defined(KERNEL)
29 /* a fixed size, whether the kernel uses the ILP32 or LP64 data models */
30 struct ViceIoctl32 {
31         unsigned int in, out;   /* Data to be transferred in, or out */
32         short in_size;          /* Size of input buffer <= 2K */
33         short out_size;         /* Maximum size of output buffer, <= 2K */
34 };
35 #endif
36
37 #ifndef AFS_NT40_ENV  /* NT decl in sys/pioctl_nt.h with pioctl() decl */
38 struct ViceIoctl {
39         caddr_t in, out;        /* Data to be transferred in, or out */
40         short in_size;          /* Size of input buffer <= 2K */
41         short out_size;         /* Maximum size of output buffer, <= 2K */
42 };
43 #endif
44
45 /* The 2K limits above are a consequence of the size of the kernel buffer
46    used to buffer requests from the user to venus--2*MAXPATHLEN.
47    The buffer pointers may be null, or the counts may be 0 if there
48    are no input or output parameters
49  */
50 /*
51  * The structure argument to _IOW() is used to add a structure
52  * size component to the _IOW() value, to help the kernel code identify
53  * how big a structure the calling process is passing into a system
54  * call.
55  *
56  * In user space, struct ViceIoctl32 and struct ViceIoctl are the same
57  * except on Digital Unix, where user space code is compiled in 64-bit
58  * mode.
59  *
60  * So, in kernel space, regardless whether it is compiled in 32-bit
61  * mode or 64-bit mode, the kernel code can use the struct ViceIoctl32
62  * version of _IOW() to check the size of user space arguments -- except
63  * on Digital Unix.
64  */
65 #if defined(KERNEL) && !defined(AFS_OSF_ENV) && !defined(AFS_ALPHA_LINUX20_ENV)
66 #define _VICEIOCTL(id)  ((unsigned int ) _IOW('V', id, struct ViceIoctl32))
67 #else
68 #define _VICEIOCTL(id)  ((unsigned int ) _IOW('V', id, struct ViceIoctl))
69 #endif
70
71 /* Use this macro to define up to 256 vice ioctl's.  These ioctl's
72    all potentially have in/out parameters--this depends upon the
73    values in the ViceIoctl structure.  This structure is itself passed
74    into the kernel by the normal ioctl parameter passing mechanism.
75  */
76
77 #define _VALIDVICEIOCTL(com) (com >= _VICEIOCTL(0) && com <= _VICEIOCTL(255))