VirtualBox

source: vbox/trunk/src/VBox/Devices/Storage/VDICore.h@ 31193

Last change on this file since 31193 was 28800, checked in by vboxsync, 15 years ago

Automated rebranding to Oracle copyright/license strings via filemuncher

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
File size: 20.1 KB
Line 
1/* $Id: VDICore.h 28800 2010-04-27 08:22:32Z vboxsync $ */
2/** @file
3 * Virtual Disk Image (VDI), Core Code Header (internal).
4 */
5
6/*
7 * Copyright (C) 2006-2009 Oracle Corporation
8 *
9 * This file is part of VirtualBox Open Source Edition (OSE), as
10 * available from http://www.virtualbox.org. This file is free software;
11 * you can redistribute it and/or modify it under the terms of the GNU
12 * General Public License (GPL) as published by the Free Software
13 * Foundation, in version 2 as it comes in the "COPYING" file of the
14 * VirtualBox OSE distribution. VirtualBox OSE is distributed in the
15 * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
16 */
17
18#ifndef __VDICore_h__
19
20
21/*******************************************************************************
22* Header Files *
23*******************************************************************************/
24#ifndef VBOX_VDICORE_VD
25#include <VBox/VBoxHDD.h>
26#else /* VBOX_VDICORE_VD */
27#include <VBox/VBoxHDD.h>
28#endif /* VBOX_VDICORE_VD */
29#include <VBox/pdm.h>
30#include <VBox/mm.h>
31#include <VBox/err.h>
32
33#include <VBox/log.h>
34#include <iprt/alloc.h>
35#include <iprt/assert.h>
36#include <iprt/uuid.h>
37#include <iprt/file.h>
38#include <iprt/string.h>
39#include <iprt/asm.h>
40
41
42/*******************************************************************************
43* Constants And Macros, Structures and Typedefs *
44*******************************************************************************/
45
46/** Image info, not handled anyhow.
47 * Must be less than 64 bytes in length, including the trailing 0.
48 */
49#define VDI_IMAGE_FILE_INFO "<<< Sun VirtualBox Disk Image >>>\n"
50
51/** The Sector size.
52 * Currently we support only 512 bytes sectors.
53 */
54#define VDI_GEOMETRY_SECTOR_SIZE (512)
55/** 512 = 2^^9 */
56#define VDI_GEOMETRY_SECTOR_SHIFT (9)
57
58/**
59 * Harddisk geometry.
60 */
61#pragma pack(1)
62typedef struct VDIDISKGEOMETRY
63{
64 /** Cylinders. */
65 uint32_t cCylinders;
66 /** Heads. */
67 uint32_t cHeads;
68 /** Sectors per track. */
69 uint32_t cSectors;
70 /** Sector size. (bytes per sector) */
71 uint32_t cbSector;
72} VDIDISKGEOMETRY, *PVDIDISKGEOMETRY;
73#pragma pack()
74
75/** Image signature. */
76#define VDI_IMAGE_SIGNATURE (0xbeda107f)
77
78/**
79 * Pre-Header to be stored in image file - used for version control.
80 */
81#pragma pack(1)
82typedef struct VDIPREHEADER
83{
84 /** Just text info about image type, for eyes only. */
85 char szFileInfo[64];
86 /** The image signature (VDI_IMAGE_SIGNATURE). */
87 uint32_t u32Signature;
88 /** The image version (VDI_IMAGE_VERSION). */
89 uint32_t u32Version;
90} VDIPREHEADER, *PVDIPREHEADER;
91#pragma pack()
92
93/**
94 * Size of szComment field of HDD image header.
95 */
96#define VDI_IMAGE_COMMENT_SIZE 256
97
98/**
99 * Header to be stored in image file, VDI_IMAGE_VERSION_MAJOR = 0.
100 * Prepended by VDIPREHEADER.
101 */
102#pragma pack(1)
103typedef struct VDIHEADER0
104{
105 /** The image type (VDI_IMAGE_TYPE_*). */
106 uint32_t u32Type;
107 /** Image flags (VDI_IMAGE_FLAGS_*). */
108 uint32_t fFlags;
109 /** Image comment. (UTF-8) */
110 char szComment[VDI_IMAGE_COMMENT_SIZE];
111 /** Legacy image geometry (previous code stored PCHS there). */
112 VDIDISKGEOMETRY LegacyGeometry;
113 /** Size of disk (in bytes). */
114 uint64_t cbDisk;
115 /** Block size. (For instance VDI_IMAGE_BLOCK_SIZE.) */
116 uint32_t cbBlock;
117 /** Number of blocks. */
118 uint32_t cBlocks;
119 /** Number of allocated blocks. */
120 uint32_t cBlocksAllocated;
121 /** UUID of image. */
122 RTUUID uuidCreate;
123 /** UUID of image's last modification. */
124 RTUUID uuidModify;
125 /** Only for secondary images - UUID of primary image. */
126 RTUUID uuidLinkage;
127} VDIHEADER0, *PVDIHEADER0;
128#pragma pack()
129
130/**
131 * Header to be stored in image file, VDI_IMAGE_VERSION_MAJOR = 1,
132 * VDI_IMAGE_VERSION_MINOR = 1. Prepended by VDIPREHEADER.
133 */
134#pragma pack(1)
135typedef struct VDIHEADER1
136{
137 /** Size of this structure in bytes. */
138 uint32_t cbHeader;
139 /** The image type (VDI_IMAGE_TYPE_*). */
140 uint32_t u32Type;
141 /** Image flags (VDI_IMAGE_FLAGS_*). */
142 uint32_t fFlags;
143 /** Image comment. (UTF-8) */
144 char szComment[VDI_IMAGE_COMMENT_SIZE];
145 /** Offset of Blocks array from the begining of image file.
146 * Should be sector-aligned for HDD access optimization. */
147 uint32_t offBlocks;
148 /** Offset of image data from the begining of image file.
149 * Should be sector-aligned for HDD access optimization. */
150 uint32_t offData;
151 /** Legacy image geometry (previous code stored PCHS there). */
152 VDIDISKGEOMETRY LegacyGeometry;
153 /** Was BIOS HDD translation mode, now unused. */
154 uint32_t u32Dummy;
155 /** Size of disk (in bytes). */
156 uint64_t cbDisk;
157 /** Block size. (For instance VDI_IMAGE_BLOCK_SIZE.) Should be a power of 2! */
158 uint32_t cbBlock;
159 /** Size of additional service information of every data block.
160 * Prepended before block data. May be 0.
161 * Should be a power of 2 and sector-aligned for optimization reasons. */
162 uint32_t cbBlockExtra;
163 /** Number of blocks. */
164 uint32_t cBlocks;
165 /** Number of allocated blocks. */
166 uint32_t cBlocksAllocated;
167 /** UUID of image. */
168 RTUUID uuidCreate;
169 /** UUID of image's last modification. */
170 RTUUID uuidModify;
171 /** Only for secondary images - UUID of previous image. */
172 RTUUID uuidLinkage;
173 /** Only for secondary images - UUID of previous image's last modification. */
174 RTUUID uuidParentModify;
175} VDIHEADER1, *PVDIHEADER1;
176#pragma pack()
177
178/**
179 * Header to be stored in image file, VDI_IMAGE_VERSION_MAJOR = 1,
180 * VDI_IMAGE_VERSION_MINOR = 1, the slightly changed variant necessary as the
181 * old released code doesn't support changing the minor version at all.
182 */
183#pragma pack(1)
184typedef struct VDIHEADER1PLUS
185{
186 /** Size of this structure in bytes. */
187 uint32_t cbHeader;
188 /** The image type (VDI_IMAGE_TYPE_*). */
189 uint32_t u32Type;
190 /** Image flags (VDI_IMAGE_FLAGS_*). */
191 uint32_t fFlags;
192 /** Image comment. (UTF-8) */
193 char szComment[VDI_IMAGE_COMMENT_SIZE];
194 /** Offset of Blocks array from the begining of image file.
195 * Should be sector-aligned for HDD access optimization. */
196 uint32_t offBlocks;
197 /** Offset of image data from the begining of image file.
198 * Should be sector-aligned for HDD access optimization. */
199 uint32_t offData;
200 /** Legacy image geometry (previous code stored PCHS there). */
201 VDIDISKGEOMETRY LegacyGeometry;
202 /** Was BIOS HDD translation mode, now unused. */
203 uint32_t u32Dummy;
204 /** Size of disk (in bytes). */
205 uint64_t cbDisk;
206 /** Block size. (For instance VDI_IMAGE_BLOCK_SIZE.) Should be a power of 2! */
207 uint32_t cbBlock;
208 /** Size of additional service information of every data block.
209 * Prepended before block data. May be 0.
210 * Should be a power of 2 and sector-aligned for optimization reasons. */
211 uint32_t cbBlockExtra;
212 /** Number of blocks. */
213 uint32_t cBlocks;
214 /** Number of allocated blocks. */
215 uint32_t cBlocksAllocated;
216 /** UUID of image. */
217 RTUUID uuidCreate;
218 /** UUID of image's last modification. */
219 RTUUID uuidModify;
220 /** Only for secondary images - UUID of previous image. */
221 RTUUID uuidLinkage;
222 /** Only for secondary images - UUID of previous image's last modification. */
223 RTUUID uuidParentModify;
224 /** LCHS image geometry (new field in VDI1.2 version. */
225 VDIDISKGEOMETRY LCHSGeometry;
226} VDIHEADER1PLUS, *PVDIHEADER1PLUS;
227#pragma pack()
228
229/**
230 * Header structure for all versions.
231 */
232typedef struct VDIHEADER
233{
234 unsigned uVersion;
235 union
236 {
237 VDIHEADER0 v0;
238 VDIHEADER1 v1;
239 VDIHEADER1PLUS v1plus;
240 } u;
241} VDIHEADER, *PVDIHEADER;
242
243/** Block 'pointer'. */
244typedef uint32_t VDIIMAGEBLOCKPOINTER;
245/** Pointer to a block 'pointer'. */
246typedef VDIIMAGEBLOCKPOINTER *PVDIIMAGEBLOCKPOINTER;
247
248/**
249 * Block marked as free is not allocated in image file, read from this
250 * block may returns any random data.
251 */
252#define VDI_IMAGE_BLOCK_FREE ((VDIIMAGEBLOCKPOINTER)~0)
253
254/**
255 * Block marked as zero is not allocated in image file, read from this
256 * block returns zeroes.
257 */
258#define VDI_IMAGE_BLOCK_ZERO ((VDIIMAGEBLOCKPOINTER)~1)
259
260/**
261 * Block 'pointer' >= VDI_IMAGE_BLOCK_UNALLOCATED indicates block is not
262 * allocated in image file.
263 */
264#define VDI_IMAGE_BLOCK_UNALLOCATED (VDI_IMAGE_BLOCK_ZERO)
265#define IS_VDI_IMAGE_BLOCK_ALLOCATED(bp) (bp < VDI_IMAGE_BLOCK_UNALLOCATED)
266
267#define GET_MAJOR_HEADER_VERSION(ph) (VDI_GET_VERSION_MAJOR((ph)->uVersion))
268#define GET_MINOR_HEADER_VERSION(ph) (VDI_GET_VERSION_MINOR((ph)->uVersion))
269
270#ifdef VBOX_VDICORE_VD
271/** @name VDI image types
272 * @{ */
273typedef enum VDIIMAGETYPE
274{
275 /** Normal dynamically growing base image file. */
276 VDI_IMAGE_TYPE_NORMAL = 1,
277 /** Preallocated base image file of a fixed size. */
278 VDI_IMAGE_TYPE_FIXED,
279 /** Dynamically growing image file for undo/commit changes support. */
280 VDI_IMAGE_TYPE_UNDO,
281 /** Dynamically growing image file for differencing support. */
282 VDI_IMAGE_TYPE_DIFF,
283
284 /** First valid image type value. */
285 VDI_IMAGE_TYPE_FIRST = VDI_IMAGE_TYPE_NORMAL,
286 /** Last valid image type value. */
287 VDI_IMAGE_TYPE_LAST = VDI_IMAGE_TYPE_DIFF
288} VDIIMAGETYPE;
289/** Pointer to VDI image type. */
290typedef VDIIMAGETYPE *PVDIIMAGETYPE;
291/** @} */
292#endif /* VBOX_VDICORE_VD */
293
294/*******************************************************************************
295* Internal Functions for header access *
296*******************************************************************************/
297DECLINLINE(VDIIMAGETYPE) getImageType(PVDIHEADER ph)
298{
299 switch (GET_MAJOR_HEADER_VERSION(ph))
300 {
301 case 0: return (VDIIMAGETYPE)ph->u.v0.u32Type;
302 case 1: return (VDIIMAGETYPE)ph->u.v1.u32Type;
303 }
304 AssertFailed();
305 return (VDIIMAGETYPE)0;
306}
307
308#ifdef VBOX_VDICORE_VD
309DECLINLINE(unsigned) getImageFlags(PVDIHEADER ph)
310{
311 switch (GET_MAJOR_HEADER_VERSION(ph))
312 {
313 case 0:
314 /* VDI image flag conversion to VD image flags. */
315 return ph->u.v0.fFlags << 8;
316 case 1:
317 /* VDI image flag conversion to VD image flags. */
318 return ph->u.v1.fFlags << 8;
319 }
320 AssertFailed();
321 return 0;
322}
323#else /* !VBOX_VDICORE_VD */
324DECLINLINE(unsigned) getImageFlags(PVDIHEADER ph)
325{
326 switch (GET_MAJOR_HEADER_VERSION(ph))
327 {
328 case 0: return ph->u.v0.fFlags;
329 case 1: return ph->u.v1.fFlags;
330 }
331 AssertFailed();
332 return 0;
333}
334#endif /* !VBOX_VDICORE_VD */
335
336DECLINLINE(char *) getImageComment(PVDIHEADER ph)
337{
338 switch (GET_MAJOR_HEADER_VERSION(ph))
339 {
340 case 0: return &ph->u.v0.szComment[0];
341 case 1: return &ph->u.v1.szComment[0];
342 }
343 AssertFailed();
344 return NULL;
345}
346
347DECLINLINE(unsigned) getImageBlocksOffset(PVDIHEADER ph)
348{
349 switch (GET_MAJOR_HEADER_VERSION(ph))
350 {
351 case 0: return (sizeof(VDIPREHEADER) + sizeof(VDIHEADER0));
352 case 1: return ph->u.v1.offBlocks;
353 }
354 AssertFailed();
355 return 0;
356}
357
358DECLINLINE(unsigned) getImageDataOffset(PVDIHEADER ph)
359{
360 switch (GET_MAJOR_HEADER_VERSION(ph))
361 {
362 case 0: return sizeof(VDIPREHEADER) + sizeof(VDIHEADER0) + \
363 (ph->u.v0.cBlocks * sizeof(VDIIMAGEBLOCKPOINTER));
364 case 1: return ph->u.v1.offData;
365 }
366 AssertFailed();
367 return 0;
368}
369
370DECLINLINE(PVDIDISKGEOMETRY) getImageLCHSGeometry(PVDIHEADER ph)
371{
372 switch (GET_MAJOR_HEADER_VERSION(ph))
373 {
374 case 0: return NULL;
375 case 1:
376 switch (GET_MINOR_HEADER_VERSION(ph))
377 {
378 case 1:
379 if (ph->u.v1.cbHeader < sizeof(ph->u.v1plus))
380 return NULL;
381 else
382 return &ph->u.v1plus.LCHSGeometry;
383 }
384 }
385 AssertFailed();
386 return NULL;
387}
388
389DECLINLINE(uint64_t) getImageDiskSize(PVDIHEADER ph)
390{
391 switch (GET_MAJOR_HEADER_VERSION(ph))
392 {
393 case 0: return ph->u.v0.cbDisk;
394 case 1: return ph->u.v1.cbDisk;
395 }
396 AssertFailed();
397 return 0;
398}
399
400DECLINLINE(unsigned) getImageBlockSize(PVDIHEADER ph)
401{
402 switch (GET_MAJOR_HEADER_VERSION(ph))
403 {
404 case 0: return ph->u.v0.cbBlock;
405 case 1: return ph->u.v1.cbBlock;
406 }
407 AssertFailed();
408 return 0;
409}
410
411DECLINLINE(unsigned) getImageExtraBlockSize(PVDIHEADER ph)
412{
413 switch (GET_MAJOR_HEADER_VERSION(ph))
414 {
415 case 0: return 0;
416 case 1: return ph->u.v1.cbBlockExtra;
417 }
418 AssertFailed();
419 return 0;
420}
421
422DECLINLINE(unsigned) getImageBlocks(PVDIHEADER ph)
423{
424 switch (GET_MAJOR_HEADER_VERSION(ph))
425 {
426 case 0: return ph->u.v0.cBlocks;
427 case 1: return ph->u.v1.cBlocks;
428 }
429 AssertFailed();
430 return 0;
431}
432
433DECLINLINE(unsigned) getImageBlocksAllocated(PVDIHEADER ph)
434{
435 switch (GET_MAJOR_HEADER_VERSION(ph))
436 {
437 case 0: return ph->u.v0.cBlocksAllocated;
438 case 1: return ph->u.v1.cBlocksAllocated;
439 }
440 AssertFailed();
441 return 0;
442}
443
444DECLINLINE(void) setImageBlocksAllocated(PVDIHEADER ph, unsigned cBlocks)
445{
446 switch (GET_MAJOR_HEADER_VERSION(ph))
447 {
448 case 0: ph->u.v0.cBlocksAllocated = cBlocks; return;
449 case 1: ph->u.v1.cBlocksAllocated = cBlocks; return;
450 }
451 AssertFailed();
452}
453
454DECLINLINE(PRTUUID) getImageCreationUUID(PVDIHEADER ph)
455{
456 switch (GET_MAJOR_HEADER_VERSION(ph))
457 {
458 case 0: return &ph->u.v0.uuidCreate;
459 case 1: return &ph->u.v1.uuidCreate;
460 }
461 AssertFailed();
462 return NULL;
463}
464
465DECLINLINE(PRTUUID) getImageModificationUUID(PVDIHEADER ph)
466{
467 switch (GET_MAJOR_HEADER_VERSION(ph))
468 {
469 case 0: return &ph->u.v0.uuidModify;
470 case 1: return &ph->u.v1.uuidModify;
471 }
472 AssertFailed();
473 return NULL;
474}
475
476DECLINLINE(PRTUUID) getImageParentUUID(PVDIHEADER ph)
477{
478 switch (GET_MAJOR_HEADER_VERSION(ph))
479 {
480 case 0: return &ph->u.v0.uuidLinkage;
481 case 1: return &ph->u.v1.uuidLinkage;
482 }
483 AssertFailed();
484 return NULL;
485}
486
487DECLINLINE(PRTUUID) getImageParentModificationUUID(PVDIHEADER ph)
488{
489 switch (GET_MAJOR_HEADER_VERSION(ph))
490 {
491 case 1: return &ph->u.v1.uuidParentModify;
492 }
493 AssertFailed();
494 return NULL;
495}
496
497#ifndef VBOX_VDICORE_VD
498/**
499 * Default image block size, may be changed by setBlockSize/getBlockSize.
500 *
501 * Note: for speed reasons block size should be a power of 2 !
502 */
503#define VDI_IMAGE_DEFAULT_BLOCK_SIZE _1M
504#endif /* !VBOX_VDICORE_VD */
505
506#ifndef VBOX_VDICORE_VD
507/**
508 * fModified bit flags.
509 */
510#define VDI_IMAGE_MODIFIED_FLAG RT_BIT(0)
511#define VDI_IMAGE_MODIFIED_FIRST RT_BIT(1)
512#define VDI_IMAGE_MODIFIED_DISABLE_UUID_UPDATE RT_BIT(2)
513#endif /* !VBOX_VDICORE_VD */
514
515/**
516 * Image structure
517 */
518typedef struct VDIIMAGEDESC
519{
520#ifndef VBOX_VDICORE_VD
521 /** Link to parent image descriptor, if any. */
522 struct VDIIMAGEDESC *pPrev;
523 /** Link to child image descriptor, if any. */
524 struct VDIIMAGEDESC *pNext;
525#endif /* !VBOX_VDICORE_VD */
526#ifndef VBOX_WITH_NEW_IO_CODE
527 /** File handle. */
528 RTFILE File;
529#else
530 /** Opaque storage handle. */
531 PVDIOSTORAGE pStorage;
532#endif
533#ifndef VBOX_VDICORE_VD
534 /** True if the image is operating in readonly mode. */
535 bool fReadOnly;
536 /** Image open flags, VDI_OPEN_FLAGS_*. */
537 unsigned fOpen;
538#else /* VBOX_VDICORE_VD */
539 /** Image open flags, VD__OPEN_FLAGS_*. */
540 unsigned uOpenFlags;
541#endif /* VBOX_VDICORE_VD */
542 /** Image pre-header. */
543 VDIPREHEADER PreHeader;
544 /** Image header. */
545 VDIHEADER Header;
546 /** Pointer to a block array. */
547 PVDIIMAGEBLOCKPOINTER paBlocks;
548#ifndef VBOX_VDICORE_VD
549 /** fFlags copy from image header, for speed optimization. */
550 unsigned fFlags;
551#else /* VBOX_VDICORE_VD */
552 /** fFlags copy from image header, for speed optimization. */
553 unsigned uImageFlags;
554#endif /* VBOX_VDICORE_VD */
555 /** Start offset of block array in image file, here for speed optimization. */
556 unsigned offStartBlocks;
557 /** Start offset of data in image file, here for speed optimization. */
558 unsigned offStartData;
559 /** Block mask for getting the offset into a block from a byte hdd offset. */
560 unsigned uBlockMask;
561 /** Block shift value for converting byte hdd offset into paBlock index. */
562 unsigned uShiftOffset2Index;
563#ifndef VBOX_VDICORE_VD
564 /** Block shift value for converting block index into offset in image. */
565 unsigned uShiftIndex2Offset;
566#endif /* !VBOX_VDICORE_VD */
567 /** Offset of data from the beginning of block. */
568 unsigned offStartBlockData;
569#ifndef VBOX_VDICORE_VD
570 /** Image is modified flags (VDI_IMAGE_MODIFIED*). */
571 unsigned fModified;
572 /** Container filename. (UTF-8)
573 * @todo Make this variable length to save a bunch of bytes. (low prio) */
574 char szFilename[RTPATH_MAX];
575#else /* VBOX_VDICORE_VD */
576 /** Total size of image block (including the extra data). */
577 unsigned cbTotalBlockData;
578 /** Container filename. (UTF-8) */
579 const char *pszFilename;
580 /** Physical geometry of this image (never actually stored). */
581 PDMMEDIAGEOMETRY PCHSGeometry;
582 /** Pointer to the per-disk VD interface list. */
583 PVDINTERFACE pVDIfsDisk;
584 /** Pointer to the per-image VD interface list. */
585 PVDINTERFACE pVDIfsImage;
586 /** Error interface. */
587 PVDINTERFACE pInterfaceError;
588 /** Error interface callback table. */
589 PVDINTERFACEERROR pInterfaceErrorCallbacks;
590# ifdef VBOX_WITH_NEW_IO_CODE
591 /** I/O interface. */
592 PVDINTERFACE pInterfaceIO;
593 /** I/O interface callbacks. */
594 PVDINTERFACEIO pInterfaceIOCallbacks;
595# endif
596#endif /* VBOX_VDICORE_VD */
597} VDIIMAGEDESC, *PVDIIMAGEDESC;
598
599#ifndef VBOX_VDICORE_VD
600/**
601 * Default work buffer size, may be changed by setBufferSize() method.
602 *
603 * For best speed performance it must be equal to image block size.
604 */
605#define VDIDISK_DEFAULT_BUFFER_SIZE (VDI_IMAGE_DEFAULT_BLOCK_SIZE)
606#endif /* !VBOX_VDICORE_VD */
607
608/** VDIDISK Signature. */
609#define VDIDISK_SIGNATURE (0xbedafeda)
610
611/**
612 * VBox HDD Container main structure, private part.
613 */
614struct VDIDISK
615{
616 /** Structure signature (VDIDISK_SIGNATURE). */
617 uint32_t u32Signature;
618
619 /** Number of opened images. */
620 unsigned cImages;
621
622 /** Base image. */
623 PVDIIMAGEDESC pBase;
624
625 /** Last opened image in the chain.
626 * The same as pBase if only one image is used or the last opened diff image. */
627 PVDIIMAGEDESC pLast;
628
629 /** Default block size for newly created images. */
630 unsigned cbBlock;
631
632 /** Working buffer size, allocated only while committing data,
633 * copying block from primary image to secondary and saving previously
634 * zero block. Buffer deallocated after operation complete.
635 * @remark For best performance buffer size must be equal to image's
636 * block size, however it may be decreased for memory saving.
637 */
638 unsigned cbBuf;
639
640 /** Flag whether zero writes should be handled normally or optimized
641 * away if possible. */
642 bool fHonorZeroWrites;
643
644 /** The media interface. */
645 PDMIMEDIA IMedia;
646 /** Pointer to the driver instance. */
647 PPDMDRVINS pDrvIns;
648};
649
650
651/*******************************************************************************
652* Internal Functions *
653*******************************************************************************/
654RT_C_DECLS_BEGIN
655
656#ifndef VBOX_VDICORE_VD
657VBOXDDU_DECL(void) vdiInitVDIDisk(PVDIDISK pDisk);
658VBOXDDU_DECL(void) VDIFlushImage(PVDIIMAGEDESC pImage);
659VBOXDDU_DECL(int) vdiChangeImageMode(PVDIIMAGEDESC pImage, bool fReadOnly);
660#endif /* !VBOX_VDICORE_VD */
661
662RT_C_DECLS_END
663
664#endif
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