VirtualBox

Ignore:
Timestamp:
Nov 26, 2018 3:44:41 PM (6 years ago)
Author:
vboxsync
Message:

HGCM: Replace C++-style inline members on VBOXHGCMSVCPARM with simple functions.
bugref:9172: Shared folder performance tuning
Changes in bugref:9172 caused a build regression on Ubuntu 18.10 due to the
use of RT_ZERO on a structure containing an embedded VBOXHGCMSVCPARM, as
VBOXHGCMSVCPARM had member functions and was therefore not a simple plain-
old-data structure. Rather than just doing the sensible thing and zeroing
it in a different way, I converted the inline member getters and setters to
standard inline C functions, including fixing callers. Actually I had planned
this for some time, as the member function use seemed a bit gratuitous in
hindsight.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/HostServices/SharedFolders/testcase/tstSharedFolderService.cpp

    r75570 r75737  
    659659    fillTestShflString(&Mapping, pcszMapping);
    660660    fillTestShflString(&AutoMountPoint, "");
    661     aParms[0].setPointer(&FolderName,   RT_UOFFSETOF(SHFLSTRING, String)
     661    HGCMSvcSetPv(&aParms[0], &FolderName,   RT_UOFFSETOF(SHFLSTRING, String)
    662662                                      + FolderName.string.u16Size);
    663     aParms[1].setPointer(&Mapping,   RT_UOFFSETOF(SHFLSTRING, String)
     663    HGCMSvcSetPv(&aParms[1], &Mapping,   RT_UOFFSETOF(SHFLSTRING, String)
    664664                                   + Mapping.string.u16Size);
    665     aParms[2].setUInt32(1);
    666     aParms[3].setPointer(&AutoMountPoint, SHFLSTRING_HEADER_SIZE + AutoMountPoint.string.u16Size);
     665    HGCMSvcSetU32(&aParms[2], 1);
     666    HGCMSvcSetPv(&aParms[3], &AutoMountPoint, SHFLSTRING_HEADER_SIZE + AutoMountPoint.string.u16Size);
    667667    rc = psvcTable->pfnHostCall(psvcTable->pvService, SHFL_FN_ADD_MAPPING,
    668668                                SHFL_CPARMS_ADD_MAPPING, aParms);
    669669    AssertReleaseRC(rc);
    670     aParms[0].setPointer(&Mapping,   RT_UOFFSETOF(SHFLSTRING, String)
     670    HGCMSvcSetPv(&aParms[0], &Mapping,   RT_UOFFSETOF(SHFLSTRING, String)
    671671                                   + Mapping.string.u16Size);
    672     aParms[1].setUInt32(0);  /* root */
    673     aParms[2].setUInt32('/');  /* delimiter */
    674     aParms[3].setUInt32(fCaseSensitive);
     672    HGCMSvcSetU32(&aParms[1], 0);  /* root */
     673    HGCMSvcSetU32(&aParms[2], '/');  /* delimiter */
     674    HGCMSvcSetU32(&aParms[3], fCaseSensitive);
    675675    psvcTable->pfnCall(psvcTable->pvService, &callHandle, 0,
    676676                       psvcTable->pvService, SHFL_FN_MAP_FOLDER,
     
    692692    int rc;
    693693
    694     aParms[0].setUInt32(root);
     694    HGCMSvcSetU32(&aParms[0], root);
    695695    psvcTable->pfnCall(psvcTable->pvService, &callHandle, 0,
    696696                       psvcTable->pvService, SHFL_FN_UNMAP_FOLDER,
     
    698698    AssertReleaseRC(callHandle.rc);
    699699    fillTestShflString(&FolderName, pcszFolderName);
    700     aParms[0].setPointer(&FolderName,   RT_UOFFSETOF(SHFLSTRING, String)
     700    HGCMSvcSetPv(&aParms[0], &FolderName,   RT_UOFFSETOF(SHFLSTRING, String)
    701701                                      + FolderName.string.u16Size);
    702702    rc = psvcTable->pfnHostCall(psvcTable->pvService, SHFL_FN_REMOVE_MAPPING,
     
    717717    RT_ZERO(CreateParms);
    718718    CreateParms.CreateFlags = fCreateFlags;
    719     aParms[0].setUInt32(Root);
    720     aParms[1].setPointer(&Path,   RT_UOFFSETOF(SHFLSTRING, String)
     719    HGCMSvcSetU32(&aParms[0], Root);
     720    HGCMSvcSetPv(&aParms[1], &Path,   RT_UOFFSETOF(SHFLSTRING, String)
    721721                                + Path.string.u16Size);
    722     aParms[2].setPointer(&CreateParms, sizeof(CreateParms));
     722    HGCMSvcSetPv(&aParms[2], &CreateParms, sizeof(CreateParms));
    723723    psvcTable->pfnCall(psvcTable->pvService, &callHandle, 0,
    724724                       psvcTable->pvService, SHFL_FN_CREATE,
     
    740740    VBOXHGCMCALLHANDLE_TYPEDEF callHandle = { VINF_SUCCESS };
    741741
    742     aParms[0].setUInt32(Root);
    743     aParms[1].setUInt64((uint64_t) hFile);
    744     aParms[2].setUInt64(offSeek);
    745     aParms[3].setUInt32(cbRead);
    746     aParms[4].setPointer(pvBuf, cbBuf);
     742    HGCMSvcSetU32(&aParms[0], Root);
     743    HGCMSvcSetU64(&aParms[1], (uint64_t) hFile);
     744    HGCMSvcSetU64(&aParms[2], offSeek);
     745    HGCMSvcSetU32(&aParms[3], cbRead);
     746    HGCMSvcSetPv(&aParms[4], pvBuf, cbBuf);
    747747    psvcTable->pfnCall(psvcTable->pvService, &callHandle, 0,
    748748                       psvcTable->pvService, SHFL_FN_READ,
     
    760760    VBOXHGCMCALLHANDLE_TYPEDEF callHandle = { VINF_SUCCESS };
    761761
    762     aParms[0].setUInt32(Root);
    763     aParms[1].setUInt64((uint64_t) hFile);
    764     aParms[2].setUInt64(offSeek);
    765     aParms[3].setUInt32(cbWrite);
    766     aParms[4].setPointer((void *)pvBuf, cbBuf);
     762    HGCMSvcSetU32(&aParms[0], Root);
     763    HGCMSvcSetU64(&aParms[1], (uint64_t) hFile);
     764    HGCMSvcSetU64(&aParms[2], offSeek);
     765    HGCMSvcSetU32(&aParms[3], cbWrite);
     766    HGCMSvcSetPv(&aParms[4], (void *)pvBuf, cbBuf);
    767767    psvcTable->pfnCall(psvcTable->pvService, &callHandle, 0,
    768768                       psvcTable->pvService, SHFL_FN_WRITE,
     
    779779    VBOXHGCMCALLHANDLE_TYPEDEF callHandle = { VINF_SUCCESS };
    780780
    781     aParms[0].setUInt32(root);
    782     aParms[1].setUInt64(handle);
     781    HGCMSvcSetU32(&aParms[0], root);
     782    HGCMSvcSetU64(&aParms[1], handle);
    783783    psvcTable->pfnCall(psvcTable->pvService, &callHandle, 0,
    784784                       psvcTable->pvService, SHFL_FN_FLUSH,
     
    796796    VBOXHGCMCALLHANDLE_TYPEDEF callHandle = { VINF_SUCCESS };
    797797
    798     aParms[0].setUInt32(root);
    799     aParms[1].setUInt64(handle);
    800     aParms[2].setUInt32(fFlags);
    801     aParms[3].setUInt32(cbBuf);
     798    HGCMSvcSetU32(&aParms[0], root);
     799    HGCMSvcSetU64(&aParms[1], handle);
     800    HGCMSvcSetU32(&aParms[2], fFlags);
     801    HGCMSvcSetU32(&aParms[3], cbBuf);
    802802    if (pcszPath)
    803803    {
    804804        fillTestShflString(&Path, pcszPath);
    805         aParms[4].setPointer(&Path,   RT_UOFFSETOF(SHFLSTRING, String)
     805        HGCMSvcSetPv(&aParms[4], &Path,   RT_UOFFSETOF(SHFLSTRING, String)
    806806                                    + Path.string.u16Size);
    807807    }
    808808    else
    809         aParms[4].setPointer(NULL, 0);
    810     aParms[5].setPointer(pvBuf, cbBuf);
    811     aParms[6].setUInt32(resumePoint);
    812     aParms[7].setUInt32(0);
     809        HGCMSvcSetPv(&aParms[4], NULL, 0);
     810    HGCMSvcSetPv(&aParms[5], pvBuf, cbBuf);
     811    HGCMSvcSetU32(&aParms[6], resumePoint);
     812    HGCMSvcSetU32(&aParms[7], 0);
    813813    psvcTable->pfnCall(psvcTable->pvService, &callHandle, 0,
    814814                       psvcTable->pvService, SHFL_FN_LIST,
     
    826826    VBOXHGCMCALLHANDLE_TYPEDEF callHandle = { VINF_SUCCESS };
    827827
    828     aParms[0].setUInt32(root);
    829     aParms[1].setUInt64(handle);
    830     aParms[2].setUInt32(fFlags);
    831     aParms[3].setUInt32(cb);
    832     aParms[4].setPointer(pInfo, cb);
     828    HGCMSvcSetU32(&aParms[0], root);
     829    HGCMSvcSetU64(&aParms[1], handle);
     830    HGCMSvcSetU32(&aParms[2], fFlags);
     831    HGCMSvcSetU32(&aParms[3], cb);
     832    HGCMSvcSetPv(&aParms[4], pInfo, cb);
    833833    psvcTable->pfnCall(psvcTable->pvService, &callHandle, 0,
    834834                       psvcTable->pvService, SHFL_FN_INFORMATION,
     
    844844    VBOXHGCMCALLHANDLE_TYPEDEF callHandle = { VINF_SUCCESS };
    845845
    846     aParms[0].setUInt32(root);
    847     aParms[1].setUInt64(handle);
    848     aParms[2].setUInt64(offLock);
    849     aParms[3].setUInt64(cbLock);
    850     aParms[4].setUInt32(fFlags);
     846    HGCMSvcSetU32(&aParms[0], root);
     847    HGCMSvcSetU64(&aParms[1], handle);
     848    HGCMSvcSetU64(&aParms[2], offLock);
     849    HGCMSvcSetU64(&aParms[3], cbLock);
     850    HGCMSvcSetU32(&aParms[4], fFlags);
    851851    psvcTable->pfnCall(psvcTable->pvService, &callHandle, 0,
    852852                       psvcTable->pvService, SHFL_FN_LOCK,
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