1/* $OpenBSD: cd9660_node.h,v 1.23 2024/05/13 01:15:53 jsg 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. Neither the name of the University nor the names of its contributors
22 * may be used to endorse or promote products derived from this software
23 * without specific prior written permission.
24 *
25 * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
26 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
27 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
28 * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
29 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
30 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
31 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
32 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
33 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
34 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
35 * SUCH DAMAGE.
36 *
37 * @(#)cd9660_node.h 8.4 (Berkeley) 12/5/94
38 */
39
40#include <sys/buf.h>
41
42#define doff_t u_quad_t
43
44typedef struct {
45 struct timespec iso_atime; /* time of last access */
46 struct timespec iso_mtime; /* time of last modification */
47 struct timespec iso_ctime; /* time file changed */
48 u_short iso_mode; /* files access mode and type */
49 uid_t iso_uid; /* owner user id */
50 gid_t iso_gid; /* owner group id */
51 short iso_links; /* links of file */
52 dev_t iso_rdev; /* Major/Minor number for special */
53} ISO_RRIP_INODE;
54
55struct iso_node {
56 struct iso_node *i_next, **i_prev; /* hash chain */
57 struct vnode *i_vnode; /* vnode associated with this inode */
58 struct vnode *i_devvp; /* vnode for block I/O */
59 u_int i_flag; /* see below */
60 dev_t i_dev; /* device where inode resides */
61 cdino_t i_number; /* the identity of the inode */
62 /* we use the actual starting block of the file */
63 struct iso_mnt *i_mnt; /* filesystem associated with this inode */
64 doff_t i_endoff; /* end of useful stuff in directory */
65 doff_t i_diroff; /* offset in dir, where we found last entry */
66 doff_t i_offset; /* offset of free space in directory */
67 cdino_t i_ino; /* inode number of found directory */
68 struct rrwlock i_lock; /* node lock */
69
70 doff_t iso_extent; /* extent of file */
71 doff_t i_size;
72 /*
73 * Actual start of data file (may be different from iso_extent, if the
74 * file has extended attributes).
75 */
76 doff_t iso_start;
77
78 ISO_RRIP_INODE inode;
79 struct cluster_info i_ci;
80};
81
82#define i_forw i_chain[0]
83#define i_back i_chain[1]
84
85/* flags */
86#define IN_ACCESS 0x0020 /* inode access time to be updated */
87
88#define VTOI(vp) ((struct iso_node *)(vp)->v_data)
89#define ITOV(ip) ((ip)->i_vnode)
90
91/*
92 * Prototypes for ISOFS vnode operations
93 */
94int cd9660_lookup(void *);
95int cd9660_open(void *);
96int cd9660_close(void *);
97int cd9660_access(void *);
98int cd9660_getattr(void *);
99int cd9660_setattr(void *);
100int cd9660_read(void *);
101int cd9660_ioctl(void *);
102int cd9660_mmap(void *);
103int cd9660_seek(void *);
104int cd9660_readdir(void *);
105int cd9660_readlink(void *);
106int cd9660_inactive(void *);
107int cd9660_reclaim(void *);
108int cd9660_link(void *);
109int cd9660_symlink(void *);
110int cd9660_bmap(void *);
111int cd9660_lock(void *);
112int cd9660_unlock(void *);
113int cd9660_strategy(void *);
114int cd9660_print(void *);
115int cd9660_islocked(void *);
116int cd9660_pathconf(void *);
117
118int cd9660_bufatoff(struct iso_node *, off_t, char **, struct buf **);
119
120void cd9660_defattr(struct iso_directory_record *, struct iso_node *,
121 struct buf *);
122void cd9660_deftstamp(struct iso_directory_record *, struct iso_node *,
123 struct buf *);
124struct vnode *cd9660_ihashget(dev_t, cdino_t);
125int cd9660_ihashins(struct iso_node *);
126void cd9660_ihashrem(struct iso_node *);
127int cd9660_tstamp_conv7(u_char *, struct timespec *);
128int cd9660_tstamp_conv17(u_char *, struct timespec *);
129int cd9660_vget_internal(struct mount *, cdino_t, struct vnode **, int,
130 struct iso_directory_record *);