VirtualBox

Changeset 25966 in vbox for trunk/src/VBox/Devices/Parallel


Ignore:
Timestamp:
Jan 22, 2010 11:15:43 AM (15 years ago)
Author:
vboxsync
Message:

PDMIBASE refactoring; use UUID as interface IDs.

Location:
trunk/src/VBox/Devices/Parallel
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Devices/Parallel/DevParallel.cpp

    r25732 r25966  
    9393*   Structures and Typedefs                                                    *
    9494*******************************************************************************/
     95/**
     96 * Parallel device state.
     97 *
     98 * @implements  PDMIBASE
     99 * @implements  PDMIHOSTPARALLELPORT
     100 */
    95101typedef struct ParallelState
    96102{
     
    105111    PPDMDEVINSRC                        pDevInsRC;
    106112    RTRCPTR                             Alignment0; /**< Alignment. */
    107     /** The base interface. */
     113    /** LUN\#0: The base interface. */
    108114    PDMIBASE                            IBase;
    109     /** The host device port interface. */
     115    /** LUN\#0: The host device port interface. */
    110116    PDMIHOSTPARALLELPORT                IHostParallelPort;
    111117    /** Pointer to the attached base driver. */
     
    644650}
    645651
    646 /** @copydoc PIBASE::pfnqueryInterface */
    647 static DECLCALLBACK(void *) parallelQueryInterface(PPDMIBASE pInterface, PDMINTERFACE enmInterface)
     652/**
     653 * @interface_method_impl{PDMIBASE,pfnQueryInterface}
     654 */
     655static DECLCALLBACK(void *) parallelQueryInterface(PPDMIBASE pInterface, const char *pszIID)
    648656{
    649657    ParallelState *pThis = PDMIBASE_2_PARALLELSTATE(pInterface);
    650     switch (enmInterface)
    651     {
    652         case PDMINTERFACE_BASE:
    653             return &pThis->IBase;
    654         case PDMINTERFACE_HOST_PARALLEL_PORT:
    655             return &pThis->IHostParallelPort;
    656         default:
    657             return NULL;
    658     }
     658    if (RTUuidCompare2Strs(pszIID, PDMIBASE_IID) == 0)
     659        return &pThis->IBase;
     660    if (RTUuidCompare2Strs(pszIID, PDMINTERFACE_HOST_PARALLEL_PORT) == 0)
     661        return &pThis->IHostParallelPort;
     662    return NULL;
    659663}
    660664
  • trunk/src/VBox/Devices/Parallel/DrvHostParallel.cpp

    r25893 r25966  
    77
    88/*
    9  * Copyright (C) 2006-2007 Sun Microsystems, Inc.
     9 * Copyright (C) 2006-2010 Sun Microsystems, Inc.
    1010 *
    1111 * This file is part of VirtualBox Open Source Edition (OSE), as
     
    3030#include <iprt/asm.h>
    3131#include <iprt/assert.h>
     32#include <iprt/file.h>
     33#include <iprt/semaphore.h>
    3234#include <iprt/stream.h>
    33 #include <iprt/semaphore.h>
    34 #include <iprt/file.h>
     35#include <iprt/uuid.h>
    3536
    3637#ifdef RT_OS_LINUX
     
    4849#include "Builtins.h"
    4950
     51
    5052/*******************************************************************************
    5153*   Structures and Typedefs                                                    *
     
    5355/**
    5456 * Host parallel port driver instance data.
     57 * @implements PDMIHOSTPARALLELCONNECTOR
    5558 */
    5659typedef struct DRVHOSTPARALLEL
     
    6265    /** Our host device interface. */
    6366    PDMIHOSTPARALLELCONNECTOR     IHostParallelConnector;
    64     /** Our host device port interface. */
    65     PDMIHOSTPARALLELPORT          IHostParallelPort;
    6667    /** Device Path */
    67     char                          *pszDevicePath;
     68    char                         *pszDevicePath;
    6869    /** Device Handle */
    6970    RTFILE                        FileDevice;
     
    7879/** Converts a pointer to DRVHOSTPARALLEL::IHostDeviceConnector to a PDRHOSTPARALLEL. */
    7980#define PDMIHOSTPARALLELCONNECTOR_2_DRVHOSTPARALLEL(pInterface) ( (PDRVHOSTPARALLEL)((uintptr_t)pInterface - RT_OFFSETOF(DRVHOSTPARALLEL, IHostParallelConnector)) )
    80 /** Converts a pointer to DRVHOSTPARALLEL::IHostDevicePort to a PDRHOSTPARALLEL. */
    81 #define PDMIHOSTPARALLELPORT_2_DRVHOSTPARALLEL(pInterface) ( (PDRVHOSTPARALLEL)((uintptr_t)pInterface - RT_OFFSETOF(DRVHOSTPARALLEL, IHostParallelPort)) )
     81
    8282
    8383/* -=-=-=-=- IBase -=-=-=-=- */
    8484
    8585/**
    86  * Queries an interface to the driver.
    87  *
    88  * @returns Pointer to interface.
    89  * @returns NULL if the interface was not supported by the driver.
    90  * @param   pInterface          Pointer to this interface structure.
    91  * @param   enmInterface        The requested interface identification.
    92  */
    93 static DECLCALLBACK(void *) drvHostParallelQueryInterface(PPDMIBASE pInterface, PDMINTERFACE enmInterface)
    94 {
    95     PPDMDRVINS  pDrvIns = PDMIBASE_2_PDMDRV(pInterface);
    96     PDRVHOSTPARALLEL    pThis = PDMINS_2_DATA(pDrvIns, PDRVHOSTPARALLEL);
    97     switch (enmInterface)
    98     {
    99         case PDMINTERFACE_BASE:
    100             return &pDrvIns->IBase;
    101         case PDMINTERFACE_HOST_PARALLEL_CONNECTOR:
    102             return &pThis->IHostParallelConnector;
    103         default:
    104             return NULL;
    105     }
     86 * @interface_method_impl{PDMIBASE,pfnQueryInterface}
     87 */
     88static DECLCALLBACK(void *) drvHostParallelQueryInterface(PPDMIBASE pInterface, const char *pszIID)
     89{
     90    PPDMDRVINS          pDrvIns = PDMIBASE_2_PDMDRV(pInterface);
     91    PDRVHOSTPARALLEL    pThis   = PDMINS_2_DATA(pDrvIns, PDRVHOSTPARALLEL);
     92
     93    if (RTUuidCompare2Strs(pszIID, PDMIBASE_IID) == 0)
     94        return &pDrvIns->IBase;
     95    if (RTUuidCompare2Strs(pszIID, PDMINTERFACE_HOST_PARALLEL_CONNECTOR) == 0)
     96        return &pThis->IHostParallelConnector;
     97    return NULL;
    10698}
    10799
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