]> git.proxmox.com Git - mirror_edk2.git/blob - MdePkg/Include/IndustryStandard/Udf.h
MdePkg: Add UDF volume structure definitions
[mirror_edk2.git] / MdePkg / Include / IndustryStandard / Udf.h
1 /** @file
2 OSTA Universal Disk Format (UDF) definitions.
3
4 Copyright (C) 2014-2017 Paulo Alcantara <pcacjr@zytor.com>
5
6 This program and the accompanying materials are licensed and made available
7 under the terms and conditions of the BSD License which accompanies this
8 distribution. The full text of the license may be found at
9 http://opensource.org/licenses/bsd-license.php
10
11 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, WITHOUT
12 WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
13 **/
14
15 #ifndef __UDF_H__
16 #define __UDF_H__
17
18 #define UDF_BEA_IDENTIFIER "BEA01"
19 #define UDF_NSR2_IDENTIFIER "NSR02"
20 #define UDF_NSR3_IDENTIFIER "NSR03"
21 #define UDF_TEA_IDENTIFIER "TEA01"
22
23 #define UDF_LOGICAL_SECTOR_SHIFT 11
24 #define UDF_LOGICAL_SECTOR_SIZE ((UINT64)(1ULL << UDF_LOGICAL_SECTOR_SHIFT))
25 #define UDF_VRS_START_OFFSET ((UINT64)(16ULL << UDF_LOGICAL_SECTOR_SHIFT))
26
27 typedef enum {
28 UdfPrimaryVolumeDescriptor = 1,
29 UdfAnchorVolumeDescriptorPointer = 2,
30 UdfVolumeDescriptorPointer = 3,
31 UdfImplemenationUseVolumeDescriptor = 4,
32 UdfPartitionDescriptor = 5,
33 UdfLogicalVolumeDescriptor = 6,
34 UdfUnallocatedSpaceDescriptor = 7,
35 UdfTerminatingDescriptor = 8,
36 UdfLogicalVolumeIntegrityDescriptor = 9,
37 UdfFileSetDescriptor = 256,
38 UdfFileIdentifierDescriptor = 257,
39 UdfAllocationExtentDescriptor = 258,
40 UdfFileEntry = 261,
41 UdfExtendedFileEntry = 266,
42 } UDF_VOLUME_DESCRIPTOR_ID;
43
44 #pragma pack(1)
45
46 typedef struct {
47 UINT16 TagIdentifier;
48 UINT16 DescriptorVersion;
49 UINT8 TagChecksum;
50 UINT8 Reserved;
51 UINT16 TagSerialNumber;
52 UINT16 DescriptorCRC;
53 UINT16 DescriptorCRCLength;
54 UINT32 TagLocation;
55 } UDF_DESCRIPTOR_TAG;
56
57 typedef struct {
58 UINT32 ExtentLength;
59 UINT32 ExtentLocation;
60 } UDF_EXTENT_AD;
61
62 typedef struct {
63 UINT8 CharacterSetType;
64 UINT8 CharacterSetInfo[63];
65 } UDF_CHAR_SPEC;
66
67 typedef struct {
68 UINT8 Flags;
69 UINT8 Identifier[23];
70 union {
71 //
72 // Domain Entity Identifier
73 //
74 struct {
75 UINT16 UdfRevision;
76 UINT8 DomainFlags;
77 UINT8 Reserved[5];
78 } Domain;
79 //
80 // UDF Entity Identifier
81 //
82 struct {
83 UINT16 UdfRevision;
84 UINT8 OSClass;
85 UINT8 OSIdentifier;
86 UINT8 Reserved[4];
87 } Entity;
88 //
89 // Implementation Entity Identifier
90 //
91 struct {
92 UINT8 OSClass;
93 UINT8 OSIdentifier;
94 UINT8 ImplementationUseArea[6];
95 } ImplementationEntity;
96 //
97 // Application Entity Identifier
98 //
99 struct {
100 UINT8 ApplicationUseArea[8];
101 } ApplicationEntity;
102 //
103 // Raw Identifier Suffix
104 //
105 struct {
106 UINT8 Data[8];
107 } Raw;
108 } Suffix;
109 } UDF_ENTITY_ID;
110
111 typedef struct {
112 UINT32 LogicalBlockNumber;
113 UINT16 PartitionReferenceNumber;
114 } UDF_LB_ADDR;
115
116 typedef struct {
117 UINT32 ExtentLength;
118 UDF_LB_ADDR ExtentLocation;
119 UINT8 ImplementationUse[6];
120 } UDF_LONG_ALLOCATION_DESCRIPTOR;
121
122 typedef struct {
123 UDF_DESCRIPTOR_TAG DescriptorTag;
124 UDF_EXTENT_AD MainVolumeDescriptorSequenceExtent;
125 UDF_EXTENT_AD ReserveVolumeDescriptorSequenceExtent;
126 UINT8 Reserved[480];
127 } UDF_ANCHOR_VOLUME_DESCRIPTOR_POINTER;
128
129 typedef struct {
130 UDF_DESCRIPTOR_TAG DescriptorTag;
131 UINT32 VolumeDescriptorSequenceNumber;
132 UDF_CHAR_SPEC DescriptorCharacterSet;
133 UINT8 LogicalVolumeIdentifier[128];
134 UINT32 LogicalBlockSize;
135 UDF_ENTITY_ID DomainIdentifier;
136 UDF_LONG_ALLOCATION_DESCRIPTOR LogicalVolumeContentsUse;
137 UINT32 MapTableLength;
138 UINT32 NumberOfPartitionMaps;
139 UDF_ENTITY_ID ImplementationIdentifier;
140 UINT8 ImplementationUse[128];
141 UDF_EXTENT_AD IntegritySequenceExtent;
142 UINT8 PartitionMaps[6];
143 } UDF_LOGICAL_VOLUME_DESCRIPTOR;
144
145 #pragma pack()
146
147 #endif