xref: /openbsd/sys/isofs/cd9660/cd9660_node.h (revision df930be7)
1 /*	$NetBSD: cd9660_node.h,v 1.10 1994/12/24 15:30:09 cgd 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.4 (Berkeley) 12/5/94
41  */
42 
43 /*
44  * Theoretically, directories can be more than 2Gb in length,
45  * however, in practice this seems unlikely. So, we define
46  * the type doff_t as a long to keep down the cost of doing
47  * lookup on a 32-bit machine. If you are porting to a 64-bit
48  * architecture, you should make doff_t the same as off_t.
49  */
50 #define doff_t	long
51 
52 typedef	struct	{
53 	struct timespec	iso_atime;	/* time of last access */
54 	struct timespec	iso_mtime;	/* time of last modification */
55 	struct timespec	iso_ctime;	/* time file changed */
56 	u_short		iso_mode;	/* files access mode and type */
57 	uid_t		iso_uid;	/* owner user id */
58 	gid_t		iso_gid;	/* owner group id */
59 	short		iso_links;	/* links of file */
60 	dev_t		iso_rdev;	/* Major/Minor number for special */
61 } ISO_RRIP_INODE;
62 
63 #ifdef ISODEVMAP
64 /*
65  * FOr device# (major,minor) translation table
66  */
67 struct iso_dnode {
68 	struct iso_dnode *d_next, **d_prev;	/* hash chain */
69 	dev_t		i_dev;		/* device where dnode resides */
70 	ino_t		i_number;	/* the identity of the inode */
71 	dev_t		d_dev;		/* device # for translation */
72 };
73 #endif
74 
75 struct iso_node {
76 	struct	iso_node *i_next, **i_prev;	/* hash chain */
77 	struct	vnode *i_vnode;	/* vnode associated with this inode */
78 	struct	vnode *i_devvp;	/* vnode for block I/O */
79 	u_long	i_flag;		/* see below */
80 	dev_t	i_dev;		/* device where inode resides */
81 	ino_t	i_number;	/* the identity of the inode */
82 				/* we use the actual starting block of the file */
83 	struct	iso_mnt *i_mnt;	/* filesystem associated with this inode */
84 	struct	lockf *i_lockf;	/* head of byte-level lock list */
85 	doff_t	i_endoff;	/* end of useful stuff in directory */
86 	doff_t	i_diroff;	/* offset in dir, where we found last entry */
87 	doff_t	i_offset;	/* offset of free space in directory */
88 	ino_t	i_ino;		/* inode number of found directory */
89 	pid_t	i_lockholder, i_lockwaiter;
90 
91 	long iso_extent;	/* extent of file */
92 	long i_size;
93 	long iso_start;		/* actual start of data of file (may be different */
94 				/* from iso_extent, if file has extended attributes) */
95 	ISO_RRIP_INODE  inode;
96 };
97 
98 #define	i_forw		i_chain[0]
99 #define	i_back		i_chain[1]
100 
101 /* flags */
102 #define	IN_LOCKED	0x0001		/* inode is locked */
103 #define	IN_WANTED	0x0002		/* some process waiting on lock */
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((struct vop_lookup_args *));
113 int cd9660_open __P((struct vop_open_args *));
114 int cd9660_close __P((struct vop_close_args *));
115 int cd9660_access __P((struct vop_access_args *));
116 int cd9660_getattr __P((struct vop_getattr_args *));
117 int cd9660_read __P((struct vop_read_args *));
118 int cd9660_ioctl __P((struct vop_ioctl_args *));
119 int cd9660_select __P((struct vop_select_args *));
120 int cd9660_mmap __P((struct vop_mmap_args *));
121 int cd9660_seek __P((struct vop_seek_args *));
122 int cd9660_readdir __P((struct vop_readdir_args *));
123 int cd9660_readlink __P((struct vop_readlink_args *));
124 int cd9660_abortop __P((struct vop_abortop_args *));
125 int cd9660_inactive __P((struct vop_inactive_args *));
126 int cd9660_reclaim __P((struct vop_reclaim_args *));
127 int cd9660_bmap __P((struct vop_bmap_args *));
128 int cd9660_lock __P((struct vop_lock_args *));
129 int cd9660_unlock __P((struct vop_unlock_args *));
130 int cd9660_strategy __P((struct vop_strategy_args *));
131 int cd9660_print __P((struct vop_print_args *));
132 int cd9660_islocked __P((struct vop_islocked_args *));
133 int cd9660_pathconf __P((struct vop_pathconf_args *));
134 int cd9660_blkatoff __P((struct vop_blkatoff_args *));
135 
136 void cd9660_defattr __P((struct iso_directory_record *,
137 			struct iso_node *, struct buf *));
138 void cd9660_deftstamp __P((struct iso_directory_record *,
139 			struct iso_node *, struct buf *));
140 struct vnode *cd9660_ihashget __P((dev_t, ino_t));
141 void cd9660_ihashins __P((struct iso_node *));
142 void cd9660_ihashrem __P((struct iso_node *));
143 int cd9660_tstamp_conv7 __P((u_char *, struct timespec *));
144 int cd9660_tstamp_conv17 __P((u_char *, struct timespec *));
145 ino_t isodirino __P((struct iso_directory_record *, struct iso_mnt *));
146 #ifdef	ISODEVMAP
147 struct iso_dnode *iso_dmap __P((dev_t, ino_t, int));
148 void iso_dunmap __P((dev_t));
149 #endif
150