VirtualBox

Changeset 78469 in vbox for trunk/include


Ignore:
Timestamp:
May 11, 2019 1:12:07 AM (6 years ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
130498
Message:

winnt/vboxsf: USe new remove function that also closes the handle to combine two typical host calls and speed up file+dir removal. bugref:9172

File:
1 edited

Legend:

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

    r77881 r78469  
    700700}
    701701
     702#ifdef __cplusplus
     703
     704/** Request structure for VbglR0SfHostReqCloseAndRemove.  */
     705typedef struct VBOXSFCLOSEANDREMOVEREQ
     706{
     707    VBGLIOCIDCHGCMFASTCALL      Hdr;
     708    VMMDevHGCMCall              Call;
     709    VBoxSFParmCloseAndRemove    Parms;
     710    SHFLSTRING                  StrPath;
     711} VBOXSFCLOSEANDREMOVEREQ;
     712
     713/**
     714 * SHFL_FN_CLOSE_AND_REMOVE request.
     715 */
     716DECLINLINE(int) VbglR0SfHostReqCloseAndRemove(SHFLROOT idRoot, VBOXSFCLOSEANDREMOVEREQ *pReq, uint32_t fFlags, SHFLHANDLE hToClose)
     717{
     718    uint32_t const cbReq = RT_UOFFSETOF(VBOXSFCLOSEANDREMOVEREQ, StrPath.String)
     719                         + (g_fHostFeatures & VMMDEV_HVF_HGCM_EMBEDDED_BUFFERS ? pReq->StrPath.u16Size : 0);
     720    VBGLIOCIDCHGCMFASTCALL_INIT(&pReq->Hdr, VbglR0PhysHeapGetPhysAddr(pReq), &pReq->Call, g_SfClient.idClient,
     721                                SHFL_FN_CLOSE_AND_REMOVE, SHFL_CPARMS_CLOSE_AND_REMOVE, cbReq);
     722
     723    pReq->Parms.id32Root.type                   = VMMDevHGCMParmType_32bit;
     724    pReq->Parms.id32Root.u.value32              = idRoot;
     725
     726    if (g_fHostFeatures & VMMDEV_HVF_HGCM_EMBEDDED_BUFFERS)
     727    {
     728        pReq->Parms.pStrPath.type               = VMMDevHGCMParmType_Embedded;
     729        pReq->Parms.pStrPath.u.Embedded.cbData  = SHFLSTRING_HEADER_SIZE + pReq->StrPath.u16Size;
     730        pReq->Parms.pStrPath.u.Embedded.offData = RT_UOFFSETOF(VBOXSFCLOSEANDREMOVEREQ, StrPath) - sizeof(VBGLIOCIDCHGCMFASTCALL);
     731        pReq->Parms.pStrPath.u.Embedded.fFlags  = VBOX_HGCM_F_PARM_DIRECTION_TO_HOST;
     732    }
     733    else
     734    {
     735        pReq->Parms.pStrPath.type               = VMMDevHGCMParmType_LinAddr_In;
     736        pReq->Parms.pStrPath.u.LinAddr.cb       = SHFLSTRING_HEADER_SIZE + pReq->StrPath.u16Size;
     737        pReq->Parms.pStrPath.u.LinAddr.uAddr    = (uintptr_t)&pReq->StrPath;
     738    }
     739
     740    pReq->Parms.f32Flags.type                   = VMMDevHGCMParmType_32bit;
     741    pReq->Parms.f32Flags.u.value32              = fFlags;
     742
     743    pReq->Parms.u64Handle.type                  = VMMDevHGCMParmType_64bit;
     744    pReq->Parms.u64Handle.u.value64             = hToClose;
     745
     746    int vrc = VbglR0HGCMFastCall(g_SfClient.handle, &pReq->Hdr, cbReq);
     747    if (RT_SUCCESS(vrc))
     748        vrc = pReq->Call.header.result;
     749    return vrc;
     750}
     751
     752#endif /* __cplusplus */
     753
    702754
    703755/** Request structure for VbglR0SfHostReqRenameWithSrcContig and
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