1 | /* $Id: fsw_iso9660.h 29125 2010-05-06 09:43:05Z vboxsync $ */
|
---|
2 | /** @file
|
---|
3 | * fsw_iso9660.h - ISO9660 file system driver header.
|
---|
4 | */
|
---|
5 |
|
---|
6 | /*-
|
---|
7 | * Copyright (c) 2006 Christoph Pfisterer
|
---|
8 | *
|
---|
9 | * Redistribution and use in source and binary forms, with or without
|
---|
10 | * modification, are permitted provided that the following conditions are
|
---|
11 | * met:
|
---|
12 | *
|
---|
13 | * * Redistributions of source code must retain the above copyright
|
---|
14 | * notice, this list of conditions and the following disclaimer.
|
---|
15 | *
|
---|
16 | * * Redistributions in binary form must reproduce the above copyright
|
---|
17 | * notice, this list of conditions and the following disclaimer in the
|
---|
18 | * documentation and/or other materials provided with the
|
---|
19 | * distribution.
|
---|
20 | *
|
---|
21 | * * Neither the name of Christoph Pfisterer nor the names of the
|
---|
22 | * contributors may be used to endorse or promote products derived
|
---|
23 | * from this software without specific prior written permission.
|
---|
24 | *
|
---|
25 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
---|
26 | * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
---|
27 | * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
---|
28 | * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
---|
29 | * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
---|
30 | * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
---|
31 | * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
---|
32 | * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
---|
33 | * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
---|
34 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
---|
35 | * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
---|
36 | */
|
---|
37 |
|
---|
38 | #ifndef _FSW_ISO9660_H_
|
---|
39 | #define _FSW_ISO9660_H_
|
---|
40 |
|
---|
41 | #define VOLSTRUCTNAME fsw_iso9660_volume
|
---|
42 | #define DNODESTRUCTNAME fsw_iso9660_dnode
|
---|
43 | #include "fsw_core.h"
|
---|
44 |
|
---|
45 |
|
---|
46 | //! Block size for ISO9660 volumes.
|
---|
47 | #define ISO9660_BLOCKSIZE 2048
|
---|
48 | #define ISO9660_BLOCKSIZE_BITS 11
|
---|
49 | //! Block number where the ISO9660 superblock resides.
|
---|
50 | #define ISO9660_SUPERBLOCK_BLOCKNO 16
|
---|
51 |
|
---|
52 |
|
---|
53 | #pragma pack(1)
|
---|
54 |
|
---|
55 | typedef struct {
|
---|
56 | fsw_u16 lsb;
|
---|
57 | fsw_u16 msb;
|
---|
58 | } iso9660_u16;
|
---|
59 |
|
---|
60 | typedef struct {
|
---|
61 | fsw_u32 lsb;
|
---|
62 | fsw_u32 msb;
|
---|
63 | } iso9660_u32;
|
---|
64 |
|
---|
65 | #define ISOINT(lsbmsbvalue) ((lsbmsbvalue).lsb)
|
---|
66 |
|
---|
67 | struct iso9660_dirrec {
|
---|
68 | fsw_u8 dirrec_length;
|
---|
69 | fsw_u8 ear_length;
|
---|
70 | iso9660_u32 extent_location;
|
---|
71 | iso9660_u32 data_length;
|
---|
72 | fsw_u8 recording_datetime[7];
|
---|
73 | fsw_u8 file_flags;
|
---|
74 | fsw_u8 file_unit_size;
|
---|
75 | fsw_u8 interleave_gap_size;
|
---|
76 | iso9660_u16 volume_sequence_number;
|
---|
77 | fsw_u8 file_identifier_length;
|
---|
78 | char file_identifier[1];
|
---|
79 | };
|
---|
80 | //#if sizeof(struct fsw_iso9660_dirrec) != 34
|
---|
81 | //#fail Structure fsw_iso9660_dirrec has wrong size
|
---|
82 | //#endif
|
---|
83 |
|
---|
84 | struct iso9660_volume_descriptor {
|
---|
85 | fsw_u8 volume_descriptor_type;
|
---|
86 | char standard_identifier[5];
|
---|
87 | fsw_u8 volume_descriptor_version;
|
---|
88 | };
|
---|
89 |
|
---|
90 | struct iso9660_primary_volume_descriptor {
|
---|
91 | fsw_u8 volume_descriptor_type;
|
---|
92 | char standard_identifier[5];
|
---|
93 | fsw_u8 volume_descriptor_version;
|
---|
94 | fsw_u8 unused1;
|
---|
95 | char system_identifier[32];
|
---|
96 | char volume_identifier[32];
|
---|
97 | fsw_u8 unused2[8];
|
---|
98 | iso9660_u32 volume_space_size;
|
---|
99 | fsw_u8 unused3[4];
|
---|
100 | fsw_u8 escape[3];
|
---|
101 | fsw_u8 unused4[25];
|
---|
102 | iso9660_u16 volume_set_size;
|
---|
103 | iso9660_u16 volume_sequence_number;
|
---|
104 | iso9660_u16 logical_block_size;
|
---|
105 | iso9660_u32 path_table_size;
|
---|
106 | fsw_u32 location_type_l_path_table;
|
---|
107 | fsw_u32 location_optional_type_l_path_table;
|
---|
108 | fsw_u32 location_type_m_path_table;
|
---|
109 | fsw_u32 location_optional_type_m_path_table;
|
---|
110 | struct iso9660_dirrec root_directory;
|
---|
111 | char volume_set_identifier[128];
|
---|
112 | char publisher_identifier[128];
|
---|
113 | char data_preparer_identifier[128];
|
---|
114 | char application_identifier[128];
|
---|
115 | char copyright_file_identifier[37];
|
---|
116 | char abstract_file_identifier[37];
|
---|
117 | char bibliographic_file_identifier[37];
|
---|
118 | char volume_creation_datetime[17];
|
---|
119 | char volume_modification_datetime[17];
|
---|
120 | char volume_expiration_datetime[17];
|
---|
121 | char volume_effective_datetime[17];
|
---|
122 | fsw_u8 file_structure_version;
|
---|
123 | fsw_u8 reserved1;
|
---|
124 | fsw_u8 application_use[512];
|
---|
125 | fsw_u8 reserved2[653];
|
---|
126 | };
|
---|
127 | //#if sizeof(struct fsw_iso9660_volume_descriptor) != 2048
|
---|
128 | //#fail Structure fsw_iso9660_volume_descriptor has wrong size
|
---|
129 | //#endif
|
---|
130 |
|
---|
131 | #pragma pack()
|
---|
132 |
|
---|
133 | struct iso9660_dirrec_buffer {
|
---|
134 | fsw_u32 ino;
|
---|
135 | struct fsw_string name;
|
---|
136 | struct iso9660_dirrec dirrec;
|
---|
137 | char dirrec_buffer[222];
|
---|
138 | };
|
---|
139 |
|
---|
140 |
|
---|
141 | /**
|
---|
142 | * ISO9660: Volume structure with ISO9660-specific data.
|
---|
143 | */
|
---|
144 |
|
---|
145 | struct fsw_iso9660_volume {
|
---|
146 | struct fsw_volume g; //!< Generic volume structure
|
---|
147 | /*Note: don't move g!*/
|
---|
148 | int fJoliet;
|
---|
149 | /*Joliet specific fields*/
|
---|
150 | int fRockRidge;
|
---|
151 | /*Rock Ridge specific fields*/
|
---|
152 | int rr_susp_skip;
|
---|
153 |
|
---|
154 | struct iso9660_primary_volume_descriptor *primary_voldesc; //!< Full Primary Volume Descriptor
|
---|
155 | };
|
---|
156 |
|
---|
157 | /**
|
---|
158 | * ISO9660: Dnode structure with ISO9660-specific data.
|
---|
159 | */
|
---|
160 |
|
---|
161 | struct fsw_iso9660_dnode {
|
---|
162 | struct fsw_dnode g; //!< Generic dnode structure
|
---|
163 |
|
---|
164 | struct iso9660_dirrec dirrec; //!< Fixed part of the directory record (i.e. w/o name)
|
---|
165 | };
|
---|
166 |
|
---|
167 |
|
---|
168 | struct fsw_rock_ridge_susp_entry
|
---|
169 | {
|
---|
170 | fsw_u8 sig[2];
|
---|
171 | fsw_u8 len;
|
---|
172 | fsw_u8 ver;
|
---|
173 | };
|
---|
174 |
|
---|
175 | struct fsw_rock_ridge_susp_sp
|
---|
176 | {
|
---|
177 | struct fsw_rock_ridge_susp_entry e;
|
---|
178 | fsw_u8 magic[2];
|
---|
179 | fsw_u8 skip;
|
---|
180 | };
|
---|
181 |
|
---|
182 | struct fsw_rock_ridge_susp_nm
|
---|
183 | {
|
---|
184 | struct fsw_rock_ridge_susp_entry e;
|
---|
185 | fsw_u8 flags;
|
---|
186 | fsw_u8 name[1];
|
---|
187 | };
|
---|
188 |
|
---|
189 | #define RR_NM_CONT (1<<0)
|
---|
190 | #define RR_NM_CURR (1<<1)
|
---|
191 | #define RR_NM_PARE (1<<2)
|
---|
192 |
|
---|
193 | union fsw_rock_ridge_susp_ce
|
---|
194 | {
|
---|
195 | struct X{
|
---|
196 | struct fsw_rock_ridge_susp_entry e;
|
---|
197 | iso9660_u32 block_loc;
|
---|
198 | iso9660_u32 offset;
|
---|
199 | iso9660_u32 len;
|
---|
200 | } X;
|
---|
201 | fsw_u8 raw[28];
|
---|
202 | };
|
---|
203 |
|
---|
204 | #endif
|
---|