VirtualBox

Changeset 79300 in vbox for trunk/src/VBox/Main


Ignore:
Timestamp:
Jun 24, 2019 10:33:35 AM (6 years ago)
Author:
vboxsync
Message:

Main/GuestFileImpl.cpp: doc updates wrt file offsets. bugref:9320

Location:
trunk/src/VBox/Main
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Main/idl/VirtualBox.xidl

    r79287 r79300  
    1416114161        The <link to="IFile::seek"/> is used to change this attribute without
    1416214162        transfering any file data like read and write does.
     14163
     14164        <note> This will not always be correct with older guest additions
     14165        (version 5.2.30 and earlier, as well as versions 6.0.0 thru 6.0.8)
     14166        after a calling <link to="IFile::readAt"/> or <link to="IFile::writeAt"/>,
     14167        or after calling <link to="IFile::write"/> on a file in append mode.
     14168        The correct file offset can be obtained using <link to="IFile::seek"/>.</note>
     14169
    1416314170      </desc>
    1416414171    </attribute>
  • trunk/src/VBox/Main/src-client/GuestFileImpl.cpp

    r79296 r79300  
    298298    AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS);
    299299
    300 /** @todo r=bird: Why do you have both a offset and a tell() function?
    301  * After a ReadAt or WriteAt with a non-current offset, the tell() result will
    302  * differ from this value, because mOffCurrent is only ever incremented with
    303  * data read or written.  */
     300    /* Note! This will not be accurate with older (< 5.2.32, 6.0.0 - 6.0.9)
     301             guest additions when using writeAt, readAt or writing to a file
     302             opened in append mode. */
    304303    *aOffset = mData.mOffCurrent;
    305304
     
    507506                AutoWriteLock alock(this COMMA_LOCKVAL_SRC_POS);
    508507
    509                 mData.mOffCurrent += cbRead;
     508                mData.mOffCurrent += cbRead; /* Bogus for readAt, which is why we've got GUEST_FILE_NOTIFYTYPE_READ_OFFSET. */
    510509
    511510                alock.release();
     
    569568                AutoWriteLock alock(this COMMA_LOCKVAL_SRC_POS);
    570569
    571                 mData.mOffCurrent += cbWritten;
     570                mData.mOffCurrent += cbWritten; /* Bogus for writeAt and append mode, thus GUEST_FILE_NOTIFYTYPE_WRITE_OFFSET. */
    572571
    573572                alock.release();
     
    626625                alock.release();
    627626
    628                 fireGuestFileOffsetChangedEvent(mEventSource, mSession, this, mData.mOffCurrent, 0 /* Processed */);
     627                fireGuestFileOffsetChangedEvent(mEventSource, mSession, this, dataCb.u.seek.uOffActual, 0 /* Processed */);
    629628            }
    630629            break;
     
    632631
    633632        case GUEST_FILE_NOTIFYTYPE_TELL:
    634         {
    635             if (pSvcCbData->mParms == 4)
    636             {
    637                 rc = HGCMSvcGetU64(&pSvcCbData->mpaParms[idx++], &dataCb.u.tell.uOffActual);
    638                 if (RT_FAILURE(rc))
    639                     break;
    640 
    641                 Log3ThisFunc(("uOffActual=%RU64\n", dataCb.u.tell.uOffActual));
    642 
    643                 AutoWriteLock alock(this COMMA_LOCKVAL_SRC_POS);
    644 
    645                 mData.mOffCurrent = dataCb.u.tell.uOffActual;
    646 
    647                 alock.release();
    648 
    649                 fireGuestFileOffsetChangedEvent(mEventSource, mSession, this, mData.mOffCurrent, 0 /* Processed */);
    650             }
     633            /* We don't issue any HOST_MSG_FILE_TELL, so we shouldn't get these notifications! */
     634            AssertFailed();
    651635            break;
    652         }
    653636
    654637        case GUEST_FILE_NOTIFYTYPE_SET_SIZE:
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