export.h
上传用户:jlfgdled
上传日期:2013-04-10
资源大小:33168k
文件大小:3k
源码类别:

Linux/Unix编程

开发平台:

Unix_Linux

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