source: rtems-libbsd/freebsd/sys/fs/nfsclient/nfs.h @ 882425f

6-freebsd-12
Last change on this file since 882425f was 882425f, checked in by Chris Johns <chrisj@…>, on 07/29/21 at 05:49:52

kern/sys: Add NFSv4 client

Update #4475

  • Property mode set to 100644
File size: 4.5 KB
Line 
1/*-
2 * SPDX-License-Identifier: BSD-3-Clause
3 *
4 * Copyright (c) 1989, 1993
5 *      The Regents of the University of California.  All rights reserved.
6 *
7 * This code is derived from software contributed to Berkeley by
8 * Rick Macklem at The University of Guelph.
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. Neither the name of the University nor the names of its contributors
19 *    may be used to endorse or promote products derived from this software
20 *    without specific prior written permission.
21 *
22 * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
23 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
24 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
25 * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
26 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
27 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
28 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
29 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
30 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
31 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
32 * SUCH DAMAGE.
33 *
34 * $FreeBSD$
35 */
36
37#ifndef _NFSCLIENT_NFS_H_
38#define _NFSCLIENT_NFS_H_
39
40#if defined(_KERNEL)
41
42#ifndef NFS_TPRINTF_INITIAL_DELAY
43#define NFS_TPRINTF_INITIAL_DELAY       12
44#endif
45
46#ifndef NFS_TPRINTF_DELAY
47#define NFS_TPRINTF_DELAY               30
48#endif
49
50/*
51 * Nfs version macros.
52 */
53#define NFS_ISV3(v) \
54        (VFSTONFS((v)->v_mount)->nm_flag & NFSMNT_NFSV3)
55#define NFS_ISV4(v) \
56        (VFSTONFS((v)->v_mount)->nm_flag & NFSMNT_NFSV4)
57#define NFS_ISV34(v) \
58        (VFSTONFS((v)->v_mount)->nm_flag & (NFSMNT_NFSV3 | NFSMNT_NFSV4))
59
60#ifdef NFS_DEBUG
61
62extern int nfs_debug;
63#define NFS_DEBUG_ASYNCIO       1 /* asynchronous i/o */
64#define NFS_DEBUG_WG            2 /* server write gathering */
65#define NFS_DEBUG_RC            4 /* server request caching */
66
67#define NFS_DPF(cat, args)                                      \
68        do {                                                    \
69                if (nfs_debug & NFS_DEBUG_##cat) printf args;   \
70        } while (0)
71
72#else
73
74#define NFS_DPF(cat, args)
75
76#endif
77
78/*
79 * NFS iod threads can be in one of these three states once spawned.
80 * NFSIOD_NOT_AVAILABLE - Cannot be assigned an I/O operation at this time.
81 * NFSIOD_AVAILABLE - Available to be assigned an I/O operation.
82 * NFSIOD_CREATED_FOR_NFS_ASYNCIO - Newly created for nfs_asyncio() and
83 *      will be used by the thread that called nfs_asyncio().
84 */
85enum nfsiod_state {
86        NFSIOD_NOT_AVAILABLE = 0,
87        NFSIOD_AVAILABLE = 1,
88        NFSIOD_CREATED_FOR_NFS_ASYNCIO = 2,
89};
90
91/*
92 * Function prototypes.
93 */
94int ncl_meta_setsize(struct vnode *, struct thread *, u_quad_t);
95void ncl_doio_directwrite(struct buf *);
96int ncl_bioread(struct vnode *, struct uio *, int, struct ucred *);
97int ncl_biowrite(struct vnode *, struct uio *, int, struct ucred *);
98int ncl_vinvalbuf(struct vnode *, int, struct thread *, int);
99int ncl_asyncio(struct
100                nfsmount *, struct buf *, struct ucred *,
101    struct thread *);
102int ncl_doio(struct vnode *, struct buf *, struct ucred *, struct thread *,
103    int);
104void ncl_nhinit(void);
105void ncl_nhuninit(void);
106void ncl_nodelock(struct nfsnode *);
107void ncl_nodeunlock(struct nfsnode *);
108int ncl_getattrcache(struct vnode *, struct vattr *);
109int ncl_readrpc(struct vnode *, struct uio *, struct ucred *);
110int ncl_writerpc(struct vnode *, struct uio *, struct ucred *, int *, int *,
111    int);
112int ncl_readlinkrpc(struct vnode *, struct uio *, struct ucred *);
113int ncl_readdirrpc(struct vnode *, struct uio *, struct ucred *,
114    struct thread *);
115int ncl_readdirplusrpc(struct vnode *, struct uio *, struct ucred *,
116    struct thread *);
117int ncl_writebp(struct buf *, int, struct thread *);
118int ncl_commit(struct vnode *, u_quad_t, int, struct ucred *, struct thread *);
119void ncl_clearcommit(struct mount *);
120int ncl_fsinfo(struct nfsmount *, struct vnode *, struct ucred *,
121    struct thread *);
122int ncl_init(struct vfsconf *);
123int ncl_uninit(struct vfsconf *);
124void    ncl_nfsiodnew(void);
125void    ncl_nfsiodnew_tq(__unused void *, int);
126
127#endif  /* _KERNEL */
128
129#endif  /* _NFSCLIENT_NFS_H_ */
Note: See TracBrowser for help on using the repository browser.