VirtualBox

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


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.

Location:
trunk/src/VBox/Devices/VirtIO
Files:
1 added
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Devices/VirtIO/Virtio.cpp

    r25830 r25966  
    22/** @file
    33 * Virtio - Virtio Common Functions (VRing, VQueue, Virtio PCI)
    4  *
    54 */
    65
    76/*
    8  * Copyright (C) 2009 Sun Microsystems, Inc.
     7 * Copyright (C) 2009-2010 Sun Microsystems, Inc.
    98 *
    109 * This file is part of VirtualBox Open Source Edition (OSE), as
     
    2524
    2625#include <iprt/param.h>
     26#include <iprt/uuid.h>
    2727#include <VBox/pdmdev.h>
    2828#include "Virtio.h"
     
    522522
    523523#ifdef IN_RING3
    524 /**
    525  * Provides interfaces to the driver.
    526  *
    527  * @returns Pointer to interface. NULL if the interface is not supported.
    528  * @param   pInterface          Pointer to this interface structure.
    529  * @param   enmInterface        The requested interface identification.
    530  * @thread  EMT
    531  */
    532 void *vpciQueryInterface(struct PDMIBASE *pInterface, PDMINTERFACE enmInterface)
    533 {
    534     VPCISTATE *pState = IFACE_TO_STATE(pInterface, IBase);
    535     Assert(&pState->IBase == pInterface);
    536     switch (enmInterface)
    537     {
    538         case PDMINTERFACE_BASE:
    539             return &pState->IBase;
    540         case PDMINTERFACE_LED_PORTS:
    541             return &pState->ILeds;
    542         default:
    543             return NULL;
    544     }
     524
     525/**
     526 * @interface_method_impl{PDMIBASE,pfnQueryInterface}
     527 */
     528void *vpciQueryInterface(struct PDMIBASE *pInterface, const char *pszIID)
     529{
     530    VPCISTATE *pThis = IFACE_TO_STATE(pInterface, IBase);
     531    Assert(&pThis->IBase == pInterface);
     532
     533    if (RTUuidCompare2Strs(pszIID, PDMIBASE_IID) == 0)
     534        return &pThis->IBase;
     535    if (RTUuidCompare2Strs(pszIID, PDMINTERFACE_LED_PORTS) == 0)
     536        return &pThis->ILeds;
     537    return NULL;
    545538}
    546539
     
    934927}
    935928
    936 
    937929#endif /* IN_RING3 */
    938930
  • trunk/src/VBox/Devices/VirtIO/Virtio.h

    r25158 r25966  
    22/** @file
    33 * Virtio.h - Virtio Declarations
    4  *
    54 */
    65
     
    162161};
    163162
     163
     164/**
     165 * The state of the VirtIO PCI device
     166 *
     167 * @implements  PDMILEDPORTS
     168 */
    164169struct VPCIState_st
    165170{
     
    172177#endif
    173178
     179    /** Status LUN: Base interface. */
    174180    PDMIBASE               IBase;
    175     PDMILEDPORTS           ILeds;                               /**< LED interface */
     181    /** Status LUN: LED port interface. */
     182    PDMILEDPORTS           ILeds;
     183    /** Status LUN: LED connector (peer). */
    176184    R3PTRTYPE(PPDMILEDCONNECTORS) pLedsConnector;
    177185
     
    263271void  vpciRelocate(PPDMDEVINS pDevIns, RTGCINTPTR offDelta);
    264272void  vpciReset(PVPCISTATE pState);
    265 void *vpciQueryInterface(struct PDMIBASE *pInterface,
    266                          PDMINTERFACE enmInterface);
     273void *vpciQueryInterface(struct PDMIBASE *pInterface, const char *pszIID);
    267274PVQUEUE vpciAddQueue(VPCISTATE* pState, unsigned uSize,
    268275                     void (*pfnCallback)(void *pvState, PVQUEUE pQueue),
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