/*-1* SPDX-License-Identifier: BSD-3-Clause2*3* Copyright (c) 1998 Berkeley Software Design, Inc. All rights reserved.4* Redistribution and use in source and binary forms, with or without5* modification, are permitted provided that the following conditions6* are met:7* 1. Redistributions of source code must retain the above copyright8* notice, this list of conditions and the following disclaimer.9* 2. Redistributions in binary form must reproduce the above copyright10* notice, this list of conditions and the following disclaimer in the11* documentation and/or other materials provided with the distribution.12* 3. Berkeley Software Design Inc's name may not be used to endorse or13* promote products derived from this software without specific prior14* written permission.15*16* THIS SOFTWARE IS PROVIDED BY BERKELEY SOFTWARE DESIGN INC ``AS IS'' AND17* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE18* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE19* ARE DISCLAIMED. IN NO EVENT SHALL BERKELEY SOFTWARE DESIGN INC BE LIABLE20* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL21* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS22* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)23* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT24* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY25* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF26* SUCH DAMAGE.27*28* from nfs_lock.h,v 2.2 1998/04/28 19:38:41 don Exp29*/3031/*32* lockd uses the nfssvc system call to get the unique kernel services it needs.33* It passes in a request structure with a version number at the start.34* This prevents libc from needing to change if the information passed35* between lockd and the kernel needs to change.36*37* If a structure changes, you must bump the version number.38*/3940/*41* The fifo where the kernel writes requests for locks on remote NFS files,42* and where lockd reads these requests.43*44*/45#define _PATH_NFSLCKDEV "nfslock"4647/*48* This structure is used to uniquely identify the process which originated49* a particular message to lockd. A sequence number is used to differentiate50* multiple messages from the same process. A process start time is used to51* detect the unlikely, but possible, event of the recycling of a pid.52*/53struct lockd_msg_ident {54pid_t pid; /* The process ID. */55struct timeval pid_start; /* Start time of process id */56int msg_seq; /* Sequence number of message */57};5859#define LOCKD_MSG_VERSION 36061/*62* The structure that the kernel hands us for each lock request.63*/64typedef struct __lock_msg {65TAILQ_ENTRY(__lock_msg) lm_link; /* internal linkage */66int lm_version; /* which version is this */67struct lockd_msg_ident lm_msg_ident; /* originator of the message */68struct flock lm_fl; /* The lock request. */69int lm_wait; /* The F_WAIT flag. */70int lm_getlk; /* is this a F_GETLK request */71struct sockaddr_storage lm_addr; /* The address. */72int lm_nfsv3; /* If NFS version 3. */73size_t lm_fh_len; /* The file handle length. */74struct xucred lm_cred; /* user cred for lock req */75u_int8_t lm_fh[NFSX_V3FHMAX];/* The file handle. */76} LOCKD_MSG;7778#define LOCKD_ANS_VERSION 17980struct lockd_ans {81int la_vers;82struct lockd_msg_ident la_msg_ident; /* originator of the message */83int la_errno;84int la_set_getlk_pid; /* use returned pid */85int la_getlk_pid; /* returned pid for F_GETLK */86};8788#ifdef _KERNEL89int nfs_dolock(struct vop_advlock_args *ap);90extern vop_advlock_t *nfs_advlock_p;91extern vop_reclaim_t *nfs_reclaim_p;92#endif939495