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>


   2  * CDDL HEADER START
   3  *
   4  * The contents of this file are subject to the terms of the
   5  * Common Development and Distribution License (the "License").
   6  * You may not use this file except in compliance with the License.
   7  *
   8  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
   9  * or http://www.opensolaris.org/os/licensing.
  10  * See the License for the specific language governing permissions
  11  * and limitations under the License.
  12  *
  13  * When distributing Covered Code, include this CDDL HEADER in each
  14  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
  15  * If applicable, add the following below this CDDL HEADER, with the
  16  * fields enclosed by brackets "[]" replaced with your own identifying
  17  * information: Portions Copyright [yyyy] [name of copyright owner]
  18  *
  19  * CDDL HEADER END
  20  */
  21 /*



  22  * Copyright 2008 Sun Microsystems, Inc.  All rights reserved.
  23  * Use is subject to license terms.
  24  */
  25 
  26 #ifndef _SYS_SHARE_H
  27 #define _SYS_SHARE_H
  28 
  29 #include <sys/types.h>
  30 
  31 #ifdef  __cplusplus
  32 extern "C" {
  33 #endif
  34 
  35 /*
  36  * Maximum size of a shrlock owner.
  37  * Must be large enough to handle a netobj.
  38  */
  39 #define MAX_SHR_OWNER_LEN       1024
  40 
  41 /*


  49 struct shrlock {
  50         short   s_access;
  51         short   s_deny;
  52         int32_t s_sysid;        /* 0 if local otherwise passed by lm */
  53         pid_t   s_pid;          /* 0 if remote otherwise local pid */
  54         int     s_own_len;      /* if 0 and F_UNSHARE matching sysid */
  55         caddr_t s_owner;        /* variable length opaque owner */
  56 };
  57 
  58 struct shrlocklist {
  59         struct shrlock *shr;
  60         struct shrlocklist *next;
  61 };
  62 
  63 #if defined(_KERNEL)
  64 struct flock64;
  65 
  66 extern int add_share(struct vnode *, struct shrlock *);
  67 extern int del_share(struct vnode *, struct shrlock *);
  68 extern void cleanshares(struct vnode *, pid_t);

  69 extern int shr_has_remote_shares(vnode_t *, int32_t);
  70 extern int proc_has_nbmand_share_on_vp(vnode_t *, pid_t);
  71 #endif /* _KERNEL */
  72 
  73 #ifdef  __cplusplus
  74 }
  75 #endif
  76 
  77 #endif /* _SYS_SHARE_H */


   2  * CDDL HEADER START
   3  *
   4  * The contents of this file are subject to the terms of the
   5  * Common Development and Distribution License (the "License").
   6  * You may not use this file except in compliance with the License.
   7  *
   8  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
   9  * or http://www.opensolaris.org/os/licensing.
  10  * See the License for the specific language governing permissions
  11  * and limitations under the License.
  12  *
  13  * When distributing Covered Code, include this CDDL HEADER in each
  14  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
  15  * If applicable, add the following below this CDDL HEADER, with the
  16  * fields enclosed by brackets "[]" replaced with your own identifying
  17  * information: Portions Copyright [yyyy] [name of copyright owner]
  18  *
  19  * CDDL HEADER END
  20  */
  21 /*
  22  * Copyright 2011 Nexenta Systems, Inc.  All rights reserved.
  23  */
  24 /*
  25  * Copyright 2008 Sun Microsystems, Inc.  All rights reserved.
  26  * Use is subject to license terms.
  27  */
  28 
  29 #ifndef _SYS_SHARE_H
  30 #define _SYS_SHARE_H
  31 
  32 #include <sys/types.h>
  33 
  34 #ifdef  __cplusplus
  35 extern "C" {
  36 #endif
  37 
  38 /*
  39  * Maximum size of a shrlock owner.
  40  * Must be large enough to handle a netobj.
  41  */
  42 #define MAX_SHR_OWNER_LEN       1024
  43 
  44 /*


  52 struct shrlock {
  53         short   s_access;
  54         short   s_deny;
  55         int32_t s_sysid;        /* 0 if local otherwise passed by lm */
  56         pid_t   s_pid;          /* 0 if remote otherwise local pid */
  57         int     s_own_len;      /* if 0 and F_UNSHARE matching sysid */
  58         caddr_t s_owner;        /* variable length opaque owner */
  59 };
  60 
  61 struct shrlocklist {
  62         struct shrlock *shr;
  63         struct shrlocklist *next;
  64 };
  65 
  66 #if defined(_KERNEL)
  67 struct flock64;
  68 
  69 extern int add_share(struct vnode *, struct shrlock *);
  70 extern int del_share(struct vnode *, struct shrlock *);
  71 extern void cleanshares(struct vnode *, pid_t);
  72 extern void cleanshares_by_sysid(struct vnode *, int32_t);
  73 extern int shr_has_remote_shares(vnode_t *, int32_t);
  74 extern int proc_has_nbmand_share_on_vp(vnode_t *, pid_t);
  75 #endif /* _KERNEL */
  76 
  77 #ifdef  __cplusplus
  78 }
  79 #endif
  80 
  81 #endif /* _SYS_SHARE_H */