]> git.saurik.com Git - apple/xnu.git/blame_incremental - bsd/isofs/cd9660/cd9660_node.h
xnu-792.21.3.tar.gz
[apple/xnu.git] / bsd / isofs / cd9660 / cd9660_node.h
... / ...
CommitLineData
1/*
2 * Copyright (c) 2000-2003 Apple Computer, Inc. All rights reserved.
3 *
4 * @APPLE_OSREFERENCE_LICENSE_HEADER_START@
5 *
6 * This file contains Original Code and/or Modifications of Original Code
7 * as defined in and that are subject to the Apple Public Source License
8 * Version 2.0 (the 'License'). You may not use this file except in
9 * compliance with the License. The rights granted to you under the License
10 * may not be used to create, or enable the creation or redistribution of,
11 * unlawful or unlicensed copies of an Apple operating system, or to
12 * circumvent, violate, or enable the circumvention or violation of, any
13 * terms of an Apple operating system software license agreement.
14 *
15 * Please obtain a copy of the License at
16 * http://www.opensource.apple.com/apsl/ and read it before using this file.
17 *
18 * The Original Code and all software distributed under the License are
19 * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
20 * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
21 * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
22 * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
23 * Please see the License for the specific language governing rights and
24 * limitations under the License.
25 *
26 * @APPLE_OSREFERENCE_LICENSE_HEADER_END@
27 */
28/* $NetBSD: cd9660_node.h,v 1.10 1994/12/24 15:30:09 cgd Exp $ */
29
30/*-
31 * Copyright (c) 1994
32 * The Regents of the University of California. All rights reserved.
33 *
34 * This code is derived from software contributed to Berkeley
35 * by Pace Willisson (pace@blitz.com). The Rock Ridge Extension
36 * Support code is derived from software contributed to Berkeley
37 * by Atsushi Murai (amurai@spec.co.jp).
38 *
39 * Redistribution and use in source and binary forms, with or without
40 * modification, are permitted provided that the following conditions
41 * are met:
42 * 1. Redistributions of source code must retain the above copyright
43 * notice, this list of conditions and the following disclaimer.
44 * 2. Redistributions in binary form must reproduce the above copyright
45 * notice, this list of conditions and the following disclaimer in the
46 * documentation and/or other materials provided with the distribution.
47 * 3. All advertising materials mentioning features or use of this software
48 * must display the following acknowledgement:
49 * This product includes software developed by the University of
50 * California, Berkeley and its contributors.
51 * 4. Neither the name of the University nor the names of its contributors
52 * may be used to endorse or promote products derived from this software
53 * without specific prior written permission.
54 *
55 * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
56 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
57 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
58 * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
59 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
60 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
61 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
62 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
63 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
64 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
65 * SUCH DAMAGE.
66 *
67 * @(#)cd9660_node.h 8.4 (Berkeley) 12/5/94
68 */
69#ifndef _CD9660_NODE_H_
70#define _CD9660_NODE_H_
71
72#include <sys/appleapiopts.h>
73
74#ifdef __APPLE_API_PRIVATE
75/*
76 * Theoretically, directories can be more than 2Gb in length,
77 * however, in practice this seems unlikely. So, we define
78 * the type doff_t as a long to keep down the cost of doing
79 * lookup on a 32-bit machine. If you are porting to a 64-bit
80 * architecture, you should make doff_t the same as off_t.
81 */
82
83#include <sys/lock.h>
84#include <sys/kauth.h>
85#include <isofs/cd9660/iso.h>
86
87#ifndef doff_t
88#define doff_t long
89#endif
90
91typedef struct {
92 struct timespec iso_atime; /* time of last access */
93 struct timespec iso_mtime; /* time of last modification */
94 struct timespec iso_ctime; /* time file changed */
95 uid_t iso_uid; /* owner user id */
96 gid_t iso_gid; /* owner group id */
97 u_short iso_mode; /* files access mode and type */
98 short iso_links; /* links of file */
99 dev_t iso_rdev; /* Major/Minor number for special */
100} ISO_RRIP_INODE;
101
102#ifdef ISODEVMAP
103/*
104 * FOr device# (major,minor) translation table
105 */
106struct iso_dnode {
107 struct iso_dnode *d_next, **d_prev; /* hash chain */
108 dev_t i_dev; /* device where dnode resides */
109 ino_t i_number; /* the identity of the inode */
110 dev_t d_dev; /* device # for translation */
111};
112#endif
113
114/* <ufs/inode.h> defines i_size as a macro */
115#undef i_size
116
117struct iso_node {
118 struct iso_node *i_next, **i_prev; /* hash chain */
119 struct vnode *i_vnode; /* vnode associated with this inode */
120 struct vnode *i_devvp; /* vnode for block I/O */
121 u_int32_t i_flag; /* flags, see below */
122 dev_t i_dev; /* device where inode resides */
123 ino_t i_number; /* the identity of the inode */
124 /* we use the actual starting block of the file */
125 struct iso_mnt *i_mnt; /* filesystem associated with this inode */
126 struct lockf *i_lockf; /* head of byte-level lock list */
127 doff_t i_endoff; /* end of useful stuff in directory */
128 doff_t i_diroff; /* offset in dir, where we found last entry */
129 doff_t i_offset; /* offset of free space in directory */
130 ino_t i_ino; /* inode number of found directory */
131 daddr_t i_lastr; /* last read (read ahead) */
132 long iso_extent; /* extent of file */
133 long i_size;
134 long iso_start; /* actual start of data of file (may be different */
135 /* from iso_extent, if file has extended attributes) */
136 ISO_RRIP_INODE inode;
137
138 ino_t i_parent; /* inode number of parent directory */
139 u_char *i_namep; /* node name buffer */
140
141 /* support Apple extensions to ISO directory rec */
142 long i_rsrcsize; /* cached size of associated file */
143 u_int32_t i_FileType; /* MacOS file type */
144 u_int32_t i_Creator; /* MacOS file creator */
145 u_int16_t i_FinderFlags; /* MacOS finder flags */
146
147 u_int16_t i_entries; /* count of directory entries */
148
149 struct riff_header *i_riff;
150};
151
152#define i_forw i_chain[0]
153#define i_back i_chain[1]
154
155/* These flags are kept in i_flag. */
156#define ISO_ASSOCIATED 0x0001 /* node is an associated file. */
157#define ISO_INALLOC 0x0002
158#define ISO_INWALLOC 0x0004
159
160
161/* <ufs/inode.h> defines VTOI and ITOV macros */
162#undef VTOI
163#undef ITOV
164
165#define VTOI(vp) ((struct iso_node *)(vnode_fsnode(vp)))
166#define ITOV(ip) ((ip)->i_vnode)
167
168/* similar in <hfs/hfs_mount.h> as default UID and GID */
169#define ISO_UNKNOWNUID ((uid_t)99)
170#define ISO_UNKNOWNGID ((gid_t)99)
171
172int cd9660_access_internal(vnode_t, mode_t, kauth_cred_t);
173
174/*
175 * Prototypes for ISOFS vnode operations
176 */
177int cd9660_lookup (struct vnop_lookup_args *);
178int cd9660_open (struct vnop_open_args *);
179int cd9660_close (struct vnop_close_args *);
180int cd9660_access (struct vnop_access_args *);
181int cd9660_getattr (struct vnop_getattr_args *);
182int cd9660_read (struct vnop_read_args *);
183int cd9660_xa_read (struct vnop_read_args *);
184int cd9660_ioctl (struct vnop_ioctl_args *);
185int cd9660_select (struct vnop_select_args *);
186int cd9660_mmap (struct vnop_mmap_args *);
187int cd9660_readdir (struct vnop_readdir_args *);
188int cd9660_readlink (struct vnop_readlink_args *);
189int cd9660_inactive (struct vnop_inactive_args *);
190int cd9660_reclaim (struct vnop_reclaim_args *);
191int cd9660_strategy (struct vnop_strategy_args *);
192int cd9660_pathconf (struct vnop_pathconf_args *);
193int cd9660_enotsupp(void);
194int cd9660_pagein(struct vnop_pagein_args *ap);
195int cd9660_remove(struct vnop_remove_args *ap);
196int cd9660_rmdir(struct vnop_rmdir_args *ap);
197int cd9660_getattrlist(struct vnop_getattrlist_args *ap);
198
199__private_extern__ void cd9660_xa_init(struct iso_node *ip,
200 struct iso_directory_record *isodir);
201__private_extern__ int cd9660_blkatoff (vnode_t, off_t, char **, buf_t *);
202
203void cd9660_defattr (struct iso_directory_record *,
204 struct iso_node *, struct buf *);
205void cd9660_deftstamp (struct iso_directory_record *,
206 struct iso_node *, struct buf *);
207struct vnode *cd9660_ihashget (dev_t, ino_t, struct proc *);
208void cd9660_ihashins (struct iso_node *);
209void cd9660_ihashrem (struct iso_node *);
210int cd9660_tstamp_conv7 (u_char *, struct timespec *);
211int cd9660_tstamp_conv17 (u_char *, struct timespec *);
212ino_t isodirino (struct iso_directory_record *, struct iso_mnt *);
213#ifdef ISODEVMAP
214struct iso_dnode *iso_dmap (dev_t, ino_t, int);
215void iso_dunmap (dev_t);
216#endif
217
218#endif /* __APPLE_API_PRIVATE */
219#endif /* ! _CD9660_NODE_H_ */