Home | History | Annotate | Line # | Download | only in cd9660
cd9660_node.h revision 1.13.8.1
      1 /*	$NetBSD: cd9660_node.h,v 1.13.8.1 2008/03/24 07:16:12 keiichi 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 (at) blitz.com).  The Rock Ridge Extension
      9  * Support code is derived from software contributed to Berkeley
     10  * by Atsushi Murai (amurai (at) 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. Neither the name of the University nor the names of its contributors
     21  *    may be used to endorse or promote products derived from this software
     22  *    without specific prior written permission.
     23  *
     24  * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
     25  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
     26  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
     27  * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
     28  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
     29  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
     30  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
     31  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
     32  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
     33  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
     34  * SUCH DAMAGE.
     35  *
     36  *	@(#)cd9660_node.h	8.6 (Berkeley) 5/14/95
     37  */
     38 
     39 #ifndef _ISOFS_CD9660_CD9660_NODE_H_
     40 #define _ISOFS_CD9660_CD9660_NODE_H_
     41 
     42 #include <miscfs/genfs/genfs_node.h>
     43 
     44 /*
     45  * Theoretically, directories can be more than 2Gb in length,
     46  * however, in practice this seems unlikely. So, we define
     47  * the type doff_t as a long to keep down the cost of doing
     48  * lookup on a 32-bit machine. If you are porting to a 64-bit
     49  * architecture, you should make doff_t the same as off_t.
     50  */
     51 #define doff_t	long
     52 
     53 typedef	struct	{
     54 	struct timespec	iso_atime;	/* time of last access */
     55 	struct timespec	iso_mtime;	/* time of last modification */
     56 	struct timespec	iso_ctime;	/* time file changed */
     57 	u_short		iso_mode;	/* files access mode and type */
     58 	uid_t		iso_uid;	/* owner user id */
     59 	gid_t		iso_gid;	/* owner group id */
     60 	short		iso_links;	/* links of file */
     61 	dev_t		iso_rdev;	/* Major/Minor number for special */
     62 } ISO_RRIP_INODE;
     63 
     64 struct iso_node {
     65 	struct	genfs_node i_gnode;
     66 	LIST_ENTRY(iso_node) i_hash;
     67 	struct	vnode *i_vnode;	/* vnode associated with this inode */
     68 	struct	vnode *i_devvp;	/* vnode for block I/O */
     69 	u_long	i_flag;		/* see below */
     70 	dev_t	i_dev;		/* device where inode resides */
     71 	ino_t	i_number;	/* the identity of the inode */
     72 				/* we use the actual starting block of the file */
     73 	struct	iso_mnt *i_mnt;	/* filesystem associated with this inode */
     74 	struct	lockf *i_lockf;	/* head of byte-level lock list */
     75 	doff_t	i_endoff;	/* end of useful stuff in directory */
     76 	doff_t	i_diroff;	/* offset in dir, where we found last entry */
     77 	doff_t	i_offset;	/* offset of free space in directory */
     78 	ino_t	i_ino;		/* inode number of found directory */
     79 
     80 	unsigned long iso_extent;	/* extent of file */
     81 	unsigned long i_size;
     82 	unsigned long iso_start;		/* actual start of data of file (may be different */
     83 				/* from iso_extent, if file has extended attributes) */
     84 	ISO_RRIP_INODE  inode;
     85 };
     86 
     87 #define	i_forw		i_chain[0]
     88 #define	i_back		i_chain[1]
     89 
     90 /* flags */
     91 #define	IN_ACCESS	0x0020		/* inode access time to be updated */
     92 
     93 #define VTOI(vp) ((struct iso_node *)(vp)->v_data)
     94 #define ITOV(ip) ((ip)->i_vnode)
     95 
     96 #ifdef _KERNEL
     97 /*
     98  * Prototypes for ISOFS vnode operations
     99  */
    100 int	cd9660_lookup(void *);
    101 #define	cd9660_open	genfs_nullop
    102 #define	cd9660_close	genfs_nullop
    103 int	cd9660_access(void *);
    104 int	cd9660_getattr(void *);
    105 int	cd9660_read(void *);
    106 #define	cd9660_ioctl	genfs_enoioctl
    107 #define	cd9660_poll	genfs_poll
    108 #define	cd9660_mmap	genfs_mmap
    109 #define	cd9660_seek	genfs_seek
    110 int	cd9660_readdir(void *);
    111 int	cd9660_readlink(void *);
    112 #define	cd9660_abortop	genfs_abortop
    113 int	cd9660_inactive(void *);
    114 int	cd9660_reclaim(void *);
    115 int	cd9660_link(void *);
    116 int	cd9660_symlink(void *);
    117 int	cd9660_bmap(void *);
    118 int	cd9660_lock(void *);
    119 int	cd9660_unlock(void *);
    120 int	cd9660_strategy(void *);
    121 int	cd9660_print(void *);
    122 int	cd9660_islocked(void *);
    123 int	cd9660_pathconf(void *);
    124 int	cd9660_setattr(void *);
    125 
    126 int	cd9660_blkatoff(struct vnode *, off_t, char **, struct buf **);
    127 void	cd9660_defattr(struct iso_directory_record *,
    128 			struct iso_node *, struct buf *);
    129 void	cd9660_deftstamp(struct iso_directory_record *,
    130 			struct iso_node *, struct buf *);
    131 struct	vnode *cd9660_ihashget(dev_t, ino_t, int);
    132 void	cd9660_ihashins(struct iso_node *);
    133 void	cd9660_ihashrem(struct iso_node *);
    134 int	cd9660_tstamp_conv7(const u_char *, struct timespec *);
    135 int	cd9660_tstamp_conv17(const u_char *, struct timespec *);
    136 int	cd9660_vget_internal(struct mount *, ino_t, struct vnode **, int,
    137 			      struct iso_directory_record *);
    138 
    139 extern kmutex_t cd9660_hashlock;
    140 
    141 #endif /* _KERNEL */
    142 #endif /* _ISOFS_CD9660_CD9660_NODE_H_ */
    143