1 /* $OpenBSD: cd9660_node.h,v 1.17 2004/10/04 23:37:37 millert 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
44 typedef 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
55 #ifdef ISODEVMAP
56 /*
57 * FOr device# (major,minor) translation table
58 */
59 struct iso_dnode {
60 struct iso_dnode *d_next, **d_prev; /* hash chain */
61 dev_t i_dev; /* device where dnode resides */
62 ino_t i_number; /* the identity of the inode */
63 dev_t d_dev; /* device # for translation */
64 };
65 #endif
66
67 struct iso_node {
68 struct iso_node *i_next, **i_prev; /* hash chain */
69 struct vnode *i_vnode; /* vnode associated with this inode */
70 struct vnode *i_devvp; /* vnode for block I/O */
71 u_int i_flag; /* see below */
72 dev_t i_dev; /* device where inode resides */
73 ino_t i_number; /* the identity of the inode */
74 /* we use the actual starting block of the file */
75 struct iso_mnt *i_mnt; /* filesystem associated with this inode */
76 struct lockf *i_lockf; /* head of byte-level lock list */
77 doff_t i_endoff; /* end of useful stuff in directory */
78 doff_t i_diroff; /* offset in dir, where we found last entry */
79 doff_t i_offset; /* offset of free space in directory */
80 ino_t i_ino; /* inode number of found directory */
81 struct lock i_lock; /* node lock */
82
83 doff_t iso_extent; /* extent of file */
84 doff_t i_size;
85 /*
86 * Actual start of data file (may be different from iso_extent, if the
87 * file has extended attributes).
88 */
89 doff_t iso_start;
90
91 ISO_RRIP_INODE inode;
92 struct cluster_info i_ci;
93 };
94
95 #define i_forw i_chain[0]
96 #define i_back i_chain[1]
97
98 /* flags */
99 #define IN_ACCESS 0x0020 /* inode access time to be updated */
100
101 #define VTOI(vp) ((struct iso_node *)(vp)->v_data)
102 #define ITOV(ip) ((ip)->i_vnode)
103
104 /*
105 * Prototypes for ISOFS vnode operations
106 */
107 int cd9660_lookup(void *);
108 int cd9660_open(void *);
109 int cd9660_close(void *);
110 int cd9660_access(void *);
111 int cd9660_getattr(void *);
112 int cd9660_setattr(void *);
113 int cd9660_read(void *);
114 int cd9660_ioctl(void *);
115 int cd9660_poll(void *);
116 int cd9660_mmap(void *);
117 int cd9660_seek(void *);
118 int cd9660_readdir(void *);
119 int cd9660_readlink(void *);
120 int cd9660_abortop(void *);
121 int cd9660_inactive(void *);
122 int cd9660_reclaim(void *);
123 int cd9660_link(void *);
124 int cd9660_symlink(void *);
125 int cd9660_bmap(void *);
126 int cd9660_lock(void *);
127 int cd9660_unlock(void *);
128 int cd9660_strategy(void *);
129 int cd9660_print(void *);
130 int cd9660_islocked(void *);
131 int cd9660_pathconf(void *);
132
133 int cd9660_bufatoff(struct iso_node *, off_t, char **, struct buf **);
134
135 void cd9660_defattr(struct iso_directory_record *, struct iso_node *,
136 struct buf *);
137 void cd9660_deftstamp(struct iso_directory_record *, struct iso_node *,
138 struct buf *);
139 struct vnode *cd9660_ihashget(dev_t, ino_t);
140 int cd9660_ihashins(struct iso_node *);
141 void cd9660_ihashrem(struct iso_node *);
142 int cd9660_tstamp_conv7(u_char *, struct timespec *);
143 int cd9660_tstamp_conv17(u_char *, struct timespec *);
144 int cd9660_vget_internal(struct mount *, ino_t, struct vnode **, int,
145 struct iso_directory_record *);
146 ino_t isodirino(struct iso_directory_record *, struct iso_mnt *);
147 #ifdef ISODEVMAP
148 struct iso_dnode *iso_dmap(dev_t, ino_t, int);
149 void iso_dunmap(dev_t);
150 #endif