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 6 * 7 * Copyright (C) 1995-1997 Olaf Kirch <okir@monad.swb.de> 8 */ 9 10#ifndef NFSD_EXPORT_H 11#define NFSD_EXPORT_H 12 13#include <asm/types.h> 14#ifdef __KERNEL__ 15# include <linux/types.h> 16# include <linux/in.h> 17#endif 18 19/* 20 * Important limits for the exports stuff. 21 */ 22#define NFSCLNT_IDMAX 1024 23#define NFSCLNT_ADDRMAX 16 24#define NFSCLNT_KEYMAX 32 25 26/* 27 * Export flags. 28 */ 29#define NFSEXP_READONLY 0x0001 30#define NFSEXP_INSECURE_PORT 0x0002 31#define NFSEXP_ROOTSQUASH 0x0004 32#define NFSEXP_ALLSQUASH 0x0008 33#define NFSEXP_ASYNC 0x0010 34#define NFSEXP_GATHERED_WRITES 0x0020 35#define NFSEXP_UIDMAP 0x0040 36#define NFSEXP_KERBEROS 0x0080 /* not available */ 37#define NFSEXP_SUNSECURE 0x0100 38#define NFSEXP_CROSSMNT 0x0200 39#define NFSEXP_NOSUBTREECHECK 0x0400 40#define NFSEXP_NOAUTHNLM 0x0800 /* Don't authenticate NLM requests - just trust */ 41#define NFSEXP_MSNFS 0x1000 /* do silly things that MS clients expect */ 42#define NFSEXP_FSID 0x2000 43#define NFSEXP_ALLFLAGS 0x3FFF 44 45 46#ifdef __KERNEL__ 47 48/* The following are hashtable sizes and must be powers of 2 */ 49#define NFSCLNT_EXPMAX 16 50 51struct svc_client { 52 struct svc_client * cl_next; 53 char cl_ident[NFSCLNT_IDMAX]; 54 int cl_idlen; 55 int cl_naddr; 56 struct in_addr cl_addr[NFSCLNT_ADDRMAX]; 57 struct svc_uidmap * cl_umap; 58 struct list_head cl_export[NFSCLNT_EXPMAX]; 59 struct list_head cl_expfsid[NFSCLNT_EXPMAX]; 60 struct list_head cl_list; 61}; 62 63struct svc_export { 64 struct list_head ex_hash; 65 struct list_head ex_fsid_hash; 66 struct list_head ex_list; 67 char ex_path[NFS_MAXPATHLEN+1]; 68 struct svc_export * ex_parent; 69 struct svc_client * ex_client; 70 int ex_flags; 71 struct vfsmount * ex_mnt; 72 struct dentry * ex_dentry; 73 kdev_t ex_dev; 74 ino_t ex_ino; 75 uid_t ex_anon_uid; 76 gid_t ex_anon_gid; 77 int ex_fsid; 78}; 79 80#define EX_SECURE(exp) (!((exp)->ex_flags & NFSEXP_INSECURE_PORT)) 81#define EX_ISSYNC(exp) (!((exp)->ex_flags & NFSEXP_ASYNC)) 82#define EX_RDONLY(exp) ((exp)->ex_flags & NFSEXP_READONLY) 83#define EX_CROSSMNT(exp) ((exp)->ex_flags & NFSEXP_CROSSMNT) 84#define EX_SUNSECURE(exp) ((exp)->ex_flags & NFSEXP_SUNSECURE) 85#define EX_WGATHER(exp) ((exp)->ex_flags & NFSEXP_GATHERED_WRITES) 86 87 88/* 89 * Function declarations 90 */ 91void nfsd_export_init(void); 92void nfsd_export_shutdown(void); 93void exp_readlock(void); 94int exp_writelock(void); 95void exp_unlock(void); 96struct svc_client * exp_getclient(struct sockaddr_in *sin); 97void exp_putclient(struct svc_client *clp); 98struct svc_export * exp_get(struct svc_client *clp, kdev_t dev, ino_t ino); 99struct svc_export * exp_get_fsid(struct svc_client *clp, int fsid); 100int exp_rootfh(struct svc_client *, kdev_t, ino_t, 101 char *path, struct knfsd_fh *, int maxsize); 102int nfserrno(int errno); 103void exp_nlmdetach(void); 104 105 106#endif /* __KERNEL__ */ 107 108#endif /* NFSD_EXPORT_H */ 109 110