VirtualBox

Ignore:
Timestamp:
Dec 11, 2018 5:22:18 AM (6 years ago)
Author:
vboxsync
Message:

SharedFolders,os2/VBoxSF: Continued hacking on replacements for VbglR0SfXxxx using OS/2 as testbed. Some simple read+write optimizations. bugref:9172

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Additions/os2/VBoxSF/VBoxSFInternal.h

    r76143 r76146  
    222222extern VBGLSFCLIENT g_SfClient;
    223223
     224void        vboxSfOs2InitFileBuffers(void);
    224225PSHFLSTRING vboxSfOs2StrAlloc(size_t cwcLength);
    225226PSHFLSTRING vboxSfOs2StrDup(PCSHFLSTRING pSrc);
     
    798799
    799800
    800 /** Request structure for vboxSfOs2HostReqRead. */
     801/** Request structure for vboxSfOs2HostReqReadEmbedded. */
    801802typedef struct VBOXSFREADEMBEDDEDREQ
    802803{
     
    808809
    809810/**
    810  * SHFL_FN_INFORMATION[SHFL_INFO_GET | SHFL_INFO_FILE] request.
     811 * SHFL_FN_READ request using embedded data buffer.
    811812 */
    812813DECLINLINE(int) vboxSfOs2HostReqReadEmbedded(PVBOXSFFOLDER pFolder, VBOXSFREADEMBEDDEDREQ *pReq, uint64_t hHostFile,
     
    840841
    841842
     843/** Request structure for vboxSfOs2HostReqRead. */
     844typedef struct VBOXSFREADPGLSTREQ
     845{
     846    VBGLIOCIDCHGCMFASTCALL  Hdr;
     847    VMMDevHGCMCall          Call;
     848    VBoxSFParmRead          Parms;
     849    HGCMPageListInfo        PgLst;
     850} VBOXSFREADPGLSTREQ;
     851
     852/**
     853 * SHFL_FN_READ request using page list for data buffer (caller populated).
     854 */
     855DECLINLINE(int) vboxSfOs2HostReqReadPgLst(PVBOXSFFOLDER pFolder, VBOXSFREADPGLSTREQ *pReq, uint64_t hHostFile,
     856                                          uint64_t offRead, uint32_t cbToRead, uint32_t cPages)
     857{
     858    VBGLIOCIDCHGCMFASTCALL_INIT(&pReq->Hdr, VbglR0PhysHeapGetPhysAddr(pReq), &pReq->Call, g_SfClient.idClient,
     859                                SHFL_FN_READ, SHFL_CPARMS_READ,
     860                                RT_UOFFSETOF_DYN(VBOXSFREADPGLSTREQ, PgLst.aPages[cPages]));
     861
     862    pReq->Parms.id32Root.type               = VMMDevHGCMParmType_32bit;
     863    pReq->Parms.id32Root.u.value32          = pFolder->hHostFolder.root;
     864
     865    pReq->Parms.u64Handle.type              = VMMDevHGCMParmType_64bit;
     866    pReq->Parms.u64Handle.u.value64         = hHostFile;
     867
     868    pReq->Parms.off64Read.type              = VMMDevHGCMParmType_64bit;
     869    pReq->Parms.off64Read.u.value64         = offRead;
     870
     871    pReq->Parms.cb32Read.type               = VMMDevHGCMParmType_32bit;
     872    pReq->Parms.cb32Read.u.value32          = cbToRead;
     873
     874    pReq->Parms.pBuf.type                   = VMMDevHGCMParmType_PageList;
     875    pReq->Parms.pBuf.u.PageList.size        = cbToRead;
     876    pReq->Parms.pBuf.u.PageList.offset      = RT_UOFFSETOF(VBOXSFREADEMBEDDEDREQ, abData[0]) - sizeof(VBGLIOCIDCHGCMFASTCALL);
     877    pReq->PgLst.flags                       = VBOX_HGCM_F_PARM_DIRECTION_FROM_HOST;
     878    pReq->PgLst.cPages                      = (uint16_t)cPages;
     879    AssertReturn(cPages <= UINT16_MAX, VERR_OUT_OF_RANGE);
     880    /* caller sets offset */
     881
     882    int vrc = VbglR0HGCMFastCall(g_SfClient.handle, &pReq->Hdr,
     883                                 RT_UOFFSETOF_DYN(VBOXSFREADPGLSTREQ, PgLst.aPages[cPages]));
     884    if (RT_SUCCESS(vrc))
     885        vrc = pReq->Call.header.result;
     886    return vrc;
     887}
     888
     889
     890
     891/** Request structure for vboxSfOs2HostReqWriteEmbedded. */
     892typedef struct VBOXSFWRITEEMBEDDEDREQ
     893{
     894    VBGLIOCIDCHGCMFASTCALL  Hdr;
     895    VMMDevHGCMCall          Call;
     896    VBoxSFParmWrite         Parms;
     897    uint8_t                 abData[RT_FLEXIBLE_ARRAY];
     898} VBOXSFWRITEEMBEDDEDREQ;
     899
     900/**
     901 * SHFL_FN_WRITE request using embedded data buffer.
     902 */
     903DECLINLINE(int) vboxSfOs2HostReqWriteEmbedded(PVBOXSFFOLDER pFolder, VBOXSFWRITEEMBEDDEDREQ *pReq, uint64_t hHostFile,
     904                                              uint64_t offWrite, uint32_t cbToWrite)
     905{
     906    VBGLIOCIDCHGCMFASTCALL_INIT(&pReq->Hdr, VbglR0PhysHeapGetPhysAddr(pReq), &pReq->Call, g_SfClient.idClient,
     907                                SHFL_FN_WRITE, SHFL_CPARMS_WRITE, RT_UOFFSETOF(VBOXSFWRITEEMBEDDEDREQ, abData[0]) + cbToWrite);
     908
     909    pReq->Parms.id32Root.type               = VMMDevHGCMParmType_32bit;
     910    pReq->Parms.id32Root.u.value32          = pFolder->hHostFolder.root;
     911
     912    pReq->Parms.u64Handle.type              = VMMDevHGCMParmType_64bit;
     913    pReq->Parms.u64Handle.u.value64         = hHostFile;
     914
     915    pReq->Parms.off64Write.type             = VMMDevHGCMParmType_64bit;
     916    pReq->Parms.off64Write.u.value64        = offWrite;
     917
     918    pReq->Parms.cb32Write.type              = VMMDevHGCMParmType_32bit;
     919    pReq->Parms.cb32Write.u.value32         = cbToWrite;
     920
     921    pReq->Parms.pBuf.type                   = VMMDevHGCMParmType_Embedded;
     922    pReq->Parms.pBuf.u.Embedded.cbData      = cbToWrite;
     923    pReq->Parms.pBuf.u.Embedded.offData     = RT_UOFFSETOF(VBOXSFWRITEEMBEDDEDREQ, abData[0]) - sizeof(VBGLIOCIDCHGCMFASTCALL);
     924    pReq->Parms.pBuf.u.Embedded.fFlags      = VBOX_HGCM_F_PARM_DIRECTION_TO_HOST;
     925
     926    int vrc = VbglR0HGCMFastCall(g_SfClient.handle, &pReq->Hdr, RT_UOFFSETOF(VBOXSFWRITEEMBEDDEDREQ, abData[0]) + cbToWrite);
     927    if (RT_SUCCESS(vrc))
     928        vrc = pReq->Call.header.result;
     929    return vrc;
     930}
     931
     932
     933/** Request structure for vboxSfOs2HostReqWrite. */
     934typedef struct VBOXSFWRITEPGLSTREQ
     935{
     936    VBGLIOCIDCHGCMFASTCALL  Hdr;
     937    VMMDevHGCMCall          Call;
     938    VBoxSFParmWrite         Parms;
     939    HGCMPageListInfo        PgLst;
     940} VBOXSFWRITEPGLSTREQ;
     941
     942/**
     943 * SHFL_FN_WRITE request using page list for data buffer (caller populated).
     944 */
     945DECLINLINE(int) vboxSfOs2HostReqWritePgLst(PVBOXSFFOLDER pFolder, VBOXSFWRITEPGLSTREQ *pReq, uint64_t hHostFile,
     946                                           uint64_t offWrite, uint32_t cbToWrite, uint32_t cPages)
     947{
     948    VBGLIOCIDCHGCMFASTCALL_INIT(&pReq->Hdr, VbglR0PhysHeapGetPhysAddr(pReq), &pReq->Call, g_SfClient.idClient,
     949                                SHFL_FN_WRITE, SHFL_CPARMS_WRITE,
     950                                RT_UOFFSETOF_DYN(VBOXSFWRITEPGLSTREQ, PgLst.aPages[cPages]));
     951
     952    pReq->Parms.id32Root.type               = VMMDevHGCMParmType_32bit;
     953    pReq->Parms.id32Root.u.value32          = pFolder->hHostFolder.root;
     954
     955    pReq->Parms.u64Handle.type              = VMMDevHGCMParmType_64bit;
     956    pReq->Parms.u64Handle.u.value64         = hHostFile;
     957
     958    pReq->Parms.off64Write.type              = VMMDevHGCMParmType_64bit;
     959    pReq->Parms.off64Write.u.value64         = offWrite;
     960
     961    pReq->Parms.cb32Write.type               = VMMDevHGCMParmType_32bit;
     962    pReq->Parms.cb32Write.u.value32          = cbToWrite;
     963
     964    pReq->Parms.pBuf.type                   = VMMDevHGCMParmType_PageList;
     965    pReq->Parms.pBuf.u.PageList.size        = cbToWrite;
     966    pReq->Parms.pBuf.u.PageList.offset      = RT_UOFFSETOF(VBOXSFWRITEEMBEDDEDREQ, abData[0]) - sizeof(VBGLIOCIDCHGCMFASTCALL);
     967    pReq->PgLst.flags                       = VBOX_HGCM_F_PARM_DIRECTION_FROM_HOST;
     968    pReq->PgLst.cPages                      = (uint16_t)cPages;
     969    AssertReturn(cPages <= UINT16_MAX, VERR_OUT_OF_RANGE);
     970    /* caller sets offset */
     971
     972    int vrc = VbglR0HGCMFastCall(g_SfClient.handle, &pReq->Hdr,
     973                                 RT_UOFFSETOF_DYN(VBOXSFWRITEPGLSTREQ, PgLst.aPages[cPages]));
     974    if (RT_SUCCESS(vrc))
     975        vrc = pReq->Call.header.result;
     976    return vrc;
     977}
     978
     979
    842980/** @} */
    843981
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