VirtualBox

source: vbox/trunk/include/VBox/vdmedia.h@ 94249

Last change on this file since 94249 was 93115, checked in by vboxsync, 3 years ago

scm --update-copyright-year

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
File size: 6.7 KB
Line 
1/** @file
2 * Virtual Disk Container API - Media type definitions shared with PDM.
3 */
4
5/*
6 * Copyright (C) 2017-2022 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
26#ifndef VBOX_INCLUDED_vdmedia_h
27#define VBOX_INCLUDED_vdmedia_h
28#ifndef RT_WITHOUT_PRAGMA_ONCE
29# pragma once
30#endif
31
32#include <iprt/types.h>
33
34/** @name VD container type.
35 * @{
36 */
37typedef enum VDTYPE
38{
39 /** Invalid. */
40 VDTYPE_INVALID = 0,
41 /** HardDisk */
42 VDTYPE_HDD,
43 /** Any kind of optical disc (CD/DVD etc.). */
44 VDTYPE_OPTICAL_DISC,
45 /** Floppy. */
46 VDTYPE_FLOPPY
47} VDTYPE;
48/** @}*/
49
50/** @name VD medium type.
51 * @{
52 */
53typedef enum VDMEDIUMTYPE
54{
55 /** Invalid. */
56 VDMEDIUMTYPE_INVALID = 0,
57 /** HardDisk (spinning platter or SSD). */
58 VDMEDIUMTYPE_HDD,
59 /** CD-ROM */
60 VDMEDIUMTYPE_CDROM,
61 /** DVD-ROM */
62 VDMEDIUMTYPE_DVDROM,
63 /** BluRay. */
64 VDMEDIUMTYPE_BD,
65 /** 360KB 5 1/4" floppy. */
66 VDMEDIUMTYPE_FLOPPY_360,
67 /** 720KB 3 1/2" floppy. */
68 VDMEDIUMTYPE_FLOPPY_720,
69 /** 1.2MB 5 1/4" floppy. */
70 VDMEDIUMTYPE_FLOPPY_1_20,
71 /** 1.44MB 3 1/2" floppy. */
72 VDMEDIUMTYPE_FLOPPY_1_44,
73 /** 2.88MB 3 1/2" floppy. */
74 VDMEDIUMTYPE_FLOPPY_2_88,
75 /** Fake disk that can take up to 15.6 MB images.
76 * C=255, H=2, S=63. */
77 VDMEDIUMTYPE_FLOPPY_FAKE_15_6,
78 /** Fake disk that can take up to 63.5 MB images.
79 * C=255, H=2, S=255. */
80 VDMEDIUMTYPE_FLOPPY_FAKE_63_5
81} VDMEDIUMTYPE;
82/** @} */
83
84/** Check if the given medium type is a floppy. */
85#define VDMEDIUMTYPE_IS_FLOPPY(a_enmType) ( (a_enmType) >= VDMEDIUMTYPE_FLOPPY_360 && (a_enmType) <= VDMEDIUMTYPE_FLOPPY_2_88 )
86
87/**
88 * Disk geometry.
89 */
90typedef struct VDGEOMETRY
91{
92 /** Number of cylinders. */
93 uint32_t cCylinders;
94 /** Number of heads. */
95 uint32_t cHeads;
96 /** Number of sectors. */
97 uint32_t cSectors;
98} VDGEOMETRY;
99
100/** Pointer to disk geometry. */
101typedef VDGEOMETRY *PVDGEOMETRY;
102/** Pointer to constant disk geometry. */
103typedef const VDGEOMETRY *PCVDGEOMETRY;
104
105/**
106 * Disk region data form known to us from various standards.
107 */
108typedef enum VDREGIONDATAFORM
109{
110 /** Invalid data form. */
111 VDREGIONDATAFORM_INVALID = 0,
112 /** Raw data, no standardized format. */
113 VDREGIONDATAFORM_RAW,
114 /** CD-DA (audio CD), 2352 bytes of data. */
115 VDREGIONDATAFORM_CDDA,
116 /** CDDA data is pause. */
117 VDREGIONDATAFORM_CDDA_PAUSE,
118 /** Mode 1 with 2048 bytes sector size. */
119 VDREGIONDATAFORM_MODE1_2048,
120 /** Mode 1 with 2352 bytes sector size. */
121 VDREGIONDATAFORM_MODE1_2352,
122 /** Mode 1 with 0 bytes sector size (generated by the drive). */
123 VDREGIONDATAFORM_MODE1_0,
124 /** XA Mode with 2336 bytes sector size. */
125 VDREGIONDATAFORM_XA_2336,
126 /** XA Mode with 2352 bytes sector size. */
127 VDREGIONDATAFORM_XA_2352,
128 /** XA Mode with 0 bytes sector size (generated by the drive). */
129 VDREGIONDATAFORM_XA_0,
130 /** Mode 2 with 2336 bytes sector size. */
131 VDREGIONDATAFORM_MODE2_2336,
132 /** Mode 2 with 2352 bytes sector size. */
133 VDREGIONDATAFORM_MODE2_2352,
134 /** Mode 2 with 0 bytes sector size (generated by the drive). */
135 VDREGIONDATAFORM_MODE2_0
136} VDREGIONDATAFORM;
137/** Pointer to a region data form. */
138typedef VDREGIONDATAFORM *PVDREGIONDATAFORM;
139/** Pointer to a const region data form. */
140typedef const VDREGIONDATAFORM PCVDREGIONDATAFORM;
141
142/**
143 * Disk region metadata forms known to us.
144 */
145typedef enum VDREGIONMETADATAFORM
146{
147 /** Invalid metadata form. */
148 VDREGIONMETADATAFORM_INVALID = 0,
149 /** No metadata assined to the region. */
150 VDREGIONMETADATAFORM_NONE,
151 /** Raw metadata, no standardized format. */
152 VDREGIONMETADATAFORM_RAW
153} VDREGIONMETADATAFORM;
154/** Pointer to a region metadata form. */
155typedef VDREGIONMETADATAFORM *PVDREGIONMETADATAFORM;
156/** Pointer to a const region metadata form. */
157typedef const VDREGIONMETADATAFORM PCVDREGIONMETADATAFORM;
158
159/**
160 * Disk region descriptor.
161 */
162typedef struct VDREGIONDESC
163{
164 /** Start of the region in bytes or LBA number (depending on the flag in the
165 * list header). */
166 uint64_t offRegion;
167 /** Overall size of the region in bytes or number of blocks (depending on the
168 * flag in the list header). */
169 uint64_t cRegionBlocksOrBytes;
170 /** Size of one block in bytes, containing user and metadata. */
171 uint64_t cbBlock;
172 /** User data form of the block. */
173 VDREGIONDATAFORM enmDataForm;
174 /** Metadata form of the block. */
175 VDREGIONMETADATAFORM enmMetadataForm;
176 /** Size of the data block in bytes. */
177 uint64_t cbData;
178 /** Size of the metadata in a block in bytes. */
179 uint64_t cbMetadata;
180} VDREGIONDESC;
181/** Pointer to a region descriptor. */
182typedef VDREGIONDESC *PVDREGIONDESC;
183/** Pointer to a constant region descriptor. */
184typedef const VDREGIONDESC *PCVDREGIONDESC;
185
186/**
187 * Disk region list.
188 */
189typedef struct VDREGIONLIST
190{
191 /** Flags valid for the region list. */
192 uint32_t fFlags;
193 /** Number of regions in the descriptor array. */
194 uint32_t cRegions;
195 /** Region descriptors - variable in size. */
196 VDREGIONDESC aRegions[RT_FLEXIBLE_ARRAY_NESTED];
197} VDREGIONLIST;
198/** Pointer to a region list. */
199typedef VDREGIONLIST *PVDREGIONLIST;
200/** Pointer to a constant region list. */
201typedef const VDREGIONLIST *PCVDREGIONLIST;
202/** Pointer to a region list pointer. */
203typedef PVDREGIONLIST *PPVDREGIONLIST;
204
205/** @name Valid region list flags.
206 * @{
207 */
208/** When set the region start offset and size are given in numbers of blocks
209 * instead of byte offsets and sizes. */
210#define VD_REGION_LIST_F_LOC_SIZE_BLOCKS RT_BIT_32(0)
211/** Mask of all valid flags. */
212#define VD_REGION_LIST_F_VALID (VD_REGION_LIST_F_LOC_SIZE_BLOCKS)
213/** @} */
214
215#endif /* !VBOX_INCLUDED_vdmedia_h */
216
Note: See TracBrowser for help on using the repository browser.

© 2024 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette