* better
[mascara-docs.git] / i386 / linux-2.3.21 / include / linux / nfsd / export.h
blob3370208ae4590e2d0deaf19aded2a050c6187fe6
1 /*
2 * include/linux/nfsd/export.h
3 *
4 * Public declarations for NFS exports. The definitions for the
5 * syscall interface are in nfsctl.h
7 * Copyright (C) 1995, 1996 Olaf Kirch <okir@monad.swb.de>
8 */
10 #ifndef NFSD_EXPORT_H
11 #define NFSD_EXPORT_H
13 #include <linux/types.h>
14 #include <linux/socket.h>
15 #include <linux/in.h>
16 #include <linux/fs.h>
19 * Important limits for the exports stuff.
21 #define NFSCLNT_IDMAX 1024
22 #define NFSCLNT_ADDRMAX 16
23 #define NFSCLNT_KEYMAX 32
26 * Export flags.
28 #define NFSEXP_READONLY 0x0001
29 #define NFSEXP_INSECURE_PORT 0x0002
30 #define NFSEXP_ROOTSQUASH 0x0004
31 #define NFSEXP_ALLSQUASH 0x0008
32 #define NFSEXP_ASYNC 0x0010
33 #define NFSEXP_GATHERED_WRITES 0x0020
34 #define NFSEXP_UIDMAP 0x0040
35 #define NFSEXP_KERBEROS 0x0080 /* not available */
36 #define NFSEXP_SUNSECURE 0x0100
37 #define NFSEXP_CROSSMNT 0x0200 /* not available */
38 #define NFSEXP_ALLFLAGS 0x03FF
41 #ifdef __KERNEL__
43 /* The following are hashtable sizes and must be powers of 2 */
44 #define NFSCLNT_EXPMAX 16
46 struct svc_client {
47 struct svc_client * cl_next;
48 char cl_ident[NFSCLNT_IDMAX];
49 int cl_idlen;
50 int cl_naddr;
51 struct in_addr cl_addr[NFSCLNT_ADDRMAX];
52 struct svc_uidmap * cl_umap;
53 struct svc_export * cl_export[NFSCLNT_EXPMAX];
56 struct svc_export {
57 struct svc_export * ex_next;
58 char ex_path[NFS_MAXPATHLEN+1];
59 struct svc_export * ex_parent;
60 struct svc_client * ex_client;
61 int ex_flags;
62 struct dentry * ex_dentry;
63 kdev_t ex_dev;
64 ino_t ex_ino;
65 uid_t ex_anon_uid;
66 gid_t ex_anon_gid;
69 #define EX_SECURE(exp) (!((exp)->ex_flags & NFSEXP_INSECURE_PORT))
70 #define EX_ISSYNC(exp) (!((exp)->ex_flags & NFSEXP_ASYNC))
71 #define EX_RDONLY(exp) ((exp)->ex_flags & NFSEXP_READONLY)
72 #define EX_CROSSMNT(exp) ((exp)->ex_flags & NFSEXP_CROSSMNT)
73 #define EX_SUNSECURE(exp) ((exp)->ex_flags & NFSEXP_SUNSECURE)
74 #define EX_WGATHER(exp) ((exp)->ex_flags & NFSEXP_GATHERED_WRITES)
78 * Function declarations
80 void nfsd_export_init(void);
81 void nfsd_export_shutdown(void);
82 void exp_readlock(void);
83 int exp_writelock(void);
84 void exp_unlock(void);
85 struct svc_client * exp_getclient(struct sockaddr_in *sin);
86 void exp_putclient(struct svc_client *clp);
87 struct svc_export * exp_get(struct svc_client *clp, kdev_t dev, ino_t ino);
88 int exp_rootfh(struct svc_client *, kdev_t, ino_t,
89 char *path, struct knfs_fh *);
90 int nfserrno(int errno);
91 void exp_nlmdetach(void);
94 extern __inline__ int
95 exp_checkaddr(struct svc_client *clp, struct in_addr addr)
97 struct in_addr *ap = clp->cl_addr;
98 int i;
100 for (i = clp->cl_naddr; i--; ap++)
101 if (ap->s_addr == addr.s_addr)
102 return 1;
103 return 0;
106 #endif /* __KERNEL__ */
108 #endif /* NFSD_EXPORT_H */