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>


  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 /*      Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T     */
  23 /*        All Rights Reserved   */
  24 
  25 
  26 /*
  27  * Copyright 2004 Sun Microsystems, Inc.  All rights reserved.
  28  * Use is subject to license terms.
  29  */



  30 
  31 #ifndef _SYS_FLOCK_H
  32 #define _SYS_FLOCK_H
  33 
  34 #pragma ident   "%Z%%M% %I%     %E% SMI"
  35 
  36 #include <sys/types.h>
  37 #include <sys/fcntl.h>
  38 #include <sys/vnode.h>
  39 #include <sys/t_lock.h>           /* for <sys/callb.h> */
  40 #include <sys/callb.h>
  41 #include <sys/param.h>
  42 #include <sys/zone.h>
  43 
  44 #ifdef  __cplusplus
  45 extern "C" {
  46 #endif
  47 
  48 /*
  49  * Private declarations and instrumentation for local locking.
  50  */
  51 
  52 /*
  53  * The flag passed to fs_frlock() may be ORed together with either
  54  * `F_REMOTELOCK' or `F_PXFSLOCK'.  Since this flag is initialized using the
  55  * `f_flag' field in the `file' structure, and that field is an unsigned short,


 221 #define FLK_QUERY_SLEEPING      0x2
 222 
 223 int     reclock(struct vnode *, struct flock64 *, int, int, u_offset_t,
 224                 flk_callback_t *);
 225 int     chklock(struct vnode *, int, u_offset_t, ssize_t, int,
 226                 caller_context_t *);
 227 int     convoff(struct vnode *, struct flock64 *, int, offset_t);
 228 void    cleanlocks(struct vnode *, pid_t, int);
 229 locklist_t *flk_get_sleeping_locks(int sysid, pid_t pid);
 230 locklist_t *flk_get_active_locks(int sysid, pid_t pid);
 231 locklist_t *flk_active_locks_for_vp(const struct vnode *vp);
 232 locklist_t *flk_active_nbmand_locks_for_vp(const struct vnode *vp);
 233 locklist_t *flk_active_nbmand_locks(pid_t pid);
 234 void    flk_free_locklist(locklist_t *);
 235 int     flk_convert_lock_data(struct vnode *, struct flock64 *,
 236                 u_offset_t *, u_offset_t *, offset_t);
 237 int     flk_check_lock_data(u_offset_t, u_offset_t, offset_t);
 238 int     flk_has_remote_locks(struct vnode *vp);
 239 void    flk_set_lockmgr_status(flk_lockmgr_status_t status);
 240 int     flk_sysid_has_locks(int sysid, int chklck);

 241 void    flk_init_callback(flk_callback_t *,
 242                 callb_cpr_t *(*)(flk_cb_when_t, void *), void *);
 243 void    flk_add_callback(flk_callback_t *,
 244                 callb_cpr_t *(*)(flk_cb_when_t, void *), void *,
 245                 flk_callback_t *);
 246 callb_cpr_t *flk_invoke_callbacks(flk_callback_t *, flk_cb_when_t);
 247 
 248 /* Zones hooks */
 249 extern  zone_key_t flock_zone_key;
 250 
 251 void    *flk_zone_init(zoneid_t);
 252 void    flk_zone_fini(zoneid_t, void *);
 253 
 254 /* Clustering hooks */
 255 void    cl_flk_set_nlm_status(int nlmid, flk_nlm_status_t nlm_state);
 256 void    cl_flk_remove_locks_by_sysid(int sysid);
 257 int     cl_flk_has_remote_locks_for_nlmid(struct vnode *vp, int nlmid);
 258 void    cl_flk_change_nlm_state_to_unknown(int nlmid);
 259 void    cl_flk_delete_pxfs_locks(struct vfs *vfsp, int pxfsid);
 260 #endif /* _KERNEL */


  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 /*      Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T     */
  23 /*        All Rights Reserved   */
  24 
  25 
  26 /*
  27  * Copyright 2004 Sun Microsystems, Inc.  All rights reserved.
  28  * Use is subject to license terms.
  29  */
  30 /*
  31  * Copyright 2011 Nexenta Systems, Inc.  All rights reserved.
  32  */
  33 
  34 #ifndef _SYS_FLOCK_H
  35 #define _SYS_FLOCK_H
  36 


  37 #include <sys/types.h>
  38 #include <sys/fcntl.h>
  39 #include <sys/vnode.h>
  40 #include <sys/t_lock.h>           /* for <sys/callb.h> */
  41 #include <sys/callb.h>
  42 #include <sys/param.h>
  43 #include <sys/zone.h>
  44 
  45 #ifdef  __cplusplus
  46 extern "C" {
  47 #endif
  48 
  49 /*
  50  * Private declarations and instrumentation for local locking.
  51  */
  52 
  53 /*
  54  * The flag passed to fs_frlock() may be ORed together with either
  55  * `F_REMOTELOCK' or `F_PXFSLOCK'.  Since this flag is initialized using the
  56  * `f_flag' field in the `file' structure, and that field is an unsigned short,


 222 #define FLK_QUERY_SLEEPING      0x2
 223 
 224 int     reclock(struct vnode *, struct flock64 *, int, int, u_offset_t,
 225                 flk_callback_t *);
 226 int     chklock(struct vnode *, int, u_offset_t, ssize_t, int,
 227                 caller_context_t *);
 228 int     convoff(struct vnode *, struct flock64 *, int, offset_t);
 229 void    cleanlocks(struct vnode *, pid_t, int);
 230 locklist_t *flk_get_sleeping_locks(int sysid, pid_t pid);
 231 locklist_t *flk_get_active_locks(int sysid, pid_t pid);
 232 locklist_t *flk_active_locks_for_vp(const struct vnode *vp);
 233 locklist_t *flk_active_nbmand_locks_for_vp(const struct vnode *vp);
 234 locklist_t *flk_active_nbmand_locks(pid_t pid);
 235 void    flk_free_locklist(locklist_t *);
 236 int     flk_convert_lock_data(struct vnode *, struct flock64 *,
 237                 u_offset_t *, u_offset_t *, offset_t);
 238 int     flk_check_lock_data(u_offset_t, u_offset_t, offset_t);
 239 int     flk_has_remote_locks(struct vnode *vp);
 240 void    flk_set_lockmgr_status(flk_lockmgr_status_t status);
 241 int     flk_sysid_has_locks(int sysid, int chklck);
 242 int     flk_has_remote_locks_for_sysid(vnode_t *vp, int);
 243 void    flk_init_callback(flk_callback_t *,
 244                 callb_cpr_t *(*)(flk_cb_when_t, void *), void *);
 245 void    flk_add_callback(flk_callback_t *,
 246                 callb_cpr_t *(*)(flk_cb_when_t, void *), void *,
 247                 flk_callback_t *);
 248 callb_cpr_t *flk_invoke_callbacks(flk_callback_t *, flk_cb_when_t);
 249 
 250 /* Zones hooks */
 251 extern  zone_key_t flock_zone_key;
 252 
 253 void    *flk_zone_init(zoneid_t);
 254 void    flk_zone_fini(zoneid_t, void *);
 255 
 256 /* Clustering hooks */
 257 void    cl_flk_set_nlm_status(int nlmid, flk_nlm_status_t nlm_state);
 258 void    cl_flk_remove_locks_by_sysid(int sysid);
 259 int     cl_flk_has_remote_locks_for_nlmid(struct vnode *vp, int nlmid);
 260 void    cl_flk_change_nlm_state_to_unknown(int nlmid);
 261 void    cl_flk_delete_pxfs_locks(struct vfs *vfsp, int pxfsid);
 262 #endif /* _KERNEL */