6 #include <linux/posix_types.h>
8 #include <netinet/in.h>
9 #include <rpcsvc/nfs_prot.h>
10 #include <nfs/export.h>
12 #define NFS3_FHSIZE 64
15 #define NFSD_MINVERS 2
16 #define NFSD_MAXVERS 4
18 #define NFSD_MINMINORVERS4 1
19 #ifdef NFS41_SUPPORTED
20 #define NFSD_MAXMINORVERS4 1
22 #define NFSD_MAXMINORVERS4 0
27 u_int8_t fh_handle[NFS3_FHSIZE];
30 u_int8_t fh_handle[NFS_FHSIZE];
34 * Version of the syscall interface
36 #define NFSCTL_VERSION 0x0201
39 * These are the commands understood by nfsctl().
41 #define NFSCTL_SVC 0 /* This is a server process. */
42 #define NFSCTL_ADDCLIENT 1 /* Add an NFS client. */
43 #define NFSCTL_DELCLIENT 2 /* Remove an NFS client. */
44 #define NFSCTL_EXPORT 3 /* export a file system. */
45 #define NFSCTL_UNEXPORT 4 /* unexport a file system. */
46 #define NFSCTL_UGIDUPDATE 5 /* update a client's uid/gid map. */
47 #define NFSCTL_GETFH 6 /* get an fh (used by mountd) */
48 #define NFSCTL_GETFD 7 /* get an fh by path (used by mountd) */
49 #define NFSCTL_GETFS 8 /* get an fh by path with max size (used by mountd) */
51 #define NFSCTL_UDPBIT (1 << (17 - 1))
52 #define NFSCTL_TCPBIT (1 << (18 - 1))
54 #define NFSCTL_VERUNSET(_cltbits, _v) ((_cltbits) &= ~(1 << ((_v) - 1)))
55 #define NFSCTL_UDPUNSET(_cltbits) ((_cltbits) &= ~NFSCTL_UDPBIT)
56 #define NFSCTL_TCPUNSET(_cltbits) ((_cltbits) &= ~NFSCTL_TCPBIT)
58 #define NFSCTL_VERISSET(_cltbits, _v) ((_cltbits) & (1 << ((_v) - 1)))
59 #define NFSCTL_UDPISSET(_cltbits) ((_cltbits) & NFSCTL_UDPBIT)
60 #define NFSCTL_TCPISSET(_cltbits) ((_cltbits) & NFSCTL_TCPBIT)
62 #define NFSCTL_UDPSET(_cltbits) ((_cltbits) |= NFSCTL_UDPBIT)
63 #define NFSCTL_TCPSET(_cltbits) ((_cltbits) |= NFSCTL_TCPBIT)
65 #define NFSCTL_ANYPROTO(_cltbits) ((_cltbits) & (NFSCTL_UDPBIT | NFSCTL_TCPBIT))
66 #define NFSCTL_ALLBITS (~0)
70 unsigned short svc_port;
74 /* ADDCLIENT/DELCLIENT */
75 struct nfsctl_client {
76 char cl_ident[NFSCLNT_IDMAX+1];
78 struct in_addr cl_addrlist[NFSCLNT_ADDRMAX];
81 unsigned char cl_fhkey[NFSCLNT_KEYMAX];
84 /* IN 2.5.6? __kernel_dev_t changed size, and __kernel_old_dev_t was left
85 * with the old value. We need to make sure we use the right one.
88 #include <linux/version.h>
89 #if LINUX_VERSION_CODE > KERNEL_VERSION(2,5,70)
90 # define __nfsd_dev_t __kernel_old_dev_t
92 # define __nfsd_dev_t __kernel_dev_t
96 struct nfsctl_export {
97 char ex_client[NFSCLNT_IDMAX+1];
98 char ex_path[NFS_MAXPATHLEN+1];
100 __kernel_ino_t ex_ino;
102 __kernel_uid_t ex_anon_uid;
103 __kernel_gid_t ex_anon_gid;
107 struct nfsctl_uidmap {
109 __kernel_uid_t ug_uidbase;
111 __kernel_uid_t * ug_udimap;
112 __kernel_gid_t ug_gidbase;
114 __kernel_gid_t * ug_gdimap;
118 struct nfsctl_fhparm {
119 struct sockaddr gf_addr;
121 __kernel_ino_t gf_ino;
126 struct nfsctl_fdparm {
127 struct sockaddr gd_addr;
128 char gd_path[NFS_MAXPATHLEN+1];
132 /* GETFS - GET Filehandle with Size */
133 struct nfsctl_fsparm {
134 struct sockaddr gd_addr;
135 char gd_path[NFS_MAXPATHLEN+1];
140 * This is the argument union.
143 int ca_version; /* safeguard */
145 struct nfsctl_svc u_svc;
146 struct nfsctl_client u_client;
147 struct nfsctl_export u_export;
148 struct nfsctl_uidmap u_umap;
149 struct nfsctl_fhparm u_getfh;
150 struct nfsctl_fdparm u_getfd;
151 struct nfsctl_fsparm u_getfs;
153 #define ca_svc u.u_svc
154 #define ca_client u.u_client
155 #define ca_export u.u_export
156 #define ca_umap u.u_umap
157 #define ca_getfh u.u_getfh
158 #define ca_getfd u.u_getfd
159 #define ca_getfs u.u_getfs
160 #define ca_authd u.u_authd
164 struct nfs_fh_old cr_getfh;
165 struct nfs_fh_len cr_getfs;
168 #endif /* _NFS_NFS_H */