VirtualBox

Changeset 107276 in vbox


Ignore:
Timestamp:
Dec 10, 2024 12:40:08 PM (5 weeks ago)
Author:
vboxsync
Message:

PDMUsb: bugref:10810 Introduced PDMR3UsbQueryDeviceLun needed by Console::i_onNetworkAdapterChange

Location:
trunk
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • trunk/include/VBox/vmm/pdmusb.h

    r106061 r107276  
    14921492VMMR3DECL(int)  PDMR3UsbQueryDriverOnLun(PUVM pUVM, const char *pszDevice, unsigned iInstance, unsigned iLun,
    14931493                                         const char *pszDriver, PPPDMIBASE ppBase);
     1494VMMR3DECL(int)  PDMR3UsbQueryDeviceLun(PUVM pUVM, const char *pszDevice, unsigned iInstance, unsigned iLun, PPDMIBASE *ppBase);
    14941495
    14951496/** @} */
  • trunk/include/VBox/vmm/vmmr3vtable-def.h

    r106061 r107276  
    638638VTABLE_ENTRY(PDMR3UsbQueryLun)
    639639VTABLE_ENTRY(PDMR3UsbQueryDriverOnLun)
     640VTABLE_ENTRY(PDMR3UsbQueryDeviceLun)
    640641
    641642VTABLE_ENTRY(PDMR3DriverEnumInstances)
  • trunk/src/VBox/Main/src-client/ConsoleImpl.cpp

    r107268 r107276  
    16991699            return "3c501";
    17001700        case NetworkAdapterType_UsbNet:
    1701             return "usbnet";
     1701            return "UsbNet";
    17021702        default:
    17031703            AssertFailed();
     
    43574357                    int vrc = VINF_SUCCESS;
    43584358                    if (adapterType == NetworkAdapterType_UsbNet)
    4359                         vrc = ptrVM.vtable()->pfnPDMR3UsbQueryLun(ptrVM.rawUVM(), pszAdapterName, ulInstance, 0, &pBase);
     4359                        vrc = ptrVM.vtable()->pfnPDMR3UsbQueryDeviceLun(ptrVM.rawUVM(), pszAdapterName, ulInstance, 0, &pBase);
    43604360                    else
    43614361                        vrc = ptrVM.vtable()->pfnPDMR3QueryDeviceLun(ptrVM.rawUVM(), pszAdapterName, ulInstance, 0, &pBase);
     
    44684468            const char *pszAdapterName = networkAdapterTypeToName(adapterType);
    44694469            PPDMIBASE pBase;
    4470             int vrc = ptrVM.vtable()->pfnPDMR3QueryLun(ptrVM.rawUVM(), pszAdapterName, ulInstance, 0, &pBase);
     4470            int vrc;
     4471            if (adapterType == NetworkAdapterType_UsbNet)
     4472                vrc = ptrVM.vtable()->pfnPDMR3UsbQueryLun(ptrVM.rawUVM(), pszAdapterName, ulInstance, 0, &pBase);
     4473            else
     4474                vrc = ptrVM.vtable()->pfnPDMR3QueryLun(ptrVM.rawUVM(), pszAdapterName, ulInstance, 0, &pBase);
    44714475            if (RT_FAILURE(vrc))
    44724476            {
  • trunk/src/VBox/VMM/VMMR3/PDMUsb.cpp

    r106061 r107276  
    15441544    RTCritSectRwLeaveExcl(&pVM->pdm.s.CoreListCritSectRw);
    15451545    LogFlow(("PDMR3UsbDriverDetach: returns %Rrc\n", rc));
     1546    return rc;
     1547}
     1548
     1549
     1550/**
     1551 * Queries the base interface of a device LUN.
     1552 *
     1553 * This differs from PDMR3UsbQueryLun by that it returns the interface on the
     1554 * device and not the top level driver.
     1555 *
     1556 * @returns VBox status code.
     1557 * @param   pUVM            The user mode VM handle.
     1558 * @param   pszDevice       Device name.
     1559 * @param   iInstance       Device instance.
     1560 * @param   iLun            The Logical Unit to obtain the interface of.
     1561 * @param   ppBase          Where to store the base interface pointer.
     1562 */
     1563VMMR3DECL(int) PDMR3UsbQueryDeviceLun(PUVM pUVM, const char *pszDevice, unsigned iInstance, unsigned iLun, PPDMIBASE *ppBase)
     1564{
     1565    LogFlow(("PDMR3UsbQueryDeviceLun: pszDevice=%p:{%s} iInstance=%u iLun=%u ppBase=%p\n",
     1566             pszDevice, pszDevice, iInstance, iLun, ppBase));
     1567    *ppBase = NULL;
     1568    UVM_ASSERT_VALID_EXT_RETURN(pUVM, VERR_INVALID_VM_HANDLE);
     1569    PVM pVM = pUVM->pVM;
     1570    VM_ASSERT_VALID_EXT_RETURN(pVM, VERR_INVALID_VM_HANDLE);
     1571
     1572    /*
     1573     * Find the LUN.
     1574     */
     1575    RTCritSectRwEnterShared(&pVM->pdm.s.CoreListCritSectRw);
     1576
     1577    PPDMLUN pLun;
     1578    int rc = pdmR3UsbFindLun(pVM, pszDevice, iInstance, iLun, &pLun);
     1579    if (RT_SUCCESS(rc))
     1580    {
     1581        *ppBase = pLun->pBase;
     1582
     1583        RTCritSectRwLeaveShared(&pVM->pdm.s.CoreListCritSectRw);
     1584        LogFlow(("PDMR3UsbQueryDeviceLun: return %Rrc and *ppBase=%p\n", VINF_SUCCESS, *ppBase));
     1585        return VINF_SUCCESS;
     1586    }
     1587
     1588    RTCritSectRwLeaveShared(&pVM->pdm.s.CoreListCritSectRw);
     1589    LogFlow(("PDMR3UsbQueryDeviceLun: returns %Rrc\n", rc));
    15461590    return rc;
    15471591}
  • trunk/src/VBox/VMM/VMMR3/VMMR3.def

    r106061 r107276  
    326326    PDMR3UsbQueryLun
    327327    PDMR3UsbQueryDriverOnLun
     328    PDMR3UsbQueryDeviceLun
    328329
    329330    PGMHandlerPhysicalPageTempOff
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