Merge to Fedora kernel-2.6.18-1.2224_FC5 patched with stable patch-2.6.18.1-vs2.0...
[linux-2.6.git] / include / linux / nfsd / syscall.h
1 /*
2  * include/linux/nfsd/syscall.h
3  *
4  * This file holds all declarations for the knfsd syscall interface.
5  *
6  * Copyright (C) 1995-1997 Olaf Kirch <okir@monad.swb.de>
7  */
8
9 #ifndef NFSD_SYSCALL_H
10 #define NFSD_SYSCALL_H
11
12 #include <asm/types.h>
13 #ifdef __KERNEL__
14 # include <linux/types.h>
15 # include <linux/in.h>
16 #endif 
17 #include <linux/posix_types.h>
18 #include <linux/nfsd/const.h>
19 #include <linux/nfsd/export.h>
20 #include <linux/nfsd/nfsfh.h>
21 #include <linux/nfsd/auth.h>
22
23 /*
24  * Version of the syscall interface
25  */
26 #define NFSCTL_VERSION          0x0201
27
28 /*
29  * These are the commands understood by nfsctl().
30  */
31 #define NFSCTL_SVC              0       /* This is a server process. */
32 #define NFSCTL_ADDCLIENT        1       /* Add an NFS client. */
33 #define NFSCTL_DELCLIENT        2       /* Remove an NFS client. */
34 #define NFSCTL_EXPORT           3       /* export a file system. */
35 #define NFSCTL_UNEXPORT         4       /* unexport a file system. */
36 /*#define NFSCTL_UGIDUPDATE     5       / * update a client's uid/gid map. DISCARDED */
37 /*#define NFSCTL_GETFH          6       / * get an fh by ino DISCARDED */
38 #define NFSCTL_GETFD            7       /* get an fh by path (used by mountd) */
39 #define NFSCTL_GETFS            8       /* get an fh by path with max FH len */
40
41 /*
42  * Macros used to set version and protocol
43  */
44 #define NFSCTL_VERSET(_cltbits, _v)   ((_cltbits) |=  (1 << (_v)))
45 #define NFSCTL_VERUNSET(_cltbits, _v) ((_cltbits) &= ~(1 << (_v)))
46 #define NFSCTL_VERISSET(_cltbits, _v) ((_cltbits) & (1 << (_v)))
47
48 #if defined(CONFIG_NFSD_V4)
49 #define NFSCTL_VERALL   (0x1c /* 0b011100 */)
50 #elif defined(CONFIG_NFSD_V3)
51 #define NFSCTL_VERALL   (0x0c /* 0b001100 */)
52 #else
53 #define NFSCTL_VERALL   (0x04 /* 0b000100 */)
54 #endif
55
56 #define NFSCTL_UDPSET(_cltbits)       ((_cltbits) |=  (1 << (17 - 1)))
57 #define NFSCTL_UDPUNSET(_cltbits)     ((_cltbits) &= ~(1 << (17 - 1)))
58 #define NFSCTL_UDPISSET(_cltbits)     ((_cltbits) & (1 << (17 - 1)))
59
60 #define NFSCTL_TCPSET(_cltbits)       ((_cltbits) |=  (1 << (18 - 1)))
61 #define NFSCTL_TCPUNSET(_cltbits)     ((_cltbits) &= ~(1 << (18 - 1)))
62 #define NFSCTL_TCPISSET(_cltbits)     ((_cltbits) & (1 << (18 - 1)))
63
64
65 /* SVC */
66 struct nfsctl_svc {
67         unsigned short          svc_port;
68         int                     svc_nthreads;
69 };
70
71 /* ADDCLIENT/DELCLIENT */
72 struct nfsctl_client {
73         char                    cl_ident[NFSCLNT_IDMAX+1];
74         int                     cl_naddr;
75         struct in_addr          cl_addrlist[NFSCLNT_ADDRMAX];
76         int                     cl_fhkeytype;
77         int                     cl_fhkeylen;
78         unsigned char           cl_fhkey[NFSCLNT_KEYMAX];
79 };
80
81 /* EXPORT/UNEXPORT */
82 struct nfsctl_export {
83         char                    ex_client[NFSCLNT_IDMAX+1];
84         char                    ex_path[NFS_MAXPATHLEN+1];
85         __kernel_old_dev_t      ex_dev;
86         __kernel_ino_t          ex_ino;
87         int                     ex_flags;
88         __kernel_uid_t          ex_anon_uid;
89         __kernel_gid_t          ex_anon_gid;
90 };
91
92 /* GETFD */
93 struct nfsctl_fdparm {
94         struct sockaddr         gd_addr;
95         char                    gd_path[NFS_MAXPATHLEN+1];
96         int                     gd_version;
97 };
98
99 /* GETFS - GET Filehandle with Size */
100 struct nfsctl_fsparm {
101         struct sockaddr         gd_addr;
102         char                    gd_path[NFS_MAXPATHLEN+1];
103         int                     gd_maxlen;
104 };
105
106 /*
107  * This is the argument union.
108  */
109 struct nfsctl_arg {
110         int                     ca_version;     /* safeguard */
111         union {
112                 struct nfsctl_svc       u_svc;
113                 struct nfsctl_client    u_client;
114                 struct nfsctl_export    u_export;
115                 struct nfsctl_fdparm    u_getfd;
116                 struct nfsctl_fsparm    u_getfs;
117                 /*
118                  * The following dummy member is needed to preserve binary compatibility
119                  * on platforms where alignof(void*)>alignof(int).  It's needed because
120                  * this union used to contain a member (u_umap) which contained a
121                  * pointer.
122                  */
123                 void *u_ptr;
124         } u;
125 #define ca_svc          u.u_svc
126 #define ca_client       u.u_client
127 #define ca_export       u.u_export
128 #define ca_getfd        u.u_getfd
129 #define ca_getfs        u.u_getfs
130 };
131
132 union nfsctl_res {
133         __u8                    cr_getfh[NFS_FHSIZE];
134         struct knfsd_fh         cr_getfs;
135 };
136
137 #ifdef __KERNEL__
138 /*
139  * Kernel syscall implementation.
140  */
141 extern int              exp_addclient(struct nfsctl_client *ncp);
142 extern int              exp_delclient(struct nfsctl_client *ncp);
143 extern int              exp_export(struct nfsctl_export *nxp);
144 extern int              exp_unexport(struct nfsctl_export *nxp);
145
146 extern int nfsd_port;
147 extern unsigned int nfsd_versbits, nfsd_portbits;
148
149 #endif /* __KERNEL__ */
150
151 #endif /* NFSD_SYSCALL_H */