VirtualBox

Ignore:
Timestamp:
Dec 5, 2018 5:37:36 PM (6 years ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
127206
Message:

GuestProperties: s/u64Timestamp/nsTimestamp/g

File:
1 edited

Legend:

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

    r75984 r75985  
    212212     * @returns VWRN_NOT_FOUND if the last notification was not found in the queue
    213213     * @param   pszPatterns   the patterns to match the property name against
    214      * @param   u64Timestamp  the timestamp of the last notification
     214     * @param   nsTimestamp   the timestamp of the last notification
    215215     * @param   pProp         where to return the property found.  If none is
    216216     *                        found this will be set to nil.
     217     * @throws  can throw std::bad_alloc
    217218     * @thread  HGCM
    218219     */
    219     int getOldNotification(const char *pszPatterns, uint64_t u64Timestamp,
    220                            Property *pProp)
     220    int getOldNotification(const char *pszPatterns, uint64_t nsTimestamp, Property *pProp)
    221221    {
    222222        AssertPtrReturn(pszPatterns, VERR_INVALID_POINTER);
    223223        /* Zero means wait for a new notification. */
    224         AssertReturn(u64Timestamp != 0, VERR_INVALID_PARAMETER);
     224        AssertReturn(nsTimestamp != 0, VERR_INVALID_PARAMETER);
    225225        AssertPtrReturn(pProp, VERR_INVALID_POINTER);
    226         int rc = getOldNotificationInternal(pszPatterns, u64Timestamp, pProp);
     226        int rc = getOldNotificationInternal(pszPatterns, nsTimestamp, pProp);
    227227#ifdef VBOX_STRICT
    228228        /*
    229229         * ENSURE that pProp is the first event in the notification queue that:
    230          *  - Appears later than u64Timestamp
     230         *  - Appears later than nsTimestamp
    231231         *  - Matches the pszPatterns
    232232         */
     
    235235        PropertyList::const_iterator it = mGuestNotifications.begin();
    236236        for (;    it != mGuestNotifications.end()
    237                && it->mTimestamp != u64Timestamp; ++it)
     237               && it->mTimestamp != nsTimestamp; ++it)
    238238        { /*nothing*/ }
    239239        if (it == mGuestNotifications.end())  /* Not found */
     
    428428    int delProperty(uint32_t cParms, VBOXHGCMSVCPARM paParms[], bool isGuest);
    429429    int enumProps(uint32_t cParms, VBOXHGCMSVCPARM paParms[]);
    430     int getNotification(uint32_t u32ClientId, VBOXHGCMCALLHANDLE callHandle, uint32_t cParms,
    431                         VBOXHGCMSVCPARM paParms[]);
    432     int getOldNotificationInternal(const char *pszPattern,
    433                                    uint64_t u64Timestamp, Property *pProp);
     430    int getNotification(uint32_t u32ClientId, VBOXHGCMCALLHANDLE callHandle, uint32_t cParms, VBOXHGCMSVCPARM paParms[]);
     431    int getOldNotificationInternal(const char *pszPattern, uint64_t nsTimestamp, Property *pProp);
    434432    int getNotificationWriteOut(uint32_t cParms, VBOXHGCMSVCPARM paParms[], Property prop);
    435     int doNotifications(const char *pszProperty, uint64_t u64Timestamp);
    436     int notifyHost(const char *pszName, const char *pszValue,
    437                    uint64_t u64Timestamp, const char *pszFlags);
     433    int doNotifications(const char *pszProperty, uint64_t nsTimestamp);
     434    int notifyHost(const char *pszName, const char *pszValue, uint64_t nsTimestamp, const char *pszFlags);
    438435
    439436    void call(VBOXHGCMCALLHANDLE callHandle, uint32_t u32ClientID,
     
    540537    const char **papszValues;
    541538    const char **papszFlags;
    542     uint64_t    *pau64Timestamps;
     539    uint64_t    *paNsTimestamps;
    543540    uint32_t     cbDummy;
    544541    int          rc = VINF_SUCCESS;
     
    550547        || RT_FAILURE(HGCMSvcGetPv(&paParms[0], (void **)&papszNames, &cbDummy))
    551548        || RT_FAILURE(HGCMSvcGetPv(&paParms[1], (void **)&papszValues, &cbDummy))
    552         || RT_FAILURE(HGCMSvcGetPv(&paParms[2], (void **)&pau64Timestamps, &cbDummy))
     549        || RT_FAILURE(HGCMSvcGetPv(&paParms[2], (void **)&paNsTimestamps, &cbDummy))
    553550        || RT_FAILURE(HGCMSvcGetPv(&paParms[3], (void **)&papszFlags, &cbDummy))
    554551        )
     
    591588                    /* Update existing property. */
    592589                    pProp->mValue     = papszValues[i];
    593                     pProp->mTimestamp = pau64Timestamps[i];
     590                    pProp->mTimestamp = paNsTimestamps[i];
    594591                    pProp->mFlags     = fFlags;
    595592                }
     
    597594                {
    598595                    /* Create a new property */
    599                     pProp = new Property(papszNames[i], papszValues[i], pau64Timestamps[i], fFlags);
     596                    pProp = new Property(papszNames[i], papszValues[i], paNsTimestamps[i], fFlags);
    600597                    if (!pProp)
    601598                    {
     
    893890    if (rc == VINF_SUCCESS && pProp)
    894891    {
    895         uint64_t u64Timestamp = getCurrentTimestamp();
     892        uint64_t nsTimestamp = getCurrentTimestamp();
    896893        PRTSTRSPACECORE pStrCore = RTStrSpaceRemove(&mhProperties, pProp->mStrCore.pszString);
    897894        AssertPtr(pStrCore); NOREF(pStrCore);
     
    900897        // if (isGuest)  /* Notify the host even for properties that the host
    901898        //                * changed.  Less efficient, but ensures consistency. */
    902         int rc2 = doNotifications(pcszName, u64Timestamp);
     899        int rc2 = doNotifications(pcszName, nsTimestamp);
    903900        if (RT_SUCCESS(rc))
    904901            rc = rc2;
     
    10511048
    10521049
    1053 /** Helper query used by getOldNotification */
    1054 int Service::getOldNotificationInternal(const char *pszPatterns,
    1055                                         uint64_t u64Timestamp,
    1056                                         Property *pProp)
     1050/** Helper query used by getOldNotification
     1051 * @throws  can throw std::bad_alloc
     1052 */
     1053int Service::getOldNotificationInternal(const char *pszPatterns, uint64_t nsTimestamp, Property *pProp)
    10571054{
    10581055    /* We count backwards, as the guest should normally be querying the
     
    10611058    PropertyList::reverse_iterator it = mGuestNotifications.rbegin();
    10621059    for (; it != mGuestNotifications.rend(); ++it)
    1063         if (it->mTimestamp == u64Timestamp)
     1060        if (it->mTimestamp == nsTimestamp)
    10641061        {
    10651062            rc = VINF_SUCCESS;
     
    11381135    uint32_t cchPatterns = 0;
    11391136    uint32_t cbBuf = 0;
    1140     uint64_t u64Timestamp;
     1137    uint64_t nsTimestamp;
    11411138
    11421139    /*
     
    11461143    if (   cParms != 4  /* Hardcoded value as the next lines depend on it. */
    11471144        || RT_FAILURE(HGCMSvcGetStr(&paParms[0], &pszPatterns, &cchPatterns))  /* patterns */
    1148         || RT_FAILURE(HGCMSvcGetU64(&paParms[1], &u64Timestamp))  /* timestamp */
     1145        || RT_FAILURE(HGCMSvcGetU64(&paParms[1], &nsTimestamp))  /* timestamp */
    11491146        || RT_FAILURE(HGCMSvcGetBuf(&paParms[2], (void **)&pchBuf, &cbBuf))  /* return buffer */
    11501147       )
     
    11521149    else
    11531150    {
    1154         LogFlow(("pszPatterns=%s, u64Timestamp=%llu\n", pszPatterns, u64Timestamp));
     1151        LogFlow(("pszPatterns=%s, nsTimestamp=%llu\n", pszPatterns, nsTimestamp));
    11551152
    11561153        /*
     
    11591156         */
    11601157        Property prop;
    1161         if (RT_SUCCESS(rc) && u64Timestamp != 0)
    1162             rc = getOldNotification(pszPatterns, u64Timestamp, &prop);
     1158        if (RT_SUCCESS(rc) && nsTimestamp != 0)
     1159            rc = getOldNotification(pszPatterns, nsTimestamp, &prop);
    11631160        if (RT_SUCCESS(rc))
    11641161        {
     
    12141211 * added/deleted/changed
    12151212 * @param pszProperty  the name of the property which has changed
    1216  * @param u64Timestamp the time at which the change took place
     1213 * @param nsTimestamp the time at which the change took place
    12171214 *
    12181215 * @thread  HGCM service
    12191216 */
    1220 int Service::doNotifications(const char *pszProperty, uint64_t u64Timestamp)
     1217int Service::doNotifications(const char *pszProperty, uint64_t nsTimestamp)
    12211218{
    12221219    AssertPtrReturn(pszProperty, VERR_INVALID_POINTER);
    1223     LogFlowThisFunc(("pszProperty=%s, u64Timestamp=%llu\n", pszProperty, u64Timestamp));
     1220    LogFlowThisFunc(("pszProperty=%s, nsTimestamp=%llu\n", pszProperty, nsTimestamp));
    12241221    /* Ensure that our timestamp is different to the last one. */
    12251222    if (   !mGuestNotifications.empty()
    1226         && u64Timestamp == mGuestNotifications.back().mTimestamp)
    1227         ++u64Timestamp;
     1223        && nsTimestamp == mGuestNotifications.back().mTimestamp)
     1224        ++nsTimestamp;
    12281225
    12291226    /*
     
    12331230    Property prop;
    12341231    prop.mName = pszProperty;
    1235     prop.mTimestamp = u64Timestamp;
     1232    prop.mTimestamp = nsTimestamp;
    12361233    /* prop is currently a delete event for pszProperty */
    12371234    Property const * const pProp = getPropertyInternal(pszProperty);
     
    12931290            rc = GuestPropWriteFlags(prop.mFlags, szFlags);
    12941291            if (RT_SUCCESS(rc))
    1295                 rc = notifyHost(pszProperty, pszValue, u64Timestamp, szFlags);
     1292                rc = notifyHost(pszProperty, pszValue, nsTimestamp, szFlags);
    12961293        }
    12971294        /*
     
    13021299        {
    13031300            /* Send out a host notification */
    1304             rc = notifyHost(pszProperty, "", u64Timestamp, "");
     1301            rc = notifyHost(pszProperty, "", nsTimestamp, "");
    13051302        }
    13061303    }
     
    13271324 * @param    pszName       the property name
    13281325 * @param    pszValue      the new value, or NULL if the property was deleted
    1329  * @param    u64Timestamp  the time of the change
     1326 * @param    nsTimestamp   the time of the change
    13301327 * @param    pszFlags      the new flags string
    13311328 */
    1332 int Service::notifyHost(const char *pszName, const char *pszValue,
    1333                         uint64_t u64Timestamp, const char *pszFlags)
    1334 {
    1335     LogFlowFunc(("pszName=%s, pszValue=%s, u64Timestamp=%llu, pszFlags=%s\n",
    1336                  pszName, pszValue, u64Timestamp, pszFlags));
     1329int Service::notifyHost(const char *pszName, const char *pszValue, uint64_t nsTimestamp, const char *pszFlags)
     1330{
     1331    LogFlowFunc(("pszName=%s, pszValue=%s, nsTimestamp=%llu, pszFlags=%s\n", pszName, pszValue, nsTimestamp, pszFlags));
    13371332#ifdef ASYNC_HOST_NOTIFY
    13381333    int rc = VINF_SUCCESS;
     
    13611356        *pu8++ = 0;
    13621357
    1363         pHostCallbackData->u64Timestamp = u64Timestamp;
     1358        pHostCallbackData->u64Timestamp = nsTimestamp;
    13641359
    13651360        pHostCallbackData->pcszFlags    = (const char *)pu8;
     
    13851380    HostCallbackData.pcszName     = pszName;
    13861381    HostCallbackData.pcszValue    = pszValue;
    1387     HostCallbackData.u64Timestamp = u64Timestamp;
     1382    HostCallbackData.nsTimestamp  = nsTimestamp;
    13881383    HostCallbackData.pcszFlags    = pszFlags;
    13891384    int rc = mpfnHostCallback(mpvHostData, 0 /*u32Function*/,
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