syscall.h 2.9 KB

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