xref: /freebsd/sys/fs/cd9660/cd9660_node.h (revision 51369649b03ece2aed3eb61b0c8214b9aa5b2fa2)
1df8bae1dSRodney W. Grimes /*-
2*51369649SPedro F. Giffuni  * SPDX-License-Identifier: BSD-3-Clause
3*51369649SPedro F. Giffuni  *
4df8bae1dSRodney W. Grimes  * Copyright (c) 1994
5df8bae1dSRodney W. Grimes  *	The Regents of the University of California.  All rights reserved.
6df8bae1dSRodney W. Grimes  *
7df8bae1dSRodney W. Grimes  * This code is derived from software contributed to Berkeley
8df8bae1dSRodney W. Grimes  * by Pace Willisson (pace@blitz.com).  The Rock Ridge Extension
9df8bae1dSRodney W. Grimes  * Support code is derived from software contributed to Berkeley
10df8bae1dSRodney W. Grimes  * by Atsushi Murai (amurai@spec.co.jp).
11df8bae1dSRodney W. Grimes  *
12df8bae1dSRodney W. Grimes  * Redistribution and use in source and binary forms, with or without
13df8bae1dSRodney W. Grimes  * modification, are permitted provided that the following conditions
14df8bae1dSRodney W. Grimes  * are met:
15df8bae1dSRodney W. Grimes  * 1. Redistributions of source code must retain the above copyright
16df8bae1dSRodney W. Grimes  *    notice, this list of conditions and the following disclaimer.
17df8bae1dSRodney W. Grimes  * 2. Redistributions in binary form must reproduce the above copyright
18df8bae1dSRodney W. Grimes  *    notice, this list of conditions and the following disclaimer in the
19df8bae1dSRodney W. Grimes  *    documentation and/or other materials provided with the distribution.
20fbbd9655SWarner Losh  * 3. Neither the name of the University nor the names of its contributors
21df8bae1dSRodney W. Grimes  *    may be used to endorse or promote products derived from this software
22df8bae1dSRodney W. Grimes  *    without specific prior written permission.
23df8bae1dSRodney W. Grimes  *
24df8bae1dSRodney W. Grimes  * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
25df8bae1dSRodney W. Grimes  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
26df8bae1dSRodney W. Grimes  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
27df8bae1dSRodney W. Grimes  * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
28df8bae1dSRodney W. Grimes  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
29df8bae1dSRodney W. Grimes  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
30df8bae1dSRodney W. Grimes  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
31df8bae1dSRodney W. Grimes  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
32df8bae1dSRodney W. Grimes  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
33df8bae1dSRodney W. Grimes  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
34df8bae1dSRodney W. Grimes  * SUCH DAMAGE.
35df8bae1dSRodney W. Grimes  *
36996c772fSJohn Dyson  *	@(#)cd9660_node.h	8.6 (Berkeley) 5/14/95
37c3aac50fSPeter Wemm  * $FreeBSD$
38df8bae1dSRodney W. Grimes  */
39df8bae1dSRodney W. Grimes 
40df8bae1dSRodney W. Grimes /*
41df8bae1dSRodney W. Grimes  * Theoretically, directories can be more than 2Gb in length,
42df8bae1dSRodney W. Grimes  * however, in practice this seems unlikely. So, we define
43df8bae1dSRodney W. Grimes  * the type doff_t as a long to keep down the cost of doing
44df8bae1dSRodney W. Grimes  * lookup on a 32-bit machine. If you are porting to a 64-bit
45df8bae1dSRodney W. Grimes  * architecture, you should make doff_t the same as off_t.
46df8bae1dSRodney W. Grimes  */
47df8bae1dSRodney W. Grimes #define doff_t	long
48df8bae1dSRodney W. Grimes 
49df8bae1dSRodney W. Grimes typedef	struct	{
50df8bae1dSRodney W. Grimes 	struct timespec	iso_atime;	/* time of last access */
51df8bae1dSRodney W. Grimes 	struct timespec	iso_mtime;	/* time of last modification */
52df8bae1dSRodney W. Grimes 	struct timespec	iso_ctime;	/* time file changed */
53df8bae1dSRodney W. Grimes 	u_short		iso_mode;	/* files access mode and type */
54df8bae1dSRodney W. Grimes 	uid_t		iso_uid;	/* owner user id */
55df8bae1dSRodney W. Grimes 	gid_t		iso_gid;	/* owner group id */
56df8bae1dSRodney W. Grimes 	short		iso_links;	/* links of file */
57f3732fd1SPoul-Henning Kamp 	dev_t		iso_rdev;	/* Major/Minor number for special */
58df8bae1dSRodney W. Grimes } ISO_RRIP_INODE;
59df8bae1dSRodney W. Grimes 
60df8bae1dSRodney W. Grimes 
61df8bae1dSRodney W. Grimes struct iso_node {
62df8bae1dSRodney W. Grimes 	struct	vnode *i_vnode;	/* vnode associated with this inode */
63dbaab6e6SConrad Meyer 	cd_ino_t	i_number;	/* the identity of the inode */
64df8bae1dSRodney W. Grimes 				/* we use the actual starting block of the file */
65df8bae1dSRodney W. Grimes 	struct	iso_mnt *i_mnt;	/* filesystem associated with this inode */
66df8bae1dSRodney W. Grimes 	struct	lockf *i_lockf;	/* head of byte-level lock list */
67df8bae1dSRodney W. Grimes 	doff_t	i_endoff;	/* end of useful stuff in directory */
68df8bae1dSRodney W. Grimes 	doff_t	i_diroff;	/* offset in dir, where we found last entry */
69df8bae1dSRodney W. Grimes 
70df8bae1dSRodney W. Grimes 	long iso_extent;	/* extent of file */
718d3027e2STim Kientzle 	unsigned long i_size;
72df8bae1dSRodney W. Grimes 	long iso_start;		/* actual start of data of file (may be different */
73df8bae1dSRodney W. Grimes 				/* from iso_extent, if file has extended attributes) */
74df8bae1dSRodney W. Grimes 	ISO_RRIP_INODE	inode;
75df8bae1dSRodney W. Grimes };
76df8bae1dSRodney W. Grimes 
77df8bae1dSRodney W. Grimes #define	i_forw		i_chain[0]
78df8bae1dSRodney W. Grimes #define	i_back		i_chain[1]
79df8bae1dSRodney W. Grimes 
80df8bae1dSRodney W. Grimes #define VTOI(vp) ((struct iso_node *)(vp)->v_data)
81df8bae1dSRodney W. Grimes #define ITOV(ip) ((ip)->i_vnode)
82df8bae1dSRodney W. Grimes 
83c4473420SPeter Wemm #ifdef _KERNEL
84c53e436eSBruce Evans 
85a1c995b6SPoul-Henning Kamp #ifdef MALLOC_DECLARE
86a1c995b6SPoul-Henning Kamp MALLOC_DECLARE(M_ISOFSMNT);
87a1c995b6SPoul-Henning Kamp MALLOC_DECLARE(M_ISOFSNODE);
88a1c995b6SPoul-Henning Kamp #endif
89a1c995b6SPoul-Henning Kamp 
90c53e436eSBruce Evans struct buf;
91c53e436eSBruce Evans struct vop_bmap_args;
92c53e436eSBruce Evans struct vop_cachedlookup_args;
93c53e436eSBruce Evans struct vop_inactive_args;
94c53e436eSBruce Evans struct vop_reclaim_args;
95c53e436eSBruce Evans 
96df8bae1dSRodney W. Grimes /*
97df8bae1dSRodney W. Grimes  * Prototypes for ISOFS vnode operations
98df8bae1dSRodney W. Grimes  */
9989c9a483SAlfred Perlstein int cd9660_lookup(struct vop_cachedlookup_args *);
10089c9a483SAlfred Perlstein int cd9660_inactive(struct vop_inactive_args *);
10189c9a483SAlfred Perlstein int cd9660_reclaim(struct vop_reclaim_args *);
10289c9a483SAlfred Perlstein int cd9660_bmap(struct vop_bmap_args *);
10389c9a483SAlfred Perlstein int cd9660_blkatoff(struct vnode *vp, off_t offset, char **res, struct buf **bpp);
104996c772fSJohn Dyson 
10589c9a483SAlfred Perlstein void cd9660_defattr(struct iso_directory_record *,
10689c9a483SAlfred Perlstein 			struct iso_node *, struct buf *, enum ISO_FTYPE);
10789c9a483SAlfred Perlstein void cd9660_deftstamp(struct iso_directory_record *,
10889c9a483SAlfred Perlstein 			struct iso_node *, struct buf *, enum ISO_FTYPE);
10989c9a483SAlfred Perlstein int cd9660_tstamp_conv7(u_char *, struct timespec *, enum ISO_FTYPE);
11089c9a483SAlfred Perlstein int cd9660_tstamp_conv17(u_char *, struct timespec *);
111c53e436eSBruce Evans 
112c4473420SPeter Wemm #endif /* _KERNEL */
113