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
18 u_int8_t fh_handle[NFS3_FHSIZE];
21 u_int8_t fh_handle[NFS_FHSIZE];
25 * Version of the syscall interface
27 #define NFSCTL_VERSION 0x0201
30 * These are the commands understood by nfsctl().
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. */
38 #define NFSCTL_GETFH 6 /* get an fh (used by mountd) */
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 size (used by mountd) */
42 /* Above this is for lockd. */
43 #define NFSCTL_LOCKD 0x10000
44 #define LOCKDCTL_SVC NFSCTL_LOCKD
46 #define NFSCTL_VERUNSET(_cltbits, _v) ((_cltbits) &= ~(1 << ((_v) - 1)))
47 #define NFSCTL_UDPUNSET(_cltbits) ((_cltbits) &= ~(1 << (17 - 1)))
48 #define NFSCTL_TCPUNSET(_cltbits) ((_cltbits) &= ~(1 << (18 - 1)))
50 #define NFSCTL_VERISSET(_cltbits, _v) ((_cltbits) & (1 << ((_v) - 1)))
51 #define NFSCTL_UDPISSET(_cltbits) ((_cltbits) & (1 << (17 - 1)))
52 #define NFSCTL_TCPISSET(_cltbits) ((_cltbits) & (1 << (18 - 1)))
54 #define NFSCTL_ALLBITS (~0)
58 unsigned short svc_port;
62 /* ADDCLIENT/DELCLIENT */
63 struct nfsctl_client {
64 char cl_ident[NFSCLNT_IDMAX+1];
66 struct in_addr cl_addrlist[NFSCLNT_ADDRMAX];
69 unsigned char cl_fhkey[NFSCLNT_KEYMAX];
72 /* IN 2.5.6? __kernel_dev_t changed size, and __kernel_old_dev_t was left
73 * with the old value. We need to make sure we use the right one.
76 #include <linux/version.h>
77 #if LINUX_VERSION_CODE > KERNEL_VERSION(2,5,70)
78 # define __nfsd_dev_t __kernel_old_dev_t
80 # define __nfsd_dev_t __kernel_dev_t
84 struct nfsctl_export {
85 char ex_client[NFSCLNT_IDMAX+1];
86 char ex_path[NFS_MAXPATHLEN+1];
88 __kernel_ino_t ex_ino;
90 __kernel_uid_t ex_anon_uid;
91 __kernel_gid_t ex_anon_gid;
95 struct nfsctl_uidmap {
97 __kernel_uid_t ug_uidbase;
99 __kernel_uid_t * ug_udimap;
100 __kernel_gid_t ug_gidbase;
102 __kernel_gid_t * ug_gdimap;
106 struct nfsctl_fhparm {
107 struct sockaddr gf_addr;
109 __kernel_ino_t gf_ino;
114 struct nfsctl_fdparm {
115 struct sockaddr gd_addr;
116 char gd_path[NFS_MAXPATHLEN+1];
120 /* GETFS - GET Filehandle with Size */
121 struct nfsctl_fsparm {
122 struct sockaddr gd_addr;
123 char gd_path[NFS_MAXPATHLEN+1];
128 * This is the argument union.
131 int ca_version; /* safeguard */
133 struct nfsctl_svc u_svc;
134 struct nfsctl_client u_client;
135 struct nfsctl_export u_export;
136 struct nfsctl_uidmap u_umap;
137 struct nfsctl_fhparm u_getfh;
138 struct nfsctl_fdparm u_getfd;
139 struct nfsctl_fsparm u_getfs;
141 #define ca_svc u.u_svc
142 #define ca_client u.u_client
143 #define ca_export u.u_export
144 #define ca_umap u.u_umap
145 #define ca_getfh u.u_getfh
146 #define ca_getfd u.u_getfd
147 #define ca_getfs u.u_getfs
148 #define ca_authd u.u_authd
152 struct nfs_fh_old cr_getfh;
153 struct nfs_fh_len cr_getfs;
156 #endif /* _NFS_NFS_H */