52e0e597dac8d0d08d161418dc7a4c1bb7ecdee7
[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 /*
11  * /usr/include/sys/vice.h
12  *
13  * Definitions required by user processes needing extended vice facilities
14  * of the kernel.
15  * 
16  * NOTE:  /usr/include/sys/remote.h contains definitions common between
17  *              Venus and the kernel.
18  *          /usr/local/include/viceioctl.h contains ioctl definitions common
19  *              between user processes and Venus.
20  */
21 #include <afs/param.h>
22 #ifdef AFS_SUN5_ENV
23 #include <sys/ioccom.h>
24 #endif
25
26 #if defined(KERNEL)
27 /* a fixed size, whether the kernel uses the ILP32 or LP64 data models */
28 struct ViceIoctl32 {
29         unsigned int in, out;   /* Data to be transferred in, or out */
30         short in_size;          /* Size of input buffer <= 2K */
31         short out_size;         /* Maximum size of output buffer, <= 2K */
32 };
33 #endif
34
35 #ifndef AFS_NT40_ENV  /* NT decl in sys/pioctl_nt.h with pioctl() decl */
36 struct ViceIoctl {
37         caddr_t in, out;        /* Data to be transferred in, or out */
38         short in_size;          /* Size of input buffer <= 2K */
39         short out_size;         /* Maximum size of output buffer, <= 2K */
40 };
41 #endif
42
43 /* The 2K limits above are a consequence of the size of the kernel buffer
44    used to buffer requests from the user to venus--2*MAXPATHLEN.
45    The buffer pointers may be null, or the counts may be 0 if there
46    are no input or output parameters
47  */
48 /*
49  * The structure argument to _IOW() is used to add a structure
50  * size component to the _IOW() value, to help the kernel code identify
51  * how big a structure the calling process is passing into a system
52  * call.
53  *
54  * In user space, struct ViceIoctl32 and struct ViceIoctl are the same
55  * except on Digital Unix, where user space code is compiled in 64-bit
56  * mode.
57  *
58  * So, in kernel space, regardless whether it is compiled in 32-bit
59  * mode or 64-bit mode, the kernel code can use the struct ViceIoctl32
60  * version of _IOW() to check the size of user space arguments -- except
61  * on Digital Unix.
62  */
63 #if defined(KERNEL) && !defined(AFS_OSF_ENV) && !defined(AFS_ALPHA_LINUX20_ENV)
64 #define _VICEIOCTL(id)  ((unsigned int ) _IOW('V', id, struct ViceIoctl32))
65 #define _VICEIOCTL2(dev, id) ((unsigned int ) _IOW(dev, id, struct ViceIoctl32))
66 #else
67 #define _VICEIOCTL(id)  ((unsigned int ) _IOW('V', id, struct ViceIoctl))
68 #define _VICEIOCTL2(dev, id) ((unsigned int ) _IOW(dev, 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