The Design and Implementation of the FreeBSD Operating System, Second Edition
Now available: The Design and Implementation of the FreeBSD Operating System (Second Edition)


[ source navigation ] [ diff markup ] [ identifier search ] [ freetext search ] [ file search ] [ list types ] [ track identifier ]

FreeBSD/Linux Kernel Cross Reference
sys/fs/nfsclient/nfs_lock.h

Version: -  FREEBSD  -  FREEBSD-13-STABLE  -  FREEBSD-13-0  -  FREEBSD-12-STABLE  -  FREEBSD-12-0  -  FREEBSD-11-STABLE  -  FREEBSD-11-0  -  FREEBSD-10-STABLE  -  FREEBSD-10-0  -  FREEBSD-9-STABLE  -  FREEBSD-9-0  -  FREEBSD-8-STABLE  -  FREEBSD-8-0  -  FREEBSD-7-STABLE  -  FREEBSD-7-0  -  FREEBSD-6-STABLE  -  FREEBSD-6-0  -  FREEBSD-5-STABLE  -  FREEBSD-5-0  -  FREEBSD-4-STABLE  -  FREEBSD-3-STABLE  -  FREEBSD22  -  l41  -  OPENBSD  -  linux-2.6  -  MK84  -  PLAN9  -  xnu-8792 
SearchContext: -  none  -  3  -  10 

    1 /*-
    2  * Copyright (c) 1998 Berkeley Software Design, Inc. All rights reserved.
    3  * Redistribution and use in source and binary forms, with or without
    4  * modification, are permitted provided that the following conditions
    5  * are met:
    6  * 1. Redistributions of source code must retain the above copyright
    7  *    notice, this list of conditions and the following disclaimer.
    8  * 2. Redistributions in binary form must reproduce the above copyright
    9  *    notice, this list of conditions and the following disclaimer in the
   10  *    documentation and/or other materials provided with the distribution.
   11  * 3. Berkeley Software Design Inc's name may not be used to endorse or
   12  *    promote products derived from this software without specific prior
   13  *    written permission.
   14  *
   15  * THIS SOFTWARE IS PROVIDED BY BERKELEY SOFTWARE DESIGN INC ``AS IS'' AND
   16  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
   17  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
   18  * ARE DISCLAIMED.  IN NO EVENT SHALL BERKELEY SOFTWARE DESIGN INC BE LIABLE
   19  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
   20  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
   21  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
   22  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
   23  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
   24  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
   25  * SUCH DAMAGE.
   26  *
   27  * $FreeBSD: releng/8.1/sys/fs/nfsclient/nfs_lock.h 191783 2009-05-04 15:23:58Z rmacklem $
   28  */
   29 
   30 /*
   31  * lockd uses the nfssvc system call to get the unique kernel services it needs.
   32  * It passes in a request structure with a version number at the start.
   33  * This prevents libc from needing to change if the information passed
   34  * between lockd and the kernel needs to change.
   35  *
   36  * If a structure changes, you must bump the version number.
   37  */
   38 
   39 /*
   40  * The fifo where the kernel writes requests for locks on remote NFS files,
   41  * and where lockd reads these requests.
   42  *
   43  */
   44 #define _PATH_NFSLCKDEV "nfslock"
   45 
   46 /*
   47  * This structure is used to uniquely identify the process which originated
   48  * a particular message to lockd.  A sequence number is used to differentiate
   49  * multiple messages from the same process.  A process start time is used to
   50  * detect the unlikely, but possible, event of the recycling of a pid.
   51  */
   52 struct lockd_msg_ident {
   53         pid_t           pid;            /* The process ID. */
   54         struct timeval  pid_start;      /* Start time of process id */
   55         int             msg_seq;        /* Sequence number of message */
   56 };
   57 
   58 #define LOCKD_MSG_VERSION       3
   59 
   60 /*
   61  * The structure that the kernel hands us for each lock request.
   62  */
   63 typedef struct __lock_msg {
   64         TAILQ_ENTRY(__lock_msg) lm_link;        /* internal linkage */
   65         int                     lm_version;     /* which version is this */
   66         struct lockd_msg_ident  lm_msg_ident;   /* originator of the message */
   67         struct flock            lm_fl;             /* The lock request. */
   68         int                     lm_wait;           /* The F_WAIT flag. */
   69         int                     lm_getlk;               /* is this a F_GETLK request */
   70         struct sockaddr_storage lm_addr;                /* The address. */
   71         int                     lm_nfsv3;               /* If NFS version 3. */
   72         size_t                  lm_fh_len;              /* The file handle length. */
   73         struct xucred           lm_cred;                /* user cred for lock req */
   74         u_int8_t                lm_fh[NFSX_V3FHMAX];/* The file handle. */
   75 } LOCKD_MSG;
   76 
   77 #define LOCKD_ANS_VERSION       1
   78 
   79 struct lockd_ans {
   80         int             la_vers;
   81         struct lockd_msg_ident  la_msg_ident;   /* originator of the message */
   82         int             la_errno;
   83         int             la_set_getlk_pid;               /* use returned pid */
   84         int             la_getlk_pid;           /* returned pid for F_GETLK */
   85 };
   86 
   87 #ifdef _KERNEL
   88 int     ncl_dolock(struct vop_advlock_args *ap);
   89 #endif

Cache object: 23be5ba6f1ede8daed406134aba3d566


[ source navigation ] [ diff markup ] [ identifier search ] [ freetext search ] [ file search ] [ list types ] [ track identifier ]


This page is part of the FreeBSD/Linux Linux Kernel Cross-Reference, and was automatically generated using a modified version of the LXR engine.