VirtualBox

source: vbox/trunk/src/VBox/Devices/Storage/RawHDDCore.cpp@ 30555

Last change on this file since 30555 was 30555, checked in by vboxsync, 14 years ago

VD/Async: Full support for VHD images. VMDK is still in progress

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
File size: 37.2 KB
Line 
1/* $Id: RawHDDCore.cpp 30555 2010-07-01 13:43:04Z vboxsync $ */
2/** @file
3 * RawHDDCore - Raw Disk image, Core Code.
4 */
5
6/*
7 * Copyright (C) 2006-2010 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/*******************************************************************************
19* Header Files *
20*******************************************************************************/
21#define LOG_GROUP LOG_GROUP_VD_RAW
22#include <VBox/VBoxHDD-Plugin.h>
23#include <VBox/err.h>
24
25#include <VBox/log.h>
26#include <iprt/assert.h>
27#include <iprt/alloc.h>
28#include <iprt/file.h>
29
30
31/*******************************************************************************
32* Constants And Macros, Structures and Typedefs *
33*******************************************************************************/
34
35/**
36 * Raw image data structure.
37 */
38typedef struct RAWIMAGE
39{
40 /** Base image name. */
41 const char *pszFilename;
42#ifndef VBOX_WITH_NEW_IO_CODE
43 /** File descriptor. */
44 RTFILE File;
45#else
46 /** Storage handle. */
47 PVDIOSTORAGE pStorage;
48 /** I/O interface. */
49 PVDINTERFACE pInterfaceIO;
50 /** Async I/O interface callbacks. */
51 PVDINTERFACEIO pInterfaceIOCallbacks;
52#endif
53
54 /** Pointer to the per-disk VD interface list. */
55 PVDINTERFACE pVDIfsDisk;
56 /** Pointer to the per-image VD interface list. */
57 PVDINTERFACE pVDIfsImage;
58
59 /** Error callback. */
60 PVDINTERFACE pInterfaceError;
61 /** Opaque data for error callback. */
62 PVDINTERFACEERROR pInterfaceErrorCallbacks;
63
64 /** Open flags passed by VBoxHD layer. */
65 unsigned uOpenFlags;
66 /** Image flags defined during creation or determined during open. */
67 unsigned uImageFlags;
68 /** Total size of the image. */
69 uint64_t cbSize;
70 /** Physical geometry of this image. */
71 PDMMEDIAGEOMETRY PCHSGeometry;
72 /** Logical geometry of this image. */
73 PDMMEDIAGEOMETRY LCHSGeometry;
74
75} RAWIMAGE, *PRAWIMAGE;
76
77/*******************************************************************************
78* Static Variables *
79*******************************************************************************/
80
81/** NULL-terminated array of supported file extensions. */
82static const char *const s_apszRawFileExtensions[] =
83{
84 /** @todo At the monment this backend doesn't claim any extensions, but it might
85 * be useful to add a few later. However this needs careful testing, as the
86 * CheckIfValid function never returns success. */
87 NULL
88};
89
90/*******************************************************************************
91* Internal Functions *
92*******************************************************************************/
93
94static int rawFlushImage(PRAWIMAGE pImage);
95static void rawFreeImage(PRAWIMAGE pImage, bool fDelete);
96
97
98/**
99 * Internal: signal an error to the frontend.
100 */
101DECLINLINE(int) rawError(PRAWIMAGE pImage, int rc, RT_SRC_POS_DECL,
102 const char *pszFormat, ...)
103{
104 va_list va;
105 va_start(va, pszFormat);
106 if (pImage->pInterfaceError)
107 pImage->pInterfaceErrorCallbacks->pfnError(pImage->pInterfaceError->pvUser, rc, RT_SRC_POS_ARGS,
108 pszFormat, va);
109 va_end(va);
110 return rc;
111}
112
113static int rawFileOpen(PRAWIMAGE pImage, bool fReadonly, bool fCreate)
114{
115 int rc = VINF_SUCCESS;
116
117 AssertMsg(!(fReadonly && fCreate), ("Image can't be opened readonly while being created\n"));
118
119#ifndef VBOX_WITH_NEW_IO_CODE
120 uint32_t fOpen = fReadonly ? RTFILE_O_READ | RTFILE_O_DENY_NONE
121 : RTFILE_O_READWRITE | RTFILE_O_DENY_WRITE;
122
123 if (fCreate)
124 fOpen |= RTFILE_O_CREATE;
125 else
126 fOpen |= RTFILE_O_OPEN;
127
128 rc = RTFileOpen(&pImage->File, pImage->pszFilename, fOpen);
129#else
130 unsigned uOpenFlags = fReadonly ? VD_INTERFACEASYNCIO_OPEN_FLAGS_READONLY : 0;
131
132 if (fCreate)
133 uOpenFlags |= VD_INTERFACEASYNCIO_OPEN_FLAGS_CREATE;
134
135 rc = pImage->pInterfaceIOCallbacks->pfnOpen(pImage->pInterfaceIO->pvUser,
136 pImage->pszFilename,
137 uOpenFlags,
138 &pImage->pStorage);
139#endif
140
141 return rc;
142}
143
144static int rawFileClose(PRAWIMAGE pImage)
145{
146 int rc = VINF_SUCCESS;
147
148#ifndef VBOX_WITH_NEW_IO_CODE
149 if (pImage->File != NIL_RTFILE)
150 rc = RTFileClose(pImage->File);
151
152 pImage->File = NIL_RTFILE;
153#else
154 if (pImage->pStorage)
155 rc = pImage->pInterfaceIOCallbacks->pfnClose(pImage->pInterfaceIO->pvUser,
156 pImage->pStorage);
157
158 pImage->pStorage = NULL;
159#endif
160
161 return rc;
162}
163
164static int rawFileFlushSync(PRAWIMAGE pImage)
165{
166 int rc = VINF_SUCCESS;
167
168#ifndef VBOX_WITH_NEW_IO_CODE
169 rc = RTFileFlush(pImage->File);
170#else
171 rc = pImage->pInterfaceIOCallbacks->pfnFlushSync(pImage->pInterfaceIO->pvUser,
172 pImage->pStorage);
173#endif
174
175 return rc;
176}
177
178static int rawFileGetSize(PRAWIMAGE pImage, uint64_t *pcbSize)
179{
180 int rc = VINF_SUCCESS;
181
182#ifndef VBOX_WITH_NEW_IO_CODE
183 rc = RTFileGetSize(pImage->File, pcbSize);
184#else
185 rc = pImage->pInterfaceIOCallbacks->pfnGetSize(pImage->pInterfaceIO->pvUser,
186 pImage->pStorage,
187 pcbSize);
188#endif
189
190 return rc;
191
192}
193
194static int rawFileSetSize(PRAWIMAGE pImage, uint64_t cbSize)
195{
196 int rc = VINF_SUCCESS;
197
198#ifndef VBOX_WITH_NEW_IO_CODE
199 rc = RTFileSetSize(pImage->File, cbSize);
200#else
201 rc = pImage->pInterfaceIOCallbacks->pfnSetSize(pImage->pInterfaceIO->pvUser,
202 pImage->pStorage,
203 cbSize);
204#endif
205
206 return rc;
207}
208
209
210static int rawFileWriteSync(PRAWIMAGE pImage, uint64_t off, const void *pcvBuf, size_t cbWrite, size_t *pcbWritten)
211{
212 int rc = VINF_SUCCESS;
213
214#ifndef VBOX_WITH_NEW_IO_CODE
215 rc = RTFileWriteAt(pImage->File, off, pcvBuf, cbWrite, pcbWritten);
216#else
217 rc = pImage->pInterfaceIOCallbacks->pfnWriteSync(pImage->pInterfaceIO->pvUser,
218 pImage->pStorage,
219 off, cbWrite, pcvBuf,
220 pcbWritten);
221#endif
222
223 return rc;
224}
225
226static int rawFileReadSync(PRAWIMAGE pImage, uint64_t off, void *pvBuf, size_t cbRead, size_t *pcbRead)
227{
228 int rc = VINF_SUCCESS;
229
230#ifndef VBOX_WITH_NEW_IO_CODE
231 rc = RTFileReadAt(pImage->File, off, pvBuf, cbRead, pcbRead);
232#else
233 rc = pImage->pInterfaceIOCallbacks->pfnReadSync(pImage->pInterfaceIO->pvUser,
234 pImage->pStorage,
235 off, cbRead, pvBuf,
236 pcbRead);
237#endif
238
239 return rc;
240}
241
242static bool rawFileOpened(PRAWIMAGE pImage)
243{
244#ifndef VBOX_WITH_NEW_IO_CODE
245 return pImage->File != NIL_RTFILE;
246#else
247 return pImage->pStorage != NULL;
248#endif
249}
250
251/**
252 * Internal: Open an image, constructing all necessary data structures.
253 */
254static int rawOpenImage(PRAWIMAGE pImage, unsigned uOpenFlags)
255{
256 int rc;
257
258 if (uOpenFlags & VD_OPEN_FLAGS_ASYNC_IO)
259 return VERR_NOT_SUPPORTED;
260
261 pImage->uOpenFlags = uOpenFlags;
262
263 pImage->pInterfaceError = VDInterfaceGet(pImage->pVDIfsDisk, VDINTERFACETYPE_ERROR);
264 if (pImage->pInterfaceError)
265 pImage->pInterfaceErrorCallbacks = VDGetInterfaceError(pImage->pInterfaceError);
266
267#ifdef VBOX_WITH_NEW_IO_CODE
268 /* Try to get I/O interface. */
269 pImage->pInterfaceIO = VDInterfaceGet(pImage->pVDIfsImage, VDINTERFACETYPE_IO);
270 AssertPtr(pImage->pInterfaceIO);
271 pImage->pInterfaceIOCallbacks = VDGetInterfaceIO(pImage->pInterfaceIO);
272 AssertPtr(pImage->pInterfaceIOCallbacks);
273#endif
274
275 /*
276 * Open the image.
277 */
278 rc = rawFileOpen(pImage, !!(uOpenFlags & VD_OPEN_FLAGS_READONLY), false);
279 if (RT_FAILURE(rc))
280 {
281 /* Do NOT signal an appropriate error here, as the VD layer has the
282 * choice of retrying the open if it failed. */
283 goto out;
284 }
285
286 rc = rawFileGetSize(pImage, &pImage->cbSize);
287 if (RT_FAILURE(rc))
288 goto out;
289 if (pImage->cbSize % 512)
290 {
291 rc = VERR_VD_RAW_INVALID_HEADER;
292 goto out;
293 }
294 pImage->uImageFlags |= VD_IMAGE_FLAGS_FIXED;
295
296out:
297 if (RT_FAILURE(rc))
298 rawFreeImage(pImage, false);
299 return rc;
300}
301
302/**
303 * Internal: Create a raw image.
304 */
305static int rawCreateImage(PRAWIMAGE pImage, uint64_t cbSize,
306 unsigned uImageFlags, const char *pszComment,
307 PCPDMMEDIAGEOMETRY pPCHSGeometry,
308 PCPDMMEDIAGEOMETRY pLCHSGeometry,
309 PFNVDPROGRESS pfnProgress, void *pvUser,
310 unsigned uPercentStart, unsigned uPercentSpan)
311{
312 int rc;
313 RTFOFF cbFree = 0;
314 uint64_t uOff;
315 size_t cbBuf = 128 * _1K;
316 void *pvBuf = NULL;
317
318 if (uImageFlags & VD_IMAGE_FLAGS_DIFF)
319 {
320 rc = rawError(pImage, VERR_VD_RAW_INVALID_TYPE, RT_SRC_POS, N_("Raw: cannot create diff image '%s'"), pImage->pszFilename);
321 goto out;
322 }
323 uImageFlags |= VD_IMAGE_FLAGS_FIXED;
324
325 pImage->uImageFlags = uImageFlags;
326 pImage->PCHSGeometry = *pPCHSGeometry;
327 pImage->LCHSGeometry = *pLCHSGeometry;
328
329 pImage->pInterfaceError = VDInterfaceGet(pImage->pVDIfsDisk, VDINTERFACETYPE_ERROR);
330 if (pImage->pInterfaceError)
331 pImage->pInterfaceErrorCallbacks = VDGetInterfaceError(pImage->pInterfaceError);
332
333#ifdef VBOX_WITH_NEW_IO_CODE
334 /* Try to get async I/O interface. */
335 pImage->pInterfaceIO = VDInterfaceGet(pImage->pVDIfsImage, VDINTERFACETYPE_IO);
336 AssertPtr(pImage->pInterfaceIO);
337 pImage->pInterfaceIOCallbacks = VDGetInterfaceIO(pImage->pInterfaceIO);
338 AssertPtr(pImage->pInterfaceIOCallbacks);
339#endif
340
341 /* Create image file. */
342 rc = rawFileOpen(pImage, false, true);
343 if (RT_FAILURE(rc))
344 {
345 rc = rawError(pImage, rc, RT_SRC_POS, N_("Raw: cannot create image '%s'"), pImage->pszFilename);
346 goto out;
347 }
348
349 /* Check the free space on the disk and leave early if there is not
350 * sufficient space available. */
351 rc = RTFsQuerySizes(pImage->pszFilename, NULL, &cbFree, NULL, NULL);
352 if (RT_SUCCESS(rc) /* ignore errors */ && ((uint64_t)cbFree < cbSize))
353 {
354 rc = rawError(pImage, VERR_DISK_FULL, RT_SRC_POS, N_("Raw: disk would overflow creating image '%s'"), pImage->pszFilename);
355 goto out;
356 }
357
358 /* Allocate & commit whole file if fixed image, it must be more
359 * effective than expanding file by write operations. */
360 rc = rawFileSetSize(pImage, cbSize);
361 if (RT_FAILURE(rc))
362 {
363 rc = rawError(pImage, rc, RT_SRC_POS, N_("Raw: setting image size failed for '%s'"), pImage->pszFilename);
364 goto out;
365 }
366
367 /* Fill image with zeroes. We do this for every fixed-size image since on
368 * some systems (for example Windows Vista), it takes ages to write a block
369 * near the end of a sparse file and the guest could complain about an ATA
370 * timeout. */
371 pvBuf = RTMemTmpAllocZ(cbBuf);
372 if (!pvBuf)
373 {
374 rc = VERR_NO_MEMORY;
375 goto out;
376 }
377
378 uOff = 0;
379 /* Write data to all image blocks. */
380 while (uOff < cbSize)
381 {
382 unsigned cbChunk = (unsigned)RT_MIN(cbSize, cbBuf);
383
384 rc = rawFileWriteSync(pImage, uOff, pvBuf, cbChunk, NULL);
385 if (RT_FAILURE(rc))
386 {
387 rc = rawError(pImage, rc, RT_SRC_POS, N_("Raw: writing block failed for '%s'"), pImage->pszFilename);
388 goto out;
389 }
390
391 uOff += cbChunk;
392
393 if (pfnProgress)
394 {
395 rc = pfnProgress(pvUser,
396 uPercentStart + uOff * uPercentSpan * 98 / (cbSize * 100));
397 if (RT_FAILURE(rc))
398 goto out;
399 }
400 }
401 RTMemTmpFree(pvBuf);
402
403 if (RT_SUCCESS(rc) && pfnProgress)
404 pfnProgress(pvUser, uPercentStart + uPercentSpan * 98 / 100);
405
406 pImage->cbSize = cbSize;
407
408 rc = rawFlushImage(pImage);
409
410out:
411 if (RT_SUCCESS(rc) && pfnProgress)
412 pfnProgress(pvUser, uPercentStart + uPercentSpan);
413
414 if (RT_FAILURE(rc))
415 rawFreeImage(pImage, rc != VERR_ALREADY_EXISTS);
416 return rc;
417}
418
419/**
420 * Internal. Free all allocated space for representing an image, and optionally
421 * delete the image from disk.
422 */
423static void rawFreeImage(PRAWIMAGE pImage, bool fDelete)
424{
425 Assert(pImage);
426
427 if (rawFileOpened(pImage))
428 {
429 if (!(pImage->uOpenFlags & VD_OPEN_FLAGS_READONLY))
430 rawFlushImage(pImage);
431 rawFileClose(pImage);
432 }
433 if (fDelete && pImage->pszFilename)
434 RTFileDelete(pImage->pszFilename);
435}
436
437/**
438 * Internal. Flush image data to disk.
439 */
440static int rawFlushImage(PRAWIMAGE pImage)
441{
442 int rc = VINF_SUCCESS;
443
444 if ( rawFileOpened(pImage)
445 && !(pImage->uOpenFlags & VD_OPEN_FLAGS_READONLY))
446 rc = rawFileFlushSync(pImage);
447
448 return rc;
449}
450
451
452/** @copydoc VBOXHDDBACKEND::pfnCheckIfValid */
453static int rawCheckIfValid(const char *pszFilename, PVDINTERFACE pVDIfsDisk)
454{
455 LogFlowFunc(("pszFilename=\"%s\"\n", pszFilename));
456 int rc = VINF_SUCCESS;
457
458 if ( !VALID_PTR(pszFilename)
459 || !*pszFilename)
460 {
461 rc = VERR_INVALID_PARAMETER;
462 goto out;
463 }
464
465 /* Always return failure, to avoid opening everything as a raw image. */
466 rc = VERR_VD_RAW_INVALID_HEADER;
467
468out:
469 LogFlowFunc(("returns %Rrc\n", rc));
470 return rc;
471}
472
473/** @copydoc VBOXHDDBACKEND::pfnOpen */
474static int rawOpen(const char *pszFilename, unsigned uOpenFlags,
475 PVDINTERFACE pVDIfsDisk, PVDINTERFACE pVDIfsImage,
476 void **ppBackendData)
477{
478 LogFlowFunc(("pszFilename=\"%s\" uOpenFlags=%#x pVDIfsDisk=%#p pVDIfsImage=%#p ppBackendData=%#p\n", pszFilename, uOpenFlags, pVDIfsDisk, pVDIfsImage, ppBackendData));
479 int rc;
480 PRAWIMAGE pImage;
481
482 /* Check open flags. All valid flags are supported. */
483 if (uOpenFlags & ~VD_OPEN_FLAGS_MASK)
484 {
485 rc = VERR_INVALID_PARAMETER;
486 goto out;
487 }
488
489 /* Check remaining arguments. */
490 if ( !VALID_PTR(pszFilename)
491 || !*pszFilename)
492 {
493 rc = VERR_INVALID_PARAMETER;
494 goto out;
495 }
496
497
498 pImage = (PRAWIMAGE)RTMemAllocZ(sizeof(RAWIMAGE));
499 if (!pImage)
500 {
501 rc = VERR_NO_MEMORY;
502 goto out;
503 }
504 pImage->pszFilename = pszFilename;
505#ifndef VBOX_WITH_NEW_IO_CODE
506 pImage->File = NIL_RTFILE;
507#else
508 pImage->pStorage = NULL;
509#endif
510 pImage->pVDIfsDisk = pVDIfsDisk;
511 pImage->pVDIfsImage = pVDIfsImage;
512
513 rc = rawOpenImage(pImage, uOpenFlags);
514 if (RT_SUCCESS(rc))
515 *ppBackendData = pImage;
516 else
517 RTMemFree(pImage);
518
519out:
520 LogFlowFunc(("returns %Rrc (pBackendData=%#p)\n", rc, *ppBackendData));
521 return rc;
522}
523
524/** @copydoc VBOXHDDBACKEND::pfnCreate */
525static int rawCreate(const char *pszFilename, uint64_t cbSize,
526 unsigned uImageFlags, const char *pszComment,
527 PCPDMMEDIAGEOMETRY pPCHSGeometry,
528 PCPDMMEDIAGEOMETRY pLCHSGeometry, PCRTUUID pUuid,
529 unsigned uOpenFlags, unsigned uPercentStart,
530 unsigned uPercentSpan, PVDINTERFACE pVDIfsDisk,
531 PVDINTERFACE pVDIfsImage, PVDINTERFACE pVDIfsOperation,
532 void **ppBackendData)
533{
534 LogFlowFunc(("pszFilename=\"%s\" cbSize=%llu uImageFlags=%#x pszComment=\"%s\" pPCHSGeometry=%#p pLCHSGeometry=%#p Uuid=%RTuuid uOpenFlags=%#x uPercentStart=%u uPercentSpan=%u pVDIfsDisk=%#p pVDIfsImage=%#p pVDIfsOperation=%#p ppBackendData=%#p", pszFilename, cbSize, uImageFlags, pszComment, pPCHSGeometry, pLCHSGeometry, pUuid, uOpenFlags, uPercentStart, uPercentSpan, pVDIfsDisk, pVDIfsImage, pVDIfsOperation, ppBackendData));
535 int rc;
536 PRAWIMAGE pImage;
537
538 PFNVDPROGRESS pfnProgress = NULL;
539 void *pvUser = NULL;
540 PVDINTERFACE pIfProgress = VDInterfaceGet(pVDIfsOperation,
541 VDINTERFACETYPE_PROGRESS);
542 PVDINTERFACEPROGRESS pCbProgress = NULL;
543 if (pIfProgress)
544 {
545 pCbProgress = VDGetInterfaceProgress(pIfProgress);
546 if (pCbProgress)
547 pfnProgress = pCbProgress->pfnProgress;
548 pvUser = pIfProgress->pvUser;
549 }
550
551 /* Check open flags. All valid flags are supported. */
552 if (uOpenFlags & ~VD_OPEN_FLAGS_MASK)
553 {
554 rc = VERR_INVALID_PARAMETER;
555 goto out;
556 }
557
558 /* Check remaining arguments. */
559 if ( !VALID_PTR(pszFilename)
560 || !*pszFilename
561 || !VALID_PTR(pPCHSGeometry)
562 || !VALID_PTR(pLCHSGeometry))
563 {
564 rc = VERR_INVALID_PARAMETER;
565 goto out;
566 }
567
568 pImage = (PRAWIMAGE)RTMemAllocZ(sizeof(RAWIMAGE));
569 if (!pImage)
570 {
571 rc = VERR_NO_MEMORY;
572 goto out;
573 }
574 pImage->pszFilename = pszFilename;
575#ifndef VBOX_WITH_NEW_IO_CODE
576 pImage->File = NIL_RTFILE;
577#else
578 pImage->pStorage = NULL;
579#endif
580 pImage->pVDIfsDisk = pVDIfsDisk;
581 pImage->pVDIfsImage = pVDIfsImage;
582
583 rc = rawCreateImage(pImage, cbSize, uImageFlags, pszComment,
584 pPCHSGeometry, pLCHSGeometry,
585 pfnProgress, pvUser, uPercentStart, uPercentSpan);
586 if (RT_SUCCESS(rc))
587 {
588 /* So far the image is opened in read/write mode. Make sure the
589 * image is opened in read-only mode if the caller requested that. */
590 if (uOpenFlags & VD_OPEN_FLAGS_READONLY)
591 {
592 rawFreeImage(pImage, false);
593 rc = rawOpenImage(pImage, uOpenFlags);
594 if (RT_FAILURE(rc))
595 {
596 RTMemFree(pImage);
597 goto out;
598 }
599 }
600 *ppBackendData = pImage;
601 }
602 else
603 RTMemFree(pImage);
604
605out:
606 LogFlowFunc(("returns %Rrc (pBackendData=%#p)\n", rc, *ppBackendData));
607 return rc;
608}
609
610/** @copydoc VBOXHDDBACKEND::pfnRename */
611static int rawRename(void *pBackendData, const char *pszFilename)
612{
613 LogFlowFunc(("pBackendData=%#p pszFilename=%#p\n", pBackendData, pszFilename));
614 int rc = VERR_NOT_IMPLEMENTED;
615
616 LogFlowFunc(("returns %Rrc\n", rc));
617 return rc;
618}
619
620/** @copydoc VBOXHDDBACKEND::pfnClose */
621static int rawClose(void *pBackendData, bool fDelete)
622{
623 LogFlowFunc(("pBackendData=%#p fDelete=%d\n", pBackendData, fDelete));
624 PRAWIMAGE pImage = (PRAWIMAGE)pBackendData;
625 int rc = VINF_SUCCESS;
626
627 /* Freeing a never allocated image (e.g. because the open failed) is
628 * not signalled as an error. After all nothing bad happens. */
629 if (pImage)
630 {
631 rawFreeImage(pImage, fDelete);
632 RTMemFree(pImage);
633 }
634
635 LogFlowFunc(("returns %Rrc\n", rc));
636 return rc;
637}
638
639/** @copydoc VBOXHDDBACKEND::pfnRead */
640static int rawRead(void *pBackendData, uint64_t uOffset, void *pvBuf,
641 size_t cbToRead, size_t *pcbActuallyRead)
642{
643 LogFlowFunc(("pBackendData=%#p uOffset=%llu pvBuf=%#p cbToRead=%zu pcbActuallyRead=%#p\n", pBackendData, uOffset, pvBuf, cbToRead, pcbActuallyRead));
644 PRAWIMAGE pImage = (PRAWIMAGE)pBackendData;
645 int rc;
646
647 Assert(pImage);
648 Assert(uOffset % 512 == 0);
649 Assert(cbToRead % 512 == 0);
650
651 if ( uOffset + cbToRead > pImage->cbSize
652 || cbToRead == 0)
653 {
654 rc = VERR_INVALID_PARAMETER;
655 goto out;
656 }
657
658 rc = rawFileReadSync(pImage, uOffset, pvBuf, cbToRead, NULL);
659 *pcbActuallyRead = cbToRead;
660
661out:
662 LogFlowFunc(("returns %Rrc\n", rc));
663 return rc;
664}
665
666/** @copydoc VBOXHDDBACKEND::pfnWrite */
667static int rawWrite(void *pBackendData, uint64_t uOffset, const void *pvBuf,
668 size_t cbToWrite, size_t *pcbWriteProcess,
669 size_t *pcbPreRead, size_t *pcbPostRead, unsigned fWrite)
670{
671 LogFlowFunc(("pBackendData=%#p uOffset=%llu pvBuf=%#p cbToWrite=%zu pcbWriteProcess=%#p pcbPreRead=%#p pcbPostRead=%#p\n", pBackendData, uOffset, pvBuf, cbToWrite, pcbWriteProcess, pcbPreRead, pcbPostRead));
672 PRAWIMAGE pImage = (PRAWIMAGE)pBackendData;
673 int rc;
674
675 Assert(pImage);
676 Assert(uOffset % 512 == 0);
677 Assert(cbToWrite % 512 == 0);
678
679 if (pImage->uOpenFlags & VD_OPEN_FLAGS_READONLY)
680 {
681 rc = VERR_VD_IMAGE_READ_ONLY;
682 goto out;
683 }
684
685 if ( uOffset + cbToWrite > pImage->cbSize
686 || cbToWrite == 0)
687 {
688 rc = VERR_INVALID_PARAMETER;
689 goto out;
690 }
691
692 rc = rawFileWriteSync(pImage, uOffset, pvBuf, cbToWrite, NULL);
693 if (pcbWriteProcess)
694 *pcbWriteProcess = cbToWrite;
695
696out:
697 LogFlowFunc(("returns %Rrc\n", rc));
698 return rc;
699}
700
701/** @copydoc VBOXHDDBACKEND::pfnFlush */
702static int rawFlush(void *pBackendData)
703{
704 LogFlowFunc(("pBackendData=%#p\n", pBackendData));
705 PRAWIMAGE pImage = (PRAWIMAGE)pBackendData;
706 int rc;
707
708 rc = rawFlushImage(pImage);
709 LogFlowFunc(("returns %Rrc\n", rc));
710 return rc;
711}
712
713/** @copydoc VBOXHDDBACKEND::pfnGetVersion */
714static unsigned rawGetVersion(void *pBackendData)
715{
716 LogFlowFunc(("pBackendData=%#p\n", pBackendData));
717 PRAWIMAGE pImage = (PRAWIMAGE)pBackendData;
718
719 Assert(pImage);
720
721 if (pImage)
722 return 1;
723 else
724 return 0;
725}
726
727/** @copydoc VBOXHDDBACKEND::pfnGetSize */
728static uint64_t rawGetSize(void *pBackendData)
729{
730 LogFlowFunc(("pBackendData=%#p\n", pBackendData));
731 PRAWIMAGE pImage = (PRAWIMAGE)pBackendData;
732
733 Assert(pImage);
734
735 if (pImage)
736 return pImage->cbSize;
737 else
738 return 0;
739}
740
741/** @copydoc VBOXHDDBACKEND::pfnGetFileSize */
742static uint64_t rawGetFileSize(void *pBackendData)
743{
744 LogFlowFunc(("pBackendData=%#p\n", pBackendData));
745 PRAWIMAGE pImage = (PRAWIMAGE)pBackendData;
746 uint64_t cb = 0;
747
748 Assert(pImage);
749
750 if (pImage)
751 {
752 uint64_t cbFile;
753 if (rawFileOpened(pImage))
754 {
755 int rc = rawFileGetSize(pImage, &cbFile);
756 if (RT_SUCCESS(rc))
757 cb += cbFile;
758 }
759 }
760
761 LogFlowFunc(("returns %lld\n", cb));
762 return cb;
763}
764
765/** @copydoc VBOXHDDBACKEND::pfnGetPCHSGeometry */
766static int rawGetPCHSGeometry(void *pBackendData,
767 PPDMMEDIAGEOMETRY pPCHSGeometry)
768{
769 LogFlowFunc(("pBackendData=%#p pPCHSGeometry=%#p\n", pBackendData, pPCHSGeometry));
770 PRAWIMAGE pImage = (PRAWIMAGE)pBackendData;
771 int rc;
772
773 Assert(pImage);
774
775 if (pImage)
776 {
777 if (pImage->PCHSGeometry.cCylinders)
778 {
779 *pPCHSGeometry = pImage->PCHSGeometry;
780 rc = VINF_SUCCESS;
781 }
782 else
783 rc = VERR_VD_GEOMETRY_NOT_SET;
784 }
785 else
786 rc = VERR_VD_NOT_OPENED;
787
788 LogFlowFunc(("returns %Rrc (PCHS=%u/%u/%u)\n", rc, pPCHSGeometry->cCylinders, pPCHSGeometry->cHeads, pPCHSGeometry->cSectors));
789 return rc;
790}
791
792/** @copydoc VBOXHDDBACKEND::pfnSetPCHSGeometry */
793static int rawSetPCHSGeometry(void *pBackendData,
794 PCPDMMEDIAGEOMETRY pPCHSGeometry)
795{
796 LogFlowFunc(("pBackendData=%#p pPCHSGeometry=%#p PCHS=%u/%u/%u\n", pBackendData, pPCHSGeometry, pPCHSGeometry->cCylinders, pPCHSGeometry->cHeads, pPCHSGeometry->cSectors));
797 PRAWIMAGE pImage = (PRAWIMAGE)pBackendData;
798 int rc;
799
800 Assert(pImage);
801
802 if (pImage)
803 {
804 if (pImage->uOpenFlags & VD_OPEN_FLAGS_READONLY)
805 {
806 rc = VERR_VD_IMAGE_READ_ONLY;
807 goto out;
808 }
809
810 pImage->PCHSGeometry = *pPCHSGeometry;
811 rc = VINF_SUCCESS;
812 }
813 else
814 rc = VERR_VD_NOT_OPENED;
815
816out:
817 LogFlowFunc(("returns %Rrc\n", rc));
818 return rc;
819}
820
821/** @copydoc VBOXHDDBACKEND::pfnGetLCHSGeometry */
822static int rawGetLCHSGeometry(void *pBackendData,
823 PPDMMEDIAGEOMETRY pLCHSGeometry)
824{
825 LogFlowFunc(("pBackendData=%#p pLCHSGeometry=%#p\n", pBackendData, pLCHSGeometry));
826 PRAWIMAGE pImage = (PRAWIMAGE)pBackendData;
827 int rc;
828
829 Assert(pImage);
830
831 if (pImage)
832 {
833 if (pImage->LCHSGeometry.cCylinders)
834 {
835 *pLCHSGeometry = pImage->LCHSGeometry;
836 rc = VINF_SUCCESS;
837 }
838 else
839 rc = VERR_VD_GEOMETRY_NOT_SET;
840 }
841 else
842 rc = VERR_VD_NOT_OPENED;
843
844 LogFlowFunc(("returns %Rrc (LCHS=%u/%u/%u)\n", rc, pLCHSGeometry->cCylinders, pLCHSGeometry->cHeads, pLCHSGeometry->cSectors));
845 return rc;
846}
847
848/** @copydoc VBOXHDDBACKEND::pfnSetLCHSGeometry */
849static int rawSetLCHSGeometry(void *pBackendData,
850 PCPDMMEDIAGEOMETRY pLCHSGeometry)
851{
852 LogFlowFunc(("pBackendData=%#p pLCHSGeometry=%#p LCHS=%u/%u/%u\n", pBackendData, pLCHSGeometry, pLCHSGeometry->cCylinders, pLCHSGeometry->cHeads, pLCHSGeometry->cSectors));
853 PRAWIMAGE pImage = (PRAWIMAGE)pBackendData;
854 int rc;
855
856 Assert(pImage);
857
858 if (pImage)
859 {
860 if (pImage->uOpenFlags & VD_OPEN_FLAGS_READONLY)
861 {
862 rc = VERR_VD_IMAGE_READ_ONLY;
863 goto out;
864 }
865
866 pImage->LCHSGeometry = *pLCHSGeometry;
867 rc = VINF_SUCCESS;
868 }
869 else
870 rc = VERR_VD_NOT_OPENED;
871
872out:
873 LogFlowFunc(("returns %Rrc\n", rc));
874 return rc;
875}
876
877/** @copydoc VBOXHDDBACKEND::pfnGetImageFlags */
878static unsigned rawGetImageFlags(void *pBackendData)
879{
880 LogFlowFunc(("pBackendData=%#p\n", pBackendData));
881 PRAWIMAGE pImage = (PRAWIMAGE)pBackendData;
882 unsigned uImageFlags;
883
884 Assert(pImage);
885
886 if (pImage)
887 uImageFlags = pImage->uImageFlags;
888 else
889 uImageFlags = 0;
890
891 LogFlowFunc(("returns %#x\n", uImageFlags));
892 return uImageFlags;
893}
894
895/** @copydoc VBOXHDDBACKEND::pfnGetOpenFlags */
896static unsigned rawGetOpenFlags(void *pBackendData)
897{
898 LogFlowFunc(("pBackendData=%#p\n", pBackendData));
899 PRAWIMAGE pImage = (PRAWIMAGE)pBackendData;
900 unsigned uOpenFlags;
901
902 Assert(pImage);
903
904 if (pImage)
905 uOpenFlags = pImage->uOpenFlags;
906 else
907 uOpenFlags = 0;
908
909 LogFlowFunc(("returns %#x\n", uOpenFlags));
910 return uOpenFlags;
911}
912
913/** @copydoc VBOXHDDBACKEND::pfnSetOpenFlags */
914static int rawSetOpenFlags(void *pBackendData, unsigned uOpenFlags)
915{
916 LogFlowFunc(("pBackendData=%#p\n uOpenFlags=%#x", pBackendData, uOpenFlags));
917 PRAWIMAGE pImage = (PRAWIMAGE)pBackendData;
918 int rc;
919
920 /* Image must be opened and the new flags must be valid. Just readonly and
921 * info flags are supported. */
922 if (!pImage || (uOpenFlags & ~(VD_OPEN_FLAGS_READONLY | VD_OPEN_FLAGS_INFO)))
923 {
924 rc = VERR_INVALID_PARAMETER;
925 goto out;
926 }
927
928 /* Implement this operation via reopening the image. */
929 rawFreeImage(pImage, false);
930 rc = rawOpenImage(pImage, uOpenFlags);
931
932out:
933 LogFlowFunc(("returns %Rrc\n", rc));
934 return rc;
935}
936
937/** @copydoc VBOXHDDBACKEND::pfnGetComment */
938static int rawGetComment(void *pBackendData, char *pszComment,
939 size_t cbComment)
940{
941 LogFlowFunc(("pBackendData=%#p pszComment=%#p cbComment=%zu\n", pBackendData, pszComment, cbComment));
942 PRAWIMAGE pImage = (PRAWIMAGE)pBackendData;
943 int rc;
944
945 Assert(pImage);
946
947 if (pImage)
948 {
949 if (pszComment)
950 *pszComment = '\0';
951 rc = VINF_SUCCESS;
952 }
953 else
954 rc = VERR_VD_NOT_OPENED;
955
956 LogFlowFunc(("returns %Rrc comment='%s'\n", rc, pszComment));
957 return rc;
958}
959
960/** @copydoc VBOXHDDBACKEND::pfnSetComment */
961static int rawSetComment(void *pBackendData, const char *pszComment)
962{
963 LogFlowFunc(("pBackendData=%#p pszComment=\"%s\"\n", pBackendData, pszComment));
964 PRAWIMAGE pImage = (PRAWIMAGE)pBackendData;
965 int rc;
966
967 Assert(pImage);
968
969 if (pImage->uOpenFlags & VD_OPEN_FLAGS_READONLY)
970 {
971 rc = VERR_VD_IMAGE_READ_ONLY;
972 goto out;
973 }
974
975 if (pImage)
976 rc = VERR_NOT_SUPPORTED;
977 else
978 rc = VERR_VD_NOT_OPENED;
979
980out:
981 LogFlowFunc(("returns %Rrc\n", rc));
982 return rc;
983}
984
985/** @copydoc VBOXHDDBACKEND::pfnGetUuid */
986static int rawGetUuid(void *pBackendData, PRTUUID pUuid)
987{
988 LogFlowFunc(("pBackendData=%#p pUuid=%#p\n", pBackendData, pUuid));
989 PRAWIMAGE pImage = (PRAWIMAGE)pBackendData;
990 int rc;
991
992 Assert(pImage);
993
994 if (pImage)
995 rc = VERR_NOT_SUPPORTED;
996 else
997 rc = VERR_VD_NOT_OPENED;
998
999 LogFlowFunc(("returns %Rrc (%RTuuid)\n", rc, pUuid));
1000 return rc;
1001}
1002
1003/** @copydoc VBOXHDDBACKEND::pfnSetUuid */
1004static int rawSetUuid(void *pBackendData, PCRTUUID pUuid)
1005{
1006 LogFlowFunc(("pBackendData=%#p Uuid=%RTuuid\n", pBackendData, pUuid));
1007 PRAWIMAGE pImage = (PRAWIMAGE)pBackendData;
1008 int rc;
1009
1010 LogFlowFunc(("%RTuuid\n", pUuid));
1011 Assert(pImage);
1012
1013 if (pImage)
1014 {
1015 if (!(pImage->uOpenFlags & VD_OPEN_FLAGS_READONLY))
1016 rc = VERR_NOT_SUPPORTED;
1017 else
1018 rc = VERR_VD_IMAGE_READ_ONLY;
1019 }
1020 else
1021 rc = VERR_VD_NOT_OPENED;
1022
1023 LogFlowFunc(("returns %Rrc\n", rc));
1024 return rc;
1025}
1026
1027/** @copydoc VBOXHDDBACKEND::pfnGetModificationUuid */
1028static int rawGetModificationUuid(void *pBackendData, PRTUUID pUuid)
1029{
1030 LogFlowFunc(("pBackendData=%#p pUuid=%#p\n", pBackendData, pUuid));
1031 PRAWIMAGE pImage = (PRAWIMAGE)pBackendData;
1032 int rc;
1033
1034 Assert(pImage);
1035
1036 if (pImage)
1037 rc = VERR_NOT_SUPPORTED;
1038 else
1039 rc = VERR_VD_NOT_OPENED;
1040
1041 LogFlowFunc(("returns %Rrc (%RTuuid)\n", rc, pUuid));
1042 return rc;
1043}
1044
1045/** @copydoc VBOXHDDBACKEND::pfnSetModificationUuid */
1046static int rawSetModificationUuid(void *pBackendData, PCRTUUID pUuid)
1047{
1048 LogFlowFunc(("pBackendData=%#p Uuid=%RTuuid\n", pBackendData, pUuid));
1049 PRAWIMAGE pImage = (PRAWIMAGE)pBackendData;
1050 int rc;
1051
1052 Assert(pImage);
1053
1054 if (pImage)
1055 {
1056 if (!(pImage->uOpenFlags & VD_OPEN_FLAGS_READONLY))
1057 rc = VERR_NOT_SUPPORTED;
1058 else
1059 rc = VERR_VD_IMAGE_READ_ONLY;
1060 }
1061 else
1062 rc = VERR_VD_NOT_OPENED;
1063
1064 LogFlowFunc(("returns %Rrc\n", rc));
1065 return rc;
1066}
1067
1068/** @copydoc VBOXHDDBACKEND::pfnGetParentUuid */
1069static int rawGetParentUuid(void *pBackendData, PRTUUID pUuid)
1070{
1071 LogFlowFunc(("pBackendData=%#p pUuid=%#p\n", pBackendData, pUuid));
1072 PRAWIMAGE pImage = (PRAWIMAGE)pBackendData;
1073 int rc;
1074
1075 Assert(pImage);
1076
1077 if (pImage)
1078 rc = VERR_NOT_SUPPORTED;
1079 else
1080 rc = VERR_VD_NOT_OPENED;
1081
1082 LogFlowFunc(("returns %Rrc (%RTuuid)\n", rc, pUuid));
1083 return rc;
1084}
1085
1086/** @copydoc VBOXHDDBACKEND::pfnSetParentUuid */
1087static int rawSetParentUuid(void *pBackendData, PCRTUUID pUuid)
1088{
1089 LogFlowFunc(("pBackendData=%#p Uuid=%RTuuid\n", pBackendData, pUuid));
1090 PRAWIMAGE pImage = (PRAWIMAGE)pBackendData;
1091 int rc;
1092
1093 Assert(pImage);
1094
1095 if (pImage)
1096 {
1097 if (!(pImage->uOpenFlags & VD_OPEN_FLAGS_READONLY))
1098 rc = VERR_NOT_SUPPORTED;
1099 else
1100 rc = VERR_VD_IMAGE_READ_ONLY;
1101 }
1102 else
1103 rc = VERR_VD_NOT_OPENED;
1104
1105 LogFlowFunc(("returns %Rrc\n", rc));
1106 return rc;
1107}
1108
1109/** @copydoc VBOXHDDBACKEND::pfnGetParentModificationUuid */
1110static int rawGetParentModificationUuid(void *pBackendData, PRTUUID pUuid)
1111{
1112 LogFlowFunc(("pBackendData=%#p pUuid=%#p\n", pBackendData, pUuid));
1113 PRAWIMAGE pImage = (PRAWIMAGE)pBackendData;
1114 int rc;
1115
1116 Assert(pImage);
1117
1118 if (pImage)
1119 rc = VERR_NOT_SUPPORTED;
1120 else
1121 rc = VERR_VD_NOT_OPENED;
1122
1123 LogFlowFunc(("returns %Rrc (%RTuuid)\n", rc, pUuid));
1124 return rc;
1125}
1126
1127/** @copydoc VBOXHDDBACKEND::pfnSetParentModificationUuid */
1128static int rawSetParentModificationUuid(void *pBackendData, PCRTUUID pUuid)
1129{
1130 LogFlowFunc(("pBackendData=%#p Uuid=%RTuuid\n", pBackendData, pUuid));
1131 PRAWIMAGE pImage = (PRAWIMAGE)pBackendData;
1132 int rc;
1133
1134 Assert(pImage);
1135
1136 if (pImage)
1137 {
1138 if (!(pImage->uOpenFlags & VD_OPEN_FLAGS_READONLY))
1139 rc = VERR_NOT_SUPPORTED;
1140 else
1141 rc = VERR_VD_IMAGE_READ_ONLY;
1142 }
1143 else
1144 rc = VERR_VD_NOT_OPENED;
1145
1146 LogFlowFunc(("returns %Rrc\n", rc));
1147 return rc;
1148}
1149
1150/** @copydoc VBOXHDDBACKEND::pfnDump */
1151static void rawDump(void *pBackendData)
1152{
1153 PRAWIMAGE pImage = (PRAWIMAGE)pBackendData;
1154
1155 Assert(pImage);
1156 if (pImage)
1157 {
1158 pImage->pInterfaceErrorCallbacks->pfnMessage(pImage->pInterfaceError->pvUser, "Header: Geometry PCHS=%u/%u/%u LCHS=%u/%u/%u cbSector=%llu\n",
1159 pImage->PCHSGeometry.cCylinders, pImage->PCHSGeometry.cHeads, pImage->PCHSGeometry.cSectors,
1160 pImage->LCHSGeometry.cCylinders, pImage->LCHSGeometry.cHeads, pImage->LCHSGeometry.cSectors,
1161 pImage->cbSize / 512);
1162 }
1163}
1164
1165static int rawGetTimeStamp(void *pvBackendData, PRTTIMESPEC pTimeStamp)
1166{
1167 int rc = VERR_NOT_IMPLEMENTED;
1168 LogFlow(("%s: returned %Rrc\n", __FUNCTION__, rc));
1169 return rc;
1170}
1171
1172static int rawGetParentTimeStamp(void *pvBackendData, PRTTIMESPEC pTimeStamp)
1173{
1174 int rc = VERR_NOT_IMPLEMENTED;
1175 LogFlow(("%s: returned %Rrc\n", __FUNCTION__, rc));
1176 return rc;
1177}
1178
1179static int rawSetParentTimeStamp(void *pvBackendData, PCRTTIMESPEC pTimeStamp)
1180{
1181 int rc = VERR_NOT_IMPLEMENTED;
1182 LogFlow(("%s: returned %Rrc\n", __FUNCTION__, rc));
1183 return rc;
1184}
1185
1186static int rawGetParentFilename(void *pvBackendData, char **ppszParentFilename)
1187{
1188 int rc = VERR_NOT_IMPLEMENTED;
1189 LogFlow(("%s: returned %Rrc\n", __FUNCTION__, rc));
1190 return rc;
1191}
1192
1193static int rawSetParentFilename(void *pvBackendData, const char *pszParentFilename)
1194{
1195 int rc = VERR_NOT_IMPLEMENTED;
1196 LogFlow(("%s: returned %Rrc\n", __FUNCTION__, rc));
1197 return rc;
1198}
1199
1200static bool rawIsAsyncIOSupported(void *pvBackendData)
1201{
1202 return true;
1203}
1204
1205static int rawAsyncRead(void *pvBackendData, uint64_t uOffset, size_t cbRead,
1206 PVDIOCTX pIoCtx, size_t *pcbActuallyRead)
1207{
1208 int rc = VINF_SUCCESS;
1209 PRAWIMAGE pImage = (PRAWIMAGE)pvBackendData;
1210
1211 rc = pImage->pInterfaceIOCallbacks->pfnReadUserAsync(pImage->pInterfaceIO->pvUser,
1212 pImage->pStorage,
1213 uOffset, pIoCtx, cbRead);
1214 if (RT_SUCCESS(rc))
1215 *pcbActuallyRead = cbRead;
1216
1217 return rc;
1218}
1219
1220static int rawAsyncWrite(void *pvBackendData, uint64_t uOffset, size_t cbWrite,
1221 PVDIOCTX pIoCtx,
1222 size_t *pcbWriteProcess, size_t *pcbPreRead,
1223 size_t *pcbPostRead, unsigned fWrite)
1224{
1225 int rc = VINF_SUCCESS;
1226 PRAWIMAGE pImage = (PRAWIMAGE)pvBackendData;
1227
1228 rc = pImage->pInterfaceIOCallbacks->pfnWriteUserAsync(pImage->pInterfaceIO->pvUser,
1229 pImage->pStorage,
1230 uOffset, pIoCtx, cbWrite,
1231 NULL, NULL);
1232
1233 if (RT_SUCCESS(rc))
1234 {
1235 *pcbWriteProcess = cbWrite;
1236 *pcbPostRead = 0;
1237 *pcbPreRead = 0;
1238 }
1239
1240 return rc;
1241}
1242
1243static int rawAsyncFlush(void *pvBackendData, PVDIOCTX pIoCtx)
1244{
1245 int rc = VERR_NOT_IMPLEMENTED;
1246 LogFlowFunc(("returns %Rrc\n", rc));
1247 return rc;
1248}
1249
1250VBOXHDDBACKEND g_RawBackend =
1251{
1252 /* pszBackendName */
1253 "raw",
1254 /* cbSize */
1255 sizeof(VBOXHDDBACKEND),
1256 /* uBackendCaps */
1257 VD_CAP_CREATE_FIXED | VD_CAP_FILE | VD_CAP_ASYNC,
1258 /* papszFileExtensions */
1259 s_apszRawFileExtensions,
1260 /* paConfigInfo */
1261 NULL,
1262 /* hPlugin */
1263 NIL_RTLDRMOD,
1264 /* pfnCheckIfValid */
1265 rawCheckIfValid,
1266 /* pfnOpen */
1267 rawOpen,
1268 /* pfnCreate */
1269 rawCreate,
1270 /* pfnRename */
1271 rawRename,
1272 /* pfnClose */
1273 rawClose,
1274 /* pfnRead */
1275 rawRead,
1276 /* pfnWrite */
1277 rawWrite,
1278 /* pfnFlush */
1279 rawFlush,
1280 /* pfnGetVersion */
1281 rawGetVersion,
1282 /* pfnGetSize */
1283 rawGetSize,
1284 /* pfnGetFileSize */
1285 rawGetFileSize,
1286 /* pfnGetPCHSGeometry */
1287 rawGetPCHSGeometry,
1288 /* pfnSetPCHSGeometry */
1289 rawSetPCHSGeometry,
1290 /* pfnGetLCHSGeometry */
1291 rawGetLCHSGeometry,
1292 /* pfnSetLCHSGeometry */
1293 rawSetLCHSGeometry,
1294 /* pfnGetImageFlags */
1295 rawGetImageFlags,
1296 /* pfnGetOpenFlags */
1297 rawGetOpenFlags,
1298 /* pfnSetOpenFlags */
1299 rawSetOpenFlags,
1300 /* pfnGetComment */
1301 rawGetComment,
1302 /* pfnSetComment */
1303 rawSetComment,
1304 /* pfnGetUuid */
1305 rawGetUuid,
1306 /* pfnSetUuid */
1307 rawSetUuid,
1308 /* pfnGetModificationUuid */
1309 rawGetModificationUuid,
1310 /* pfnSetModificationUuid */
1311 rawSetModificationUuid,
1312 /* pfnGetParentUuid */
1313 rawGetParentUuid,
1314 /* pfnSetParentUuid */
1315 rawSetParentUuid,
1316 /* pfnGetParentModificationUuid */
1317 rawGetParentModificationUuid,
1318 /* pfnSetParentModificationUuid */
1319 rawSetParentModificationUuid,
1320 /* pfnDump */
1321 rawDump,
1322 /* pfnGetTimeStamp */
1323 rawGetTimeStamp,
1324 /* pfnGetParentTimeStamp */
1325 rawGetParentTimeStamp,
1326 /* pfnSetParentTimeStamp */
1327 rawSetParentTimeStamp,
1328 /* pfnGetParentFilename */
1329 rawGetParentFilename,
1330 /* pfnSetParentFilename */
1331 rawSetParentFilename,
1332 /* pfnIsAsyncIOSupported */
1333 rawIsAsyncIOSupported,
1334 /* pfnAsyncRead */
1335 rawAsyncRead,
1336 /* pfnAsyncWrite */
1337 rawAsyncWrite,
1338 /* pfnAsyncFlush */
1339 rawAsyncFlush,
1340 /* pfnComposeLocation */
1341 genericFileComposeLocation,
1342 /* pfnComposeName */
1343 genericFileComposeName,
1344 /* pfnCompact */
1345 NULL
1346};
1347
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