VirtualBox

Ignore:
Timestamp:
Jan 22, 2010 11:15:43 AM (15 years ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
56818
Message:

PDMIBASE refactoring; use UUID as interface IDs.

File:
1 edited

Legend:

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

    r25893 r25966  
     1/* $Id$ */
    12/** @file
    2  *
    3  * VBox storage devices:
    4  * ISO image media driver
     3 * VBox storage devices: ISO image media driver
    54 */
    65
     
    2827#include <iprt/assert.h>
    2928#include <iprt/file.h>
    30 
    31 #include <string.h>
     29#include <iprt/string.h>
     30#include <iprt/uuid.h>
    3231
    3332#include "Builtins.h"
     33
    3434
    3535/*******************************************************************************
    3636*   Defined Constants And Macros                                               *
    3737*******************************************************************************/
    38 
    3938/** Converts a pointer to MEDIAISO::IMedia to a PRDVMEDIAISO. */
    4039#define PDMIMEDIA_2_DRVMEDIAISO(pInterface) ( (PDRVMEDIAISO)((uintptr_t)pInterface - RT_OFFSETOF(DRVMEDIAISO, IMedia)) )
     
    5352/**
    5453 * Block driver instance data.
     54 *
     55 * @implements PDMIMEDIA
    5556 */
    5657typedef struct DRVMEDIAISO
     
    8283static DECLCALLBACK(int) drvMediaISOBiosSetLCHSGeometry(PPDMIMEDIA pInterface, PCPDMMEDIAGEOMETRY pLCHSGeometry);
    8384
    84 static DECLCALLBACK(void *) drvMediaISOQueryInterface(PPDMIBASE pInterface, PDMINTERFACE enmInterface);
     85static DECLCALLBACK(void *) drvMediaISOQueryInterface(PPDMIBASE pInterface, const char *pszIID);
    8586
    8687
     
    286287
    287288/**
    288  * Queries an interface to the driver.
    289  *
    290  * @returns Pointer to interface.
    291  * @returns NULL if the interface was not supported by the driver.
    292  * @param   pInterface          Pointer to this interface structure.
    293  * @param   enmInterface        The requested interface identification.
    294  * @thread  Any thread.
    295  */
    296 static DECLCALLBACK(void *) drvMediaISOQueryInterface(PPDMIBASE pInterface, PDMINTERFACE enmInterface)
     289 * @interface_method_impl{PDMIBASE,pfnQueryInterface}
     290 */
     291static DECLCALLBACK(void *) drvMediaISOQueryInterface(PPDMIBASE pInterface, const char *pszIID)
    297292{
    298293    PPDMDRVINS pDrvIns = PDMIBASE_2_DRVINS(pInterface);
    299294    PDRVMEDIAISO pThis = PDMINS_2_DATA(pDrvIns, PDRVMEDIAISO);
    300     switch (enmInterface)
    301     {
    302         case PDMINTERFACE_BASE:
    303             return &pDrvIns->IBase;
    304         case PDMINTERFACE_MEDIA:
    305             return &pThis->IMedia;
    306         default:
    307             return NULL;
    308     }
     295    if (RTUuidCompare2Strs(pszIID, PDMIBASE_IID) == 0)
     296        return &pDrvIns->IBase;
     297    if (RTUuidCompare2Strs(pszIID, PDMINTERFACE_MEDIA) == 0)
     298        return &pThis->IMedia;
     299    return NULL;
    309300}
    310301
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