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