VirtualBox

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

Last change on this file since 67180 was 66486, checked in by vboxsync, 8 years ago

Storage/VD: Convert all backends to use the region list callbacks, remove the pfnGetSize and pfnGetSectorSize callbacks because they are covered by the region lists

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