xref: /illumos-gate/usr/src/uts/common/sys/fs/lofs_node.h (revision af4c679f)
17c478bd9Sstevel@tonic-gate /*
27c478bd9Sstevel@tonic-gate  * CDDL HEADER START
37c478bd9Sstevel@tonic-gate  *
47c478bd9Sstevel@tonic-gate  * The contents of this file are subject to the terms of the
5*af4c679fSSean McEnroe  * Common Development and Distribution License (the "License").
6*af4c679fSSean McEnroe  * You may not use this file except in compliance with the License.
77c478bd9Sstevel@tonic-gate  *
87c478bd9Sstevel@tonic-gate  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
97c478bd9Sstevel@tonic-gate  * or http://www.opensolaris.org/os/licensing.
107c478bd9Sstevel@tonic-gate  * See the License for the specific language governing permissions
117c478bd9Sstevel@tonic-gate  * and limitations under the License.
127c478bd9Sstevel@tonic-gate  *
137c478bd9Sstevel@tonic-gate  * When distributing Covered Code, include this CDDL HEADER in each
147c478bd9Sstevel@tonic-gate  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
157c478bd9Sstevel@tonic-gate  * If applicable, add the following below this CDDL HEADER, with the
167c478bd9Sstevel@tonic-gate  * fields enclosed by brackets "[]" replaced with your own identifying
177c478bd9Sstevel@tonic-gate  * information: Portions Copyright [yyyy] [name of copyright owner]
187c478bd9Sstevel@tonic-gate  *
197c478bd9Sstevel@tonic-gate  * CDDL HEADER END
207c478bd9Sstevel@tonic-gate  */
217c478bd9Sstevel@tonic-gate /*
22*af4c679fSSean McEnroe  * Copyright 2009 Sun Microsystems, Inc.  All rights reserved.
237c478bd9Sstevel@tonic-gate  * Use is subject to license terms.
247c478bd9Sstevel@tonic-gate  */
257c478bd9Sstevel@tonic-gate 
267c478bd9Sstevel@tonic-gate /*
277c478bd9Sstevel@tonic-gate  * Loop-back file information structure.
287c478bd9Sstevel@tonic-gate  */
297c478bd9Sstevel@tonic-gate 
307c478bd9Sstevel@tonic-gate #ifndef _SYS_FS_LOFS_NODE_H
317c478bd9Sstevel@tonic-gate #define	_SYS_FS_LOFS_NODE_H
327c478bd9Sstevel@tonic-gate 
337c478bd9Sstevel@tonic-gate #include <sys/fs/lofs_info.h>
347c478bd9Sstevel@tonic-gate 
357c478bd9Sstevel@tonic-gate #ifdef	__cplusplus
367c478bd9Sstevel@tonic-gate extern "C" {
377c478bd9Sstevel@tonic-gate #endif
387c478bd9Sstevel@tonic-gate 
397c478bd9Sstevel@tonic-gate /*
407c478bd9Sstevel@tonic-gate  * The lnode is the "inode" for loop-back files.  It contains
417c478bd9Sstevel@tonic-gate  * all the information necessary to handle loop-back file on the
427c478bd9Sstevel@tonic-gate  * client side.
437c478bd9Sstevel@tonic-gate  */
447c478bd9Sstevel@tonic-gate typedef struct lnode {
457c478bd9Sstevel@tonic-gate 	struct lnode	*lo_next;	/* link for hash chain */
467c478bd9Sstevel@tonic-gate 	struct vnode	*lo_vp;		/* pointer to real vnode */
47b431137cSowenr 	uint_t		lo_looping; 	/* looping flags (see below) */
487c478bd9Sstevel@tonic-gate 	struct vnode	*lo_vnode;	/* place holder vnode for file */
497c478bd9Sstevel@tonic-gate } lnode_t;
507c478bd9Sstevel@tonic-gate 
51b431137cSowenr /*
52b431137cSowenr  * Flags used when looping has been detected.
53b431137cSowenr  */
54b431137cSowenr #define	LO_LOOPING	0x01	/* Looping detected */
55b431137cSowenr #define	LO_AUTOLOOP	0x02	/* Autonode looping detected */
56b431137cSowenr 
57b431137cSowenr /*
58b431137cSowenr  * Flag passed to makelonode().
59b431137cSowenr  */
60b431137cSowenr #define	LOF_FORCE	0x1	/* Force creation of new lnode */
61b431137cSowenr 
627c478bd9Sstevel@tonic-gate /*
637c478bd9Sstevel@tonic-gate  * Convert between vnode and lnode
647c478bd9Sstevel@tonic-gate  */
657c478bd9Sstevel@tonic-gate #define	ltov(lp)	(((lp)->lo_vnode))
667c478bd9Sstevel@tonic-gate #define	vtol(vp)	((struct lnode *)((vp)->v_data))
677c478bd9Sstevel@tonic-gate #define	realvp(vp)	(vtol(vp)->lo_vp)
687c478bd9Sstevel@tonic-gate 
697c478bd9Sstevel@tonic-gate #ifdef _KERNEL
70b431137cSowenr extern vnode_t *makelonode(vnode_t *, struct loinfo *, int);
717c478bd9Sstevel@tonic-gate extern void freelonode(lnode_t *);
727c478bd9Sstevel@tonic-gate #endif /* _KERNEL */
737c478bd9Sstevel@tonic-gate 
747c478bd9Sstevel@tonic-gate #ifdef	__cplusplus
757c478bd9Sstevel@tonic-gate }
767c478bd9Sstevel@tonic-gate #endif
777c478bd9Sstevel@tonic-gate 
787c478bd9Sstevel@tonic-gate #endif	/* _SYS_FS_LOFS_NODE_H */
79