4 #include <linux/posix_types.h>
6 #include <netinet/in.h>
7 #include <rpcsvc/nfs_prot.h>
8 #include <nfs/export.h>
10 #define NFS3_FHSIZE 64
13 #define NFSD_MINVERS 2
14 #define NFSD_MAXVERS 4
16 #define NFSD_MINMINORVERS4 1
17 #define NFSD_MAXMINORVERS4 1
21 u_int8_t fh_handle[NFS3_FHSIZE];
24 u_int8_t fh_handle[NFS_FHSIZE];
28 * Version of the syscall interface
30 #define NFSCTL_VERSION 0x0201
33 * These are the commands understood by nfsctl().
35 #define NFSCTL_SVC 0 /* This is a server process. */
36 #define NFSCTL_ADDCLIENT 1 /* Add an NFS client. */
37 #define NFSCTL_DELCLIENT 2 /* Remove an NFS client. */
38 #define NFSCTL_EXPORT 3 /* export a file system. */
39 #define NFSCTL_UNEXPORT 4 /* unexport a file system. */
40 #define NFSCTL_UGIDUPDATE 5 /* update a client's uid/gid map. */
41 #define NFSCTL_GETFH 6 /* get an fh (used by mountd) */
42 #define NFSCTL_GETFD 7 /* get an fh by path (used by mountd) */
43 #define NFSCTL_GETFS 8 /* get an fh by path with max size (used by mountd) */
45 #define NFSCTL_UDPBIT (1 << (17 - 1))
46 #define NFSCTL_TCPBIT (1 << (18 - 1))
48 #define NFSCTL_VERUNSET(_cltbits, _v) ((_cltbits) &= ~(1 << ((_v) - 1)))
49 #define NFSCTL_UDPUNSET(_cltbits) ((_cltbits) &= ~NFSCTL_UDPBIT)
50 #define NFSCTL_TCPUNSET(_cltbits) ((_cltbits) &= ~NFSCTL_TCPBIT)
52 #define NFSCTL_VERISSET(_cltbits, _v) ((_cltbits) & (1 << ((_v) - 1)))
53 #define NFSCTL_UDPISSET(_cltbits) ((_cltbits) & NFSCTL_UDPBIT)
54 #define NFSCTL_TCPISSET(_cltbits) ((_cltbits) & NFSCTL_TCPBIT)
56 #define NFSCTL_UDPSET(_cltbits) ((_cltbits) |= NFSCTL_UDPBIT)
57 #define NFSCTL_TCPSET(_cltbits) ((_cltbits) |= NFSCTL_TCPBIT)
59 #define NFSCTL_ANYPROTO(_cltbits) ((_cltbits) & (NFSCTL_UDPBIT | NFSCTL_TCPBIT))
60 #define NFSCTL_ALLBITS (~0)
64 unsigned short svc_port;
68 /* ADDCLIENT/DELCLIENT */
69 struct nfsctl_client {
70 char cl_ident[NFSCLNT_IDMAX+1];
72 struct in_addr cl_addrlist[NFSCLNT_ADDRMAX];
75 unsigned char cl_fhkey[NFSCLNT_KEYMAX];
78 /* IN 2.5.6? __kernel_dev_t changed size, and __kernel_old_dev_t was left
79 * with the old value. We need to make sure we use the right one.
82 #include <linux/version.h>
83 #if LINUX_VERSION_CODE > KERNEL_VERSION(2,5,70)
84 # define __nfsd_dev_t __kernel_old_dev_t
86 # define __nfsd_dev_t __kernel_dev_t
90 struct nfsctl_export {
91 char ex_client[NFSCLNT_IDMAX+1];
92 char ex_path[NFS_MAXPATHLEN+1];
94 __kernel_ino_t ex_ino;
96 __kernel_uid_t ex_anon_uid;
97 __kernel_gid_t ex_anon_gid;
101 struct nfsctl_uidmap {
103 __kernel_uid_t ug_uidbase;
105 __kernel_uid_t * ug_udimap;
106 __kernel_gid_t ug_gidbase;
108 __kernel_gid_t * ug_gdimap;
112 struct nfsctl_fhparm {
113 struct sockaddr gf_addr;
115 __kernel_ino_t gf_ino;
120 struct nfsctl_fdparm {
121 struct sockaddr gd_addr;
122 char gd_path[NFS_MAXPATHLEN+1];
126 /* GETFS - GET Filehandle with Size */
127 struct nfsctl_fsparm {
128 struct sockaddr gd_addr;
129 char gd_path[NFS_MAXPATHLEN+1];
134 * This is the argument union.
137 int ca_version; /* safeguard */
139 struct nfsctl_svc u_svc;
140 struct nfsctl_client u_client;
141 struct nfsctl_export u_export;
142 struct nfsctl_uidmap u_umap;
143 struct nfsctl_fhparm u_getfh;
144 struct nfsctl_fdparm u_getfd;
145 struct nfsctl_fsparm u_getfs;
147 #define ca_svc u.u_svc
148 #define ca_client u.u_client
149 #define ca_export u.u_export
150 #define ca_umap u.u_umap
151 #define ca_getfh u.u_getfh
152 #define ca_getfd u.u_getfd
153 #define ca_getfs u.u_getfs
154 #define ca_authd u.u_authd
158 struct nfs_fh_old cr_getfh;
159 struct nfs_fh_len cr_getfs;
162 #endif /* _NFS_NFS_H */