]> code.delx.au - refind/blob - filesystems/fsw_iso9660.h
Added rudimentary debconf support for Debian package.
[refind] / filesystems / fsw_iso9660.h
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 //Slice - we already have shifted blockIO by 16
52 //but we should use ParentBlockIo
53 //#define ISO9660_SUPERBLOCK_BLOCKNO 0
54
55 #pragma pack(1)
56
57 typedef struct {
58 fsw_u16 lsb;
59 fsw_u16 msb;
60 } iso9660_u16;
61
62 typedef struct {
63 fsw_u32 lsb;
64 fsw_u32 msb;
65 } iso9660_u32;
66
67 #define ISOINT(lsbmsbvalue) ((lsbmsbvalue).lsb)
68
69 struct iso9660_dirrec {
70 fsw_u8 dirrec_length;
71 fsw_u8 ear_length;
72 iso9660_u32 extent_location;
73 iso9660_u32 data_length;
74 fsw_u8 recording_datetime[7];
75 fsw_u8 file_flags;
76 fsw_u8 file_unit_size;
77 fsw_u8 interleave_gap_size;
78 iso9660_u16 volume_sequence_number;
79 fsw_u8 file_identifier_length;
80 char file_identifier[1];
81 };
82 //#if sizeof(struct fsw_iso9660_dirrec) != 34
83 //#fail Structure fsw_iso9660_dirrec has wrong size
84 //#endif
85
86 struct iso9660_volume_descriptor {
87 fsw_u8 volume_descriptor_type;
88 char standard_identifier[5];
89 fsw_u8 volume_descriptor_version;
90 };
91
92 struct iso9660_primary_volume_descriptor {
93 fsw_u8 volume_descriptor_type;
94 char standard_identifier[5];
95 fsw_u8 volume_descriptor_version;
96 fsw_u8 unused1;
97 char system_identifier[32];
98 char volume_identifier[32];
99 fsw_u8 unused2[8];
100 iso9660_u32 volume_space_size;
101 fsw_u8 unused3[4];
102 fsw_u8 escape[3];
103 fsw_u8 unused4[25];
104 iso9660_u16 volume_set_size;
105 iso9660_u16 volume_sequence_number;
106 iso9660_u16 logical_block_size;
107 iso9660_u32 path_table_size;
108 fsw_u32 location_type_l_path_table;
109 fsw_u32 location_optional_type_l_path_table;
110 fsw_u32 location_type_m_path_table;
111 fsw_u32 location_optional_type_m_path_table;
112 struct iso9660_dirrec root_directory;
113 char volume_set_identifier[128];
114 char publisher_identifier[128];
115 char data_preparer_identifier[128];
116 char application_identifier[128];
117 char copyright_file_identifier[37];
118 char abstract_file_identifier[37];
119 char bibliographic_file_identifier[37];
120 char volume_creation_datetime[17];
121 char volume_modification_datetime[17];
122 char volume_expiration_datetime[17];
123 char volume_effective_datetime[17];
124 fsw_u8 file_structure_version;
125 fsw_u8 reserved1;
126 fsw_u8 application_use[512];
127 fsw_u8 reserved2[653];
128 };
129 //#if sizeof(struct fsw_iso9660_volume_descriptor) != 2048
130 //#fail Structure fsw_iso9660_volume_descriptor has wrong size
131 //#endif
132
133 #pragma pack()
134
135 struct iso9660_dirrec_buffer {
136 fsw_u32 ino;
137 struct fsw_string name;
138 struct iso9660_dirrec dirrec;
139 char dirrec_buffer[222];
140 };
141
142
143 /**
144 * ISO9660: Volume structure with ISO9660-specific data.
145 */
146
147 struct fsw_iso9660_volume {
148 struct fsw_volume g; //!< Generic volume structure
149 /*Note: don't move g!*/
150 int fJoliet;
151 /*Joliet specific fields*/
152 int fRockRidge;
153 /*Rock Ridge specific fields*/
154 int rr_susp_skip;
155
156 struct iso9660_primary_volume_descriptor *primary_voldesc; //!< Full Primary Volume Descriptor
157 };
158
159 /**
160 * ISO9660: Dnode structure with ISO9660-specific data.
161 */
162
163 struct fsw_iso9660_dnode {
164 struct fsw_dnode g; //!< Generic dnode structure
165
166 struct iso9660_dirrec dirrec; //!< Fixed part of the directory record (i.e. w/o name)
167 };
168
169
170 struct fsw_rock_ridge_susp_entry
171 {
172 fsw_u8 sig[2];
173 fsw_u8 len;
174 fsw_u8 ver;
175 };
176
177 struct fsw_rock_ridge_susp_sp
178 {
179 struct fsw_rock_ridge_susp_entry e;
180 fsw_u8 magic[2];
181 fsw_u8 skip;
182 };
183
184 struct fsw_rock_ridge_susp_nm
185 {
186 struct fsw_rock_ridge_susp_entry e;
187 fsw_u8 flags;
188 fsw_u8 name[1];
189 };
190
191 #define RR_NM_CONT (1<<0)
192 #define RR_NM_CURR (1<<1)
193 #define RR_NM_PARE (1<<2)
194
195 union fsw_rock_ridge_susp_ce
196 {
197 struct X{
198 struct fsw_rock_ridge_susp_entry e;
199 iso9660_u32 block_loc;
200 iso9660_u32 offset;
201 iso9660_u32 len;
202 } X;
203 fsw_u8 raw[28];
204 };
205
206 #endif