Annotation of src/sys/nfs/nfs_var.h, Revision 1.74.2.1
1.74.2.1! mjf 1: /* $NetBSD: nfs_var.h,v 1.75 2007/12/04 17:42:32 yamt Exp $ */
1.1 christos 2:
1.15 christos 3: /*-
4: * Copyright (c) 1996 The NetBSD Foundation, Inc.
5: * All rights reserved.
6: *
7: * This code is derived from software contributed to The NetBSD Foundation
8: * by Christos Zoulas.
1.1 christos 9: *
10: * Redistribution and use in source and binary forms, with or without
11: * modification, are permitted provided that the following conditions
12: * are met:
13: * 1. Redistributions of source code must retain the above copyright
14: * notice, this list of conditions and the following disclaimer.
15: * 2. Redistributions in binary form must reproduce the above copyright
16: * notice, this list of conditions and the following disclaimer in the
17: * documentation and/or other materials provided with the distribution.
18: * 3. All advertising materials mentioning features or use of this software
19: * must display the following acknowledgement:
1.15 christos 20: * This product includes software developed by the NetBSD
21: * Foundation, Inc. and its contributors.
22: * 4. Neither the name of The NetBSD Foundation nor the names of its
23: * contributors may be used to endorse or promote products derived
24: * from this software without specific prior written permission.
1.1 christos 25: *
1.15 christos 26: * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
27: * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
28: * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
29: * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
30: * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
31: * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
32: * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
33: * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
34: * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
35: * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
36: * POSSIBILITY OF SUCH DAMAGE.
1.1 christos 37: */
38:
1.3 fvdl 39: /*
40: * XXX needs <nfs/rpcv2.h> and <nfs/nfs.h> because of typedefs
41: */
1.27 thorpej 42:
1.28 christos 43: #ifdef _KERNEL
1.27 thorpej 44: #include <sys/mallocvar.h>
1.37 yamt 45: #include <sys/pool.h>
1.27 thorpej 46:
47: MALLOC_DECLARE(M_NFSREQ);
48: MALLOC_DECLARE(M_NFSMNT);
49: MALLOC_DECLARE(M_NFSUID);
50: MALLOC_DECLARE(M_NFSD);
51: MALLOC_DECLARE(M_NFSDIROFF);
52: MALLOC_DECLARE(M_NFSBIGFH);
53: MALLOC_DECLARE(M_NQLEASE);
1.3 fvdl 54:
1.1 christos 55: struct vnode;
56: struct uio;
57: struct proc;
58: struct buf;
59: struct nfs_diskless;
60: struct sockaddr_in;
61: struct nfs_dlmount;
62: struct vnode;
63: struct nfsd;
64: struct mbuf;
65: struct file;
66: struct nfssvc_sock;
67: struct nfsmount;
68: struct socket;
69: struct nfsreq;
70: struct vattr;
71: struct nameidata;
72: struct nfsnode;
73: struct sillyrename;
74: struct componentname;
1.2 christos 75: struct nfsd_srvargs;
1.3 fvdl 76: struct nfsrv_descript;
77: struct nfs_fattr;
1.10 fvdl 78: struct nfsdircache;
1.13 mrg 79: union nethostaddr;
1.1 christos 80:
81: /* nfs_bio.c */
1.59 elad 82: int nfs_bioread(struct vnode *, struct uio *, int, kauth_cred_t, int);
1.57 yamt 83: struct buf *nfs_getcacheblk(struct vnode *, daddr_t, int, struct lwp *);
1.59 elad 84: int nfs_vinvalbuf(struct vnode *, int, kauth_cred_t, struct lwp *, int);
85: int nfs_flushstalebuf(struct vnode *, kauth_cred_t, struct lwp *, int);
1.47 yamt 86: #define NFS_FLUSHSTALEBUF_MYWRITE 1 /* assume writes are ours */
1.57 yamt 87: int nfs_asyncio(struct buf *);
88: int nfs_doio(struct buf *);
1.1 christos 89:
90: /* nfs_boot.c */
1.9 gwr 91: /* see nfsdiskless.h */
1.25 jdolecek 92:
93: /* nfs_kq.c */
1.57 yamt 94: void nfs_kqinit(void);
1.1 christos 95:
96: /* nfs_node.c */
1.57 yamt 97: void nfs_nhinit(void);
98: void nfs_nhreinit(void);
99: void nfs_nhdone(void);
100: int nfs_nget1(struct mount *, nfsfh_t *, int, struct nfsnode **, int);
1.43 yamt 101: #define nfs_nget(mp, fhp, fhsize, npp) \
102: nfs_nget1((mp), (fhp), (fhsize), (npp), 0)
1.1 christos 103:
104: /* nfs_vnops.c */
1.59 elad 105: int nfs_null(struct vnode *, kauth_cred_t, struct lwp *);
106: int nfs_setattrrpc(struct vnode *, struct vattr *, kauth_cred_t, struct lwp *);
107: int nfs_readlinkrpc(struct vnode *, struct uio *, kauth_cred_t);
1.57 yamt 108: int nfs_readrpc(struct vnode *, struct uio *);
1.65 thorpej 109: int nfs_writerpc(struct vnode *, struct uio *, int *, bool, bool *);
1.57 yamt 110: int nfs_mknodrpc(struct vnode *, struct vnode **, struct componentname *,
111: struct vattr *);
112: int nfs_removeit(struct sillyrename *);
1.59 elad 113: int nfs_removerpc(struct vnode *, const char *, int, kauth_cred_t,
1.57 yamt 114: struct lwp *);
115: int nfs_renameit(struct vnode *, struct componentname *, struct sillyrename *);
116: int nfs_renamerpc(struct vnode *, const char *, int, struct vnode *,
1.59 elad 117: const char *, int, kauth_cred_t, struct lwp *);
118: int nfs_readdirrpc(struct vnode *, struct uio *, kauth_cred_t);
119: int nfs_readdirplusrpc(struct vnode *, struct uio *, kauth_cred_t);
1.62 yamt 120: int nfs_sillyrename(struct vnode *, struct vnode *, struct componentname *,
1.65 thorpej 121: bool);
1.59 elad 122: int nfs_lookitup(struct vnode *, const char *, int, kauth_cred_t,
1.57 yamt 123: struct lwp *, struct nfsnode **);
124: int nfs_commit(struct vnode *, off_t, uint32_t, struct lwp *);
1.59 elad 125: int nfs_flush(struct vnode *, kauth_cred_t, int, struct lwp *, int);
1.1 christos 126:
127: /* nfs_serv.c */
1.57 yamt 128: int nfsrv3_access(struct nfsrv_descript *, struct nfssvc_sock *,
129: struct lwp *, struct mbuf **);
130: int nfsrv_getattr(struct nfsrv_descript *, struct nfssvc_sock *,
131: struct lwp *, struct mbuf **);
132: int nfsrv_setattr(struct nfsrv_descript *, struct nfssvc_sock *,
133: struct lwp *, struct mbuf **);
134: int nfsrv_lookup(struct nfsrv_descript *, struct nfssvc_sock *,
135: struct lwp *, struct mbuf **);
136: int nfsrv_readlink(struct nfsrv_descript *, struct nfssvc_sock *,
137: struct lwp *, struct mbuf **);
138: int nfsrv_read(struct nfsrv_descript *, struct nfssvc_sock *,
139: struct lwp *, struct mbuf **);
140: int nfsrv_write(struct nfsrv_descript *, struct nfssvc_sock *,
141: struct lwp *, struct mbuf **);
142: int nfsrv_writegather(struct nfsrv_descript **, struct nfssvc_sock *,
143: struct lwp *, struct mbuf **);
144: void nfsrvw_coalesce(struct nfsrv_descript *, struct nfsrv_descript *);
145: int nfsrv_create(struct nfsrv_descript *, struct nfssvc_sock *,
146: struct lwp *, struct mbuf **);
147: int nfsrv_mknod(struct nfsrv_descript *, struct nfssvc_sock *,
148: struct lwp *, struct mbuf **);
149: int nfsrv_remove(struct nfsrv_descript *, struct nfssvc_sock *,
150: struct lwp *, struct mbuf **);
151: int nfsrv_rename(struct nfsrv_descript *, struct nfssvc_sock *,
152: struct lwp *, struct mbuf **);
153: int nfsrv_link(struct nfsrv_descript *, struct nfssvc_sock *,
154: struct lwp *, struct mbuf **);
155: int nfsrv_symlink(struct nfsrv_descript *, struct nfssvc_sock *,
156: struct lwp *, struct mbuf **);
157: int nfsrv_mkdir(struct nfsrv_descript *, struct nfssvc_sock *,
158: struct lwp *, struct mbuf **);
159: int nfsrv_rmdir(struct nfsrv_descript *, struct nfssvc_sock *,
160: struct lwp *, struct mbuf **);
161: int nfsrv_readdir(struct nfsrv_descript *, struct nfssvc_sock *,
162: struct lwp *, struct mbuf **);
163: int nfsrv_readdirplus(struct nfsrv_descript *, struct nfssvc_sock *,
164: struct lwp *, struct mbuf **);
165: int nfsrv_commit(struct nfsrv_descript *, struct nfssvc_sock *,
166: struct lwp *, struct mbuf **);
167: int nfsrv_statfs(struct nfsrv_descript *, struct nfssvc_sock *,
168: struct lwp *, struct mbuf **);
169: int nfsrv_fsinfo(struct nfsrv_descript *, struct nfssvc_sock *,
170: struct lwp *, struct mbuf **);
171: int nfsrv_pathconf(struct nfsrv_descript *, struct nfssvc_sock *,
172: struct lwp *, struct mbuf **);
173: int nfsrv_null(struct nfsrv_descript *, struct nfssvc_sock *,
174: struct lwp *, struct mbuf **);
175: int nfsrv_noop(struct nfsrv_descript *, struct nfssvc_sock *,
176: struct lwp *, struct mbuf **);
1.59 elad 177: int nfsrv_access(struct vnode *, int, kauth_cred_t, int, struct lwp *, int);
1.1 christos 178:
179: /* nfs_socket.c */
1.57 yamt 180: int nfs_connect(struct nfsmount *, struct nfsreq *, struct lwp *);
1.73 yamt 181: int nfs_reconnect(struct nfsreq *);
1.57 yamt 182: void nfs_disconnect(struct nfsmount *);
183: void nfs_safedisconnect(struct nfsmount *);
184: int nfs_send(struct socket *, struct mbuf *, struct mbuf *, struct nfsreq *,
185: struct lwp *);
186: int nfs_receive(struct nfsreq *, struct mbuf **, struct mbuf **, struct lwp *);
187: int nfs_reply(struct nfsreq *, struct lwp *);
188: int nfs_request(struct nfsnode *, struct mbuf *, int, struct lwp *,
1.66 christos 189: kauth_cred_t, struct mbuf **, struct mbuf **, char **, int *);
1.57 yamt 190: int nfs_rephead(int, struct nfsrv_descript *, struct nfssvc_sock *,
1.66 christos 191: int, int, u_quad_t *, struct mbuf **, struct mbuf **, char **);
1.57 yamt 192: void nfs_timer(void *);
1.71 yamt 193: void nfs_timer_init(void);
194: void nfs_timer_start(void);
1.57 yamt 195: int nfs_sigintr(struct nfsmount *, struct nfsreq *, struct lwp *);
196: int nfs_getreq(struct nfsrv_descript *, struct nfsd *, int);
197: int nfs_msg(struct lwp *, const char *, const char *);
1.74.2.1! mjf 198: void nfsrv_soupcall(struct socket *, void *, int);
! 199: void nfsrv_rcv(struct nfssvc_sock *);
1.57 yamt 200: int nfsrv_getstream(struct nfssvc_sock *, int);
1.74.2.1! mjf 201: int nfsrv_dorec(struct nfssvc_sock *, struct nfsd *, struct nfsrv_descript **,
! 202: bool *);
1.57 yamt 203: void nfsrv_wakenfsd(struct nfssvc_sock *);
1.65 thorpej 204: int nfsdsock_lock(struct nfssvc_sock *, bool);
1.56 yamt 205: void nfsdsock_unlock(struct nfssvc_sock *);
206: int nfsdsock_drain(struct nfssvc_sock *);
207: int nfsdsock_sendreply(struct nfssvc_sock *, struct nfsrv_descript *);
1.61 yamt 208: void nfsdreq_init(void);
209: struct nfsrv_descript *nfsdreq_alloc(void);
1.60 yamt 210: void nfsdreq_free(struct nfsrv_descript *);
1.1 christos 211:
1.74.2.1! mjf 212: void nfsdsock_setbits(struct nfssvc_sock *, int);
! 213: void nfsdsock_clearbits(struct nfssvc_sock *, int);
! 214: bool nfsdsock_testbits(struct nfssvc_sock *, int);
! 215:
1.1 christos 216: /* nfs_srvcache.c */
1.57 yamt 217: void nfsrv_initcache(void);
218: int nfsrv_getcache(struct nfsrv_descript *, struct nfssvc_sock *,
219: struct mbuf **);
220: void nfsrv_updatecache(struct nfsrv_descript *, int, struct mbuf *);
221: void nfsrv_cleancache(void);
1.1 christos 222:
223: /* nfs_subs.c */
1.66 christos 224: struct mbuf *nfsm_reqh(struct nfsnode *, u_long, int, char **);
1.59 elad 225: struct mbuf *nfsm_rpchead(kauth_cred_t, int, int, int, int, char *, int,
1.57 yamt 226: char *, struct mbuf *, int, struct mbuf **, u_int32_t *);
1.66 christos 227: int nfsm_mbuftouio(struct mbuf **, struct uio *, int, char **);
228: int nfsm_uiotombuf(struct uio *, struct mbuf **, int, char **);
229: int nfsm_disct(struct mbuf **, char **, int, int, char **);
230: int nfs_adv(struct mbuf **, char **, int, int);
1.57 yamt 231: int nfsm_strtmbuf(struct mbuf **, char **, const char *, long);
232: u_long nfs_dirhash(off_t);
233: void nfs_initdircache(struct vnode *);
234: void nfs_initdirxlatecookie(struct vnode *);
235: struct nfsdircache *nfs_searchdircache(struct vnode *, off_t, int, int *);
236: struct nfsdircache *nfs_enterdircache(struct vnode *, off_t, off_t, int,
237: daddr_t);
238: void nfs_putdircache(struct nfsnode *, struct nfsdircache *);
239: void nfs_invaldircache(struct vnode *, int);
1.49 yamt 240: #define NFS_INVALDIRCACHE_FORCE 1
241: #define NFS_INVALDIRCACHE_KEEPEOF 2
1.3 fvdl 242: void nfs_init __P((void));
1.66 christos 243: int nfsm_loadattrcache(struct vnode **, struct mbuf **, char **,
1.57 yamt 244: struct vattr *, int flags);
245: int nfs_loadattrcache(struct vnode **, struct nfs_fattr *, struct vattr *,
246: int flags);
247: int nfs_getattrcache(struct vnode *, struct vattr *);
248: void nfs_delayedtruncate(struct vnode *);
249: int nfs_check_wccdata(struct nfsnode *, const struct timespec *,
1.65 thorpej 250: struct timespec *, bool);
1.63 yamt 251: int nfs_namei(struct nameidata *, nfsrvfh_t *, uint32_t, struct nfssvc_sock *,
1.66 christos 252: struct mbuf *, struct mbuf **, char **, struct vnode **, struct lwp *,
1.57 yamt 253: int, int);
254: void nfs_zeropad(struct mbuf *, int, int);
255: void nfsm_srvwcc(struct nfsrv_descript *, int, struct vattr *, int,
256: struct vattr *, struct mbuf **, char **);
257: void nfsm_srvpostopattr(struct nfsrv_descript *, int, struct vattr *,
258: struct mbuf **, char **);
259: void nfsm_srvfattr(struct nfsrv_descript *, struct vattr *, struct nfs_fattr *);
1.63 yamt 260: int nfsrv_fhtovp(nfsrvfh_t *, int, struct vnode **, kauth_cred_t,
1.57 yamt 261: struct nfssvc_sock *, struct mbuf *, int *, int, int);
1.63 yamt 262: int nfs_ispublicfh __P((const nfsrvfh_t *));
1.57 yamt 263: int netaddr_match(int, union nethostaddr *, struct mbuf *);
1.74 yamt 264: time_t nfs_attrtimeo(struct nfsmount *, struct nfsnode *);
1.24 yamt 265:
266: /* flags for nfs_loadattrcache and friends */
267: #define NAC_NOTRUNC 1 /* don't truncate file size */
1.18 fvdl 268:
1.57 yamt 269: void nfs_clearcommit(struct mount *);
270: void nfs_merge_commit_ranges(struct vnode *);
271: int nfs_in_committed_range(struct vnode *, off_t, off_t);
272: int nfs_in_tobecommitted_range(struct vnode *, off_t, off_t);
273: void nfs_add_committed_range(struct vnode *, off_t, off_t);
274: void nfs_del_committed_range(struct vnode *, off_t, off_t);
275: void nfs_add_tobecommitted_range(struct vnode *, off_t, off_t);
276: void nfs_del_tobecommitted_range(struct vnode *, off_t, off_t);
277:
278: int nfsrv_errmap(struct nfsrv_descript *, int);
1.59 elad 279: void nfs_cookieheuristic(struct vnode *, int *, struct lwp *, kauth_cred_t);
1.42 yamt 280:
1.57 yamt 281: u_int32_t nfs_getxid(void);
282: void nfs_renewxid(struct nfsreq *);
1.1 christos 283:
1.65 thorpej 284: int nfsrv_composefh(struct vnode *, nfsrvfh_t *, bool);
1.63 yamt 285: int nfsrv_comparefh(const nfsrvfh_t *, const nfsrvfh_t *);
286: void nfsrv_copyfh(nfsrvfh_t *, const nfsrvfh_t *);
287:
1.1 christos 288: /* nfs_syscalls.c */
1.57 yamt 289: int sys_getfh(struct lwp *, void *, register_t *);
290: int sys_nfssvc(struct lwp *, void *, register_t *);
291: int nfssvc_addsock(struct file *, struct mbuf *);
1.66 christos 292: int nfssvc_nfsd(struct nfsd_srvargs *, void *, struct lwp *);
1.57 yamt 293: void nfsrv_zapsock(struct nfssvc_sock *);
294: void nfsrv_slpderef(struct nfssvc_sock *);
295: void nfsrv_init(int);
296: void nfs_iodinit(void);
1.72 yamt 297: int nfs_set_niothreads(int);
1.59 elad 298: int nfs_getauth(struct nfsmount *, struct nfsreq *, kauth_cred_t, char **,
1.57 yamt 299: int *, char *, int *, NFSKERBKEY_T);
1.59 elad 300: int nfs_getnickauth(struct nfsmount *, kauth_cred_t, char **, int *, char *,
1.57 yamt 301: int);
1.59 elad 302: int nfs_savenickauth(struct nfsmount *, kauth_cred_t, int, NFSKERBKEY_T,
1.57 yamt 303: struct mbuf **, char **, struct mbuf *);
1.52 jmmv 304:
305: /* nfs_export.c */
306: extern struct nfs_public nfs_pub;
1.55 christos 307: int mountd_set_exports_list(const struct mountd_exports_list *, struct lwp *);
1.54 yamt 308: int netexport_check(const fsid_t *, struct mbuf *, struct mount **, int *,
1.59 elad 309: kauth_cred_t *);
1.58 yamt 310: void netexport_rdlock(void);
311: void netexport_rdunlock(void);
1.53 jmmv 312: #ifdef COMPAT_30
1.69 dsl 313: int nfs_update_exports_30(struct mount *, const char *,
314: struct mnt_export_args30 *, struct lwp *);
1.53 jmmv 315: #endif
1.32 yamt 316: #endif /* _KERNEL */
CVSweb <webmaster@jp.NetBSD.org>