Print this page
195 Need replacement for nfs/lockd+klm
Reviewed by: Gordon Ross <gordon.ross@nexenta.com>
Reviewed by: Jeremy Jones <jeremy@delphix.com>
Reviewed by: Jeff Biseda <jbiseda@delphix.com>


   7  * with the License.
   8  *
   9  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
  10  * or http://www.opensolaris.org/os/licensing.
  11  * See the License for the specific language governing permissions
  12  * and limitations under the License.
  13  *
  14  * When distributing Covered Code, include this CDDL HEADER in each
  15  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
  16  * If applicable, add the following below this CDDL HEADER, with the
  17  * fields enclosed by brackets "[]" replaced with your own identifying
  18  * information: Portions Copyright [yyyy] [name of copyright owner]
  19  *
  20  * CDDL HEADER END
  21  */
  22 /*
  23  * Copyright 2005 Sun Microsystems, Inc.  All rights reserved.
  24  * Use is subject to license terms.
  25  */
  26 




  27 #ifndef _NFS_LM_H
  28 #define _NFS_LM_H
  29 
  30 #pragma ident   "%Z%%M% %I%     %E% SMI"
  31 
  32 /*
  33  * Interface definitions for the NFSv2/v3 lock manager.
  34  */
  35 
  36 #ifdef __cplusplus
  37 extern "C" {
  38 #endif
  39 
  40 #include <sys/cred.h>
  41 #include <sys/fcntl.h>
  42 #include <sys/types.h>
  43 #include <sys/vnode.h>
  44 #include <rpc/rpc.h>
  45 #include <nfs/export.h>
  46 
  47 #ifdef _KERNEL
  48 
  49 /*
  50  * Common interfaces.
  51  */
  52 


  53 /*
  54  * The numeric sysid is used to identify a host and transport.
  55  *
  56  * The local locking code uses (pid, sysid) to uniquely identify a process.
  57  * This means that the client-side code must doctor up the sysid before
  58  * registering a lock, so that the local locking code doesn't confuse a
  59  * remote process with a local process just because they have the same pid.
  60  * We currently do this by ORing LM_SYSID_CLIENT into the sysid before
  61  * registering a lock.
  62  *
  63  * If you change LM_SYSID and LM_SYSID_MAX, be sure to pick values so that
  64  * LM_SYSID_MAX > LM_SYSID using signed arithmetic, and don't use zero.
  65  * You may also need a different way to tag lock manager locks that are
  66  * registered locally.
  67  */
  68 #define LM_SYSID        ((sysid_t)0x0001)
  69 #define LM_SYSID_MAX    ((sysid_t)0x3FFF)
  70 #define LM_SYSID_CLIENT ((sysid_t)0x4000)
  71 #define LM_NOSYSID      ((sysid_t)-1)
  72 


 137 extern void (*lm_remove_file_locks)(int);
 138 
 139 /*
 140  * The following global variable is the node id of the node where this
 141  * NLM server is running.
 142  */
 143 extern int lm_global_nlmid;
 144 
 145 /*
 146  * End of clustering hooks.
 147  */
 148 
 149 /*
 150  * Return non-zero if the given local vnode is in use.
 151  */
 152 extern int lm_vp_active(const struct vnode *);
 153 
 154 extern sysid_t             lm_alloc_sysidt(void);
 155 extern void                lm_free_sysidt(sysid_t);
 156 
 157 #else /* _KERNEL */
 158 
 159 #ifdef __STDC__
 160 extern int lm_shutdown(void);
 161 #else
 162 extern int lm_shutdown();
 163 #endif /* __STDC__ */
 164 
 165 #endif /* _KERNEL */
 166 
 167 #ifdef __cplusplus
 168 }
 169 #endif
 170 
 171 #endif /* _NFS_LM_H */


   7  * with the License.
   8  *
   9  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
  10  * or http://www.opensolaris.org/os/licensing.
  11  * See the License for the specific language governing permissions
  12  * and limitations under the License.
  13  *
  14  * When distributing Covered Code, include this CDDL HEADER in each
  15  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
  16  * If applicable, add the following below this CDDL HEADER, with the
  17  * fields enclosed by brackets "[]" replaced with your own identifying
  18  * information: Portions Copyright [yyyy] [name of copyright owner]
  19  *
  20  * CDDL HEADER END
  21  */
  22 /*
  23  * Copyright 2005 Sun Microsystems, Inc.  All rights reserved.
  24  * Use is subject to license terms.
  25  */
  26 
  27 /*
  28  * Copyright 2011 Nexenta Systems, Inc.  All rights reserved.
  29  */
  30 
  31 #ifndef _NFS_LM_H
  32 #define _NFS_LM_H
  33 


  34 /*
  35  * Interface definitions for the NFSv2/v3 lock manager.
  36  */
  37 
  38 #ifdef __cplusplus
  39 extern "C" {
  40 #endif
  41 
  42 #include <sys/cred.h>
  43 #include <sys/fcntl.h>
  44 #include <sys/types.h>
  45 #include <sys/vnode.h>
  46 #include <rpc/rpc.h>

  47 
  48 #ifdef _KERNEL
  49 
  50 /*
  51  * Common interfaces.
  52  */
  53 
  54 struct exportinfo;
  55 
  56 /*
  57  * The numeric sysid is used to identify a host and transport.
  58  *
  59  * The local locking code uses (pid, sysid) to uniquely identify a process.
  60  * This means that the client-side code must doctor up the sysid before
  61  * registering a lock, so that the local locking code doesn't confuse a
  62  * remote process with a local process just because they have the same pid.
  63  * We currently do this by ORing LM_SYSID_CLIENT into the sysid before
  64  * registering a lock.
  65  *
  66  * If you change LM_SYSID and LM_SYSID_MAX, be sure to pick values so that
  67  * LM_SYSID_MAX > LM_SYSID using signed arithmetic, and don't use zero.
  68  * You may also need a different way to tag lock manager locks that are
  69  * registered locally.
  70  */
  71 #define LM_SYSID        ((sysid_t)0x0001)
  72 #define LM_SYSID_MAX    ((sysid_t)0x3FFF)
  73 #define LM_SYSID_CLIENT ((sysid_t)0x4000)
  74 #define LM_NOSYSID      ((sysid_t)-1)
  75 


 140 extern void (*lm_remove_file_locks)(int);
 141 
 142 /*
 143  * The following global variable is the node id of the node where this
 144  * NLM server is running.
 145  */
 146 extern int lm_global_nlmid;
 147 
 148 /*
 149  * End of clustering hooks.
 150  */
 151 
 152 /*
 153  * Return non-zero if the given local vnode is in use.
 154  */
 155 extern int lm_vp_active(const struct vnode *);
 156 
 157 extern sysid_t             lm_alloc_sysidt(void);
 158 extern void                lm_free_sysidt(sysid_t);
 159 
 160 #endif /* _KERNEL */
 161 
 162 #ifdef __STDC__
 163 extern int lm_shutdown(void);
 164 #else
 165 extern int lm_shutdown();
 166 #endif /* __STDC__ */
 167 


 168 #ifdef __cplusplus
 169 }
 170 #endif
 171 
 172 #endif /* _NFS_LM_H */