/*-1* SPDX-License-Identifier: BSD-2-Clause2*3* Copyright (c) 2009 Rick Macklem, University of Guelph4* All rights reserved.5*6* Redistribution and use in source and binary forms, with or without7* modification, are permitted provided that the following conditions8* are met:9* 1. Redistributions of source code must retain the above copyright10* notice, this list of conditions and the following disclaimer.11* 2. Redistributions in binary form must reproduce the above copyright12* notice, this list of conditions and the following disclaimer in the13* documentation and/or other materials provided with the distribution.14*15* THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND16* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE17* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE18* ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE19* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL20* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS21* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)22* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT23* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY24* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF25* SUCH DAMAGE.26*/2728#ifndef _NFS_NFSCL_H29#define _NFS_NFSCL_H3031/*32* Extra stuff for a NFSv4 nfsnode.33* MALLOC'd to the correct length for the name and file handle.34* n4_data has the file handle, followed by the file name.35* The macro NFS4NODENAME() returns a pointer to the start of the36* name.37*/38struct nfsv4node {39u_int16_t n4_fhlen;40u_int16_t n4_namelen;41u_int8_t n4_data[1];42};4344#define NFS4NODENAME(n) (&((n)->n4_data[(n)->n4_fhlen]))4546/*47* Just a macro to convert the nfscl_reqstart arguments.48*/49#define NFSCL_REQSTART(n, p, v, c) \50nfscl_reqstart((n), (p), VFSTONFS((v)->v_mount), \51VTONFS(v)->n_fhp->nfh_fh, VTONFS(v)->n_fhp->nfh_len, NULL, \52NULL, 0, 0, (c))5354/*55* These two macros convert between a lease duration and renew interval.56* For now, just make the renew interval 1/2 the lease duration.57* (They should be inverse operators.)58*/59#define NFSCL_RENEW(l) (((l) < 2) ? 1 : ((l) / 2))60#define NFSCL_LEASE(r) ((r) * 2)6162/* This macro checks to see if a forced dismount is about to occur. */63#define NFSCL_FORCEDISM(m) (((m)->mnt_kern_flag & MNTK_UNMOUNTF) != 0 || \64(VFSTONFS(m)->nm_privflag & NFSMNTP_FORCEDISM) != 0)6566/*67* These flag bits are used for the argument to nfscl_fillsattr() to68* indicate special handling of the attributes.69*/70#define NFSSATTR_FULL 0x0171#define NFSSATTR_SIZE0 0x0272#define NFSSATTR_SIZENEG1 0x0473#define NFSSATTR_SIZERDEV 0x0874#define NFSSATTR_NEWFILE 0x107576/* Use this macro for debug printfs. */77#define NFSCL_DEBUG(level, ...) do { \78if (nfscl_debuglevel >= (level)) \79printf(__VA_ARGS__); \80} while (0)8182struct nfscl_reconarg {83int minorvers;84uint8_t sessionid[NFSX_V4SESSIONID];85};8687#endif /* _NFS_NFSCL_H */888990