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