1191783Srmacklem/*-
2191783Srmacklem * Copyright (c) 1989, 1993
3191783Srmacklem *	The Regents of the University of California.  All rights reserved.
4191783Srmacklem *
5191783Srmacklem * This code is derived from software contributed to Berkeley by
6191783Srmacklem * Rick Macklem at The University of Guelph.
7191783Srmacklem *
8191783Srmacklem * Redistribution and use in source and binary forms, with or without
9191783Srmacklem * modification, are permitted provided that the following conditions
10191783Srmacklem * are met:
11191783Srmacklem * 1. Redistributions of source code must retain the above copyright
12191783Srmacklem *    notice, this list of conditions and the following disclaimer.
13191783Srmacklem * 2. Redistributions in binary form must reproduce the above copyright
14191783Srmacklem *    notice, this list of conditions and the following disclaimer in the
15191783Srmacklem *    documentation and/or other materials provided with the distribution.
16191783Srmacklem * 4. Neither the name of the University nor the names of its contributors
17191783Srmacklem *    may be used to endorse or promote products derived from this software
18191783Srmacklem *    without specific prior written permission.
19191783Srmacklem *
20191783Srmacklem * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
21191783Srmacklem * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
22191783Srmacklem * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
23191783Srmacklem * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
24191783Srmacklem * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
25191783Srmacklem * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
26191783Srmacklem * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
27191783Srmacklem * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
28191783Srmacklem * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
29191783Srmacklem * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
30191783Srmacklem * SUCH DAMAGE.
31191783Srmacklem *
32191783Srmacklem * $FreeBSD$
33191783Srmacklem */
34191783Srmacklem
35191783Srmacklem#ifndef _NFSCLIENT_NFS_H_
36191783Srmacklem#define	_NFSCLIENT_NFS_H_
37191783Srmacklem
38191783Srmacklem#if defined(_KERNEL)
39191783Srmacklem
40191783Srmacklem#ifndef NFS_TPRINTF_INITIAL_DELAY
41191783Srmacklem#define	NFS_TPRINTF_INITIAL_DELAY       12
42191783Srmacklem#endif
43191783Srmacklem
44191783Srmacklem#ifndef NFS_TPRINTF_DELAY
45191783Srmacklem#define	NFS_TPRINTF_DELAY               30
46191783Srmacklem#endif
47191783Srmacklem
48191783Srmacklem/*
49191783Srmacklem * Nfs version macros.
50191783Srmacklem */
51191783Srmacklem#define	NFS_ISV3(v) \
52191783Srmacklem	(VFSTONFS((v)->v_mount)->nm_flag & NFSMNT_NFSV3)
53191783Srmacklem#define	NFS_ISV4(v) \
54191783Srmacklem	(VFSTONFS((v)->v_mount)->nm_flag & NFSMNT_NFSV4)
55191783Srmacklem#define	NFS_ISV34(v) \
56191783Srmacklem	(VFSTONFS((v)->v_mount)->nm_flag & (NFSMNT_NFSV3 | NFSMNT_NFSV4))
57191783Srmacklem
58191783Srmacklem/*
59203119Srmacklem * NFS iod threads can be in one of these three states once spawned.
60203119Srmacklem * NFSIOD_NOT_AVAILABLE - Cannot be assigned an I/O operation at this time.
61203119Srmacklem * NFSIOD_AVAILABLE - Available to be assigned an I/O operation.
62203119Srmacklem * NFSIOD_CREATED_FOR_NFS_ASYNCIO - Newly created for nfs_asyncio() and
63203119Srmacklem *	will be used by the thread that called nfs_asyncio().
64203119Srmacklem */
65203119Srmacklemenum nfsiod_state {
66203119Srmacklem	NFSIOD_NOT_AVAILABLE = 0,
67203119Srmacklem	NFSIOD_AVAILABLE = 1,
68203119Srmacklem	NFSIOD_CREATED_FOR_NFS_ASYNCIO = 2,
69203119Srmacklem};
70203119Srmacklem
71203119Srmacklem/*
72191783Srmacklem * Function prototypes.
73191783Srmacklem */
74191783Srmacklemint ncl_meta_setsize(struct vnode *, struct ucred *, struct thread *,
75191783Srmacklem    u_quad_t);
76191783Srmacklemvoid ncl_doio_directwrite(struct buf *);
77191783Srmacklemint ncl_bioread(struct vnode *, struct uio *, int, struct ucred *);
78191783Srmacklemint ncl_biowrite(struct vnode *, struct uio *, int, struct ucred *);
79191783Srmacklemint ncl_vinvalbuf(struct vnode *, int, struct thread *, int);
80191783Srmacklemint ncl_asyncio(struct nfsmount *, struct buf *, struct ucred *,
81191783Srmacklem    struct thread *);
82207082Srmacklemint ncl_doio(struct vnode *, struct buf *, struct ucred *, struct thread *,
83207082Srmacklem    int);
84191783Srmacklemvoid ncl_nhinit(void);
85191783Srmacklemvoid ncl_nhuninit(void);
86191783Srmacklemvoid ncl_nodelock(struct nfsnode *);
87191783Srmacklemvoid ncl_nodeunlock(struct nfsnode *);
88191783Srmacklemint ncl_getattrcache(struct vnode *, struct vattr *);
89191783Srmacklemint ncl_readrpc(struct vnode *, struct uio *, struct ucred *);
90207082Srmacklemint ncl_writerpc(struct vnode *, struct uio *, struct ucred *, int *, int *,
91207082Srmacklem    int);
92191783Srmacklemint ncl_readlinkrpc(struct vnode *, struct uio *, struct ucred *);
93191783Srmacklemint ncl_readdirrpc(struct vnode *, struct uio *, struct ucred *,
94191783Srmacklem    struct thread *);
95191783Srmacklemint ncl_readdirplusrpc(struct vnode *, struct uio *, struct ucred *,
96191783Srmacklem    struct thread *);
97191783Srmacklemint ncl_writebp(struct buf *, int, struct thread *);
98191783Srmacklemint ncl_commit(struct vnode *, u_quad_t, int, struct ucred *, struct thread *);
99191783Srmacklemvoid ncl_clearcommit(struct mount *);
100191783Srmacklemint ncl_fsinfo(struct nfsmount *, struct vnode *, struct ucred *,
101191783Srmacklem    struct thread *);
102191783Srmacklemint ncl_init(struct vfsconf *);
103191783Srmacklemint ncl_uninit(struct vfsconf *);
104220683Srmacklemvoid	ncl_nfsiodnew(void);
105220683Srmacklemvoid	ncl_nfsiodnew_tq(__unused void *, int);
106191783Srmacklem
107191783Srmacklem#endif	/* _KERNEL */
108191783Srmacklem
109191783Srmacklem#endif	/* _NFSCLIENT_NFS_H_ */
110