19ec7b004SRick Macklem /*- 251369649SPedro F. Giffuni * SPDX-License-Identifier: BSD-3-Clause 351369649SPedro F. Giffuni * 49ec7b004SRick Macklem * Copyright (c) 1989, 1993 59ec7b004SRick Macklem * The Regents of the University of California. All rights reserved. 69ec7b004SRick Macklem * 79ec7b004SRick Macklem * This code is derived from software contributed to Berkeley by 89ec7b004SRick Macklem * Rick Macklem at The University of Guelph. 99ec7b004SRick Macklem * 109ec7b004SRick Macklem * Redistribution and use in source and binary forms, with or without 119ec7b004SRick Macklem * modification, are permitted provided that the following conditions 129ec7b004SRick Macklem * are met: 139ec7b004SRick Macklem * 1. Redistributions of source code must retain the above copyright 149ec7b004SRick Macklem * notice, this list of conditions and the following disclaimer. 159ec7b004SRick Macklem * 2. Redistributions in binary form must reproduce the above copyright 169ec7b004SRick Macklem * notice, this list of conditions and the following disclaimer in the 179ec7b004SRick Macklem * documentation and/or other materials provided with the distribution. 18fbbd9655SWarner Losh * 3. Neither the name of the University nor the names of its contributors 199ec7b004SRick Macklem * may be used to endorse or promote products derived from this software 209ec7b004SRick Macklem * without specific prior written permission. 219ec7b004SRick Macklem * 229ec7b004SRick Macklem * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND 239ec7b004SRick Macklem * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 249ec7b004SRick Macklem * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 259ec7b004SRick Macklem * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE 269ec7b004SRick Macklem * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 279ec7b004SRick Macklem * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 289ec7b004SRick Macklem * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 299ec7b004SRick Macklem * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 309ec7b004SRick Macklem * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 319ec7b004SRick Macklem * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 329ec7b004SRick Macklem * SUCH DAMAGE. 339ec7b004SRick Macklem */ 349ec7b004SRick Macklem 359ec7b004SRick Macklem #ifndef _NFSCLIENT_NFSMOUNT_H_ 369ec7b004SRick Macklem #define _NFSCLIENT_NFSMOUNT_H_ 379ec7b004SRick Macklem 38ca27c028SRick Macklem #include <nfs/nfs_mountcommon.h> 39ca27c028SRick Macklem 401e0a518dSRick Macklem /* Maximum value for nm_nconnect. */ 411e0a518dSRick Macklem #define NFS_MAXNCONN 16 421e0a518dSRick Macklem 439ec7b004SRick Macklem /* 449ec7b004SRick Macklem * Mount structure. 459ec7b004SRick Macklem * One allocated on every NFS mount. 469ec7b004SRick Macklem * Holds NFS specific information for mount. 479ec7b004SRick Macklem */ 489ec7b004SRick Macklem struct nfsmount { 49ca27c028SRick Macklem struct nfsmount_common nm_com; /* Common fields for nlm */ 5047cbff34SRick Macklem uint32_t nm_privflag; /* Private flags */ 516e4b6ff8SRick Macklem uint32_t nm_newflag; /* New mount flags */ 529ec7b004SRick Macklem int nm_numgrps; /* Max. size of groupslist */ 539ec7b004SRick Macklem u_char nm_fh[NFSX_FHMAX]; /* File handle of root dir */ 549ec7b004SRick Macklem int nm_fhsize; /* Size of root file handle */ 559ec7b004SRick Macklem struct nfssockreq nm_sockreq; /* Socket Info */ 569ec7b004SRick Macklem int nm_timeouts; /* Request timeouts */ 579ec7b004SRick Macklem int nm_rsize; /* Max size of read rpc */ 589ec7b004SRick Macklem int nm_wsize; /* Max size of write rpc */ 599ec7b004SRick Macklem int nm_readdirsize; /* Size of a readdir rpc */ 609ec7b004SRick Macklem int nm_readahead; /* Num. of blocks to readahead */ 619ec7b004SRick Macklem int nm_wcommitsize; /* Max size of commit for write */ 629ec7b004SRick Macklem int nm_acdirmin; /* Directory attr cache min lifetime */ 639ec7b004SRick Macklem int nm_acdirmax; /* Directory attr cache max lifetime */ 649ec7b004SRick Macklem int nm_acregmin; /* Reg file attr cache min lifetime */ 659ec7b004SRick Macklem int nm_acregmax; /* Reg file attr cache max lifetime */ 669ec7b004SRick Macklem u_char nm_verf[NFSX_VERF]; /* write verifier */ 679ec7b004SRick Macklem TAILQ_HEAD(, buf) nm_bufq; /* async io buffer queue */ 689ec7b004SRick Macklem short nm_bufqlen; /* number of buffers in queue */ 699ec7b004SRick Macklem short nm_bufqwant; /* process wants to add to the queue */ 709ec7b004SRick Macklem int nm_bufqiods; /* number of iods processing queue */ 719ec7b004SRick Macklem u_int64_t nm_maxfilesize; /* maximum file size */ 729ec7b004SRick Macklem int nm_tprintf_initial_delay; /* initial delay */ 739ec7b004SRick Macklem int nm_tprintf_delay; /* interval for messages */ 740b17c7beSJohn Baldwin int nm_nametimeo; /* timeout for +ve entries (sec) */ 75dd5b5a94SRick Macklem int nm_negnametimeo; /* timeout for -ve entries (sec) */ 769ec7b004SRick Macklem 779ec7b004SRick Macklem /* Newnfs additions */ 781f60bfd8SRick Macklem TAILQ_HEAD(, nfsclds) nm_sess; /* Session(s) for NFSv4.1. */ 799ec7b004SRick Macklem struct nfsclclient *nm_clp; 80665b1365SRick Macklem char *nm_tlscertname; /* TLS certificate file name */ 819ec7b004SRick Macklem uid_t nm_uid; /* Uid for SetClientID etc. */ 829ec7b004SRick Macklem u_int64_t nm_clval; /* identifies which clientid */ 839ec7b004SRick Macklem u_int64_t nm_fsid[2]; /* NFSv4 fsid */ 841f60bfd8SRick Macklem int nm_minorvers; /* Minor version # for NFSv4 */ 851e0a518dSRick Macklem u_int nm_aconnect; /* additional TCP connections */ 861e0a518dSRick Macklem u_int nm_nextaconn; /* Next nm_aconn[] to use */ 871e0a518dSRick Macklem /* unclipped, wraps to 0 */ 881e0a518dSRick Macklem struct __rpc_client *nm_aconn[NFS_MAXNCONN - 1]; /* Additional nconn */ 891e0a518dSRick Macklem /* Locked via nm_sockreq.nr_mtx */ 909ec7b004SRick Macklem u_int16_t nm_krbnamelen; /* Krb5 host principal, if any */ 919ec7b004SRick Macklem u_int16_t nm_dirpathlen; /* and mount dirpath, for V4 */ 929ec7b004SRick Macklem u_int16_t nm_srvkrbnamelen; /* and the server's target name */ 939ec7b004SRick Macklem u_char nm_name[1]; /* malloc'd actual len of krbname + dirpath */ 949ec7b004SRick Macklem }; 959ec7b004SRick Macklem 969ec7b004SRick Macklem #define nm_nam nm_sockreq.nr_nam 979ec7b004SRick Macklem #define nm_sotype nm_sockreq.nr_sotype 989ec7b004SRick Macklem #define nm_so nm_sockreq.nr_so 999ec7b004SRick Macklem #define nm_soflags nm_sockreq.nr_soflags 1009ec7b004SRick Macklem #define nm_soproto nm_sockreq.nr_soproto 1019ec7b004SRick Macklem #define nm_client nm_sockreq.nr_client 1029ec7b004SRick Macklem #define nm_krbname nm_name 103ca27c028SRick Macklem #define nm_mtx nm_com.nmcom_mtx 104ca27c028SRick Macklem #define nm_flag nm_com.nmcom_flag 105ca27c028SRick Macklem #define nm_state nm_com.nmcom_state 106ca27c028SRick Macklem #define nm_mountp nm_com.nmcom_mountp 107ca27c028SRick Macklem #define nm_timeo nm_com.nmcom_timeo 108ca27c028SRick Macklem #define nm_retry nm_com.nmcom_retry 109ca27c028SRick Macklem #define nm_hostname nm_com.nmcom_hostname 110ca27c028SRick Macklem #define nm_getinfo nm_com.nmcom_getinfo 11190305aa3SRick Macklem #define nm_vinvalbuf nm_com.nmcom_vinvalbuf 1129ec7b004SRick Macklem 11347cbff34SRick Macklem /* Private flags. */ 11447cbff34SRick Macklem #define NFSMNTP_FORCEDISM 0x00000001 11547cbff34SRick Macklem #define NFSMNTP_CANCELRPCS 0x00000002 116c057a378SRick Macklem #define NFSMNTP_IOADVISETHRUMDS 0x00000004 117c057a378SRick Macklem #define NFSMNTP_NOCOPY 0x00000008 118c057a378SRick Macklem #define NFSMNTP_NOCONSECUTIVE 0x00000010 119c057a378SRick Macklem #define NFSMNTP_SEEK 0x00000020 120c057a378SRick Macklem #define NFSMNTP_SEEKTESTED 0x00000040 121c057a378SRick Macklem #define NFSMNTP_NOXATTR 0x00000080 122c057a378SRick Macklem #define NFSMNTP_NOADVISE 0x00000100 123c057a378SRick Macklem #define NFSMNTP_NOALLOCATE 0x00000200 1245e5ca4c8SRick Macklem #define NFSMNTP_DELEGISSUED 0x00000400 12508b9cc31SRick Macklem #define NFSMNTP_NODEALLOCATE 0x00000800 126*896516e5SRick Macklem #define NFSMNTP_FAKEROOTFH 0x00001000 12747cbff34SRick Macklem 1286e4b6ff8SRick Macklem /* New mount flags only used by the kernel via nmount(2). */ 1296e4b6ff8SRick Macklem #define NFSMNT_TLS 0x00000001 130*896516e5SRick Macklem #define NFSMNT_SYSKRB5 0x00000002 1316e4b6ff8SRick Macklem 1329ec7b004SRick Macklem #define NFSMNT_DIRPATH(m) (&((m)->nm_name[(m)->nm_krbnamelen + 1])) 1339ec7b004SRick Macklem #define NFSMNT_SRVKRBNAME(m) \ 1349ec7b004SRick Macklem (&((m)->nm_name[(m)->nm_krbnamelen + (m)->nm_dirpathlen + 2])) 1359ec7b004SRick Macklem 1369ec7b004SRick Macklem #if defined(_KERNEL) 1379ec7b004SRick Macklem /* 1389ec7b004SRick Macklem * Convert mount ptr to nfsmount ptr. 1399ec7b004SRick Macklem */ 1409ec7b004SRick Macklem #define VFSTONFS(mp) ((struct nfsmount *)((mp)->mnt_data)) 1419ec7b004SRick Macklem 1420b17c7beSJohn Baldwin #ifndef NFS_DEFAULT_NAMETIMEO 1430b17c7beSJohn Baldwin #define NFS_DEFAULT_NAMETIMEO 60 1440b17c7beSJohn Baldwin #endif 1450b17c7beSJohn Baldwin 146dd5b5a94SRick Macklem #ifndef NFS_DEFAULT_NEGNAMETIMEO 147dd5b5a94SRick Macklem #define NFS_DEFAULT_NEGNAMETIMEO 60 148dd5b5a94SRick Macklem #endif 149dd5b5a94SRick Macklem 1509ec7b004SRick Macklem #endif /* _KERNEL */ 1519ec7b004SRick Macklem 1529ec7b004SRick Macklem #endif /* _NFSCLIENT_NFSMOUNT_H_ */ 153