VirtualBox

source: vbox/trunk/src/VBox/Devices/EFI/Firmware/VBoxPkg/VBoxFsDxe/fsw_iso9660.h

Last change on this file was 98103, checked in by vboxsync, 16 months ago

Copyright year updates by scm.

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
File size: 7.2 KB
Line 
1/* $Id: fsw_iso9660.h 98103 2023-01-17 14:15:46Z vboxsync $ */
2/** @file
3 * fsw_iso9660.h - ISO9660 file system driver header.
4 */
5
6/*
7 * Copyright (C) 2010-2023 Oracle and/or its affiliates.
8 *
9 * This file is part of VirtualBox base platform packages, as
10 * available from https://www.virtualbox.org.
11 *
12 * This program is free software; you can redistribute it and/or
13 * modify it under the terms of the GNU General Public License
14 * as published by the Free Software Foundation, in version 3 of the
15 * License.
16 *
17 * This program is distributed in the hope that it will be useful, but
18 * WITHOUT ANY WARRANTY; without even the implied warranty of
19 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
20 * General Public License for more details.
21 *
22 * You should have received a copy of the GNU General Public License
23 * along with this program; if not, see <https://www.gnu.org/licenses>.
24 *
25 * The contents of this file may alternatively be used under the terms
26 * of the Common Development and Distribution License Version 1.0
27 * (CDDL), a copy of it is provided in the "COPYING.CDDL" file included
28 * in the VirtualBox distribution, in which case the provisions of the
29 * CDDL are applicable instead of those of the GPL.
30 *
31 * You may elect to license modified versions of this file under the
32 * terms and conditions of either the GPL or the CDDL or both.
33 *
34 * SPDX-License-Identifier: GPL-3.0-only OR CDDL-1.0
35 * ---------------------------------------------------------------------------
36 * This code is based on:
37 *
38 * Copyright (c) 2006 Christoph Pfisterer
39 *
40 * Redistribution and use in source and binary forms, with or without
41 * modification, are permitted provided that the following conditions are
42 * met:
43 *
44 * * Redistributions of source code must retain the above copyright
45 * notice, this list of conditions and the following disclaimer.
46 *
47 * * Redistributions in binary form must reproduce the above copyright
48 * notice, this list of conditions and the following disclaimer in the
49 * documentation and/or other materials provided with the
50 * distribution.
51 *
52 * * Neither the name of Christoph Pfisterer nor the names of the
53 * contributors may be used to endorse or promote products derived
54 * from this software without specific prior written permission.
55 *
56 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
57 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
58 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
59 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
60 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
61 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
62 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
63 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
64 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
65 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
66 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
67 */
68
69#ifndef _FSW_ISO9660_H_
70#define _FSW_ISO9660_H_
71
72#define VOLSTRUCTNAME fsw_iso9660_volume
73#define DNODESTRUCTNAME fsw_iso9660_dnode
74#include "fsw_core.h"
75
76
77//! Block size for ISO9660 volumes.
78#define ISO9660_BLOCKSIZE 2048
79#define ISO9660_BLOCKSIZE_BITS 11
80//! Block number where the ISO9660 superblock resides.
81#define ISO9660_SUPERBLOCK_BLOCKNO 16
82
83
84#pragma pack(1)
85
86typedef struct {
87 fsw_u16 lsb;
88 fsw_u16 msb;
89} iso9660_u16;
90
91typedef struct {
92 fsw_u32 lsb;
93 fsw_u32 msb;
94} iso9660_u32;
95
96#define ISOINT(lsbmsbvalue) ((lsbmsbvalue).lsb)
97
98struct iso9660_dirrec {
99 fsw_u8 dirrec_length;
100 fsw_u8 ear_length;
101 iso9660_u32 extent_location;
102 iso9660_u32 data_length;
103 fsw_u8 recording_datetime[7];
104 fsw_u8 file_flags;
105 fsw_u8 file_unit_size;
106 fsw_u8 interleave_gap_size;
107 iso9660_u16 volume_sequence_number;
108 fsw_u8 file_identifier_length;
109 char file_identifier[1];
110};
111//#if sizeof(struct fsw_iso9660_dirrec) != 34
112//#fail Structure fsw_iso9660_dirrec has wrong size
113//#endif
114
115struct iso9660_volume_descriptor {
116 fsw_u8 volume_descriptor_type;
117 char standard_identifier[5];
118 fsw_u8 volume_descriptor_version;
119};
120
121struct iso9660_primary_volume_descriptor {
122 fsw_u8 volume_descriptor_type;
123 char standard_identifier[5];
124 fsw_u8 volume_descriptor_version;
125 fsw_u8 unused1;
126 char system_identifier[32];
127 char volume_identifier[32];
128 fsw_u8 unused2[8];
129 iso9660_u32 volume_space_size;
130 fsw_u8 unused3[4];
131 fsw_u8 escape[3];
132 fsw_u8 unused4[25];
133 iso9660_u16 volume_set_size;
134 iso9660_u16 volume_sequence_number;
135 iso9660_u16 logical_block_size;
136 iso9660_u32 path_table_size;
137 fsw_u32 location_type_l_path_table;
138 fsw_u32 location_optional_type_l_path_table;
139 fsw_u32 location_type_m_path_table;
140 fsw_u32 location_optional_type_m_path_table;
141 struct iso9660_dirrec root_directory;
142 char volume_set_identifier[128];
143 char publisher_identifier[128];
144 char data_preparer_identifier[128];
145 char application_identifier[128];
146 char copyright_file_identifier[37];
147 char abstract_file_identifier[37];
148 char bibliographic_file_identifier[37];
149 char volume_creation_datetime[17];
150 char volume_modification_datetime[17];
151 char volume_expiration_datetime[17];
152 char volume_effective_datetime[17];
153 fsw_u8 file_structure_version;
154 fsw_u8 reserved1;
155 fsw_u8 application_use[512];
156 fsw_u8 reserved2[653];
157};
158//#if sizeof(struct fsw_iso9660_volume_descriptor) != 2048
159//#fail Structure fsw_iso9660_volume_descriptor has wrong size
160//#endif
161
162#pragma pack()
163
164struct iso9660_dirrec_buffer {
165 fsw_u32 ino;
166 struct fsw_string name;
167 struct iso9660_dirrec dirrec;
168 char dirrec_buffer[222];
169};
170
171
172/**
173 * ISO9660: Volume structure with ISO9660-specific data.
174 */
175
176struct fsw_iso9660_volume {
177 struct fsw_volume g; //!< Generic volume structure
178 /*Note: don't move g!*/
179 int fJoliet;
180 /*Joliet specific fields*/
181 int fRockRidge;
182 /*Rock Ridge specific fields*/
183 int rr_susp_skip;
184
185 struct iso9660_primary_volume_descriptor *primary_voldesc; //!< Full Primary Volume Descriptor
186};
187
188/**
189 * ISO9660: Dnode structure with ISO9660-specific data.
190 */
191
192struct fsw_iso9660_dnode {
193 struct fsw_dnode g; //!< Generic dnode structure
194
195 struct iso9660_dirrec dirrec; //!< Fixed part of the directory record (i.e. w/o name)
196};
197
198
199struct fsw_rock_ridge_susp_entry
200{
201 fsw_u8 sig[2];
202 fsw_u8 len;
203 fsw_u8 ver;
204};
205
206struct fsw_rock_ridge_susp_sp
207{
208 struct fsw_rock_ridge_susp_entry e;
209 fsw_u8 magic[2];
210 fsw_u8 skip;
211};
212
213struct fsw_rock_ridge_susp_nm
214{
215 struct fsw_rock_ridge_susp_entry e;
216 fsw_u8 flags;
217 fsw_u8 name[1];
218};
219
220#define RR_NM_CONT (1<<0)
221#define RR_NM_CURR (1<<1)
222#define RR_NM_PARE (1<<2)
223
224union fsw_rock_ridge_susp_ce
225{
226 struct X{
227 struct fsw_rock_ridge_susp_entry e;
228 iso9660_u32 block_loc;
229 iso9660_u32 offset;
230 iso9660_u32 len;
231 } X;
232 fsw_u8 raw[28];
233};
234
235#endif
Note: See TracBrowser for help on using the repository browser.

© 2023 Oracle
ContactPrivacy policyTerms of Use