source: mainline/uspace/srv/fs/udf/udf_volume.h

Last change on this file was c477c80, checked in by Jiri Svoboda <jiri@…>, 6 years ago

Fix some common misspellings

  • Property mode set to 100644
File size: 7.7 KB
RevLine 
[48e3190]1/*
2 * Copyright (c) 2012 Julia Medvedeva
3 * All rights reserved.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions
7 * are met:
8 *
9 * - Redistributions of source code must retain the above copyright
10 * notice, this list of conditions and the following disclaimer.
11 * - Redistributions in binary form must reproduce the above copyright
12 * notice, this list of conditions and the following disclaimer in the
13 * documentation and/or other materials provided with the distribution.
14 * - The name of the author may not be used to endorse or promote products
15 * derived from this software without specific prior written permission.
16 *
17 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
18 * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
19 * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
20 * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
21 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
22 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
23 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
24 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
25 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
26 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
27 */
28
[b1834a01]29/** @addtogroup udf
[48e3190]30 * @{
31 */
32
33#ifndef UDF_UDF_VOLUME_H_
34#define UDF_UDF_VOLUME_H_
35
[8d2dd7f2]36#include <stdint.h>
[48e3190]37#include <ipc/loc.h>
38#include "udf_types.h"
39
40/* Descriptor Tag Identifier (ECMA 167 3/7.2.1) */
41#define UDF_TAG_PVD 0x0001 /* Primary Volume Descriptor */
42#define UDF_TAG_AVDP 0x0002 /* Anchor Volume Descriptor */
43#define UDF_TAG_VDP 0x0003 /* Volume Descriptor Pointer */
44#define UDF_TAG_IUVD 0x0004 /* Implementation Use Volume Descriptor */
45#define UDF_TAG_PD 0x0005 /* Partition Descriptor */
46#define UDF_TAG_LVD 0x0006 /* Logical Volume Descriptor */
47#define UDF_TAG_USD 0x0007 /* Unallocated Space Descriptor */
48#define UDF_TAG_TD 0x0008 /* Terminating Descriptor */
49#define UDF_TAG_LVID 0x0009 /* Logical Volume Integrity Descriptor */
50
[c477c80]51/* Start address of Anchor Volume Descriptor */
[48e3190]52#define UDF_AVDP_SECTOR 256
53
54/* Volume Recognition Sequence params */
55#define VRS_ADDR 32768
56#define VRS_TYPE 0
57#define VRS_VERSION 1
58#define VRS_BEGIN "BEA01"
59#define VRS_END "TEA01"
60#define VRS_NSR2 "NSR02"
61#define VRS_NSR3 "NSR03"
62#define VRS_DEPTH 10
63#define VRS_ID_LEN 5
64
65/* Volume Structure Descriptor (ECMA 167 2/9.1) */
66typedef struct udf_vrs_descriptor {
67 uint8_t type; /* Structure type */
68 uint8_t identifier[5]; /* Standart identifier */
69 uint8_t version; /* Structure version */
70 uint8_t data[2041]; /* Structure data */
71} __attribute__((packed)) udf_vrs_descriptor_t;
72
73/* Anchor volume descriptor (ECMA 167 3/10.2) */
74typedef struct udf_anchor_volume_descriptor {
75 udf_descriptor_tag_t tag; /* Descriptor tag */
76 udf_extent_t main_extent; /* Main Volume Descriptor Sequence Extent */
77 udf_extent_t reserve_extent; /* Reserve Volume Descriptor Sequence Extent */
78 uint8_t reserved[480]; /* Structure data */
79} __attribute__((packed)) udf_anchor_volume_descriptor_t;
80
81/* Common Volume Descriptor */
82typedef struct udf_common_descriptor {
83 udf_descriptor_tag_t tag;
84 uint8_t reserved[496];
85} __attribute__((packed)) udf_common_descriptor_t;
86
87/* Volume Descriptor Pointer (ECMA 167 3/10.3) */
88typedef struct udf_volume_pointer_descriptor {
89 udf_descriptor_tag_t tag;
90 uint32_t sequence_number;
91 udf_extent_t next_sequence;
92 uint8_t reserved[484];
93} __attribute__((packed)) udf_volume_pointer_descriptor_t;
94
95/* Primary Volume Descriptor (ECMA 167 3/10.1) */
96typedef struct udf_primary_volume_descriptor {
97 udf_descriptor_tag_t tag;
98 uint32_t sequence_number;
99 uint32_t primary_volume_descriptor_num;
100 udf_dstring volume_id[32];
101 uint16_t max_sequence_number;
102 uint16_t interchange_level;
103 uint16_t max_interchange_level;
104 uint32_t charset_list;
105 uint32_t max_charset_list;
106 udf_dstring volume_set_id[128];
107 udf_charspec_t descriptor_charset;
108 udf_charspec_t explanatory_charset;
109 udf_extent_t volume_abstract;
110 udf_extent_t volume_copyright_notice;
111 udf_regid_t application_id;
112 udf_timestamp_t recording_data_and_time;
113 udf_regid_t implementation_id;
114 uint8_t implementation_use[64];
115 uint32_t predecessor_vds_location;
116 uint16_t flags;
117 uint8_t reserved[22];
118} __attribute__((packed)) udf_primary_volume_descriptor_t;
119
120/* Partition Descriptor (ECMA 167 3/10.5) */
121typedef struct udf_partition_descriptor {
122 udf_descriptor_tag_t tag;
123 uint32_t sequence_number;
124 uint16_t flags;
125 uint16_t number;
126 udf_regid_t contents;
127 uint8_t contents_use[128];
128 uint32_t access_type;
129 uint32_t starting_location;
130 uint32_t length;
131 udf_regid_t implementation_id;
132 uint8_t implementation_use[128];
133 uint8_t reserved[156];
134} __attribute__((packed)) udf_partition_descriptor_t;
135
136/* Logical Volume Descriptor (ECMA 167 3/10.6) */
137typedef struct udf_logical_volume_descriptor {
138 udf_descriptor_tag_t tag;
139 uint32_t sequence_number;
140 udf_charspec_t charset;
141 udf_dstring logical_volume_id[128];
142 uint32_t logical_block_size;
143 udf_regid_t domain_id;
144 uint8_t logical_volume_conents_use[16];
145 uint32_t map_table_length;
146 uint32_t number_of_partitions_maps;
147 udf_regid_t implementation_id;
148 uint8_t implementation_use[128];
149 udf_extent_t integrity_sequence_extent;
150 uint8_t partition_map[0];
151} __attribute__((packed)) udf_logical_volume_descriptor_t;
152
153typedef struct udf_volume_descriptor {
154 union {
155 udf_common_descriptor_t common;
156 udf_terminating_descriptor_t terminating;
157 udf_volume_pointer_descriptor_t pointer;
158 udf_partition_descriptor_t partition;
159 udf_logical_volume_descriptor_t logical;
160 udf_unallocated_space_descriptor_t unallocated;
161 udf_primary_volume_descriptor_t volume;
162 };
163} __attribute__((packed)) udf_volume_descriptor_t;
164
165typedef struct udf_general_type {
166 uint8_t partition_map_type;
[c477c80]167 uint8_t partition_map_length;
[48e3190]168} __attribute__((packed)) udf_general_type_t;
169
170typedef struct udf_type1_partition_map {
171 uint8_t partition_map_type;
[c477c80]172 uint8_t partition_map_length;
[48e3190]173 uint16_t volume_sequence_number;
174 uint16_t partition_number;
175} __attribute__((packed)) udf_type1_partition_map_t;
176
177typedef struct udf_type2_partition_map {
178 uint8_t partition_map_type;
179 uint8_t partition_map_length;
180 uint8_t reserved1[2];
181 udf_regid_t partition_ident;
182 uint16_t volume_sequence_number;
183 uint16_t partition_number;
184} __attribute__((packed)) udf_type2_partition_map_t;
185
186/* Metadata Partition Map (UDF 2.4.0 2.2.10) */
187typedef struct udf_metadata_partition_map {
188 uint8_t partition_map_type;
189 uint8_t partition_map_length;
190 uint8_t reserved1[2];
191 udf_regid_t partition_ident;
192 uint16_t volume_sequence_number;
193 uint16_t partition_number;
194 uint32_t metadata_fileloc;
195 uint32_t metadata_mirror_fileloc;
196 uint32_t metadata_bitmap_fileloc;
197 uint32_t alloc_unit_size;
198 uint16_t align_unit_size;
199 uint8_t flags;
200 uint8_t reserved2[5];
201} __attribute__((packed)) udf_metadata_partition_map_t;
202
203/* Partition Header Descriptor (ECMA 167 4/14.3) */
204typedef struct udf_partition_header_descriptor {
205 udf_short_ad_t unallocated_space_table;
206 udf_short_ad_t unallocated_space_bitmap;
207 udf_short_ad_t partition_integrity_table;
208 udf_short_ad_t freed_space_table;
209 udf_short_ad_t freed_space_bitmap;
210 uint8_t reserved[88];
211} __attribute__((packed)) udf_partition_header_descriptor_t;
212
[b7fd2a0]213extern errno_t udf_volume_recongnition(service_id_t);
214extern errno_t udf_get_anchor_volume_descriptor(service_id_t,
[48e3190]215 udf_anchor_volume_descriptor_t *);
[b7fd2a0]216extern errno_t udf_read_volume_descriptor_sequence(service_id_t, udf_extent_t);
[48e3190]217extern fs_index_t udf_long_ad_to_pos(udf_instance_t *, udf_long_ad_t *);
218
219#endif
220
221/**
222 * @}
223 */
Note: See TracBrowser for help on using the repository browser.