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