VirtualBox

Changeset 66192 in vbox


Ignore:
Timestamp:
Mar 22, 2017 12:45:37 PM (8 years ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
114104
Message:

VD,pdmstorageifs.h: Move media descriptor related definitions to an extra header and include/use that for the PDMIMEDIA interface to avoid duplicating them in several places

Location:
trunk
Files:
1 added
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/include/VBox/vd.h

    r66139 r66192  
    44
    55/*
    6  * Copyright (C) 2006-2016 Oracle Corporation
     6 * Copyright (C) 2006-2017 Oracle Corporation
    77 *
    88 * This file is part of VirtualBox Open Source Edition (OSE), as
     
    3737#include <VBox/types.h>
    3838#include <VBox/err.h>
     39#include <VBox/vdmedia.h>
    3940#include <VBox/vd-ifs.h>
    4041
     
    342343/** @}*/
    343344
    344 /** @name VBox HDD container type.
    345  * @{
    346  */
    347 typedef enum VDTYPE
    348 {
    349     /** Invalid. */
    350     VDTYPE_INVALID = 0,
    351     /** HardDisk */
    352     VDTYPE_HDD,
    353     /** CD/DVD */
    354     VDTYPE_DVD,
    355     /** Floppy. */
    356     VDTYPE_FLOPPY
    357 } VDTYPE;
    358 /** @}*/
    359 
    360 
    361345/** @name Configuration interface key handling flags.
    362346 * @{
     
    476460/** Pointer to a transfer compelte callback. */
    477461typedef FNVDASYNCTRANSFERCOMPLETE *PFNVDASYNCTRANSFERCOMPLETE;
    478 
    479 /**
    480  * Disk geometry.
    481  */
    482 typedef struct VDGEOMETRY
    483 {
    484     /** Number of cylinders. */
    485     uint32_t    cCylinders;
    486     /** Number of heads. */
    487     uint32_t    cHeads;
    488     /** Number of sectors. */
    489     uint32_t    cSectors;
    490 } VDGEOMETRY;
    491 
    492 /** Pointer to disk geometry. */
    493 typedef VDGEOMETRY *PVDGEOMETRY;
    494 /** Pointer to constant disk geometry. */
    495 typedef const VDGEOMETRY *PCVDGEOMETRY;
    496 
    497 /**
    498  * Disk region data form known to us from various standards.
    499  */
    500 typedef enum VDREGIONDATAFORM
    501 {
    502     /** Invalid data form. */
    503     VDREGIONDATAFORM_INVALID = 0,
    504     /** Raw data, no standardized format. */
    505     VDREGIONDATAFORM_RAW,
    506     /** CD-DA (audio CD), 2352 bytes of data. */
    507     VDREGIONDATAFORM_CDDA,
    508     /** CDDA data is pause. */
    509     VDREGIONDATAFORM_CDDA_PAUSE,
    510     /** Mode 1 with 2048 bytes sector size. */
    511     VDREGIONDATAFORM_MODE1_2048,
    512     /** Mode 1 with 2352 bytes sector size. */
    513     VDREGIONDATAFORM_MODE1_2352,
    514     /** Mode 1 with 0 bytes sector size (generated by the drive). */
    515     VDREGIONDATAFORM_MODE1_0,
    516     /** XA Mode with 2336 bytes sector size. */
    517     VDREGIONDATAFORM_XA_2336,
    518     /** XA Mode with 2352 bytes sector size. */
    519     VDREGIONDATAFORM_XA_2352,
    520     /** XA Mode with 0 bytes sector size (generated by the drive). */
    521     VDREGIONDATAFORM_XA_0,
    522     /** Mode 2 with 2336 bytes sector size. */
    523     VDREGIONDATAFORM_MODE2_2336,
    524     /** Mode 2 with 2352 bytes sector size. */
    525     VDREGIONDATAFORM_MODE2_2352,
    526     /** Mode 2 with 0 bytes sector size (generated by the drive). */
    527     VDREGIONDATAFORM_MODE2_0
    528 } VDREGIONDATAFORM;
    529 
    530 /**
    531  * Disk region metadata forms known to us.
    532  */
    533 typedef enum VDREGIONMETADATAFORM
    534 {
    535     /** Invalid metadata form. */
    536     VDREGIONMETADATAFORM_INVALID = 0,
    537     /** No metadata assined to the region. */
    538     VDREGIONMETADATAFORM_NONE,
    539     /** Raw metadata, no standardized format. */
    540     VDREGIONMETADATAFORM_RAW
    541 } VDREGIONMETADATAFORM;
    542 
    543 /**
    544  * Disk region descriptor.
    545  */
    546 typedef struct VDREGIONDESC
    547 {
    548     /** Start of the region in bytes or LBA number (depending on the flag in the
    549      * list header). */
    550     uint64_t                 offRegion;
    551     /** Overall size of the region in bytes or number of blocks (depending on the
    552      * flag in the list header). */
    553     uint64_t                 cRegionBlocksOrBytes;
    554     /** Size of one block in bytes, containing user and metadata. */
    555     uint64_t                 cbBlock;
    556     /** User data form of the block. */
    557     VDREGIONDATAFORM         enmDataForm;
    558     /** Metadata form of the block. */
    559     VDREGIONMETADATAFORM     enmMetadataForm;
    560     /** Size of the data block in bytes. */
    561     uint64_t                 cbData;
    562     /** Size of the metadata in a block in bytes. */
    563     uint64_t                 cbMetadata;
    564 } VDREGIONDESC;
    565 /** Pointer to a region descriptor. */
    566 typedef VDREGIONDESC *PVDREGIONDESC;
    567 /** Pointer to a constant region descriptor. */
    568 typedef const VDREGIONDESC *PCVDREGIONDESC;
    569 
    570 /**
    571  * Disk region list.
    572  */
    573 typedef struct VDREGIONLIST
    574 {
    575     /** Flags valid for the region list. */
    576     uint32_t                 fFlags;
    577     /** Number of regions in the descriptor array. */
    578     uint32_t                 cRegions;
    579     /** Region descriptors - variable in size. */
    580     VDREGIONDESC             aRegions[RT_FLEXIBLE_ARRAY];
    581 } VDREGIONLIST;
    582 /** Pointer to a region list. */
    583 typedef VDREGIONLIST *PVDREGIONLIST;
    584 /** Pointer to a constant region list. */
    585 typedef const VDREGIONLIST *PCVDREGIONLIST;
    586 /** Pointer to a region list pointer. */
    587 typedef PVDREGIONLIST *PPVDREGIONLIST;
    588 
    589 /** @name Valid region list flags.
    590  * @{
    591  */
    592 /** When set the region start offset and size are given in numbers of blocks
    593  * instead of byte offsets and sizes. */
    594 #define VD_REGION_LIST_F_LOC_SIZE_BLOCKS     RT_BIT_32(0)
    595 /** Mask of all valid flags. */
    596 #define VD_REGION_LIST_F_VALID               (VD_REGION_LIST_F_LOC_SIZE_BLOCKS)
    597 /** @} */
    598462
    599463/**
  • trunk/include/VBox/vmm/pdmstorageifs.h

    r66166 r66192  
    2929#include <iprt/sg.h>
    3030#include <VBox/types.h>
     31#include <VBox/vdmedia.h>
    3132
    3233RT_C_DECLS_BEGIN
     
    203204typedef const PDMMEDIAGEOMETRY *PCPDMMEDIAGEOMETRY;
    204205
    205 /**
    206  * Region data forms known to us from various standards.
    207  */
    208 typedef enum PDMMEDIAREGIONDATAFORM
    209 {
    210     /** Invalid data form. */
    211     PDMMEDIAREGIONDATAFORM_INVALID = 0,
    212     /** Raw data, no standardized format. */
    213     PDMMEDIAREGIONDATAFORM_RAW,
    214     /** CD-DA (audio CD), 2352 bytes of data. */
    215     PDMMEDIAREGIONDATAFORM_CDDA,
    216     /** CDDA data is pause. */
    217     PDMMEDIAREGIONDATAFORM_CDDA_PAUSE,
    218     /** Mode 1 with 2048 bytes sector size. */
    219     PDMMEDIAREGIONDATAFORM_MODE1_2048,
    220     /** Mode 1 with 2352 bytes sector size. */
    221     PDMMEDIAREGIONDATAFORM_MODE1_2352,
    222     /** Mode 1 with 0 bytes sector size (generated by the drive). */
    223     PDMMEDIAREGIONDATAFORM_MODE1_0,
    224     /** XA Mode with 2336 bytes sector size. */
    225     PDMMEDIAREGIONDATAFORM_XA_2336,
    226     /** XA Mode with 2352 bytes sector size. */
    227     PDMMEDIAREGIONDATAFORM_XA_2352,
    228     /** XA Mode with 0 bytes sector size (generated by the drive). */
    229     PDMMEDIAREGIONDATAFORM_XA_0,
    230     /** Mode 2 with 2336 bytes sector size. */
    231     PDMMEDIAREGIONDATAFORM_MODE2_2336,
    232     /** Mode 2 with 2352 bytes sector size. */
    233     PDMMEDIAREGIONDATAFORM_MODE2_2352,
    234     /** Mode 2 with 0 bytes sector size (generated by the drive). */
    235     PDMMEDIAREGIONDATAFORM_MODE2_0
    236 } PDMMEDIAREGIONDATAFORM;
    237 /** Pointer to a region data form. */
    238 typedef PDMMEDIAREGIONDATAFORM *PPDMMEDIAREGIONDATAFORM;
    239 
    240206/** Pointer to a media port interface. */
    241207typedef struct PDMIMEDIAPORT *PPDMIMEDIAPORT;
     
    518484    DECLR3CALLBACKMEMBER(int, pfnQueryRegionProperties,(PPDMIMEDIA pInterface, uint32_t uRegion, uint64_t *pu64LbaStart,
    519485                                                        uint64_t *pcBlocks, uint64_t *pcbBlock,
    520                                                         PPDMMEDIAREGIONDATAFORM penmDataForm));
     486                                                        PVDREGIONDATAFORM penmDataForm));
    521487
    522488    /**
     
    533499    DECLR3CALLBACKMEMBER(int, pfnQueryRegionPropertiesForLba,(PPDMIMEDIA pInterface, uint64_t u64LbaStart,
    534500                                                              uint64_t *pcBlocks, uint64_t *pcbBlock,
    535                                                               PPDMMEDIAREGIONDATAFORM penmDataForm));
     501                                                              PVDREGIONDATAFORM penmDataForm));
    536502
    537503} PDMIMEDIA;
  • trunk/src/VBox/Devices/Storage/DrvHostBase.cpp

    r66165 r66192  
    358358static DECLCALLBACK(int) drvHostBaseQueryRegionProperties(PPDMIMEDIA pInterface, uint32_t uRegion, uint64_t *pu64LbaStart,
    359359                                                          uint64_t *pcBlocks, uint64_t *pcbBlock,
    360                                                           PPDMMEDIAREGIONDATAFORM penmDataForm)
     360                                                          PVDREGIONDATAFORM penmDataForm)
    361361{
    362362    LogFlowFunc(("\n"));
     
    384384                *pcbBlock = cbBlock;
    385385            if (penmDataForm)
    386                 *penmDataForm = PDMMEDIAREGIONDATAFORM_RAW;
     386                *penmDataForm = VDREGIONDATAFORM_RAW;
    387387        }
    388388    }
     
    397397static DECLCALLBACK(int) drvHostBaseQueryRegionPropertiesForLba(PPDMIMEDIA pInterface, uint64_t u64LbaStart,
    398398                                                                uint64_t *pcBlocks, uint64_t *pcbBlock,
    399                                                                 PPDMMEDIAREGIONDATAFORM penmDataForm)
     399                                                                PVDREGIONDATAFORM penmDataForm)
    400400{
    401401    LogFlowFunc(("\n"));
     
    421421            *pcbBlock = cbBlock;
    422422        if (penmDataForm)
    423             *penmDataForm = PDMMEDIAREGIONDATAFORM_RAW;
     423            *penmDataForm = VDREGIONDATAFORM_RAW;
    424424    }
    425425    else
  • trunk/src/VBox/Devices/Storage/DrvVD.cpp

    r66166 r66192  
    537537}
    538538
    539 /**
    540  * Converts from VD region data form enum to the PDM variant.
    541  *
    542  * @returns PDM media region data form.
    543  * @param   enmDataForm         The VD region data form.
    544  */
    545 static PDMMEDIAREGIONDATAFORM drvvdVDRegionForm2PdmDataForm(VDREGIONDATAFORM enmDataForm)
    546 {
    547     switch (enmDataForm)
    548     {
    549         #define VDDATAFORM2PDM(tag) case VDREGIONDATAFORM_##tag: return PDMMEDIAREGIONDATAFORM_##tag
    550 
    551         VDDATAFORM2PDM(INVALID);
    552         VDDATAFORM2PDM(RAW);
    553         VDDATAFORM2PDM(CDDA);
    554         VDDATAFORM2PDM(CDDA_PAUSE);
    555         VDDATAFORM2PDM(MODE1_2048);
    556         VDDATAFORM2PDM(MODE1_2352);
    557         VDDATAFORM2PDM(MODE1_0);
    558         VDDATAFORM2PDM(XA_2336);
    559         VDDATAFORM2PDM(XA_2352);
    560         VDDATAFORM2PDM(XA_0);
    561         VDDATAFORM2PDM(MODE2_2336);
    562         VDDATAFORM2PDM(MODE2_2352);
    563         VDDATAFORM2PDM(MODE2_0);
    564 
    565         #undef VDDATAFORM2PDM
    566 
    567         default:
    568         {
    569             AssertMsgFailed(("Unknown data form %d! forgot to add it to the switch?\n", enmDataForm));
    570             return PDMMEDIAREGIONDATAFORM_INVALID;
    571         }
    572     }
    573 }
    574 
    575539/*********************************************************************************************************************************
    576540*   Error reporting callback                                                                                                     *
     
    25312495static DECLCALLBACK(int) drvvdQueryRegionProperties(PPDMIMEDIA pInterface, uint32_t uRegion, uint64_t *pu64LbaStart,
    25322496                                                    uint64_t *pcBlocks, uint64_t *pcbBlock,
    2533                                                     PPDMMEDIAREGIONDATAFORM penmDataForm)
     2497                                                    PVDREGIONDATAFORM penmDataForm)
    25342498{
    25352499    LogFlowFunc(("\n"));
     
    25492513            *pcbBlock = pRegion->cbBlock;
    25502514        if (penmDataForm)
    2551             *penmDataForm = drvvdVDRegionForm2PdmDataForm(pRegion->enmDataForm);
     2515            *penmDataForm = pRegion->enmDataForm;
    25522516    }
    25532517    else
     
    25612525static DECLCALLBACK(int) drvvdQueryRegionPropertiesForLba(PPDMIMEDIA pInterface, uint64_t u64LbaStart,
    25622526                                                          uint64_t *pcBlocks, uint64_t *pcbBlock,
    2563                                                           PPDMMEDIAREGIONDATAFORM penmDataForm)
     2527                                                          PVDREGIONDATAFORM penmDataForm)
    25642528{
    25652529    LogFlowFunc(("\n"));
     
    25882552                    *pcbBlock = pRegion->cbBlock;
    25892553                if (penmDataForm)
    2590                     *penmDataForm = drvvdVDRegionForm2PdmDataForm(pRegion->enmDataForm);
     2554                    *penmDataForm = pRegion->enmDataForm;
    25912555
    25922556                rc = VINF_SUCCESS;
Note: See TracChangeset for help on using the changeset viewer.

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