VirtualBox

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

Last change on this file since 73768 was 68670, checked in by vboxsync, 7 years ago

include file build fixes (kmk -C include)

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

© 2023 Oracle
ContactPrivacy policyTerms of Use