VirtualBox

Changeset 7152 in vbox


Ignore:
Timestamp:
Feb 26, 2008 5:17:10 PM (17 years ago)
Author:
vboxsync
Message:

Preparations for implementing a VBoxHDD-new based VDI backend. Clean up the existing stuff to not pollute the namespace.

Location:
trunk/src/VBox/Devices/Storage
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Devices/Storage/VBoxHDD.cpp

    r6291 r7152  
    162162    LogFlow(("vdiFlush:\n"));
    163163    PVDIDISK pData = PDMIMEDIA_2_VDIDISK(pInterface);
    164     vdiFlushImage(pData->pLast);
     164    VDIFlushImage(pData->pLast);
    165165    int rc = VINF_SUCCESS;
    166166    LogFlow(("vdiFlush: returns %Vrc\n", rc));
  • trunk/src/VBox/Devices/Storage/VDICore.cpp

    r6987 r7152  
    935935 * Flush the image file to disk.
    936936 */
    937 void vdiFlushImage(PVDIIMAGEDESC pImage)
     937void VDIFlushImage(PVDIIMAGEDESC pImage)
    938938{
    939939    if (!pImage->fReadOnly)
     
    959959    Assert(pImage->File != NIL_RTFILE);
    960960
    961     vdiFlushImage(pImage);
     961    VDIFlushImage(pImage);
    962962    RTFileUnlock(pImage->File,
    963963                 0,
     
    33133313
    33143314    /* Flush last image changes if was r/w mode. */
    3315     vdiFlushImage(pImage);
     3315    VDIFlushImage(pImage);
    33163316
    33173317    /* Change image locking. */
     
    33673367        if (VBOX_SUCCESS(rc))
    33683368        {
    3369             vdiFlushImage(pImage);
     3369            VDIFlushImage(pImage);
    33703370            rc = vdiChangeImageMode(pImage, true);
    33713371            AssertReleaseRC(rc);
     
    33733373    }
    33743374    else
    3375         vdiFlushImage(pImage);
     3375        VDIFlushImage(pImage);
    33763376
    33773377    return rc;
     
    36133613
    36143614    /* Flush last parent image changes if possible. */
    3615     vdiFlushImage(pDisk->pLast);
     3615    VDIFlushImage(pDisk->pLast);
    36163616
    36173617    int rc = vdiCreateImage(pszFilename,
  • trunk/src/VBox/Devices/Storage/VDICore.h

    r6374 r7152  
    2222*   Header Files                                                               *
    2323*******************************************************************************/
     24#ifndef VBOX_VDICORE_VD
    2425#include <VBox/VBoxHDD.h>
     26#else /* VBOX_VDICORE_VD */
     27#include <VBox/VBoxHDD-new.h>
     28#endif /* VBOX_VDICORE_VD */
    2529#include <VBox/pdm.h>
    2630#include <VBox/mm.h>
     
    264268#define GET_MINOR_HEADER_VERSION(ph) (VDI_GET_VERSION_MINOR((ph)->uVersion))
    265269
     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 */
    266293
    267294/*******************************************************************************
     
    451478}
    452479
     480#ifndef VBOX_VDICORE_VD
    453481/**
    454482 * Default image block size, may be changed by setBlockSize/getBlockSize.
     
    457485 */
    458486#define VDI_IMAGE_DEFAULT_BLOCK_SIZE            _1M
    459 
     487#endif /* !VBOX_VDICORE_VD */
     488
     489#ifndef VBOX_VDICORE_VD
    460490/**
    461491 * fModified bit flags.
     
    464494#define VDI_IMAGE_MODIFIED_FIRST                RT_BIT(1)
    465495#define VDI_IMAGE_MODIFIED_DISABLE_UUID_UPDATE  RT_BIT(2)
     496#endif /* !VBOX_VDICORE_VD */
    466497
    467498/**
     
    470501typedef struct VDIIMAGEDESC
    471502{
     503#ifndef VBOX_VDICORE_VD
    472504    /** Link to parent image descriptor, if any. */
    473505    struct VDIIMAGEDESC    *pPrev;
    474506    /** Link to child image descriptor, if any. */
    475507    struct VDIIMAGEDESC    *pNext;
     508#endif /* !VBOX_VDICORE_VD */
    476509    /** File handle. */
    477510    RTFILE                  File;
     511#ifndef VBOX_VDICORE_VD
    478512    /** True if the image is operating in readonly mode. */
    479513    bool                    fReadOnly;
    480514    /** Image open flags, VDI_OPEN_FLAGS_*. */
    481515    unsigned                fOpen;
     516#else /* VBOX_VDICORE_VD */
     517    /** Image open flags, VD__OPEN_FLAGS_*. */
     518    unsigned                uOpenFlags;
     519#endif /* VBOX_VDICORE_VD */
    482520    /** Image pre-header. */
    483521    VDIPREHEADER            PreHeader;
     
    486524    /** Pointer to a block array. */
    487525    PVDIIMAGEBLOCKPOINTER   paBlocks;
     526#ifndef VBOX_VDICORE_VD
    488527    /** fFlags copy from image header, for speed optimization. */
    489528    unsigned                fFlags;
     529#else /* VBOX_VDICORE_VD */
     530    /** fFlags copy from image header, for speed optimization. */
     531    unsigned                uImageFlags;
     532#endif /* VBOX_VDICORE_VD */
    490533    /** Start offset of block array in image file, here for speed optimization. */
    491534    unsigned                offStartBlocks;
     
    502545    /** Image is modified flags (VDI_IMAGE_MODIFIED*). */
    503546    unsigned                fModified;
     547#ifndef VBOX_VDICORE_VD
    504548    /** Container filename. (UTF-8)
    505549     * @todo Make this variable length to save a bunch of bytes. (low prio) */
    506550    char                    szFilename[RTPATH_MAX];
     551#else /* !VBOX_VDICORE_VD */
     552    /** Container filename. (UTF-8) */
     553    const char             *pszFilename;
     554    /** Physical geometry of this image (never actually stored). */
     555    PDMMEDIAGEOMETRY        PCHSGeometry;
     556    /** Error callback. */
     557    PFNVDERROR              pfnError;
     558    /** Opaque data for error callback. */
     559    void                   *pvErrorUser;
     560#endif /* !VBOX_VDICORE_VD */
    507561} VDIIMAGEDESC, *PVDIIMAGEDESC;
    508562
     563#ifndef VBOX_VDICORE_VD
    509564/**
    510565 * Default work buffer size, may be changed by setBufferSize() method.
     
    513568 */
    514569#define VDIDISK_DEFAULT_BUFFER_SIZE   (VDI_IMAGE_DEFAULT_BLOCK_SIZE)
     570#endif /* !VBOX_VDICORE_VD */
    515571
    516572/** VDIDISK Signature. */
     
    562618__BEGIN_DECLS
    563619
     620#ifndef VBOX_VDICORE_VD
    564621VBOXDDU_DECL(void) vdiInitVDIDisk(PVDIDISK pDisk);
    565 VBOXDDU_DECL(void) vdiFlushImage(PVDIIMAGEDESC pImage);
     622VBOXDDU_DECL(void) VDIFlushImage(PVDIIMAGEDESC pImage);
    566623VBOXDDU_DECL(int)  vdiChangeImageMode(PVDIIMAGEDESC pImage, bool fReadOnly);
     624#endif /* !VBOX_VDICORE_VD */
    567625
    568626__END_DECLS
Note: See TracChangeset for help on using the changeset viewer.

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