nfs_var.h 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272
  1. /* $OpenBSD: nfs_var.h,v 1.60 2013/06/11 16:42:17 deraadt Exp $ */
  2. /* $NetBSD: nfs_var.h,v 1.3 1996/02/18 11:53:54 fvdl Exp $ */
  3. /*
  4. * Copyright (c) 1996 Christos Zoulas. All rights reserved.
  5. *
  6. * Redistribution and use in source and binary forms, with or without
  7. * modification, are permitted provided that the following conditions
  8. * are met:
  9. * 1. Redistributions of source code must retain the above copyright
  10. * notice, this list of conditions and the following disclaimer.
  11. * 2. Redistributions in binary form must reproduce the above copyright
  12. * notice, this list of conditions and the following disclaimer in the
  13. * documentation and/or other materials provided with the distribution.
  14. * 3. All advertising materials mentioning features or use of this software
  15. * must display the following acknowledgement:
  16. * This product includes software developed by Christos Zoulas.
  17. * 4. The name of the author may not be used to endorse or promote products
  18. * derived from this software without specific prior written permission.
  19. *
  20. * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
  21. * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
  22. * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
  23. * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
  24. * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
  25. * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
  26. * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
  27. * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
  28. * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
  29. * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  30. */
  31. /*
  32. * XXX needs <nfs/rpcv2.h> and <nfs/nfs.h> because of typedefs.
  33. */
  34. #ifndef _NFS_NFS_VAR_H_
  35. #define _NFS_NFS_VAR_H_
  36. #ifdef _KERNEL
  37. struct nfsnode;
  38. struct sillyrename;
  39. struct componentname;
  40. struct nfs_diskless;
  41. struct nfsm_info;
  42. /* nfs_bio.c */
  43. int nfs_bioread(struct vnode *, struct uio *, int, struct ucred *);
  44. int nfs_write(void *);
  45. struct buf *nfs_getcacheblk(struct vnode *, daddr_t, int, struct proc *);
  46. int nfs_vinvalbuf(struct vnode *, int, struct ucred *, struct proc *);
  47. int nfs_asyncio(struct buf *, int readahead);
  48. int nfs_doio(struct buf *, struct proc *);
  49. /* nfs_boot.c */
  50. int nfs_boot_init(struct nfs_diskless *, struct proc *);
  51. /* nfs_node.c */
  52. int nfs_nget(struct mount *, nfsfh_t *, int, struct nfsnode **);
  53. int nfs_inactive(void *);
  54. int nfs_reclaim(void *);
  55. /* nfs_vnops.c */
  56. int nfs_poll(void *);
  57. int nfs_null(struct vnode *, struct ucred *, struct proc *);
  58. int nfs_access(void *);
  59. int nfs_open(void *);
  60. int nfs_close(void *);
  61. int nfs_getattr(void *);
  62. int nfs_setattr(void *);
  63. int nfs_setattrrpc(struct vnode *, struct vattr *, struct ucred *,
  64. struct proc *);
  65. int nfs_lookup(void *);
  66. int nfs_read(void *);
  67. int nfs_readlink(void *);
  68. int nfs_readlinkrpc(struct vnode *, struct uio *, struct ucred *);
  69. int nfs_readrpc(struct vnode *, struct uio *);
  70. int nfs_writerpc(struct vnode *, struct uio *, int *, int *);
  71. int nfs_mknodrpc(struct vnode *, struct vnode **, struct componentname *,
  72. struct vattr *);
  73. int nfs_mknod(void *);
  74. int nfs_create(void *);
  75. int nfs_remove(void *);
  76. int nfs_removeit(struct sillyrename *);
  77. int nfs_removerpc(struct vnode *, char *, int, struct ucred *,
  78. struct proc *);
  79. int nfs_rename(void *);
  80. int nfs_renameit(struct vnode *, struct componentname *,
  81. struct sillyrename *);
  82. int nfs_renamerpc(struct vnode *, char *, int, struct vnode *, char *, int,
  83. struct ucred *, struct proc *);
  84. int nfs_link(void *);
  85. int nfs_symlink(void *);
  86. int nfs_mkdir(void *);
  87. int nfs_rmdir(void *);
  88. int nfs_readdir(void *);
  89. int nfs_readdirrpc(struct vnode *, struct uio *, struct ucred *, int *);
  90. int nfs_readdirplusrpc(struct vnode *, struct uio *, struct ucred *, int *);
  91. int nfs_sillyrename(struct vnode *, struct vnode *,
  92. struct componentname *);
  93. int nfs_lookitup(struct vnode *, char *, int, struct ucred *,
  94. struct proc *, struct nfsnode **);
  95. int nfs_commit(struct vnode *, u_quad_t, int, struct proc *);
  96. int nfs_bmap(void *);
  97. int nfs_strategy(void *);
  98. int nfs_mmap(void *);
  99. int nfs_fsync(void *);
  100. int nfs_flush(struct vnode *, struct ucred *, int, struct proc *, int);
  101. int nfs_pathconf(void *);
  102. int nfs_advlock(void *);
  103. int nfs_print(void *);
  104. int nfs_blkatoff(void *);
  105. int nfs_bwrite(void *);
  106. int nfs_writebp(struct buf *, int);
  107. int nfsspec_access(void *);
  108. int nfsspec_read(void *);
  109. int nfsspec_write(void *);
  110. int nfsspec_close(void *);
  111. int nfsfifo_read(void *);
  112. int nfsfifo_write(void *);
  113. int nfsfifo_close(void *);
  114. int nfsfifo_reclaim(void *);
  115. #define nfs_ioctl ((int (*)(void *))enoioctl)
  116. /* nfs_serv.c */
  117. int nfsrv3_access(struct nfsrv_descript *, struct nfssvc_sock *,
  118. struct proc *, struct mbuf **);
  119. int nfsrv_getattr(struct nfsrv_descript *, struct nfssvc_sock *,
  120. struct proc *, struct mbuf **);
  121. int nfsrv_setattr(struct nfsrv_descript *, struct nfssvc_sock *,
  122. struct proc *, struct mbuf **);
  123. int nfsrv_lookup(struct nfsrv_descript *, struct nfssvc_sock *,
  124. struct proc *, struct mbuf **);
  125. int nfsrv_readlink(struct nfsrv_descript *, struct nfssvc_sock *,
  126. struct proc *, struct mbuf **);
  127. int nfsrv_read(struct nfsrv_descript *, struct nfssvc_sock *,
  128. struct proc *, struct mbuf **);
  129. int nfsrv_write(struct nfsrv_descript *, struct nfssvc_sock *,
  130. struct proc *, struct mbuf **);
  131. int nfsrv_create(struct nfsrv_descript *, struct nfssvc_sock *,
  132. struct proc *, struct mbuf **);
  133. int nfsrv_mknod(struct nfsrv_descript *, struct nfssvc_sock *,
  134. struct proc *, struct mbuf **);
  135. int nfsrv_remove(struct nfsrv_descript *, struct nfssvc_sock *,
  136. struct proc *, struct mbuf **);
  137. int nfsrv_rename(struct nfsrv_descript *, struct nfssvc_sock *,
  138. struct proc *, struct mbuf **);
  139. int nfsrv_link(struct nfsrv_descript *, struct nfssvc_sock *,
  140. struct proc *, struct mbuf **);
  141. int nfsrv_symlink(struct nfsrv_descript *, struct nfssvc_sock *,
  142. struct proc *, struct mbuf **);
  143. int nfsrv_mkdir(struct nfsrv_descript *, struct nfssvc_sock *,
  144. struct proc *, struct mbuf **);
  145. int nfsrv_rmdir(struct nfsrv_descript *, struct nfssvc_sock *,
  146. struct proc *, struct mbuf **);
  147. int nfsrv_readdir(struct nfsrv_descript *, struct nfssvc_sock *,
  148. struct proc *, struct mbuf **);
  149. int nfsrv_readdirplus(struct nfsrv_descript *, struct nfssvc_sock *,
  150. struct proc *, struct mbuf **);
  151. int nfsrv_commit(struct nfsrv_descript *, struct nfssvc_sock *,
  152. struct proc *, struct mbuf **);
  153. int nfsrv_statfs(struct nfsrv_descript *, struct nfssvc_sock *,
  154. struct proc *, struct mbuf **);
  155. int nfsrv_fsinfo(struct nfsrv_descript *, struct nfssvc_sock *,
  156. struct proc *, struct mbuf **);
  157. int nfsrv_pathconf(struct nfsrv_descript *, struct nfssvc_sock *,
  158. struct proc *, struct mbuf **);
  159. int nfsrv_null(struct nfsrv_descript *, struct nfssvc_sock *,
  160. struct proc *, struct mbuf **);
  161. int nfsrv_noop(struct nfsrv_descript *, struct nfssvc_sock *,
  162. struct proc *, struct mbuf **);
  163. int nfsrv_access(struct vnode *, int, struct ucred *, int, struct proc *,
  164. int);
  165. /* nfs_socket.c */
  166. int nfs_connect(struct nfsmount *, struct nfsreq *);
  167. int nfs_reconnect(struct nfsreq *);
  168. void nfs_disconnect(struct nfsmount *);
  169. int nfs_send(struct socket *, struct mbuf *, struct mbuf *,
  170. struct nfsreq *);
  171. int nfs_receive(struct nfsreq *, struct mbuf **, struct mbuf **);
  172. int nfs_reply(struct nfsreq *);
  173. int nfs_request(struct vnode *, int, struct nfsm_info *);
  174. int nfs_rephead(int, struct nfsrv_descript *, struct nfssvc_sock *, int,
  175. struct mbuf **, struct mbuf **);
  176. void nfs_timer(void *);
  177. int nfs_sigintr(struct nfsmount *, struct nfsreq *, struct proc *);
  178. int nfs_sndlock(int *, struct nfsreq *);
  179. void nfs_sndunlock(int *);
  180. int nfs_rcvlock(struct nfsreq *);
  181. void nfs_rcvunlock(int *);
  182. int nfs_getreq(struct nfsrv_descript *, struct nfsd *, int);
  183. void nfs_msg(struct nfsreq *, char *);
  184. void nfsrv_rcv(struct socket *, caddr_t, int);
  185. int nfsrv_getstream(struct nfssvc_sock *, int);
  186. int nfsrv_dorec(struct nfssvc_sock *, struct nfsd *,
  187. struct nfsrv_descript **);
  188. void nfsrv_wakenfsd(struct nfssvc_sock *);
  189. /* nfs_srvcache.c */
  190. void nfsrv_initcache(void );
  191. int nfsrv_getcache(struct nfsrv_descript *, struct nfssvc_sock *,
  192. struct mbuf **);
  193. void nfsrv_updatecache(struct nfsrv_descript *, int, struct mbuf *);
  194. void nfsrv_cleancache(void);
  195. /* nfs_subs.c */
  196. struct mbuf *nfsm_reqhead(int);
  197. u_int32_t nfs_get_xid(void);
  198. void nfsm_rpchead(struct nfsreq *, struct ucred *, int);
  199. void *nfsm_build(struct mbuf **, u_int);
  200. int nfsm_mbuftouio(struct mbuf **, struct uio *, int, caddr_t *);
  201. void nfsm_uiotombuf(struct mbuf **, struct uio *, size_t);
  202. void nfsm_strtombuf(struct mbuf **, void *, size_t);
  203. void nfsm_buftombuf(struct mbuf **, void *, size_t);
  204. int nfsm_disct(struct mbuf **, caddr_t *, int, int, caddr_t *);
  205. int nfs_adv(struct mbuf **, caddr_t *, int, int);
  206. int nfsm_strtmbuf(struct mbuf **, char **, char *, long);
  207. int nfs_vfs_init(struct vfsconf *);
  208. int nfs_attrtimeo(struct nfsnode *);
  209. int nfs_loadattrcache(struct vnode **, struct mbuf **, caddr_t *,
  210. struct vattr *);
  211. int nfs_getattrcache(struct vnode *, struct vattr *);
  212. int nfs_namei(struct nameidata *, fhandle_t *, int, struct nfssvc_sock *,
  213. struct mbuf *, struct mbuf **, caddr_t *, struct vnode **,
  214. struct proc *);
  215. void nfsm_v3attrbuild(struct mbuf **, struct vattr *, int);
  216. void nfsm_adj(struct mbuf *, int, int);
  217. void nfsm_srvwcc(struct nfsrv_descript *, int, struct vattr *, int,
  218. struct vattr *, struct nfsm_info *);
  219. void nfsm_srvpostop_attr(struct nfsrv_descript *, int, struct vattr *,
  220. struct nfsm_info *);
  221. void nfsm_srvfattr(struct nfsrv_descript *, struct vattr *,
  222. struct nfs_fattr *);
  223. int nfsrv_fhtovp(fhandle_t *, int, struct vnode **, struct ucred *,
  224. struct nfssvc_sock *, struct mbuf *, int *);
  225. int netaddr_match(int, union nethostaddr *, struct mbuf *);
  226. void nfs_clearcommit(struct mount *);
  227. int nfs_in_committed_range(struct vnode *, struct buf *);
  228. int nfs_in_tobecommitted_range(struct vnode *, struct buf *);
  229. void nfs_add_committed_range(struct vnode *, struct buf *);
  230. void nfs_del_committed_range(struct vnode *, struct buf *);
  231. void nfs_add_tobecommitted_range(struct vnode *, struct buf *);
  232. void nfs_del_tobecommitted_range(struct vnode *, struct buf *);
  233. void nfs_merge_commit_ranges(struct vnode *);
  234. int nfsrv_errmap(struct nfsrv_descript *, int);
  235. int nfsm_srvsattr(struct mbuf **, struct vattr *, struct mbuf *, caddr_t *);
  236. void nfsm_fhtom(struct nfsm_info *, struct vnode *, int);
  237. void nfsm_srvfhtom(struct mbuf **, fhandle_t *, int);
  238. /* nfs_syscalls.c */
  239. int sys_nfssvc(struct proc *, void *, register_t *);
  240. int nfssvc_addsock(struct file *, struct mbuf *);
  241. int nfssvc_nfsd(struct nfsd *);
  242. void nfsrv_zapsock(struct nfssvc_sock *);
  243. void nfsrv_slpderef(struct nfssvc_sock *);
  244. void nfsrv_init(int);
  245. void nfssvc_iod(void *);
  246. void start_nfsio(void *);
  247. void nfs_getset_niothreads(int);
  248. /* nfs_kq.c */
  249. int nfs_kqfilter(void *);
  250. /* Internal NFS utility macros */
  251. #define mb_offset(m) (mtod((m), caddr_t) + (m)->m_len)
  252. #define nfsm_padlen(s) (nfsm_rndup(s) - (s))
  253. #endif /* _KERNEL */
  254. #endif /* _NFS_NFS_VAR_H_ */