xref: /onnv-gate/usr/src/uts/common/sys/fs/lofs_node.h (revision 11185:f0c31008e395)
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*11185SSean.McEnroe@Sun.COM  * Common Development and Distribution License (the "License").
6*11185SSean.McEnroe@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*11185SSean.McEnroe@Sun.COM  * Copyright 2009 Sun Microsystems, Inc.  All rights reserved.
230Sstevel@tonic-gate  * Use is subject to license terms.
240Sstevel@tonic-gate  */
250Sstevel@tonic-gate 
260Sstevel@tonic-gate /*
270Sstevel@tonic-gate  * Loop-back file information structure.
280Sstevel@tonic-gate  */
290Sstevel@tonic-gate 
300Sstevel@tonic-gate #ifndef _SYS_FS_LOFS_NODE_H
310Sstevel@tonic-gate #define	_SYS_FS_LOFS_NODE_H
320Sstevel@tonic-gate 
330Sstevel@tonic-gate #include <sys/fs/lofs_info.h>
340Sstevel@tonic-gate 
350Sstevel@tonic-gate #ifdef	__cplusplus
360Sstevel@tonic-gate extern "C" {
370Sstevel@tonic-gate #endif
380Sstevel@tonic-gate 
390Sstevel@tonic-gate /*
400Sstevel@tonic-gate  * The lnode is the "inode" for loop-back files.  It contains
410Sstevel@tonic-gate  * all the information necessary to handle loop-back file on the
420Sstevel@tonic-gate  * client side.
430Sstevel@tonic-gate  */
440Sstevel@tonic-gate typedef struct lnode {
450Sstevel@tonic-gate 	struct lnode	*lo_next;	/* link for hash chain */
460Sstevel@tonic-gate 	struct vnode	*lo_vp;		/* pointer to real vnode */
47324Sowenr 	uint_t		lo_looping; 	/* looping flags (see below) */
480Sstevel@tonic-gate 	struct vnode	*lo_vnode;	/* place holder vnode for file */
490Sstevel@tonic-gate } lnode_t;
500Sstevel@tonic-gate 
510Sstevel@tonic-gate /*
52324Sowenr  * Flags used when looping has been detected.
53324Sowenr  */
54324Sowenr #define	LO_LOOPING	0x01	/* Looping detected */
55324Sowenr #define	LO_AUTOLOOP	0x02	/* Autonode looping detected */
56324Sowenr 
57324Sowenr /*
58324Sowenr  * Flag passed to makelonode().
59324Sowenr  */
60324Sowenr #define	LOF_FORCE	0x1	/* Force creation of new lnode */
61324Sowenr 
62324Sowenr /*
630Sstevel@tonic-gate  * Convert between vnode and lnode
640Sstevel@tonic-gate  */
650Sstevel@tonic-gate #define	ltov(lp)	(((lp)->lo_vnode))
660Sstevel@tonic-gate #define	vtol(vp)	((struct lnode *)((vp)->v_data))
670Sstevel@tonic-gate #define	realvp(vp)	(vtol(vp)->lo_vp)
680Sstevel@tonic-gate 
690Sstevel@tonic-gate #ifdef _KERNEL
70324Sowenr extern vnode_t *makelonode(vnode_t *, struct loinfo *, int);
710Sstevel@tonic-gate extern void freelonode(lnode_t *);
720Sstevel@tonic-gate #endif /* _KERNEL */
730Sstevel@tonic-gate 
740Sstevel@tonic-gate #ifdef	__cplusplus
750Sstevel@tonic-gate }
760Sstevel@tonic-gate #endif
770Sstevel@tonic-gate 
780Sstevel@tonic-gate #endif	/* _SYS_FS_LOFS_NODE_H */
79