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