syscall.h 3.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142
  1. /*
  2. * include/linux/nfsd/syscall.h
  3. *
  4. * This file holds all declarations for the knfsd syscall interface.
  5. *
  6. * Copyright (C) 1995-1997 Olaf Kirch <okir@monad.swb.de>
  7. */
  8. #ifndef NFSD_SYSCALL_H
  9. #define NFSD_SYSCALL_H
  10. #include <asm/types.h>
  11. #ifdef __KERNEL__
  12. # include <linux/config.h>
  13. # include <linux/types.h>
  14. # include <linux/in.h>
  15. #endif
  16. #include <linux/posix_types.h>
  17. #include <linux/nfsd/const.h>
  18. #include <linux/nfsd/export.h>
  19. #include <linux/nfsd/nfsfh.h>
  20. #include <linux/nfsd/auth.h>
  21. /*
  22. * Version of the syscall interface
  23. */
  24. #define NFSCTL_VERSION 0x0201
  25. /*
  26. * These are the commands understood by nfsctl().
  27. */
  28. #define NFSCTL_SVC 0 /* This is a server process. */
  29. #define NFSCTL_ADDCLIENT 1 /* Add an NFS client. */
  30. #define NFSCTL_DELCLIENT 2 /* Remove an NFS client. */
  31. #define NFSCTL_EXPORT 3 /* export a file system. */
  32. #define NFSCTL_UNEXPORT 4 /* unexport a file system. */
  33. /*#define NFSCTL_UGIDUPDATE 5 / * update a client's uid/gid map. DISCARDED */
  34. /*#define NFSCTL_GETFH 6 / * get an fh by ino DISCARDED */
  35. #define NFSCTL_GETFD 7 /* get an fh by path (used by mountd) */
  36. #define NFSCTL_GETFS 8 /* get an fh by path with max FH len */
  37. /*
  38. * Macros used to set version
  39. */
  40. #define NFSCTL_VERSET(_cltbits, _v) ((_cltbits) |= (1 << (_v)))
  41. #define NFSCTL_VERUNSET(_cltbits, _v) ((_cltbits) &= ~(1 << (_v)))
  42. #define NFSCTL_VERISSET(_cltbits, _v) ((_cltbits) & (1 << (_v)))
  43. #if defined(CONFIG_NFSD_V4)
  44. #define NFSCTL_VERALL (0x1c /* 0b011100 */)
  45. #elif defined(CONFIG_NFSD_V3)
  46. #define NFSCTL_VERALL (0x0c /* 0b001100 */)
  47. #else
  48. #define NFSCTL_VERALL (0x04 /* 0b000100 */)
  49. #endif
  50. /* SVC */
  51. struct nfsctl_svc {
  52. unsigned short svc_port;
  53. int svc_nthreads;
  54. };
  55. /* ADDCLIENT/DELCLIENT */
  56. struct nfsctl_client {
  57. char cl_ident[NFSCLNT_IDMAX+1];
  58. int cl_naddr;
  59. struct in_addr cl_addrlist[NFSCLNT_ADDRMAX];
  60. int cl_fhkeytype;
  61. int cl_fhkeylen;
  62. unsigned char cl_fhkey[NFSCLNT_KEYMAX];
  63. };
  64. /* EXPORT/UNEXPORT */
  65. struct nfsctl_export {
  66. char ex_client[NFSCLNT_IDMAX+1];
  67. char ex_path[NFS_MAXPATHLEN+1];
  68. __kernel_old_dev_t ex_dev;
  69. __kernel_ino_t ex_ino;
  70. int ex_flags;
  71. __kernel_uid_t ex_anon_uid;
  72. __kernel_gid_t ex_anon_gid;
  73. };
  74. /* GETFD */
  75. struct nfsctl_fdparm {
  76. struct sockaddr gd_addr;
  77. char gd_path[NFS_MAXPATHLEN+1];
  78. int gd_version;
  79. };
  80. /* GETFS - GET Filehandle with Size */
  81. struct nfsctl_fsparm {
  82. struct sockaddr gd_addr;
  83. char gd_path[NFS_MAXPATHLEN+1];
  84. int gd_maxlen;
  85. };
  86. /*
  87. * This is the argument union.
  88. */
  89. struct nfsctl_arg {
  90. int ca_version; /* safeguard */
  91. union {
  92. struct nfsctl_svc u_svc;
  93. struct nfsctl_client u_client;
  94. struct nfsctl_export u_export;
  95. struct nfsctl_fdparm u_getfd;
  96. struct nfsctl_fsparm u_getfs;
  97. /*
  98. * The following dummy member is needed to preserve binary compatibility
  99. * on platforms where alignof(void*)>alignof(int). It's needed because
  100. * this union used to contain a member (u_umap) which contained a
  101. * pointer.
  102. */
  103. void *u_ptr;
  104. } u;
  105. #define ca_svc u.u_svc
  106. #define ca_client u.u_client
  107. #define ca_export u.u_export
  108. #define ca_getfd u.u_getfd
  109. #define ca_getfs u.u_getfs
  110. };
  111. union nfsctl_res {
  112. __u8 cr_getfh[NFS_FHSIZE];
  113. struct knfsd_fh cr_getfs;
  114. };
  115. #ifdef __KERNEL__
  116. /*
  117. * Kernel syscall implementation.
  118. */
  119. extern int exp_addclient(struct nfsctl_client *ncp);
  120. extern int exp_delclient(struct nfsctl_client *ncp);
  121. extern int exp_export(struct nfsctl_export *nxp);
  122. extern int exp_unexport(struct nfsctl_export *nxp);
  123. extern unsigned int nfsd_versbits;
  124. #endif /* __KERNEL__ */
  125. #endif /* NFSD_SYSCALL_H */