/*-1* SPDX-License-Identifier: BSD-3-Clause2*3* Copyright (c) 1989, 19934* The Regents of the University of California. All rights reserved.5*6* This code is derived from software contributed to Berkeley by7* Rick Macklem at The University of Guelph.8*9* Redistribution and use in source and binary forms, with or without10* modification, are permitted provided that the following conditions11* are met:12* 1. Redistributions of source code must retain the above copyright13* notice, this list of conditions and the following disclaimer.14* 2. Redistributions in binary form must reproduce the above copyright15* notice, this list of conditions and the following disclaimer in the16* documentation and/or other materials provided with the distribution.17* 3. Neither the name of the University nor the names of its contributors18* may be used to endorse or promote products derived from this software19* without specific prior written permission.20*21* THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND22* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE23* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE24* ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE25* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL26* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS27* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)28* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT29* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY30* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF31* SUCH DAMAGE.32*/3334#ifndef _NFSCLIENT_NFSMOUNT_H_35#define _NFSCLIENT_NFSMOUNT_H_3637#include <nfs/nfs_mountcommon.h>3839/* Maximum value for nm_nconnect. */40#define NFS_MAXNCONN 164142/*43* Mount structure.44* One allocated on every NFS mount.45* Holds NFS specific information for mount.46*/47struct nfsmount {48struct nfsmount_common nm_com; /* Common fields for nlm */49uint32_t nm_privflag; /* Private flags */50uint32_t nm_newflag; /* New mount flags */51int nm_numgrps; /* Max. size of groupslist */52u_char nm_fh[NFSX_FHMAX]; /* File handle of root dir */53int nm_fhsize; /* Size of root file handle */54struct nfssockreq nm_sockreq; /* Socket Info */55int nm_timeouts; /* Request timeouts */56int nm_rsize; /* Max size of read rpc */57int nm_wsize; /* Max size of write rpc */58int nm_readdirsize; /* Size of a readdir rpc */59int nm_readahead; /* Num. of blocks to readahead */60int nm_wcommitsize; /* Max size of commit for write */61int nm_acdirmin; /* Directory attr cache min lifetime */62int nm_acdirmax; /* Directory attr cache max lifetime */63int nm_acregmin; /* Reg file attr cache min lifetime */64int nm_acregmax; /* Reg file attr cache max lifetime */65u_char nm_verf[NFSX_VERF]; /* write verifier */66TAILQ_HEAD(, buf) nm_bufq; /* async io buffer queue */67short nm_bufqlen; /* number of buffers in queue */68short nm_bufqwant; /* process wants to add to the queue */69int nm_bufqiods; /* number of iods processing queue */70u_int64_t nm_maxfilesize; /* maximum file size */71int nm_tprintf_initial_delay; /* initial delay */72int nm_tprintf_delay; /* interval for messages */73int nm_nametimeo; /* timeout for +ve entries (sec) */74int nm_negnametimeo; /* timeout for -ve entries (sec) */7576/* Newnfs additions */77TAILQ_HEAD(, nfsclds) nm_sess; /* Session(s) for NFSv4.1. */78struct nfsclclient *nm_clp;79char *nm_tlscertname; /* TLS certificate file name */80uid_t nm_uid; /* Uid for SetClientID etc. */81u_int64_t nm_clval; /* identifies which clientid */82u_int64_t nm_fsid[2]; /* NFSv4 fsid */83int nm_minorvers; /* Minor version # for NFSv4 */84u_int nm_aconnect; /* additional TCP connections */85u_int nm_nextaconn; /* Next nm_aconn[] to use */86/* unclipped, wraps to 0 */87struct __rpc_client *nm_aconn[NFS_MAXNCONN - 1]; /* Additional nconn */88/* Locked via nm_sockreq.nr_mtx */89uint32_t nm_cloneblksize; /* Block cloning alignment */90u_int16_t nm_krbnamelen; /* Krb5 host principal, if any */91u_int16_t nm_dirpathlen; /* and mount dirpath, for V4 */92u_int16_t nm_srvkrbnamelen; /* and the server's target name */93u_char nm_name[1]; /* malloc'd actual len of krbname + dirpath */94};9596#define nm_nam nm_sockreq.nr_nam97#define nm_sotype nm_sockreq.nr_sotype98#define nm_so nm_sockreq.nr_so99#define nm_soflags nm_sockreq.nr_soflags100#define nm_soproto nm_sockreq.nr_soproto101#define nm_client nm_sockreq.nr_client102#define nm_krbname nm_name103#define nm_mtx nm_com.nmcom_mtx104#define nm_flag nm_com.nmcom_flag105#define nm_state nm_com.nmcom_state106#define nm_mountp nm_com.nmcom_mountp107#define nm_timeo nm_com.nmcom_timeo108#define nm_retry nm_com.nmcom_retry109#define nm_hostname nm_com.nmcom_hostname110#define nm_getinfo nm_com.nmcom_getinfo111#define nm_vinvalbuf nm_com.nmcom_vinvalbuf112113/* Private flags. */114#define NFSMNTP_FORCEDISM 0x00000001115#define NFSMNTP_CANCELRPCS 0x00000002116#define NFSMNTP_IOADVISETHRUMDS 0x00000004117#define NFSMNTP_NOCOPY 0x00000008118#define NFSMNTP_NOCONSECUTIVE 0x00000010119#define NFSMNTP_SEEK 0x00000020120#define NFSMNTP_SEEKTESTED 0x00000040121#define NFSMNTP_NOXATTR 0x00000080122#define NFSMNTP_NOADVISE 0x00000100123#define NFSMNTP_NOALLOCATE 0x00000200124#define NFSMNTP_DELEGISSUED 0x00000400125#define NFSMNTP_NODEALLOCATE 0x00000800126#define NFSMNTP_FAKEROOTFH 0x00001000127128/* New mount flags only used by the kernel via nmount(2). */129#define NFSMNT_TLS 0x00000001130#define NFSMNT_SYSKRB5 0x00000002131132#define NFSMNT_DIRPATH(m) (&((m)->nm_name[(m)->nm_krbnamelen + 1]))133#define NFSMNT_SRVKRBNAME(m) \134(&((m)->nm_name[(m)->nm_krbnamelen + (m)->nm_dirpathlen + 2]))135136#if defined(_KERNEL)137/*138* Convert mount ptr to nfsmount ptr.139*/140#define VFSTONFS(mp) ((struct nfsmount *)((mp)->mnt_data))141142#ifndef NFS_DEFAULT_NAMETIMEO143#define NFS_DEFAULT_NAMETIMEO 60144#endif145146#ifndef NFS_DEFAULT_NEGNAMETIMEO147#define NFS_DEFAULT_NEGNAMETIMEO 60148#endif149150#endif /* _KERNEL */151152#endif /* _NFSCLIENT_NFSMOUNT_H_ */153154155