VirtualBox

Ignore:
Timestamp:
Nov 26, 2018 3:44:41 PM (6 years ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
126937
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.

Location:
trunk/src/VBox/HostServices/GuestControl
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/HostServices/GuestControl/service.cpp

    r75500 r75737  
    224224             * assign the context ID to the command.
    225225             */
    226             rc = mpParms[0].getUInt32(&mContextID);
     226            rc = HGCMSvcGetU32(&mpParms[0], &mContextID);
    227227
    228228            /* Set timestamp so that clients can distinguish between already
     
    418418        if (pConnection->mNumParms >= 2)
    419419        {
    420             pConnection->mParms[0].setUInt32(mMsgType);   /* Message ID */
    421             pConnection->mParms[1].setUInt32(mParmCount); /* Required parameters for message */
     420            HGCMSvcSetU32(&pConnection->mParms[0], mMsgType);   /* Message ID */
     421            HGCMSvcSetU32(&pConnection->mParms[1], mParmCount); /* Required parameters for message */
    422422        }
    423423        else
     
    777777            && mPendingCon.mNumParms >= 2)
    778778        {
    779             mPendingCon.mParms[0].setUInt32(HOST_CANCEL_PENDING_WAITS); /* Message ID. */
    780             mPendingCon.mParms[1].setUInt32(0);                         /* Required parameters for message. */
     779            HGCMSvcSetU32(&mPendingCon.mParms[0], HOST_CANCEL_PENDING_WAITS); /* Message ID. */
     780            HGCMSvcSetU32(&mPendingCon.mParms[1], 0);                         /* Required parameters for message. */
    781781
    782782            AssertPtr(mSvcHelpers);
     
    11091109            uint32_t cParms = 0;
    11101110            VBOXHGCMSVCPARM arParms[2];
    1111             arParms[cParms++].setUInt32(pCurCmd->mContextID);
     1111            HGCMSvcSetU32(&arParms[cParms++], pCurCmd->mContextID);
    11121112
    11131113            int rc2 = hostCallback(GUEST_DISCONNECTED, cParms, arParms);
     
    12071207
    12081208    uint32_t uValue;
    1209     int rc = paParms[0].getUInt32(&uValue);
     1209    int rc = HGCMSvcGetU32(&paParms[0], &uValue);
    12101210    if (RT_SUCCESS(rc))
    12111211    {
    12121212        uint32_t uMaskAdd;
    1213         rc = paParms[1].getUInt32(&uMaskAdd);
     1213        rc = HGCMSvcGetU32(&paParms[1], &uMaskAdd);
    12141214        if (RT_SUCCESS(rc))
    12151215        {
    12161216            uint32_t uMaskRemove;
    1217             rc = paParms[2].getUInt32(&uMaskRemove);
     1217            rc = HGCMSvcGetU32(&paParms[2], &uMaskRemove);
    12181218            /** @todo paParm[3] (flags) not used yet. */
    12191219            if (RT_SUCCESS(rc))
     
    15841584
    15851585    uint32_t uContextID, uFlags;
    1586     int rc = paParms[0].getUInt32(&uContextID);
     1586    int rc = HGCMSvcGetU32(&paParms[0], &uContextID);
    15871587    if (RT_SUCCESS(rc))
    1588         rc = paParms[1].getUInt32(&uFlags);
     1588        rc = HGCMSvcGetU32(&paParms[1], &uFlags);
    15891589
    15901590    uint32_t uSessionID = VBOX_GUESTCTRL_CONTEXTID_GET_SESSION(uContextID);
  • trunk/src/VBox/HostServices/GuestControl/testcase/tstGuestControlSvc.cpp

    r75500 r75737  
    152152
    153153    VBOXHGCMSVCPARM aParms[1];
    154     aParms[0].setUInt32(1000 /* Context ID */);
     154    HGCMSvcSetU32(&aParms[0], 1000 /* Context ID */);
    155155
    156156    CMDHOST aCmdHostAll[] =
     
    208208        /* No commands from host yet. */
    209209        VBOXHGCMSVCPARM aParmsGuest[8];
    210         aParmsGuest[0].setUInt32(0 /* Msg type */);
    211         aParmsGuest[1].setUInt32(0 /* Parameters */);
     210        HGCMSvcSetU32(&aParmsGuest[0], 0 /* Msg type */);
     211        HGCMSvcSetU32(&aParmsGuest[1], 0 /* Parameters */);
    212212        pTable->pfnCall(pTable->pvService, &callHandle, 1 /* Client ID */, NULL /* pvClient */,
    213213                        GUEST_MSG_WAIT, 2, &aParmsGuest[0], 0);
     
    216216        /* Host: Add a dummy command. */
    217217        VBOXHGCMSVCPARM aParmsHost[8];
    218         aParmsHost[0].setUInt32(1000 /* Context ID */);
    219         aParmsHost[1].setString("foo.bar");
    220         aParmsHost[2].setString("baz");
     218        HGCMSvcSetU32(&aParmsHost[0], 1000 /* Context ID */);
     219        HGCMSvcSetStr(&aParmsHost[1], "foo.bar");
     220        HGCMSvcSetStr(&aParmsHost[2], "baz");
    221221
    222222        rc = pTable->pfnHostCall(pTable->pvService, HOST_EXEC_CMD, 3, &aParmsHost[0]);
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