1 | /** @file
|
---|
2 | * Virtual Disk Container API - Media type definitions shared with PDM.
|
---|
3 | */
|
---|
4 |
|
---|
5 | /*
|
---|
6 | * Copyright (C) 2017 Oracle Corporation
|
---|
7 | *
|
---|
8 | * This file is part of VirtualBox Open Source Edition (OSE), as
|
---|
9 | * available from http://www.virtualbox.org. This file is free software;
|
---|
10 | * you can redistribute it and/or modify it under the terms of the GNU
|
---|
11 | * General Public License (GPL) as published by the Free Software
|
---|
12 | * Foundation, in version 2 as it comes in the "COPYING" file of the
|
---|
13 | * VirtualBox OSE distribution. VirtualBox OSE is distributed in the
|
---|
14 | * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
|
---|
15 | *
|
---|
16 | * The contents of this file may alternatively be used under the terms
|
---|
17 | * of the Common Development and Distribution License Version 1.0
|
---|
18 | * (CDDL) only, as it comes in the "COPYING.CDDL" file of the
|
---|
19 | * VirtualBox OSE distribution, in which case the provisions of the
|
---|
20 | * CDDL are applicable instead of those of the GPL.
|
---|
21 | *
|
---|
22 | * You may elect to license modified versions of this file under the
|
---|
23 | * terms and conditions of either the GPL or the CDDL or both.
|
---|
24 | */
|
---|
25 | #ifndef ___VBox_vdmedia_h
|
---|
26 | #define ___VBox_vdmedia_h
|
---|
27 |
|
---|
28 | /** @name VD container type.
|
---|
29 | * @{
|
---|
30 | */
|
---|
31 | typedef enum VDTYPE
|
---|
32 | {
|
---|
33 | /** Invalid. */
|
---|
34 | VDTYPE_INVALID = 0,
|
---|
35 | /** HardDisk */
|
---|
36 | VDTYPE_HDD,
|
---|
37 | /** DVD */
|
---|
38 | VDTYPE_DVD,
|
---|
39 | /** Floppy. */
|
---|
40 | VDTYPE_FLOPPY
|
---|
41 | } VDTYPE;
|
---|
42 | /** @}*/
|
---|
43 |
|
---|
44 | /**
|
---|
45 | * Disk geometry.
|
---|
46 | */
|
---|
47 | typedef struct VDGEOMETRY
|
---|
48 | {
|
---|
49 | /** Number of cylinders. */
|
---|
50 | uint32_t cCylinders;
|
---|
51 | /** Number of heads. */
|
---|
52 | uint32_t cHeads;
|
---|
53 | /** Number of sectors. */
|
---|
54 | uint32_t cSectors;
|
---|
55 | } VDGEOMETRY;
|
---|
56 |
|
---|
57 | /** Pointer to disk geometry. */
|
---|
58 | typedef VDGEOMETRY *PVDGEOMETRY;
|
---|
59 | /** Pointer to constant disk geometry. */
|
---|
60 | typedef const VDGEOMETRY *PCVDGEOMETRY;
|
---|
61 |
|
---|
62 | /**
|
---|
63 | * Disk region data form known to us from various standards.
|
---|
64 | */
|
---|
65 | typedef enum VDREGIONDATAFORM
|
---|
66 | {
|
---|
67 | /** Invalid data form. */
|
---|
68 | VDREGIONDATAFORM_INVALID = 0,
|
---|
69 | /** Raw data, no standardized format. */
|
---|
70 | VDREGIONDATAFORM_RAW,
|
---|
71 | /** CD-DA (audio CD), 2352 bytes of data. */
|
---|
72 | VDREGIONDATAFORM_CDDA,
|
---|
73 | /** CDDA data is pause. */
|
---|
74 | VDREGIONDATAFORM_CDDA_PAUSE,
|
---|
75 | /** Mode 1 with 2048 bytes sector size. */
|
---|
76 | VDREGIONDATAFORM_MODE1_2048,
|
---|
77 | /** Mode 1 with 2352 bytes sector size. */
|
---|
78 | VDREGIONDATAFORM_MODE1_2352,
|
---|
79 | /** Mode 1 with 0 bytes sector size (generated by the drive). */
|
---|
80 | VDREGIONDATAFORM_MODE1_0,
|
---|
81 | /** XA Mode with 2336 bytes sector size. */
|
---|
82 | VDREGIONDATAFORM_XA_2336,
|
---|
83 | /** XA Mode with 2352 bytes sector size. */
|
---|
84 | VDREGIONDATAFORM_XA_2352,
|
---|
85 | /** XA Mode with 0 bytes sector size (generated by the drive). */
|
---|
86 | VDREGIONDATAFORM_XA_0,
|
---|
87 | /** Mode 2 with 2336 bytes sector size. */
|
---|
88 | VDREGIONDATAFORM_MODE2_2336,
|
---|
89 | /** Mode 2 with 2352 bytes sector size. */
|
---|
90 | VDREGIONDATAFORM_MODE2_2352,
|
---|
91 | /** Mode 2 with 0 bytes sector size (generated by the drive). */
|
---|
92 | VDREGIONDATAFORM_MODE2_0
|
---|
93 | } VDREGIONDATAFORM;
|
---|
94 | /** Pointer to a region data form. */
|
---|
95 | typedef VDREGIONDATAFORM *PVDREGIONDATAFORM;
|
---|
96 | /** Pointer to a const region data form. */
|
---|
97 | typedef const VDREGIONDATAFORM PCVDREGIONDATAFORM;
|
---|
98 |
|
---|
99 | /**
|
---|
100 | * Disk region metadata forms known to us.
|
---|
101 | */
|
---|
102 | typedef enum VDREGIONMETADATAFORM
|
---|
103 | {
|
---|
104 | /** Invalid metadata form. */
|
---|
105 | VDREGIONMETADATAFORM_INVALID = 0,
|
---|
106 | /** No metadata assined to the region. */
|
---|
107 | VDREGIONMETADATAFORM_NONE,
|
---|
108 | /** Raw metadata, no standardized format. */
|
---|
109 | VDREGIONMETADATAFORM_RAW
|
---|
110 | } VDREGIONMETADATAFORM;
|
---|
111 | /** Pointer to a region metadata form. */
|
---|
112 | typedef VDREGIONMETADATAFORM *PVDREGIONMETADATAFORM;
|
---|
113 | /** Pointer to a const region metadata form. */
|
---|
114 | typedef const VDREGIONMETADATAFORM PCVDREGIONMETADATAFORM;
|
---|
115 |
|
---|
116 | /**
|
---|
117 | * Disk region descriptor.
|
---|
118 | */
|
---|
119 | typedef struct VDREGIONDESC
|
---|
120 | {
|
---|
121 | /** Start of the region in bytes or LBA number (depending on the flag in the
|
---|
122 | * list header). */
|
---|
123 | uint64_t offRegion;
|
---|
124 | /** Overall size of the region in bytes or number of blocks (depending on the
|
---|
125 | * flag in the list header). */
|
---|
126 | uint64_t cRegionBlocksOrBytes;
|
---|
127 | /** Size of one block in bytes, containing user and metadata. */
|
---|
128 | uint64_t cbBlock;
|
---|
129 | /** User data form of the block. */
|
---|
130 | VDREGIONDATAFORM enmDataForm;
|
---|
131 | /** Metadata form of the block. */
|
---|
132 | VDREGIONMETADATAFORM enmMetadataForm;
|
---|
133 | /** Size of the data block in bytes. */
|
---|
134 | uint64_t cbData;
|
---|
135 | /** Size of the metadata in a block in bytes. */
|
---|
136 | uint64_t cbMetadata;
|
---|
137 | } VDREGIONDESC;
|
---|
138 | /** Pointer to a region descriptor. */
|
---|
139 | typedef VDREGIONDESC *PVDREGIONDESC;
|
---|
140 | /** Pointer to a constant region descriptor. */
|
---|
141 | typedef const VDREGIONDESC *PCVDREGIONDESC;
|
---|
142 |
|
---|
143 | /**
|
---|
144 | * Disk region list.
|
---|
145 | */
|
---|
146 | typedef struct VDREGIONLIST
|
---|
147 | {
|
---|
148 | /** Flags valid for the region list. */
|
---|
149 | uint32_t fFlags;
|
---|
150 | /** Number of regions in the descriptor array. */
|
---|
151 | uint32_t cRegions;
|
---|
152 | /** Region descriptors - variable in size. */
|
---|
153 | VDREGIONDESC aRegions[RT_FLEXIBLE_ARRAY];
|
---|
154 | } VDREGIONLIST;
|
---|
155 | /** Pointer to a region list. */
|
---|
156 | typedef VDREGIONLIST *PVDREGIONLIST;
|
---|
157 | /** Pointer to a constant region list. */
|
---|
158 | typedef const VDREGIONLIST *PCVDREGIONLIST;
|
---|
159 | /** Pointer to a region list pointer. */
|
---|
160 | typedef PVDREGIONLIST *PPVDREGIONLIST;
|
---|
161 |
|
---|
162 | /** @name Valid region list flags.
|
---|
163 | * @{
|
---|
164 | */
|
---|
165 | /** When set the region start offset and size are given in numbers of blocks
|
---|
166 | * instead of byte offsets and sizes. */
|
---|
167 | #define VD_REGION_LIST_F_LOC_SIZE_BLOCKS RT_BIT_32(0)
|
---|
168 | /** Mask of all valid flags. */
|
---|
169 | #define VD_REGION_LIST_F_VALID (VD_REGION_LIST_F_LOC_SIZE_BLOCKS)
|
---|
170 | /** @} */
|
---|
171 |
|
---|
172 | #endif /* !___VBox_vdmedia_h */
|
---|