1 /* 2 * CDDL HEADER START 3 * 4 * The contents of this file are subject to the terms of the 5 * Common Development and Distribution License, Version 1.0 only 6 * (the "License"). You may not use this file except in compliance 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 (c) 1996-1998,2001 by Sun Microsystems, Inc. 24 * All rights reserved. 25 */ 26 27 #ifndef _SYS_SHARE_H 28 #define _SYS_SHARE_H 29 30 #pragma ident "%Z%%M% %I% %E% SMI" 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 /* 45 * Contents of shrlock owner field for local share requests 46 */ 47 struct shr_locowner { 48 pid_t sl_pid; 49 int sl_id; 50 }; 51 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 int shr_has_remote_shares(vnode_t *, int32_t); 73 extern int proc_has_nbmand_share_on_vp(vnode_t *, pid_t); 74 extern int share_blocks_lock(vnode_t *, struct flock64 *); 75 extern int wait_for_share(vnode_t *, struct flock64 *); 76 #endif /* _KERNEL */ 77 78 #ifdef __cplusplus 79 } 80 #endif 81 82 #endif /* _SYS_SHARE_H */ 83