xref: /titanic_51/usr/src/uts/common/sys/fs/lofs_node.h (revision 46b2e54fef23f79962caefa489542a11b53acd45)
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 (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 2009 Sun Microsystems, Inc.  All rights reserved.
23  * Use is subject to license terms.
24  */
25 
26 /*
27  * Loop-back file information structure.
28  */
29 
30 #ifndef _SYS_FS_LOFS_NODE_H
31 #define	_SYS_FS_LOFS_NODE_H
32 
33 #include <sys/fs/lofs_info.h>
34 
35 #ifdef	__cplusplus
36 extern "C" {
37 #endif
38 
39 /*
40  * The lnode is the "inode" for loop-back files.  It contains
41  * all the information necessary to handle loop-back file on the
42  * client side.
43  */
44 typedef struct lnode {
45 	struct lnode	*lo_next;	/* link for hash chain */
46 	struct vnode	*lo_vp;		/* pointer to real vnode */
47 	uint_t		lo_looping; 	/* looping flags (see below) */
48 	struct vnode	*lo_vnode;	/* place holder vnode for file */
49 } lnode_t;
50 
51 /*
52  * Flags used when looping has been detected.
53  */
54 #define	LO_LOOPING	0x01	/* Looping detected */
55 #define	LO_AUTOLOOP	0x02	/* Autonode looping detected */
56 
57 /*
58  * Flag passed to makelonode().
59  */
60 #define	LOF_FORCE	0x1	/* Force creation of new lnode */
61 
62 /*
63  * Convert between vnode and lnode
64  */
65 #define	ltov(lp)	(((lp)->lo_vnode))
66 #define	vtol(vp)	((struct lnode *)((vp)->v_data))
67 #define	realvp(vp)	(vtol(vp)->lo_vp)
68 
69 #ifdef _KERNEL
70 extern vnode_t *makelonode(vnode_t *, struct loinfo *, int);
71 extern void freelonode(lnode_t *);
72 #endif /* _KERNEL */
73 
74 #ifdef	__cplusplus
75 }
76 #endif
77 
78 #endif	/* _SYS_FS_LOFS_NODE_H */
79