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