xref: /onnv-gate/usr/src/uts/common/sys/share.h (revision 7961:4b5e3051f38b)
10Sstevel@tonic-gate /*
20Sstevel@tonic-gate  * CDDL HEADER START
30Sstevel@tonic-gate  *
40Sstevel@tonic-gate  * The contents of this file are subject to the terms of the
5*7961SNatalie.Li@Sun.COM  * Common Development and Distribution License (the "License").
6*7961SNatalie.Li@Sun.COM  * You may not use this file except in compliance with the License.
70Sstevel@tonic-gate  *
80Sstevel@tonic-gate  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
90Sstevel@tonic-gate  * or http://www.opensolaris.org/os/licensing.
100Sstevel@tonic-gate  * See the License for the specific language governing permissions
110Sstevel@tonic-gate  * and limitations under the License.
120Sstevel@tonic-gate  *
130Sstevel@tonic-gate  * When distributing Covered Code, include this CDDL HEADER in each
140Sstevel@tonic-gate  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
150Sstevel@tonic-gate  * If applicable, add the following below this CDDL HEADER, with the
160Sstevel@tonic-gate  * fields enclosed by brackets "[]" replaced with your own identifying
170Sstevel@tonic-gate  * information: Portions Copyright [yyyy] [name of copyright owner]
180Sstevel@tonic-gate  *
190Sstevel@tonic-gate  * CDDL HEADER END
200Sstevel@tonic-gate  */
210Sstevel@tonic-gate /*
22*7961SNatalie.Li@Sun.COM  * Copyright 2008 Sun Microsystems, Inc.  All rights reserved.
23*7961SNatalie.Li@Sun.COM  * Use is subject to license terms.
240Sstevel@tonic-gate  */
250Sstevel@tonic-gate 
260Sstevel@tonic-gate #ifndef _SYS_SHARE_H
270Sstevel@tonic-gate #define	_SYS_SHARE_H
280Sstevel@tonic-gate 
290Sstevel@tonic-gate #include <sys/types.h>
300Sstevel@tonic-gate 
310Sstevel@tonic-gate #ifdef	__cplusplus
320Sstevel@tonic-gate extern "C" {
330Sstevel@tonic-gate #endif
340Sstevel@tonic-gate 
350Sstevel@tonic-gate /*
360Sstevel@tonic-gate  * Maximum size of a shrlock owner.
370Sstevel@tonic-gate  * Must be large enough to handle a netobj.
380Sstevel@tonic-gate  */
390Sstevel@tonic-gate #define	MAX_SHR_OWNER_LEN	1024
400Sstevel@tonic-gate 
410Sstevel@tonic-gate /*
420Sstevel@tonic-gate  * Contents of shrlock owner field for local share requests
430Sstevel@tonic-gate  */
440Sstevel@tonic-gate struct shr_locowner {
450Sstevel@tonic-gate 	pid_t	sl_pid;
460Sstevel@tonic-gate 	int	sl_id;
470Sstevel@tonic-gate };
480Sstevel@tonic-gate 
490Sstevel@tonic-gate struct shrlock {
500Sstevel@tonic-gate 	short	s_access;
510Sstevel@tonic-gate 	short	s_deny;
520Sstevel@tonic-gate 	int32_t	s_sysid;	/* 0 if local otherwise passed by lm */
530Sstevel@tonic-gate 	pid_t	s_pid;		/* 0 if remote otherwise local pid */
540Sstevel@tonic-gate 	int	s_own_len;	/* if 0 and F_UNSHARE matching sysid */
550Sstevel@tonic-gate 	caddr_t	s_owner;	/* variable length opaque owner */
560Sstevel@tonic-gate };
570Sstevel@tonic-gate 
580Sstevel@tonic-gate struct shrlocklist {
590Sstevel@tonic-gate 	struct shrlock *shr;
600Sstevel@tonic-gate 	struct shrlocklist *next;
610Sstevel@tonic-gate };
620Sstevel@tonic-gate 
630Sstevel@tonic-gate #if defined(_KERNEL)
640Sstevel@tonic-gate struct flock64;
650Sstevel@tonic-gate 
660Sstevel@tonic-gate extern int add_share(struct vnode *, struct shrlock *);
670Sstevel@tonic-gate extern int del_share(struct vnode *, struct shrlock *);
680Sstevel@tonic-gate extern void cleanshares(struct vnode *, pid_t);
690Sstevel@tonic-gate extern int shr_has_remote_shares(vnode_t *, int32_t);
700Sstevel@tonic-gate extern int proc_has_nbmand_share_on_vp(vnode_t *, pid_t);
710Sstevel@tonic-gate #endif /* _KERNEL */
720Sstevel@tonic-gate 
730Sstevel@tonic-gate #ifdef	__cplusplus
740Sstevel@tonic-gate }
750Sstevel@tonic-gate #endif
760Sstevel@tonic-gate 
770Sstevel@tonic-gate #endif /* _SYS_SHARE_H */
78