xref: /dragonfly/sys/vfs/isofs/cd9660/cd9660_node.h (revision e98bdfd3)
1 /*-
2  * Copyright (c) 1994
3  *	The Regents of the University of California.  All rights reserved.
4  *
5  * This code is derived from software contributed to Berkeley
6  * by Pace Willisson (pace@blitz.com).  The Rock Ridge Extension
7  * Support code is derived from software contributed to Berkeley
8  * by Atsushi Murai (amurai@spec.co.jp).
9  *
10  * Redistribution and use in source and binary forms, with or without
11  * modification, are permitted provided that the following conditions
12  * are met:
13  * 1. Redistributions of source code must retain the above copyright
14  *    notice, this list of conditions and the following disclaimer.
15  * 2. Redistributions in binary form must reproduce the above copyright
16  *    notice, this list of conditions and the following disclaimer in the
17  *    documentation and/or other materials provided with the distribution.
18  * 3. Neither the name of the University nor the names of its contributors
19  *    may be used to endorse or promote products derived from this software
20  *    without specific prior written permission.
21  *
22  * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
23  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
24  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
25  * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
26  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
27  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
28  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
29  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
30  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
31  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
32  * SUCH DAMAGE.
33  *
34  *	@(#)cd9660_node.h	8.6 (Berkeley) 5/14/95
35  * $FreeBSD: src/sys/isofs/cd9660/cd9660_node.h,v 1.20 1999/12/29 04:54:37 peter Exp $
36  */
37 
38 #include <sys/lockf.h>
39 
40 /*
41  * Theoretically, directories can be more than 2Gb in length,
42  * however, in practice this seems unlikely. So, we define
43  * the type doff_t as a long to keep down the cost of doing
44  * lookup on a 32-bit machine. If you are porting to a 64-bit
45  * architecture, you should make doff_t the same as off_t.
46  */
47 #define doff_t	long
48 
49 typedef	struct	{
50 	struct timespec	iso_atime;	/* time of last access */
51 	struct timespec	iso_mtime;	/* time of last modification */
52 	struct timespec	iso_ctime;	/* time file changed */
53 	u_short		iso_mode;	/* files access mode and type */
54 	uid_t		iso_uid;	/* owner user id */
55 	gid_t		iso_gid;	/* owner group id */
56 	short		iso_links;	/* links of file */
57 	udev_t		iso_rdev;	/* Major/Minor number for special */
58 } ISO_RRIP_INODE;
59 
60 
61 struct iso_node {
62 	struct	iso_node *i_next; /* hash chain */
63 	struct	vnode *i_vnode;	/* vnode associated with this inode */
64 	struct	vnode *i_devvp;	/* vnode for block I/O */
65 	u_long	i_flag;		/* see below */
66 	cdev_t	i_dev;		/* device where inode resides */
67 	ino_t	i_number;	/* the identity of the inode */
68 				/* we use the actual starting block of the file */
69 	struct	iso_mnt *i_mnt;	/* filesystem associated with this inode */
70 	struct	lockf i_lockf;	/* head of byte-level lock list */
71 	doff_t	i_endoff;	/* end of useful stuff in directory */
72 	doff_t	i_diroff;	/* offset in dir, where we found last entry */
73 	doff_t	i_offset;	/* offset of free space in directory */
74 	ino_t	i_ino;		/* inode number of found directory */
75 
76 	unsigned long iso_extent;	/* extent of file */
77 	unsigned long i_size;
78 	unsigned long iso_start;	/* actual start of data of file (may be different */
79 					/* from iso_extent, if file has extended attributes) */
80 	ISO_RRIP_INODE	inode;
81 };
82 
83 #define	i_forw		i_chain[0]
84 #define	i_back		i_chain[1]
85 
86 /* flags */
87 #define	IN_ACCESS	0x0020		/* inode access time to be updated */
88 
89 #define VTOI(vp) ((struct iso_node *)(vp)->v_data)
90 #define ITOV(ip) ((ip)->i_vnode)
91 
92 #ifdef _KERNEL
93 
94 #ifdef MALLOC_DECLARE
95 MALLOC_DECLARE(M_ISOFSMNT);
96 MALLOC_DECLARE(M_ISOFSNODE);
97 #endif
98 
99 struct buf;
100 struct vop_bmap_args;
101 struct vop_old_lookup_args;
102 struct vop_inactive_args;
103 struct vop_reclaim_args;
104 
105 /*
106  * Prototypes for ISOFS vnode operations
107  */
108 int cd9660_lookup(struct vop_old_lookup_args *);
109 int cd9660_inactive(struct vop_inactive_args *);
110 int cd9660_reclaim(struct vop_reclaim_args *);
111 int cd9660_bmap(struct vop_bmap_args *);
112 int cd9660_blkatoff(struct vnode *vp, off_t offset, char **res, struct buf **bpp);
113 int cd9660_devblkatoff(struct vnode *vp, off_t offset, char **res, struct buf **bpp);
114 
115 void cd9660_defattr(struct iso_directory_record *,
116 			struct iso_node *, struct buf *, enum ISO_FTYPE);
117 void cd9660_deftstamp(struct iso_directory_record *,
118 			struct iso_node *, struct buf *, enum ISO_FTYPE);
119 struct vnode *cd9660_ihashget(cdev_t, ino_t);
120 int cd9660_ihashins(struct iso_node *);
121 int cd9660_tstamp_conv7(u_char *, struct timespec *, enum ISO_FTYPE);
122 int cd9660_tstamp_conv17(u_char *, struct timespec *);
123 
124 #endif /* _KERNEL */
125