xref: /minix3/sys/fs/cd9660/cd9660_node.h (revision 0a6a1f1d05b60e214de2f05a7310ddd1f0e590e7)
1*0a6a1f1dSLionel Sambuc /*	$NetBSD: cd9660_node.h,v 1.16 2014/06/16 09:55:49 hannken Exp $	*/
284d9c625SLionel Sambuc 
384d9c625SLionel Sambuc /*-
484d9c625SLionel Sambuc  * Copyright (c) 1994
584d9c625SLionel Sambuc  *	The Regents of the University of California.  All rights reserved.
684d9c625SLionel Sambuc  *
784d9c625SLionel Sambuc  * This code is derived from software contributed to Berkeley
884d9c625SLionel Sambuc  * by Pace Willisson (pace@blitz.com).  The Rock Ridge Extension
984d9c625SLionel Sambuc  * Support code is derived from software contributed to Berkeley
1084d9c625SLionel Sambuc  * by Atsushi Murai (amurai@spec.co.jp).
1184d9c625SLionel Sambuc  *
1284d9c625SLionel Sambuc  * Redistribution and use in source and binary forms, with or without
1384d9c625SLionel Sambuc  * modification, are permitted provided that the following conditions
1484d9c625SLionel Sambuc  * are met:
1584d9c625SLionel Sambuc  * 1. Redistributions of source code must retain the above copyright
1684d9c625SLionel Sambuc  *    notice, this list of conditions and the following disclaimer.
1784d9c625SLionel Sambuc  * 2. Redistributions in binary form must reproduce the above copyright
1884d9c625SLionel Sambuc  *    notice, this list of conditions and the following disclaimer in the
1984d9c625SLionel Sambuc  *    documentation and/or other materials provided with the distribution.
2084d9c625SLionel Sambuc  * 3. Neither the name of the University nor the names of its contributors
2184d9c625SLionel Sambuc  *    may be used to endorse or promote products derived from this software
2284d9c625SLionel Sambuc  *    without specific prior written permission.
2384d9c625SLionel Sambuc  *
2484d9c625SLionel Sambuc  * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
2584d9c625SLionel Sambuc  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
2684d9c625SLionel Sambuc  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
2784d9c625SLionel Sambuc  * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
2884d9c625SLionel Sambuc  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
2984d9c625SLionel Sambuc  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
3084d9c625SLionel Sambuc  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
3184d9c625SLionel Sambuc  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
3284d9c625SLionel Sambuc  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
3384d9c625SLionel Sambuc  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
3484d9c625SLionel Sambuc  * SUCH DAMAGE.
3584d9c625SLionel Sambuc  *
3684d9c625SLionel Sambuc  *	@(#)cd9660_node.h	8.6 (Berkeley) 5/14/95
3784d9c625SLionel Sambuc  */
3884d9c625SLionel Sambuc 
3984d9c625SLionel Sambuc #ifndef _ISOFS_CD9660_CD9660_NODE_H_
4084d9c625SLionel Sambuc #define _ISOFS_CD9660_CD9660_NODE_H_
4184d9c625SLionel Sambuc 
4284d9c625SLionel Sambuc #include <miscfs/genfs/genfs_node.h>
4384d9c625SLionel Sambuc 
4484d9c625SLionel Sambuc /*
4584d9c625SLionel Sambuc  * Theoretically, directories can be more than 2Gb in length,
4684d9c625SLionel Sambuc  * however, in practice this seems unlikely. So, we define
4784d9c625SLionel Sambuc  * the type doff_t as a long to keep down the cost of doing
4884d9c625SLionel Sambuc  * lookup on a 32-bit machine. If you are porting to a 64-bit
4984d9c625SLionel Sambuc  * architecture, you should make doff_t the same as off_t.
5084d9c625SLionel Sambuc  */
5184d9c625SLionel Sambuc #define doff_t	long
5284d9c625SLionel Sambuc 
5384d9c625SLionel Sambuc typedef	struct	{
5484d9c625SLionel Sambuc 	struct timespec	iso_atime;	/* time of last access */
5584d9c625SLionel Sambuc 	struct timespec	iso_mtime;	/* time of last modification */
5684d9c625SLionel Sambuc 	struct timespec	iso_ctime;	/* time file changed */
5784d9c625SLionel Sambuc 	u_short		iso_mode;	/* files access mode and type */
5884d9c625SLionel Sambuc 	uid_t		iso_uid;	/* owner user id */
5984d9c625SLionel Sambuc 	gid_t		iso_gid;	/* owner group id */
6084d9c625SLionel Sambuc 	short		iso_links;	/* links of file */
6184d9c625SLionel Sambuc 	dev_t		iso_rdev;	/* Major/Minor number for special */
6284d9c625SLionel Sambuc } ISO_RRIP_INODE;
6384d9c625SLionel Sambuc 
6484d9c625SLionel Sambuc struct iso_node {
6584d9c625SLionel Sambuc 	struct	genfs_node i_gnode;
6684d9c625SLionel Sambuc 	struct	vnode *i_vnode;	/* vnode associated with this inode */
6784d9c625SLionel Sambuc 	struct	vnode *i_devvp;	/* vnode for block I/O */
6884d9c625SLionel Sambuc 	u_long	i_flag;		/* see below */
6984d9c625SLionel Sambuc 	dev_t	i_dev;		/* device where inode resides */
7084d9c625SLionel Sambuc 	ino_t	i_number;	/* the identity of the inode */
7184d9c625SLionel Sambuc 				/* we use the actual starting block of the file */
7284d9c625SLionel Sambuc 	struct	iso_mnt *i_mnt;	/* filesystem associated with this inode */
7384d9c625SLionel Sambuc 	struct	lockf *i_lockf;	/* head of byte-level lock list */
7484d9c625SLionel Sambuc 	doff_t	i_endoff;	/* end of useful stuff in directory */
7584d9c625SLionel Sambuc 	doff_t	i_diroff;	/* offset in dir, where we found last entry */
7684d9c625SLionel Sambuc 	doff_t	i_offset;	/* offset of free space in directory */
7784d9c625SLionel Sambuc 	ino_t	i_ino;		/* inode number of found directory */
7884d9c625SLionel Sambuc 
7984d9c625SLionel Sambuc 	unsigned long iso_extent;	/* extent of file */
8084d9c625SLionel Sambuc 	unsigned long i_size;
8184d9c625SLionel Sambuc 	unsigned long iso_start;		/* actual start of data of file (may be different */
8284d9c625SLionel Sambuc 				/* from iso_extent, if file has extended attributes) */
8384d9c625SLionel Sambuc 	ISO_RRIP_INODE  inode;
8484d9c625SLionel Sambuc };
8584d9c625SLionel Sambuc 
8684d9c625SLionel Sambuc #define	i_forw		i_chain[0]
8784d9c625SLionel Sambuc #define	i_back		i_chain[1]
8884d9c625SLionel Sambuc 
8984d9c625SLionel Sambuc /* flags */
9084d9c625SLionel Sambuc #define	IN_ACCESS	0x0020		/* inode access time to be updated */
9184d9c625SLionel Sambuc 
9284d9c625SLionel Sambuc #define VTOI(vp) ((struct iso_node *)(vp)->v_data)
9384d9c625SLionel Sambuc #define ITOV(ip) ((ip)->i_vnode)
9484d9c625SLionel Sambuc 
9584d9c625SLionel Sambuc #ifdef _KERNEL
9684d9c625SLionel Sambuc /*
9784d9c625SLionel Sambuc  * Prototypes for ISOFS vnode operations
9884d9c625SLionel Sambuc  */
9984d9c625SLionel Sambuc int	cd9660_lookup(void *);
10084d9c625SLionel Sambuc #define	cd9660_open	genfs_nullop
10184d9c625SLionel Sambuc #define	cd9660_close	genfs_nullop
10284d9c625SLionel Sambuc int	cd9660_access(void *);
10384d9c625SLionel Sambuc int	cd9660_getattr(void *);
10484d9c625SLionel Sambuc int	cd9660_read(void *);
10584d9c625SLionel Sambuc #define	cd9660_ioctl	genfs_enoioctl
10684d9c625SLionel Sambuc #define	cd9660_poll	genfs_poll
10784d9c625SLionel Sambuc #define	cd9660_mmap	genfs_mmap
10884d9c625SLionel Sambuc #define	cd9660_seek	genfs_seek
10984d9c625SLionel Sambuc int	cd9660_readdir(void *);
11084d9c625SLionel Sambuc int	cd9660_readlink(void *);
11184d9c625SLionel Sambuc #define	cd9660_abortop	genfs_abortop
11284d9c625SLionel Sambuc int	cd9660_inactive(void *);
11384d9c625SLionel Sambuc int	cd9660_reclaim(void *);
11484d9c625SLionel Sambuc int	cd9660_link(void *);
11584d9c625SLionel Sambuc int	cd9660_symlink(void *);
11684d9c625SLionel Sambuc int	cd9660_bmap(void *);
11784d9c625SLionel Sambuc int	cd9660_lock(void *);
11884d9c625SLionel Sambuc int	cd9660_unlock(void *);
11984d9c625SLionel Sambuc int	cd9660_strategy(void *);
12084d9c625SLionel Sambuc int	cd9660_print(void *);
12184d9c625SLionel Sambuc int	cd9660_islocked(void *);
12284d9c625SLionel Sambuc int	cd9660_pathconf(void *);
12384d9c625SLionel Sambuc int	cd9660_setattr(void *);
12484d9c625SLionel Sambuc 
12584d9c625SLionel Sambuc int	cd9660_blkatoff(struct vnode *, off_t, char **, struct buf **);
12684d9c625SLionel Sambuc void	cd9660_defattr(struct iso_directory_record *,
12784d9c625SLionel Sambuc 			struct iso_node *, struct buf *);
12884d9c625SLionel Sambuc void	cd9660_deftstamp(struct iso_directory_record *,
12984d9c625SLionel Sambuc 			struct iso_node *, struct buf *);
13084d9c625SLionel Sambuc int	cd9660_tstamp_conv7(const u_char *, struct timespec *);
13184d9c625SLionel Sambuc int	cd9660_tstamp_conv17(const u_char *, struct timespec *);
13284d9c625SLionel Sambuc 
13384d9c625SLionel Sambuc #endif /* _KERNEL */
13484d9c625SLionel Sambuc #endif /* _ISOFS_CD9660_CD9660_NODE_H_ */
135