1*0f9e9ec2Sjsg /* $OpenBSD: cd9660_node.h,v 1.23 2024/05/13 01:15:53 jsg Exp $ */ 2053e05a2Sniklas /* $NetBSD: cd9660_node.h,v 1.15 1997/04/11 21:52:01 kleink Exp $ */ 3df930be7Sderaadt 4df930be7Sderaadt /*- 5df930be7Sderaadt * Copyright (c) 1994 6df930be7Sderaadt * The Regents of the University of California. All rights reserved. 7df930be7Sderaadt * 8df930be7Sderaadt * This code is derived from software contributed to Berkeley 9df930be7Sderaadt * by Pace Willisson (pace@blitz.com). The Rock Ridge Extension 10df930be7Sderaadt * Support code is derived from software contributed to Berkeley 11df930be7Sderaadt * by Atsushi Murai (amurai@spec.co.jp). 12df930be7Sderaadt * 13df930be7Sderaadt * Redistribution and use in source and binary forms, with or without 14df930be7Sderaadt * modification, are permitted provided that the following conditions 15df930be7Sderaadt * are met: 16df930be7Sderaadt * 1. Redistributions of source code must retain the above copyright 17df930be7Sderaadt * notice, this list of conditions and the following disclaimer. 18df930be7Sderaadt * 2. Redistributions in binary form must reproduce the above copyright 19df930be7Sderaadt * notice, this list of conditions and the following disclaimer in the 20df930be7Sderaadt * documentation and/or other materials provided with the distribution. 2129295d1cSmillert * 3. Neither the name of the University nor the names of its contributors 22df930be7Sderaadt * may be used to endorse or promote products derived from this software 23df930be7Sderaadt * without specific prior written permission. 24df930be7Sderaadt * 25df930be7Sderaadt * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND 26df930be7Sderaadt * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 27df930be7Sderaadt * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 28df930be7Sderaadt * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE 29df930be7Sderaadt * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 30df930be7Sderaadt * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 31df930be7Sderaadt * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 32df930be7Sderaadt * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 33df930be7Sderaadt * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 34df930be7Sderaadt * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 35df930be7Sderaadt * SUCH DAMAGE. 36df930be7Sderaadt * 37df930be7Sderaadt * @(#)cd9660_node.h 8.4 (Berkeley) 12/5/94 38df930be7Sderaadt */ 39df930be7Sderaadt 404ed82744Sderaadt #include <sys/buf.h> 414ed82744Sderaadt 4262652f22Smillert #define doff_t u_quad_t 43df930be7Sderaadt 44df930be7Sderaadt typedef struct { 45df930be7Sderaadt struct timespec iso_atime; /* time of last access */ 46df930be7Sderaadt struct timespec iso_mtime; /* time of last modification */ 47df930be7Sderaadt struct timespec iso_ctime; /* time file changed */ 48df930be7Sderaadt u_short iso_mode; /* files access mode and type */ 49df930be7Sderaadt uid_t iso_uid; /* owner user id */ 50df930be7Sderaadt gid_t iso_gid; /* owner group id */ 51df930be7Sderaadt short iso_links; /* links of file */ 52df930be7Sderaadt dev_t iso_rdev; /* Major/Minor number for special */ 53df930be7Sderaadt } ISO_RRIP_INODE; 54df930be7Sderaadt 55df930be7Sderaadt struct iso_node { 56df930be7Sderaadt struct iso_node *i_next, **i_prev; /* hash chain */ 57df930be7Sderaadt struct vnode *i_vnode; /* vnode associated with this inode */ 58df930be7Sderaadt struct vnode *i_devvp; /* vnode for block I/O */ 5962652f22Smillert u_int i_flag; /* see below */ 60df930be7Sderaadt dev_t i_dev; /* device where inode resides */ 610cad8b22Sguenther cdino_t i_number; /* the identity of the inode */ 62df930be7Sderaadt /* we use the actual starting block of the file */ 63df930be7Sderaadt struct iso_mnt *i_mnt; /* filesystem associated with this inode */ 64df930be7Sderaadt doff_t i_endoff; /* end of useful stuff in directory */ 65df930be7Sderaadt doff_t i_diroff; /* offset in dir, where we found last entry */ 66df930be7Sderaadt doff_t i_offset; /* offset of free space in directory */ 670cad8b22Sguenther cdino_t i_ino; /* inode number of found directory */ 6826b8ec94Snatano struct rrwlock i_lock; /* node lock */ 69df930be7Sderaadt 7062652f22Smillert doff_t iso_extent; /* extent of file */ 7162652f22Smillert doff_t i_size; 7262652f22Smillert /* 7362652f22Smillert * Actual start of data file (may be different from iso_extent, if the 7462652f22Smillert * file has extended attributes). 7562652f22Smillert */ 7662652f22Smillert doff_t iso_start; 7762652f22Smillert 78df930be7Sderaadt ISO_RRIP_INODE inode; 791414b0faSart struct cluster_info i_ci; 80df930be7Sderaadt }; 81df930be7Sderaadt 82df930be7Sderaadt #define i_forw i_chain[0] 83df930be7Sderaadt #define i_back i_chain[1] 84df930be7Sderaadt 85df930be7Sderaadt /* flags */ 86df930be7Sderaadt #define IN_ACCESS 0x0020 /* inode access time to be updated */ 87df930be7Sderaadt 88df930be7Sderaadt #define VTOI(vp) ((struct iso_node *)(vp)->v_data) 89df930be7Sderaadt #define ITOV(ip) ((ip)->i_vnode) 90df930be7Sderaadt 91df930be7Sderaadt /* 92df930be7Sderaadt * Prototypes for ISOFS vnode operations 93df930be7Sderaadt */ 94c4071fd1Smillert int cd9660_lookup(void *); 95c4071fd1Smillert int cd9660_open(void *); 96c4071fd1Smillert int cd9660_close(void *); 97c4071fd1Smillert int cd9660_access(void *); 98c4071fd1Smillert int cd9660_getattr(void *); 99c4071fd1Smillert int cd9660_setattr(void *); 100c4071fd1Smillert int cd9660_read(void *); 101c4071fd1Smillert int cd9660_ioctl(void *); 102c4071fd1Smillert int cd9660_mmap(void *); 103c4071fd1Smillert int cd9660_seek(void *); 104c4071fd1Smillert int cd9660_readdir(void *); 105c4071fd1Smillert int cd9660_readlink(void *); 106c4071fd1Smillert int cd9660_inactive(void *); 107c4071fd1Smillert int cd9660_reclaim(void *); 108c4071fd1Smillert int cd9660_link(void *); 109c4071fd1Smillert int cd9660_symlink(void *); 110c4071fd1Smillert int cd9660_bmap(void *); 111c4071fd1Smillert int cd9660_lock(void *); 112c4071fd1Smillert int cd9660_unlock(void *); 113c4071fd1Smillert int cd9660_strategy(void *); 114c4071fd1Smillert int cd9660_print(void *); 115c4071fd1Smillert int cd9660_islocked(void *); 116c4071fd1Smillert int cd9660_pathconf(void *); 117574066a2Scsapuntz 118574066a2Scsapuntz int cd9660_bufatoff(struct iso_node *, off_t, char **, struct buf **); 119df930be7Sderaadt 120c4071fd1Smillert void cd9660_defattr(struct iso_directory_record *, struct iso_node *, 121c4071fd1Smillert struct buf *); 122c4071fd1Smillert void cd9660_deftstamp(struct iso_directory_record *, struct iso_node *, 123c4071fd1Smillert struct buf *); 1240cad8b22Sguenther struct vnode *cd9660_ihashget(dev_t, cdino_t); 125c4071fd1Smillert int cd9660_ihashins(struct iso_node *); 126c4071fd1Smillert void cd9660_ihashrem(struct iso_node *); 127c4071fd1Smillert int cd9660_tstamp_conv7(u_char *, struct timespec *); 128c4071fd1Smillert int cd9660_tstamp_conv17(u_char *, struct timespec *); 1290cad8b22Sguenther int cd9660_vget_internal(struct mount *, cdino_t, struct vnode **, int, 130c4071fd1Smillert struct iso_directory_record *); 131