xref: /netbsd-src/sys/fs/cd9660/cd9660_node.h (revision d710132b4b8ce7f7cccaaf660cb16aa16b4077a0)
1 /*	$NetBSD: cd9660_node.h,v 1.1 2002/12/23 17:52:09 jdolecek Exp $	*/
2 
3 /*-
4  * Copyright (c) 1994
5  *	The Regents of the University of California.  All rights reserved.
6  *
7  * This code is derived from software contributed to Berkeley
8  * by Pace Willisson (pace@blitz.com).  The Rock Ridge Extension
9  * Support code is derived from software contributed to Berkeley
10  * by Atsushi Murai (amurai@spec.co.jp).
11  *
12  * Redistribution and use in source and binary forms, with or without
13  * modification, are permitted provided that the following conditions
14  * are met:
15  * 1. Redistributions of source code must retain the above copyright
16  *    notice, this list of conditions and the following disclaimer.
17  * 2. Redistributions in binary form must reproduce the above copyright
18  *    notice, this list of conditions and the following disclaimer in the
19  *    documentation and/or other materials provided with the distribution.
20  * 3. All advertising materials mentioning features or use of this software
21  *    must display the following acknowledgement:
22  *	This product includes software developed by the University of
23  *	California, Berkeley and its contributors.
24  * 4. Neither the name of the University nor the names of its contributors
25  *    may be used to endorse or promote products derived from this software
26  *    without specific prior written permission.
27  *
28  * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
29  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
30  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
31  * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
32  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
33  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
34  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
35  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
36  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
37  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
38  * SUCH DAMAGE.
39  *
40  *	@(#)cd9660_node.h	8.6 (Berkeley) 5/14/95
41  */
42 
43 #include <miscfs/genfs/genfs_node.h>
44 
45 /*
46  * Theoretically, directories can be more than 2Gb in length,
47  * however, in practice this seems unlikely. So, we define
48  * the type doff_t as a long to keep down the cost of doing
49  * lookup on a 32-bit machine. If you are porting to a 64-bit
50  * architecture, you should make doff_t the same as off_t.
51  */
52 #define doff_t	long
53 
54 typedef	struct	{
55 	struct timespec	iso_atime;	/* time of last access */
56 	struct timespec	iso_mtime;	/* time of last modification */
57 	struct timespec	iso_ctime;	/* time file changed */
58 	u_short		iso_mode;	/* files access mode and type */
59 	uid_t		iso_uid;	/* owner user id */
60 	gid_t		iso_gid;	/* owner group id */
61 	short		iso_links;	/* links of file */
62 	dev_t		iso_rdev;	/* Major/Minor number for special */
63 } ISO_RRIP_INODE;
64 
65 #ifdef ISODEVMAP
66 /*
67  * FOr device# (major,minor) translation table
68  */
69 struct iso_dnode {
70 	LIST_ENTRY(iso_dnode) d_hash;
71 	dev_t		i_dev;		/* device where dnode resides */
72 	ino_t		i_number;	/* the identity of the inode */
73 	dev_t		d_dev;		/* device # for translation */
74 };
75 #endif
76 
77 struct iso_node {
78 	struct	genfs_node i_gnode;
79 	LIST_ENTRY(iso_node) i_hash;
80 	struct	vnode *i_vnode;	/* vnode associated with this inode */
81 	struct	vnode *i_devvp;	/* vnode for block I/O */
82 	u_long	i_flag;		/* see below */
83 	dev_t	i_dev;		/* device where inode resides */
84 	ino_t	i_number;	/* the identity of the inode */
85 				/* we use the actual starting block of the file */
86 	struct	iso_mnt *i_mnt;	/* filesystem associated with this inode */
87 	struct	lockf *i_lockf;	/* head of byte-level lock list */
88 	doff_t	i_endoff;	/* end of useful stuff in directory */
89 	doff_t	i_diroff;	/* offset in dir, where we found last entry */
90 	doff_t	i_offset;	/* offset of free space in directory */
91 	ino_t	i_ino;		/* inode number of found directory */
92 
93 	long iso_extent;	/* extent of file */
94 	long i_size;
95 	long iso_start;		/* actual start of data of file (may be different */
96 				/* from iso_extent, if file has extended attributes) */
97 	ISO_RRIP_INODE  inode;
98 };
99 
100 #define	i_forw		i_chain[0]
101 #define	i_back		i_chain[1]
102 
103 /* flags */
104 #define	IN_ACCESS	0x0020		/* inode access time to be updated */
105 
106 #define VTOI(vp) ((struct iso_node *)(vp)->v_data)
107 #define ITOV(ip) ((ip)->i_vnode)
108 
109 /*
110  * Prototypes for ISOFS vnode operations
111  */
112 int	cd9660_lookup	__P((void *));
113 #define	cd9660_open	genfs_nullop
114 #define	cd9660_close	genfs_nullop
115 int	cd9660_access	__P((void *));
116 int	cd9660_getattr	__P((void *));
117 int	cd9660_read	__P((void *));
118 #define	cd9660_ioctl	genfs_enoioctl
119 #define	cd9660_poll	genfs_poll
120 #define	cd9660_mmap	genfs_mmap
121 #define	cd9660_seek	genfs_seek
122 int	cd9660_readdir	__P((void *));
123 int	cd9660_readlink	__P((void *));
124 #define	cd9660_abortop	genfs_abortop
125 int	cd9660_inactive	__P((void *));
126 int	cd9660_reclaim	__P((void *));
127 int	cd9660_link	__P((void *));
128 int	cd9660_symlink	__P((void *));
129 int	cd9660_bmap	__P((void *));
130 int	cd9660_lock	__P((void *));
131 int	cd9660_unlock	__P((void *));
132 int	cd9660_strategy	__P((void *));
133 int	cd9660_print	__P((void *));
134 int	cd9660_islocked	__P((void *));
135 int	cd9660_pathconf	__P((void *));
136 int	cd9660_setattr	__P((void *));
137 int	cd9660_blkatoff	__P((void *));
138 
139 void	cd9660_defattr __P((struct iso_directory_record *,
140 			struct iso_node *, struct buf *));
141 void	cd9660_deftstamp __P((struct iso_directory_record *,
142 			struct iso_node *, struct buf *));
143 struct	vnode *cd9660_ihashget __P((dev_t, ino_t));
144 void	cd9660_ihashins __P((struct iso_node *));
145 void	cd9660_ihashrem __P((struct iso_node *));
146 int	cd9660_tstamp_conv7 __P((u_char *, struct timespec *));
147 int	cd9660_tstamp_conv17 __P((u_char *, struct timespec *));
148 int	cd9660_vget_internal __P((struct mount *, ino_t, struct vnode **, int,
149 			      struct iso_directory_record *));
150 #ifdef	ISODEVMAP
151 struct iso_dnode *iso_dmap __P((dev_t, ino_t, int));
152 void iso_dunmap __P((dev_t));
153 #endif
154