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