From 25253c9df21a9b93978237dfc1f520b0b792533f Mon Sep 17 00:00:00 2001 From: vboxsync Date: Wed, 4 Sep 2019 14:05:50 +0000 Subject: Runtime: Some renaming to stay consistent (*Get* always returns what is asked for while *Query* returns a status code and where to store the value on success is given as a pointer) * RTVfsFileGetSize -> RTVfsFileQuerySize * RTFileQuerySize -> RTFileQuerySizeByPath * RTFileGetSize -> RTFileQuerySize * RTFileGetSizeMaxEx -> RTFileQuerySizeMaxEx git-svn-id: https://www.virtualbox.org/svn/vbox/trunk@80585 cfe28804-0f27-0410-a406-dd0f0b0b656f --- include/iprt/file.h | 10 +- include/iprt/mangling.h | 6 +- include/iprt/vfs.h | 2 +- include/iprt/vfslowlevel.h | 4 +- src/VBox/Devices/Graphics/DevVGA.cpp | 4 +- src/VBox/Devices/Network/slirp/tftp.c | 2 +- src/VBox/Devices/PC/ACPI/VBoxAcpi.cpp | 2 +- src/VBox/Devices/PC/DevACPI.cpp | 2 +- src/VBox/Devices/PC/DevPcBios.cpp | 4 +- .../Frontends/VBoxManage/VBoxInternalManage.cpp | 10 +- .../Frontends/VBoxManage/VBoxManageControlVM.cpp | 2 +- src/VBox/Frontends/VBoxManage/VBoxManageDisk.cpp | 2 +- .../Frontends/VBoxManage/VBoxManageModifyVM.cpp | 2 +- src/VBox/Main/src-all/TextScript.cpp | 4 +- src/VBox/Main/src-client/ConsoleImpl2.cpp | 2 +- src/VBox/Main/src-client/GuestSessionImplTasks.cpp | 2 +- src/VBox/Main/src-server/MachineImplCloneVM.cpp | 2 +- src/VBox/Main/src-server/MachineImplMoveVM.cpp | 8 +- src/VBox/Main/src-server/MediumImpl.cpp | 4 +- .../src-server/generic/AutostartDb-generic.cpp | 2 +- src/VBox/Runtime/VBox/VBoxRTImp.def | 6 +- src/VBox/Runtime/common/checksum/RTSha1Digest.cpp | 2 +- .../Runtime/common/checksum/RTSha256Digest.cpp | 2 +- src/VBox/Runtime/common/checksum/manifest.cpp | 2 +- src/VBox/Runtime/common/dbg/dbgmodmapsym.cpp | 2 +- src/VBox/Runtime/common/dvm/dvm.cpp | 2 +- src/VBox/Runtime/common/fs/extvfs.cpp | 2 +- src/VBox/Runtime/common/fs/fatvfs.cpp | 4 +- src/VBox/Runtime/common/fs/isomaker.cpp | 2 +- src/VBox/Runtime/common/fs/isomakercmd.cpp | 8 +- src/VBox/Runtime/common/fs/isomakerimport.cpp | 2 +- src/VBox/Runtime/common/fs/isovfs.cpp | 2 +- src/VBox/Runtime/common/fs/ntfsvfs.cpp | 2 +- src/VBox/Runtime/common/fs/xfsvfs.cpp | 2 +- src/VBox/Runtime/common/fuzz/fuzz.cpp | 2 +- src/VBox/Runtime/common/ldr/ldrFile.cpp | 2 +- src/VBox/Runtime/common/ldr/ldrVfsFile.cpp | 2 +- src/VBox/Runtime/common/log/log.cpp | 2 +- src/VBox/Runtime/common/misc/inifile.cpp | 2 +- src/VBox/Runtime/common/misc/s3.cpp | 2 +- src/VBox/Runtime/common/vfs/vfsbase.cpp | 2 +- src/VBox/Runtime/common/vfs/vfsprogress.cpp | 2 +- src/VBox/Runtime/common/vfs/vfsreadahead.cpp | 2 +- src/VBox/Runtime/common/vfs/vfsstdfile.cpp | 6 +- .../generic/RTFileCopyByHandlesEx-generic.cpp | 4 +- .../Runtime/generic/RTFileQuerySize-generic.cpp | 2 +- .../Runtime/r0drv/darwin/fileio-r0drv-darwin.cpp | 4 +- src/VBox/Runtime/r3/fileio.cpp | 8 +- src/VBox/Runtime/r3/posix/fileio-posix.cpp | 4 +- src/VBox/Runtime/r3/win/fileio-win.cpp | 4 +- src/VBox/Runtime/r3/xml.cpp | 2 +- src/VBox/Runtime/testcase/Makefile.kmk | 6 +- src/VBox/Runtime/testcase/tstFile.cpp | 10 +- src/VBox/Runtime/testcase/tstRTDvm.cpp | 4 +- src/VBox/Runtime/testcase/tstRTFileGetSize-1.cpp | 106 --------------------- src/VBox/Runtime/testcase/tstRTFileQuerySize-1.cpp | 106 +++++++++++++++++++++ src/VBox/Runtime/testcase/tstRTFilesystem.cpp | 4 +- src/VBox/Runtime/tools/RTLdrCheckImports.cpp | 4 +- src/VBox/Runtime/tools/RTSignTool.cpp | 4 +- src/VBox/Storage/DMG.cpp | 6 +- src/VBox/Storage/VD.cpp | 2 +- src/VBox/Storage/VISO.cpp | 2 +- src/VBox/Storage/testcase/VDIoBackend.cpp | 2 +- src/VBox/Storage/testcase/tstVDIo.cpp | 2 +- src/VBox/VMM/VMMR3/PDMAsyncCompletionFile.cpp | 4 +- src/VBox/VMM/VMMR3/SSM.cpp | 2 +- src/VBox/VMM/testcase/tstAnimate.cpp | 4 +- .../ValidationKit/tests/unittests/tdUnitTest1.py | 2 +- src/VBox/ValidationKit/utils/fs/FsPerf.cpp | 10 +- 69 files changed, 224 insertions(+), 224 deletions(-) delete mode 100644 src/VBox/Runtime/testcase/tstRTFileGetSize-1.cpp create mode 100644 src/VBox/Runtime/testcase/tstRTFileQuerySize-1.cpp diff --git a/include/iprt/file.h b/include/iprt/file.h index 3d099137083..2e40355102d 100644 --- a/include/iprt/file.h +++ b/include/iprt/file.h @@ -93,9 +93,9 @@ RTDECL(bool) RTFileExists(const char *pszPath); * @param pszPath The path to the file. * @param pcbFile Where to return the file size (bytes). * - * @sa RTFileGetSize, RTPathQueryInfoEx. + * @sa RTFileQuerySize, RTPathQueryInfoEx. */ -RTDECL(int) RTFileQuerySize(const char *pszPath, uint64_t *pcbFile); +RTDECL(int) RTFileQuerySizeByPath(const char *pszPath, uint64_t *pcbFile); /** @name Open flags @@ -559,7 +559,7 @@ RTDECL(int) RTFileSetSize(RTFILE File, uint64_t cbSize); * @param File Handle to the file. * @param pcbSize Where to store the filesize. */ -RTDECL(int) RTFileGetSize(RTFILE File, uint64_t *pcbSize); +RTDECL(int) RTFileQuerySize(RTFILE File, uint64_t *pcbSize); /** * Determine the maximum file size. @@ -567,7 +567,7 @@ RTDECL(int) RTFileGetSize(RTFILE File, uint64_t *pcbSize); * @returns The max size of the file. * -1 on failure, the file position is undefined. * @param File Handle to the file. - * @see RTFileGetMaxSizeEx. + * @see RTFileQueryMaxSizeEx. */ RTDECL(RTFOFF) RTFileGetMaxSize(RTFILE File); @@ -579,7 +579,7 @@ RTDECL(RTFOFF) RTFileGetMaxSize(RTFILE File); * @param pcbMax Where to store the max file size. * @see RTFileGetMaxSize. */ -RTDECL(int) RTFileGetMaxSizeEx(RTFILE File, PRTFOFF pcbMax); +RTDECL(int) RTFileQueryMaxSizeEx(RTFILE File, PRTFOFF pcbMax); /** * Determine the maximum file size depending on the file system the file is stored on. diff --git a/include/iprt/mangling.h b/include/iprt/mangling.h index 2df8a9599ce..cefc53e0df8 100644 --- a/include/iprt/mangling.h +++ b/include/iprt/mangling.h @@ -931,8 +931,8 @@ # define RTFileFlush RT_MANGLER(RTFileFlush) # define RTFileFromNative RT_MANGLER(RTFileFromNative) # define RTFileGetMaxSize RT_MANGLER(RTFileGetMaxSize) -# define RTFileGetMaxSizeEx RT_MANGLER(RTFileGetMaxSizeEx) -# define RTFileGetSize RT_MANGLER(RTFileGetSize) +# define RTFileQueryMaxSizeEx RT_MANGLER(RTFileQueryMaxSizeEx) +# define RTFileQuerySizeByPath RT_MANGLER(RTFileQuerySizeByPath) # define RTFileIoCtl RT_MANGLER(RTFileIoCtl) # define RTFileIsValid RT_MANGLER(RTFileIsValid) # define RTFileLock RT_MANGLER(RTFileLock) @@ -2639,7 +2639,7 @@ # define RTVfsFileFromBuffer RT_MANGLER(RTVfsFileFromBuffer) # define RTVfsFileFromRTFile RT_MANGLER(RTVfsFileFromRTFile) # define RTVfsFileGetOpenFlags RT_MANGLER(RTVfsFileGetOpenFlags) -# define RTVfsFileGetSize RT_MANGLER(RTVfsFileGetSize) +# define RTVfsFileQuerySize RT_MANGLER(RTVfsFileQuerySize) # define RTVfsFileGetMaxSize RT_MANGLER(RTVfsFileGetMaxSize) # define RTVfsFileOpen RT_MANGLER(RTVfsFileOpen) # define RTVfsFileOpenNormal RT_MANGLER(RTVfsFileOpenNormal) diff --git a/include/iprt/vfs.h b/include/iprt/vfs.h index bb3646fb666..db29020f538 100644 --- a/include/iprt/vfs.h +++ b/include/iprt/vfs.h @@ -1474,7 +1474,7 @@ RTDECL(int) RTVfsFileSetSize(RTVFSFILE hVfsFile, uint64_t cbSize, uint32 /** @} */ -RTDECL(int) RTVfsFileGetSize(RTVFSFILE hVfsFile, uint64_t *pcbSize); +RTDECL(int) RTVfsFileQuerySize(RTVFSFILE hVfsFile, uint64_t *pcbSize); RTDECL(RTFOFF) RTVfsFileGetMaxSize(RTVFSFILE hVfsFile); RTDECL(int) RTVfsFileQueryMaxSize(RTVFSFILE hVfsFile, uint64_t *pcbMax); diff --git a/include/iprt/vfslowlevel.h b/include/iprt/vfslowlevel.h index 687cd52a431..62489b7a16b 100644 --- a/include/iprt/vfslowlevel.h +++ b/include/iprt/vfslowlevel.h @@ -1022,7 +1022,7 @@ typedef struct RTVFSFILEOPS * @returns IPRT status code. * @param pvThis The implementation specific file data. * @param pcbFile Where to store the current file size. - * @sa RTFileGetSize + * @sa RTFileQuerySize */ DECLCALLBACKMEMBER(int, pfnQuerySize)(void *pvThis, uint64_t *pcbFile); @@ -1056,7 +1056,7 @@ typedef struct RTVFSFILEOPS * @param pvThis The implementation specific file data. * @param pcbMax Where to return the max file size. * @note Optional. If NULL, VERR_NOT_IMPLEMENTED will be returned. - * @sa RTFileGetMaxSizeEx + * @sa RTFileQueryMaxSizeEx */ DECLCALLBACKMEMBER(int, pfnQueryMaxSize)(void *pvThis, uint64_t *pcbMax); diff --git a/src/VBox/Devices/Graphics/DevVGA.cpp b/src/VBox/Devices/Graphics/DevVGA.cpp index 07e917cd72f..65a88020be7 100644 --- a/src/VBox/Devices/Graphics/DevVGA.cpp +++ b/src/VBox/Devices/Graphics/DevVGA.cpp @@ -6679,7 +6679,7 @@ static DECLCALLBACK(int) vgaR3Construct(PPDMDEVINS pDevIns, int iInstance, PCF RTFILE_O_READ | RTFILE_O_OPEN | RTFILE_O_DENY_WRITE); if (RT_SUCCESS(rc)) { - rc = RTFileGetSize(FileVgaBios, &pThis->cbVgaBios); + rc = RTFileQuerySize(FileVgaBios, &pThis->cbVgaBios); if (RT_SUCCESS(rc)) { if ( RT_ALIGN(pThis->cbVgaBios, _4K) != pThis->cbVgaBios @@ -7089,7 +7089,7 @@ static DECLCALLBACK(int) vgaR3Construct(PPDMDEVINS pDevIns, int iInstance, PCF if (RT_SUCCESS(rc)) { uint64_t cbFile; - rc = RTFileGetSize(FileLogo, &cbFile); + rc = RTFileQuerySize(FileLogo, &cbFile); if (RT_SUCCESS(rc)) { if (cbFile > 0 && cbFile < 32*_1M) diff --git a/src/VBox/Devices/Network/slirp/tftp.c b/src/VBox/Devices/Network/slirp/tftp.c index ac9d910c427..dbc20446a62 100644 --- a/src/VBox/Devices/Network/slirp/tftp.c +++ b/src/VBox/Devices/Network/slirp/tftp.c @@ -448,7 +448,7 @@ DECLINLINE(int) tftpSessionEvaluateOptions(PNATState pData, PTFTPSESSION pTftpSe return rc; } - rc = RTFileGetSize(hSessionFile, &cbSessionFile); + rc = RTFileQuerySize(hSessionFile, &cbSessionFile); RTFileClose(hSessionFile); if (RT_FAILURE(rc)) { diff --git a/src/VBox/Devices/PC/ACPI/VBoxAcpi.cpp b/src/VBox/Devices/PC/ACPI/VBoxAcpi.cpp index c20dc3e0a18..56a87df5cf3 100644 --- a/src/VBox/Devices/PC/ACPI/VBoxAcpi.cpp +++ b/src/VBox/Devices/PC/ACPI/VBoxAcpi.cpp @@ -306,7 +306,7 @@ static int acpiAmlLoadExternal(PPDMDEVINS pDevIns, const char *pcszCfgName, cons * is equal to the size of the DSDT. */ uint64_t cbAmlFile = 0; - rc = RTFileGetSize(FileAml, &cbAmlFile); + rc = RTFileQuerySize(FileAml, &cbAmlFile); cbAmlCode = (size_t)cbAmlFile; diff --git a/src/VBox/Devices/PC/DevACPI.cpp b/src/VBox/Devices/PC/DevACPI.cpp index 577226f235a..e5a4252395e 100644 --- a/src/VBox/Devices/PC/DevACPI.cpp +++ b/src/VBox/Devices/PC/DevACPI.cpp @@ -3117,7 +3117,7 @@ static int acpiR3ReadCustomTable(PPDMDEVINS pDevIns, uint8_t **ppu8CustBin, uint RTFILE_O_READ | RTFILE_O_OPEN | RTFILE_O_DENY_WRITE); if (RT_SUCCESS(rc)) { - rc = RTFileGetSize(FileCUSTBin, pcbCustBin); + rc = RTFileQuerySize(FileCUSTBin, pcbCustBin); if (RT_SUCCESS(rc)) { /* The following checks should be in sync the AssertReleaseMsg's below. */ diff --git a/src/VBox/Devices/PC/DevPcBios.cpp b/src/VBox/Devices/PC/DevPcBios.cpp index e9b6f9011e2..50385200e9e 100644 --- a/src/VBox/Devices/PC/DevPcBios.cpp +++ b/src/VBox/Devices/PC/DevPcBios.cpp @@ -1483,7 +1483,7 @@ static DECLCALLBACK(int) pcbiosConstruct(PPDMDEVINS pDevIns, int iInstance, PCF { /* Figure the size and check restrictions. */ uint64_t cbPcBios; - rc = RTFileGetSize(hFilePcBios, &cbPcBios); + rc = RTFileQuerySize(hFilePcBios, &cbPcBios); if (RT_SUCCESS(rc)) { pThis->cbPcBios = (uint32_t)cbPcBios; @@ -1678,7 +1678,7 @@ static DECLCALLBACK(int) pcbiosConstruct(PPDMDEVINS pDevIns, int iInstance, PCF RTFILE_O_READ | RTFILE_O_OPEN | RTFILE_O_DENY_WRITE); if (RT_SUCCESS(rc)) { - rc = RTFileGetSize(hFileLanBoot, &cbFileLanBoot); + rc = RTFileQuerySize(hFileLanBoot, &cbFileLanBoot); if (RT_SUCCESS(rc)) { if (cbFileLanBoot <= _64K - (VBOX_LANBOOT_SEG << 4 & 0xffff)) diff --git a/src/VBox/Frontends/VBoxManage/VBoxInternalManage.cpp b/src/VBox/Frontends/VBoxManage/VBoxInternalManage.cpp index 34fc5567dae..12555638634 100644 --- a/src/VBox/Frontends/VBoxManage/VBoxInternalManage.cpp +++ b/src/VBox/Frontends/VBoxManage/VBoxInternalManage.cpp @@ -1287,7 +1287,7 @@ static RTEXITCODE CmdCreateRawVMDK(int argc, char **argv, ComPtr aV * before failing. */ vrc = RTErrConvertFromWin32(GetLastError()); - if (RT_FAILURE(RTFileGetSize(hRawFile, &cbSize))) + if (RT_FAILURE(RTFileQuerySize(hRawFile, &cbSize))) { RTMsgError("Cannot get the geometry of the raw disk '%s': %Rrc", rawdisk.c_str(), vrc); goto out; @@ -1337,7 +1337,7 @@ static RTEXITCODE CmdCreateRawVMDK(int argc, char **argv, ComPtr aV } else if (S_ISREG(DevStat.st_mode)) { - vrc = RTFileGetSize(hRawFile, &cbSize); + vrc = RTFileQuerySize(hRawFile, &cbSize); if (RT_FAILURE(vrc)) { RTMsgError("Failed to get size of file '%s': %Rrc", rawdisk.c_str(), vrc); @@ -1392,7 +1392,7 @@ static RTEXITCODE CmdCreateRawVMDK(int argc, char **argv, ComPtr aV else if (S_ISREG(DevStat.st_mode)) { fRelative = false; /* Must be false for raw image files. */ - vrc = RTFileGetSize(hRawFile, &cbSize); + vrc = RTFileQuerySize(hRawFile, &cbSize); if (RT_FAILURE(vrc)) { RTMsgError("Failed to get size of file '%s': %Rrc", rawdisk.c_str(), vrc); @@ -1430,7 +1430,7 @@ static RTEXITCODE CmdCreateRawVMDK(int argc, char **argv, ComPtr aV } else if (S_ISREG(DevStat.st_mode)) { - vrc = RTFileGetSize(hRawFile, &cbSize); + vrc = RTFileQuerySize(hRawFile, &cbSize); if (RT_FAILURE(vrc)) { RTMsgError("Failed to get size of file '%s': %Rrc", rawdisk.c_str(), vrc); @@ -1492,7 +1492,7 @@ static RTEXITCODE CmdCreateRawVMDK(int argc, char **argv, ComPtr aV #else /* all unrecognized OSes */ /* Hopefully this works on all other hosts. If it doesn't, it'll just fail * creating the VMDK, so no real harm done. */ - vrc = RTFileGetSize(hRawFile, &cbSize); + vrc = RTFileQuerySize(hRawFile, &cbSize); if (RT_FAILURE(vrc)) { RTMsgError("Cannot get the size of the raw disk '%s': %Rrc", rawdisk.c_str(), vrc); diff --git a/src/VBox/Frontends/VBoxManage/VBoxManageControlVM.cpp b/src/VBox/Frontends/VBoxManage/VBoxManageControlVM.cpp index fcf9e951975..28ec52308ad 100644 --- a/src/VBox/Frontends/VBoxManage/VBoxManageControlVM.cpp +++ b/src/VBox/Frontends/VBoxManage/VBoxManageControlVM.cpp @@ -320,7 +320,7 @@ static HRESULT keyboardPutFile(IKeyboard *pKeyboard, const char *pszFilename) if (RT_SUCCESS(vrc)) { uint64_t cbFile = 0; - vrc = RTFileGetSize(File, &cbFile); + vrc = RTFileQuerySize(File, &cbFile); if (RT_SUCCESS(vrc)) { const uint64_t cbFileMax = _64K; diff --git a/src/VBox/Frontends/VBoxManage/VBoxManageDisk.cpp b/src/VBox/Frontends/VBoxManage/VBoxManageDisk.cpp index b7022e59fdb..0c88b19303c 100644 --- a/src/VBox/Frontends/VBoxManage/VBoxManageDisk.cpp +++ b/src/VBox/Frontends/VBoxManage/VBoxManageDisk.cpp @@ -1186,7 +1186,7 @@ RTEXITCODE handleConvertFromRaw(HandlerArg *a) if (fReadFromStdIn) cbFile = RTStrToUInt64(filesize); else - rc = RTFileGetSize(File, &cbFile); + rc = RTFileQuerySize(File, &cbFile); if (RT_FAILURE(rc)) { RTMsgError("Cannot get image size for file \"%s\": %Rrc", srcfilename, rc); diff --git a/src/VBox/Frontends/VBoxManage/VBoxManageModifyVM.cpp b/src/VBox/Frontends/VBoxManage/VBoxManageModifyVM.cpp index 85e33222eed..4b5f56a4d81 100644 --- a/src/VBox/Frontends/VBoxManage/VBoxManageModifyVM.cpp +++ b/src/VBox/Frontends/VBoxManage/VBoxManageModifyVM.cpp @@ -589,7 +589,7 @@ RTEXITCODE handleModifyVM(HandlerArg *a) break; } uint64_t cbSize; - vrc = RTFileGetSize(iconFile, &cbSize); + vrc = RTFileQuerySize(iconFile, &cbSize); if (RT_FAILURE(vrc)) { RTMsgError("Cannot get size of file \"%s\": %Rrc", ValueUnion.psz, vrc); diff --git a/src/VBox/Main/src-all/TextScript.cpp b/src/VBox/Main/src-all/TextScript.cpp index 8bbc1b4ef6b..a3942149473 100644 --- a/src/VBox/Main/src-all/TextScript.cpp +++ b/src/VBox/Main/src-all/TextScript.cpp @@ -64,7 +64,7 @@ HRESULT BaseTextScript::readFromHandle(RTVFSFILE hVfsFile, const char *pszFilena */ HRESULT hrc; uint64_t cbFile = 0; - int vrc = RTVfsFileGetSize(hVfsFile, &cbFile); + int vrc = RTVfsFileQuerySize(hVfsFile, &cbFile); if ( RT_SUCCESS(vrc) && cbFile < _16M) { @@ -107,7 +107,7 @@ HRESULT BaseTextScript::readFromHandle(RTVFSFILE hVfsFile, const char *pszFilena hrc = mpSetError->setErrorVrc(VERR_FILE_TOO_BIG, mpSetError->tr("'%s' is too big (max 16MB): %'RU64"), pszFilename, cbFile); else - hrc = mpSetError->setErrorVrc(vrc, mpSetError->tr("RTVfsFileGetSize failed (%Rrc)"), vrc); + hrc = mpSetError->setErrorVrc(vrc, mpSetError->tr("RTVfsFileQuerySize failed (%Rrc)"), vrc); return hrc; } diff --git a/src/VBox/Main/src-client/ConsoleImpl2.cpp b/src/VBox/Main/src-client/ConsoleImpl2.cpp index 25ecae54d72..3d912651a8c 100644 --- a/src/VBox/Main/src-client/ConsoleImpl2.cpp +++ b/src/VBox/Main/src-client/ConsoleImpl2.cpp @@ -3968,7 +3968,7 @@ int Console::i_checkMediumLocation(IMedium *pMedium, bool *pfUseHostIOCache) { RTFOFF maxSize; /* Careful: This function will work only on selected local file systems! */ - rc = RTFileGetMaxSizeEx(file, &maxSize); + rc = RTFileQueryMaxSizeEx(file, &maxSize); RTFileClose(file); if ( RT_SUCCESS(rc) && maxSize > 0 diff --git a/src/VBox/Main/src-client/GuestSessionImplTasks.cpp b/src/VBox/Main/src-client/GuestSessionImplTasks.cpp index 070fed57b5f..27322f7a519 100644 --- a/src/VBox/Main/src-client/GuestSessionImplTasks.cpp +++ b/src/VBox/Main/src-client/GuestSessionImplTasks.cpp @@ -1978,7 +1978,7 @@ int GuestSessionTaskUpdateAdditions::copyFileToGuest(GuestSession *pSession, RTV if (RT_SUCCESS(rc)) { uint64_t cbSrcSize = 0; - rc = RTVfsFileGetSize(hVfsFile, &cbSrcSize); + rc = RTVfsFileQuerySize(hVfsFile, &cbSrcSize); if (RT_SUCCESS(rc)) { LogRel(("Copying Guest Additions installer file \"%s\" to \"%s\" on guest ...\n", diff --git a/src/VBox/Main/src-server/MachineImplCloneVM.cpp b/src/VBox/Main/src-server/MachineImplCloneVM.cpp index 7f0a47b58b5..dabfd517fce 100644 --- a/src/VBox/Main/src-server/MachineImplCloneVM.cpp +++ b/src/VBox/Main/src-server/MachineImplCloneVM.cpp @@ -221,7 +221,7 @@ HRESULT MachineCloneVMPrivate::addSaveState(const ComObjPtr &machine, b sst.snapshotUuid = machine->i_getSnapshotId(); sst.strSaveStateFile = bstrSrcSaveStatePath; uint64_t cbSize; - int vrc = RTFileQuerySize(sst.strSaveStateFile.c_str(), &cbSize); + int vrc = RTFileQuerySizeByPath(sst.strSaveStateFile.c_str(), &cbSize); if (RT_FAILURE(vrc)) return p->setErrorBoth(VBOX_E_IPRT_ERROR, vrc, p->tr("Could not query file size of '%s' (%Rrc)"), sst.strSaveStateFile.c_str(), vrc); diff --git a/src/VBox/Main/src-server/MachineImplMoveVM.cpp b/src/VBox/Main/src-server/MachineImplMoveVM.cpp index 40a8185b040..479defcb73d 100644 --- a/src/VBox/Main/src-server/MachineImplMoveVM.cpp +++ b/src/VBox/Main/src-server/MachineImplMoveVM.cpp @@ -392,7 +392,7 @@ HRESULT MachineMoveVM::init() /*if a state file is located in the actual VM folder it will be added to the actual list */ if (name.contains(strSettingsFilePath)) { - vrc = RTFileQuerySize(name.c_str(), &cbFile); + vrc = RTFileQuerySizeByPath(name.c_str(), &cbFile); if (RT_SUCCESS(vrc)) { std::pair::iterator,bool> ret; @@ -447,7 +447,7 @@ HRESULT MachineMoveVM::init() strFile.append(RTPATH_DELIMITER).append(it->second.c_str()); uint64_t cbFile = 0; - vrc = RTFileQuerySize(strFile.c_str(), &cbFile); + vrc = RTFileQuerySizeByPath(strFile.c_str(), &cbFile); if (RT_SUCCESS(vrc)) { uCount += 1; @@ -1296,7 +1296,7 @@ HRESULT MachineMoveVM::getFolderSize(const Utf8Str& strRootFolder, uint64_t& siz uint64_t cbFile = 0; Utf8Str fullPath = it->first; fullPath.append(RTPATH_DELIMITER).append(it->second); - vrc = RTFileQuerySize(fullPath.c_str(), &cbFile); + vrc = RTFileQuerySizeByPath(fullPath.c_str(), &cbFile); if (RT_SUCCESS(vrc)) { totalFolderSize += cbFile; @@ -1481,7 +1481,7 @@ HRESULT MachineMoveVM::addSaveState(const ComObjPtr &machine) sst.strSaveStateFile = bstrSrcSaveStatePath; uint64_t cbSize; - int vrc = RTFileQuerySize(sst.strSaveStateFile.c_str(), &cbSize); + int vrc = RTFileQuerySizeByPath(sst.strSaveStateFile.c_str(), &cbSize); if (RT_FAILURE(vrc)) return m_pMachine->setErrorBoth(VBOX_E_IPRT_ERROR, vrc, m_pMachine->tr("Could not get file size of '%s': %Rrc"), diff --git a/src/VBox/Main/src-server/MediumImpl.cpp b/src/VBox/Main/src-server/MediumImpl.cpp index 12e6031f567..96ac5e0ac34 100644 --- a/src/VBox/Main/src-server/MediumImpl.cpp +++ b/src/VBox/Main/src-server/MediumImpl.cpp @@ -5546,10 +5546,10 @@ HRESULT Medium::i_queryPreferredMergeDirection(const ComObjPtr &pOther, if (i_isMediumFormatFile() && pOther->i_isMediumFormatFile()) { - vrc = RTFileQuerySize(this->i_getLocationFull().c_str(), &cbMediumThis); + vrc = RTFileQuerySizeByPath(this->i_getLocationFull().c_str(), &cbMediumThis); if (RT_SUCCESS(vrc)) { - vrc = RTFileQuerySize(pOther->i_getLocationFull().c_str(), + vrc = RTFileQuerySizeByPath(pOther->i_getLocationFull().c_str(), &cbMediumOther); } diff --git a/src/VBox/Main/src-server/generic/AutostartDb-generic.cpp b/src/VBox/Main/src-server/generic/AutostartDb-generic.cpp index 4c7a11e5bdb..ac5f3d5b712 100644 --- a/src/VBox/Main/src-server/generic/AutostartDb-generic.cpp +++ b/src/VBox/Main/src-server/generic/AutostartDb-generic.cpp @@ -71,7 +71,7 @@ int AutostartDb::autostartModifyDb(bool fAutostart, bool fAddVM) * a number of the amount of VMs with autostart configured, so they * should be really really small. Anything else is bogus. */ - rc = RTFileGetSize(hAutostartFile, &cbFile); + rc = RTFileQuerySize(hAutostartFile, &cbFile); if ( RT_SUCCESS(rc) && cbFile <= 16) { diff --git a/src/VBox/Runtime/VBox/VBoxRTImp.def b/src/VBox/Runtime/VBox/VBoxRTImp.def index 7db33256c5f..e79dce2268d 100644 --- a/src/VBox/Runtime/VBox/VBoxRTImp.def +++ b/src/VBox/Runtime/VBox/VBoxRTImp.def @@ -1022,8 +1022,8 @@ EXPORTS RTFileFlush RTFileFromNative RTFileGetMaxSize - RTFileGetMaxSizeEx - RTFileGetSize + RTFileQueryMaxSizeEx + RTFileQuerySizeByPath RTFileIoCtl ; not-win RTFileIsValid RTFileLock @@ -2097,7 +2097,7 @@ EXPORTS RTVfsFileFromRTFile RTVfsFileGetMaxSize RTVfsFileGetOpenFlags - RTVfsFileGetSize + RTVfsFileQuerySize RTVfsFileOpen RTVfsFileOpenNormal RTVfsFilePoll diff --git a/src/VBox/Runtime/common/checksum/RTSha1Digest.cpp b/src/VBox/Runtime/common/checksum/RTSha1Digest.cpp index b8740f39d25..09fdc6df6be 100644 --- a/src/VBox/Runtime/common/checksum/RTSha1Digest.cpp +++ b/src/VBox/Runtime/common/checksum/RTSha1Digest.cpp @@ -123,7 +123,7 @@ RTR3DECL(int) RTSha1DigestFromFile(const char *pszFile, char **ppszDigest, PFNRT if (pfnProgressCallback) { uint64_t cbFile; - rc = RTFileGetSize(hFile, &cbFile); + rc = RTFileQuerySize(hFile, &cbFile); if (RT_FAILURE(rc)) { RTFileClose(hFile); diff --git a/src/VBox/Runtime/common/checksum/RTSha256Digest.cpp b/src/VBox/Runtime/common/checksum/RTSha256Digest.cpp index 59d29b69239..6d6ec7b7ac3 100644 --- a/src/VBox/Runtime/common/checksum/RTSha256Digest.cpp +++ b/src/VBox/Runtime/common/checksum/RTSha256Digest.cpp @@ -127,7 +127,7 @@ RTR3DECL(int) RTSha256DigestFromFile(const char *pszFile, char **ppszDigest, PFN if (pfnProgressCallback) { uint64_t cbFile; - rc = RTFileGetSize(hFile, &cbFile); + rc = RTFileQuerySize(hFile, &cbFile); if (RT_FAILURE(rc)) { RTFileClose(hFile); diff --git a/src/VBox/Runtime/common/checksum/manifest.cpp b/src/VBox/Runtime/common/checksum/manifest.cpp index 2f2d3f84e8d..76315df0085 100644 --- a/src/VBox/Runtime/common/checksum/manifest.cpp +++ b/src/VBox/Runtime/common/checksum/manifest.cpp @@ -117,7 +117,7 @@ RTR3DECL(int) RTManifestVerify(const char *pszManifestFile, PRTMANIFESTTEST paTe do { uint64_t cbSize; - rc = RTFileGetSize(file, &cbSize); + rc = RTFileQuerySize(file, &cbSize); if (RT_FAILURE(rc)) break; diff --git a/src/VBox/Runtime/common/dbg/dbgmodmapsym.cpp b/src/VBox/Runtime/common/dbg/dbgmodmapsym.cpp index 01a0b0dc26b..017f336f991 100644 --- a/src/VBox/Runtime/common/dbg/dbgmodmapsym.cpp +++ b/src/VBox/Runtime/common/dbg/dbgmodmapsym.cpp @@ -524,7 +524,7 @@ static DECLCALLBACK(int) rtDbgModMapSym_TryOpen(PRTDBGMODINT pMod, RTLDRARCH enm if (RT_SUCCESS(rc)) { uint64_t cbFile = 0; - rc = RTFileGetSize(hFile, &cbFile); + rc = RTFileQuerySize(hFile, &cbFile); if ( RT_SUCCESS(rc) && cbFile < _2M) { diff --git a/src/VBox/Runtime/common/dvm/dvm.cpp b/src/VBox/Runtime/common/dvm/dvm.cpp index 1fd7aa261d3..d451ae022ce 100644 --- a/src/VBox/Runtime/common/dvm/dvm.cpp +++ b/src/VBox/Runtime/common/dvm/dvm.cpp @@ -201,7 +201,7 @@ RTDECL(int) RTDvmCreate(PRTDVM phVolMgr, RTVFSFILE hVfsFile, uint32_t cbSector, AssertReturn(cRefs != UINT32_MAX, VERR_INVALID_HANDLE); uint64_t cbDisk; - int rc = RTVfsFileGetSize(hVfsFile, &cbDisk); + int rc = RTVfsFileQuerySize(hVfsFile, &cbDisk); if (RT_SUCCESS(rc)) { PRTDVMINTERNAL pThis = (PRTDVMINTERNAL)RTMemAllocZ(sizeof(RTDVMINTERNAL)); diff --git a/src/VBox/Runtime/common/fs/extvfs.cpp b/src/VBox/Runtime/common/fs/extvfs.cpp index 3a182935bcd..f30d0fceb20 100644 --- a/src/VBox/Runtime/common/fs/extvfs.cpp +++ b/src/VBox/Runtime/common/fs/extvfs.cpp @@ -2722,7 +2722,7 @@ RTDECL(int) RTFsExtVolOpen(RTVFSFILE hVfsFileIn, uint32_t fMntFlags, uint32_t fE RTListInit(&pThis->LstInodeLru); RTListInit(&pThis->LstBlockLru); - rc = RTVfsFileGetSize(pThis->hVfsBacking, &pThis->cbBacking); + rc = RTVfsFileQuerySize(pThis->hVfsBacking, &pThis->cbBacking); if (RT_SUCCESS(rc)) { rc = rtFsExtVolLoadAndParseSuperblock(pThis, pErrInfo); diff --git a/src/VBox/Runtime/common/fs/fatvfs.cpp b/src/VBox/Runtime/common/fs/fatvfs.cpp index 6c767749f20..4cab72848bd 100644 --- a/src/VBox/Runtime/common/fs/fatvfs.cpp +++ b/src/VBox/Runtime/common/fs/fatvfs.cpp @@ -5619,7 +5619,7 @@ static int rtFsFatVolTryInit(PRTFSFATVOL pThis, RTVFS hVfsSelf, RTVFSFILE hVfsBa /* * Get stuff that may fail. */ - int rc = RTVfsFileGetSize(hVfsBacking, &pThis->cbBacking); + int rc = RTVfsFileQuerySize(hVfsBacking, &pThis->cbBacking); if (RT_FAILURE(rc)) return rc; pThis->cbTotalSize = pThis->cbBacking - pThis->offBootSector; @@ -5815,7 +5815,7 @@ RTDECL(int) RTFsFatVolFormat(RTVFSFILE hVfsFile, uint64_t offVol, uint64_t cbVol if (!cbVol) { uint64_t cbFile; - rc = RTVfsFileGetSize(hVfsFile, &cbFile); + rc = RTVfsFileQuerySize(hVfsFile, &cbFile); AssertRCReturn(rc, rc); AssertMsgReturn(cbFile > offVol, ("cbFile=%#RX64 offVol=%#RX64\n", cbFile, offVol), VERR_INVALID_PARAMETER); cbVol = cbFile - offVol; diff --git a/src/VBox/Runtime/common/fs/isomaker.cpp b/src/VBox/Runtime/common/fs/isomaker.cpp index 450a558373e..2be9fce211d 100644 --- a/src/VBox/Runtime/common/fs/isomaker.cpp +++ b/src/VBox/Runtime/common/fs/isomaker.cpp @@ -6247,7 +6247,7 @@ static int rtFsIsoMakerOutFile_ProduceTransTbl(PRTFSISOMAKEROUTPUTFILE pThis, PR * Check that the size matches our estimate. */ uint64_t cbResult = 0; - rc = RTVfsFileGetSize(hVfsFile, &cbResult); + rc = RTVfsFileQuerySize(hVfsFile, &cbResult); if (RT_SUCCESS(rc) && cbResult == pFile->cbData) { pThis->hVfsSrcFile = hVfsFile; diff --git a/src/VBox/Runtime/common/fs/isomakercmd.cpp b/src/VBox/Runtime/common/fs/isomakercmd.cpp index c30814cf945..ce0c95d7cc9 100644 --- a/src/VBox/Runtime/common/fs/isomakercmd.cpp +++ b/src/VBox/Runtime/common/fs/isomakercmd.cpp @@ -1104,7 +1104,7 @@ static int rtFsIsoMakerCmdWriteImage(PRTFSISOMAKERCMDOPTS pOpts, RTVFSFILE hVfsS * Get the image size and setup the copy buffer. */ uint64_t cbImage; - int rc = RTVfsFileGetSize(hVfsSrcFile, &cbImage); + int rc = RTVfsFileQuerySize(hVfsSrcFile, &cbImage); if (RT_SUCCESS(rc)) { rtFsIsoMakerPrintf(pOpts, "Image size: %'RU64 (%#RX64) bytes\n", cbImage, cbImage); @@ -1159,7 +1159,7 @@ static int rtFsIsoMakerCmdWriteImage(PRTFSISOMAKERCMDOPTS pOpts, RTVFSFILE hVfsS rc = rtFsIsoMakerCmdErrorRc(pOpts, VERR_NO_TMP_MEMORY, "RTMemTmpAlloc(%zu) failed", cbBuf); } else - rc = rtFsIsoMakerCmdErrorRc(pOpts, rc, "RTVfsFileGetSize failed: %Rrc", rc); + rc = rtFsIsoMakerCmdErrorRc(pOpts, rc, "RTVfsFileQuerySize failed: %Rrc", rc); return rc; } @@ -3074,7 +3074,7 @@ static int rtFsIsoMakerCmdParseArgumentFile(PRTFSISOMAKERCMDOPTS pOpts, const ch return rtFsIsoMakerCmdChainError(pOpts, "RTVfsChainOpenFile", pszFileSpec, rc, offError, &ErrInfo.Core); uint64_t cbFile = 0; - rc = RTVfsFileGetSize(hVfsFile, &cbFile); + rc = RTVfsFileQuerySize(hVfsFile, &cbFile); if (RT_SUCCESS(rc)) { if (cbFile < _2M) @@ -3126,7 +3126,7 @@ static int rtFsIsoMakerCmdParseArgumentFile(PRTFSISOMAKERCMDOPTS pOpts, const ch rc = rtFsIsoMakerCmdErrorRc(pOpts, VERR_FILE_TOO_BIG, "%s: file is too big: %'RU64 bytes, max 2MB", pszFileSpec, cbFile); } else - rtFsIsoMakerCmdErrorRc(pOpts, rc, "%s: RTVfsFileGetSize failed: %Rrc", pszFileSpec, rc); + rtFsIsoMakerCmdErrorRc(pOpts, rc, "%s: RTVfsFileQuerySize failed: %Rrc", pszFileSpec, rc); RTVfsFileRelease(hVfsFile); return rc; } diff --git a/src/VBox/Runtime/common/fs/isomakerimport.cpp b/src/VBox/Runtime/common/fs/isomakerimport.cpp index f5ffad38ded..e2b1a8e3679 100644 --- a/src/VBox/Runtime/common/fs/isomakerimport.cpp +++ b/src/VBox/Runtime/common/fs/isomakerimport.cpp @@ -2520,7 +2520,7 @@ RTDECL(int) RTFsIsoMakerImport(RTFSISOMAKER hIsoMaker, RTVFSFILE hIsoFile, uint3 * Get the file size. */ uint64_t cbSrcFile = 0; - int rc = RTVfsFileGetSize(hIsoFile, &cbSrcFile); + int rc = RTVfsFileQuerySize(hIsoFile, &cbSrcFile); if (RT_SUCCESS(rc)) { /* diff --git a/src/VBox/Runtime/common/fs/isovfs.cpp b/src/VBox/Runtime/common/fs/isovfs.cpp index d48edcfb86b..594f1ea9b23 100644 --- a/src/VBox/Runtime/common/fs/isovfs.cpp +++ b/src/VBox/Runtime/common/fs/isovfs.cpp @@ -5617,7 +5617,7 @@ static int rtFsIsoVolTryInit(PRTFSISOVOL pThis, RTVFS hVfsSelf, RTVFSFILE hVfsBa /* * Get stuff that may fail. */ - int rc = RTVfsFileGetSize(hVfsBacking, &pThis->cbBacking); + int rc = RTVfsFileQuerySize(hVfsBacking, &pThis->cbBacking); if (RT_SUCCESS(rc)) pThis->cBackingSectors = pThis->cbBacking / pThis->cbSector; else diff --git a/src/VBox/Runtime/common/fs/ntfsvfs.cpp b/src/VBox/Runtime/common/fs/ntfsvfs.cpp index 2d2024ae260..cbbc5b6b254 100644 --- a/src/VBox/Runtime/common/fs/ntfsvfs.cpp +++ b/src/VBox/Runtime/common/fs/ntfsvfs.cpp @@ -5535,7 +5535,7 @@ RTDECL(int) RTFsNtfsVolOpen(RTVFSFILE hVfsFileIn, uint32_t fMntFlags, uint32_t f RTListInit(&pThis->CoreUnusedHead); RTListInit(&pThis->IdxNodeUnusedHead); - rc = RTVfsFileGetSize(pThis->hVfsBacking, &pThis->cbBacking); + rc = RTVfsFileQuerySize(pThis->hVfsBacking, &pThis->cbBacking); if (RT_SUCCESS(rc)) { void *pvBuf = RTMemTmpAlloc(_64K); diff --git a/src/VBox/Runtime/common/fs/xfsvfs.cpp b/src/VBox/Runtime/common/fs/xfsvfs.cpp index 933bbc57d2b..f6b67d36cb9 100644 --- a/src/VBox/Runtime/common/fs/xfsvfs.cpp +++ b/src/VBox/Runtime/common/fs/xfsvfs.cpp @@ -2326,7 +2326,7 @@ RTDECL(int) RTFsXfsVolOpen(RTVFSFILE hVfsFileIn, uint32_t fMntFlags, uint32_t fX RTListInit(&pThis->LstInodeLru); RTListInit(&pThis->LstBlockLru); - rc = RTVfsFileGetSize(pThis->hVfsBacking, &pThis->cbBacking); + rc = RTVfsFileQuerySize(pThis->hVfsBacking, &pThis->cbBacking); if (RT_SUCCESS(rc)) { rc = rtFsXfsVolLoadAndParseSuperblock(pThis, pErrInfo); diff --git a/src/VBox/Runtime/common/fuzz/fuzz.cpp b/src/VBox/Runtime/common/fuzz/fuzz.cpp index 17f28e7c221..bacd7290cf2 100644 --- a/src/VBox/Runtime/common/fuzz/fuzz.cpp +++ b/src/VBox/Runtime/common/fuzz/fuzz.cpp @@ -1834,7 +1834,7 @@ RTDECL(int) RTFuzzCtxCorpusInputAddFromVfsFile(RTFUZZCTX hFuzzCtx, RTVFSFILE hVf uint64_t cbFile = 0; void *pvCorpus = NULL; - int rc = RTVfsFileGetSize(hVfsFile, &cbFile); + int rc = RTVfsFileQuerySize(hVfsFile, &cbFile); if (RT_SUCCESS(rc)) { PRTFUZZMUTATION pMutation = rtFuzzMutationCreate(pThis, 0, NULL, cbFile, &pvCorpus); diff --git a/src/VBox/Runtime/common/ldr/ldrFile.cpp b/src/VBox/Runtime/common/ldr/ldrFile.cpp index 5140596446e..a016b8a25fe 100644 --- a/src/VBox/Runtime/common/ldr/ldrFile.cpp +++ b/src/VBox/Runtime/common/ldr/ldrFile.cpp @@ -224,7 +224,7 @@ static int rtldrFileCreate(PRTLDRREADER *ppReader, const char *pszFilename) rc = RTFileOpen(&pFileReader->hFile, pszFilename, RTFILE_O_READ | RTFILE_O_OPEN | RTFILE_O_DENY_WRITE); if (RT_SUCCESS(rc)) { - rc = RTFileGetSize(pFileReader->hFile, &pFileReader->cbFile); + rc = RTFileQuerySize(pFileReader->hFile, &pFileReader->cbFile); if (RT_SUCCESS(rc)) { pFileReader->Core.uMagic = RTLDRREADER_MAGIC; diff --git a/src/VBox/Runtime/common/ldr/ldrVfsFile.cpp b/src/VBox/Runtime/common/ldr/ldrVfsFile.cpp index 0bea91b8241..ee54431fa72 100644 --- a/src/VBox/Runtime/common/ldr/ldrVfsFile.cpp +++ b/src/VBox/Runtime/common/ldr/ldrVfsFile.cpp @@ -87,7 +87,7 @@ static DECLCALLBACK(uint64_t) rtldrVfsFileSize(PRTLDRREADER pReader) { PRTLDRREADERVFSFILE pFileReader = (PRTLDRREADERVFSFILE)pReader; uint64_t cbFile; - int rc = RTVfsFileGetSize(pFileReader->hVfsFile, &cbFile); + int rc = RTVfsFileQuerySize(pFileReader->hVfsFile, &cbFile); if (RT_SUCCESS(rc)) return cbFile; return 0; diff --git a/src/VBox/Runtime/common/log/log.cpp b/src/VBox/Runtime/common/log/log.cpp index 8751c23e11c..0b9561c8f28 100644 --- a/src/VBox/Runtime/common/log/log.cpp +++ b/src/VBox/Runtime/common/log/log.cpp @@ -3206,7 +3206,7 @@ static int rtlogFileOpen(PRTLOGGER pLogger, PRTERRINFO pErrInfo) } if (RT_SUCCESS(rc)) { - rc = RTFileGetSize(pLogger->pInt->hFile, &pLogger->pInt->cbHistoryFileWritten); + rc = RTFileQuerySize(pLogger->pInt->hFile, &pLogger->pInt->cbHistoryFileWritten); if (RT_FAILURE(rc)) { /* Don't complain if this fails, assume the file is empty. */ diff --git a/src/VBox/Runtime/common/misc/inifile.cpp b/src/VBox/Runtime/common/misc/inifile.cpp index df8d8818f06..b471623efeb 100644 --- a/src/VBox/Runtime/common/misc/inifile.cpp +++ b/src/VBox/Runtime/common/misc/inifile.cpp @@ -146,7 +146,7 @@ static int rtIniFileLoad(PRTINIFILEINT pThis) * Load the entire file into memory, ensuring two terminating zeros. */ uint64_t cbFile; - int rc = RTVfsFileGetSize(pThis->hVfsFile, &cbFile); + int rc = RTVfsFileQuerySize(pThis->hVfsFile, &cbFile); AssertRCReturn(rc, rc); if (cbFile > RTINIFILE_MAX_SIZE) diff --git a/src/VBox/Runtime/common/misc/s3.cpp b/src/VBox/Runtime/common/misc/s3.cpp index 94369750a50..55c7b226528 100644 --- a/src/VBox/Runtime/common/misc/s3.cpp +++ b/src/VBox/Runtime/common/misc/s3.cpp @@ -955,7 +955,7 @@ RTR3DECL(int) RTS3PutKey(RTS3 hS3, const char *pszBucketName, const char *pszKey return rc; uint64_t cbFileSize; - rc = RTFileGetSize(hFile, &cbFileSize); + rc = RTFileQuerySize(hFile, &cbFileSize); if (RT_FAILURE(rc)) { RTFileClose(hFile); diff --git a/src/VBox/Runtime/common/vfs/vfsbase.cpp b/src/VBox/Runtime/common/vfs/vfsbase.cpp index a08b8d9c22c..ba9630ebadc 100644 --- a/src/VBox/Runtime/common/vfs/vfsbase.cpp +++ b/src/VBox/Runtime/common/vfs/vfsbase.cpp @@ -4219,7 +4219,7 @@ RTDECL(int) RTVfsFileSeek(RTVFSFILE hVfsFile, RTFOFF offSeek, uint32_t uMethod, } -RTDECL(int) RTVfsFileGetSize(RTVFSFILE hVfsFile, uint64_t *pcbSize) +RTDECL(int) RTVfsFileQuerySize(RTVFSFILE hVfsFile, uint64_t *pcbSize) { RTVFSFILEINTERNAL *pThis = hVfsFile; AssertPtrReturn(pThis, VERR_INVALID_HANDLE); diff --git a/src/VBox/Runtime/common/vfs/vfsprogress.cpp b/src/VBox/Runtime/common/vfs/vfsprogress.cpp index 4bd7b5e6c38..caf3c08da9b 100644 --- a/src/VBox/Runtime/common/vfs/vfsprogress.cpp +++ b/src/VBox/Runtime/common/vfs/vfsprogress.cpp @@ -401,7 +401,7 @@ static DECLCALLBACK(int) rtVfsProgressFile_Seek(void *pvThis, RTFOFF offSeek, un static DECLCALLBACK(int) rtVfsProgressFile_QuerySize(void *pvThis, uint64_t *pcbFile) { PRTVFSPROGRESSFILE pThis = (PRTVFSPROGRESSFILE)pvThis; - return RTVfsFileGetSize(pThis->hVfsFile, pcbFile); + return RTVfsFileQuerySize(pThis->hVfsFile, pcbFile); } diff --git a/src/VBox/Runtime/common/vfs/vfsreadahead.cpp b/src/VBox/Runtime/common/vfs/vfsreadahead.cpp index 6ee43ff2306..cc925631a60 100644 --- a/src/VBox/Runtime/common/vfs/vfsreadahead.cpp +++ b/src/VBox/Runtime/common/vfs/vfsreadahead.cpp @@ -484,7 +484,7 @@ static DECLCALLBACK(int) rtVfsReadAhead_QuerySize(void *pvThis, uint64_t *pcbFil AssertReturn(pThis->hFile != NIL_RTVFSFILE, VERR_NOT_SUPPORTED); RTCritSectEnter(&pThis->IoCritSect); /* paranoia */ - int rc = RTVfsFileGetSize(pThis->hFile, pcbFile); + int rc = RTVfsFileQuerySize(pThis->hFile, pcbFile); RTCritSectLeave(&pThis->IoCritSect); return rc; diff --git a/src/VBox/Runtime/common/vfs/vfsstdfile.cpp b/src/VBox/Runtime/common/vfs/vfsstdfile.cpp index e218d07107b..7d12840be5b 100644 --- a/src/VBox/Runtime/common/vfs/vfsstdfile.cpp +++ b/src/VBox/Runtime/common/vfs/vfsstdfile.cpp @@ -110,7 +110,7 @@ DECLINLINE(int) rtVfsStdFile_ReadFixRC(PRTVFSSTDFILE pThis, RTFOFF off, size_t c return VINF_SUCCESS; uint64_t cbFile; - int rc = RTFileGetSize(pThis->hFile, &cbFile); + int rc = RTFileQuerySize(pThis->hFile, &cbFile); if (RT_FAILURE(rc)) return rc; @@ -382,7 +382,7 @@ static DECLCALLBACK(int) rtVfsStdFile_Seek(void *pvThis, RTFOFF offSeek, unsigne static DECLCALLBACK(int) rtVfsStdFile_QuerySize(void *pvThis, uint64_t *pcbFile) { PRTVFSSTDFILE pThis = (PRTVFSSTDFILE)pvThis; - return RTFileGetSize(pThis->hFile, pcbFile); + return RTFileQuerySize(pThis->hFile, pcbFile); } @@ -413,7 +413,7 @@ static DECLCALLBACK(int) rtVfsStdFile_QueryMaxSize(void *pvThis, uint64_t *pcbMa { PRTVFSSTDFILE pThis = (PRTVFSSTDFILE)pvThis; RTFOFF cbMax = 0; - int rc = RTFileGetMaxSizeEx(pThis->hFile, &cbMax); + int rc = RTFileQueryMaxSizeEx(pThis->hFile, &cbMax); if (RT_SUCCESS(rc)) *pcbMax = cbMax; return rc; diff --git a/src/VBox/Runtime/generic/RTFileCopyByHandlesEx-generic.cpp b/src/VBox/Runtime/generic/RTFileCopyByHandlesEx-generic.cpp index b8de38f92bd..dc8ec61e477 100644 --- a/src/VBox/Runtime/generic/RTFileCopyByHandlesEx-generic.cpp +++ b/src/VBox/Runtime/generic/RTFileCopyByHandlesEx-generic.cpp @@ -58,7 +58,7 @@ RTDECL(int) RTFileCopyByHandlesEx(RTFILE hFileSrc, RTFILE hFileDst, PFNRTPROGRES * Get the file size and figure out how much we'll copy at a time. */ uint64_t cbSrc; - rc = RTFileGetSize(hFileSrc, &cbSrc); + rc = RTFileQuerySize(hFileSrc, &cbSrc); if (RT_FAILURE(rc)) return rc; @@ -83,7 +83,7 @@ RTDECL(int) RTFileCopyByHandlesEx(RTFILE hFileSrc, RTFILE hFileDst, PFNRTPROGRES * Prepare the destination file. */ uint64_t cbDst; - rc = RTFileGetSize(hFileDst, &cbDst); + rc = RTFileQuerySize(hFileDst, &cbDst); if (RT_SUCCESS(rc) && cbDst > cbSrc) rc = RTFileSetSize(hFileDst, cbSrc); if (RT_SUCCESS(rc) && cbDst < cbSrc) diff --git a/src/VBox/Runtime/generic/RTFileQuerySize-generic.cpp b/src/VBox/Runtime/generic/RTFileQuerySize-generic.cpp index ead61c29c52..0aad0f9b786 100644 --- a/src/VBox/Runtime/generic/RTFileQuerySize-generic.cpp +++ b/src/VBox/Runtime/generic/RTFileQuerySize-generic.cpp @@ -37,7 +37,7 @@ #include -RTDECL(int) RTFileQuerySize(const char *pszPath, uint64_t *pcbFile) +RTDECL(int) RTFileQuerySizeByPath(const char *pszPath, uint64_t *pcbFile) { RTFSOBJINFO ObjInfo; int rc = RTPathQueryInfoEx(pszPath, &ObjInfo, RTFSOBJATTRADD_NOTHING, RTPATH_F_FOLLOW_LINK); diff --git a/src/VBox/Runtime/r0drv/darwin/fileio-r0drv-darwin.cpp b/src/VBox/Runtime/r0drv/darwin/fileio-r0drv-darwin.cpp index ad7756b9817..5ad8e1dc763 100644 --- a/src/VBox/Runtime/r0drv/darwin/fileio-r0drv-darwin.cpp +++ b/src/VBox/Runtime/r0drv/darwin/fileio-r0drv-darwin.cpp @@ -235,7 +235,7 @@ RTDECL(int) RTFileRead(RTFILE hFile, void *pvBuf, size_t cbToRead, size_t *pcbRe } -RTDECL(int) RTFileGetSize(RTFILE hFile, uint64_t *pcbSize) +RTDECL(int) RTFileQuerySize(RTFILE hFile, uint64_t *pcbSize) { RTFILEINT *pThis = hFile; AssertPtrReturn(pThis, VERR_INVALID_HANDLE); @@ -287,7 +287,7 @@ RTDECL(int) RTFileSeek(RTFILE hFile, int64_t offSeek, unsigned uMethod, uint64_t case RTFILE_SEEK_END: { uint64_t cbFile = 0; - int rc = RTFileGetSize(hFile, &cbFile); + int rc = RTFileQuerySize(hFile, &cbFile); if (RT_SUCCESS(rc)) offNew = cbFile + offSeek; else diff --git a/src/VBox/Runtime/r3/fileio.cpp b/src/VBox/Runtime/r3/fileio.cpp index e0f22ff0149..a3f72a2fbb5 100644 --- a/src/VBox/Runtime/r3/fileio.cpp +++ b/src/VBox/Runtime/r3/fileio.cpp @@ -226,12 +226,12 @@ RTR3DECL(uint64_t) RTFileTell(RTFILE File) * @returns The max size of the file. * -1 on failure, the file position is undefined. * @param File Handle to the file. - * @see RTFileGetMaxSizeEx. + * @see RTFileQueryMaxSizeEx. */ RTR3DECL(RTFOFF) RTFileGetMaxSize(RTFILE File) { RTFOFF cbMax; - int rc = RTFileGetMaxSizeEx(File, &cbMax); + int rc = RTFileQueryMaxSizeEx(File, &cbMax); return RT_SUCCESS(rc) ? cbMax : -1; } @@ -316,12 +316,12 @@ RTDECL(int) RTFileCompareByHandlesEx(RTFILE hFile1, RTFILE hFile2, uint32_t fFla * Compare the file sizes first. */ uint64_t cbFile1; - int rc = RTFileGetSize(hFile1, &cbFile1); + int rc = RTFileQuerySize(hFile1, &cbFile1); if (RT_FAILURE(rc)) return rc; uint64_t cbFile2; - rc = RTFileGetSize(hFile1, &cbFile2); + rc = RTFileQuerySize(hFile1, &cbFile2); if (RT_FAILURE(rc)) return rc; diff --git a/src/VBox/Runtime/r3/posix/fileio-posix.cpp b/src/VBox/Runtime/r3/posix/fileio-posix.cpp index 613af3a6962..cd7d59c90c8 100644 --- a/src/VBox/Runtime/r3/posix/fileio-posix.cpp +++ b/src/VBox/Runtime/r3/posix/fileio-posix.cpp @@ -669,7 +669,7 @@ RTR3DECL(int) RTFileSetSize(RTFILE hFile, uint64_t cbSize) } -RTR3DECL(int) RTFileGetSize(RTFILE hFile, uint64_t *pcbSize) +RTR3DECL(int) RTFileQuerySize(RTFILE hFile, uint64_t *pcbSize) { /* * Ask fstat() first. @@ -745,7 +745,7 @@ RTR3DECL(int) RTFileGetSize(RTFILE hFile, uint64_t *pcbSize) } -RTR3DECL(int) RTFileGetMaxSizeEx(RTFILE hFile, PRTFOFF pcbMax) +RTR3DECL(int) RTFileQueryMaxSizeEx(RTFILE hFile, PRTFOFF pcbMax) { /* * Save the current location diff --git a/src/VBox/Runtime/r3/win/fileio-win.cpp b/src/VBox/Runtime/r3/win/fileio-win.cpp index e0c51e18c7f..5e8df45398f 100644 --- a/src/VBox/Runtime/r3/win/fileio-win.cpp +++ b/src/VBox/Runtime/r3/win/fileio-win.cpp @@ -797,7 +797,7 @@ RTR3DECL(int) RTFileSetSize(RTFILE hFile, uint64_t cbSize) } -RTR3DECL(int) RTFileGetSize(RTFILE hFile, uint64_t *pcbSize) +RTR3DECL(int) RTFileQuerySize(RTFILE hFile, uint64_t *pcbSize) { /* * GetFileSize works for most handles. @@ -848,7 +848,7 @@ RTR3DECL(int) RTFileGetSize(RTFILE hFile, uint64_t *pcbSize) } -RTR3DECL(int) RTFileGetMaxSizeEx(RTFILE hFile, PRTFOFF pcbMax) +RTR3DECL(int) RTFileQueryMaxSizeEx(RTFILE hFile, PRTFOFF pcbMax) { /** @todo r=bird: * We might have to make this code OS version specific... In the worse diff --git a/src/VBox/Runtime/r3/xml.cpp b/src/VBox/Runtime/r3/xml.cpp index 864a6f23547..7f797fdbdd3 100644 --- a/src/VBox/Runtime/r3/xml.cpp +++ b/src/VBox/Runtime/r3/xml.cpp @@ -2289,7 +2289,7 @@ void XmlFileWriter::write(const char *pcszFilename, bool fSafe) /* Make a backup of any existing file (ignore failure). */ uint64_t cbPrevFile; - rc = RTFileQuerySize(pcszFilename, &cbPrevFile); + rc = RTFileQuerySizeByPath(pcszFilename, &cbPrevFile); if (RT_SUCCESS(rc) && cbPrevFile >= 16) RTFileRename(pcszFilename, szPrevFilename, RTPATHRENAME_FLAGS_REPLACE); diff --git a/src/VBox/Runtime/testcase/Makefile.kmk b/src/VBox/Runtime/testcase/Makefile.kmk index 0bd7881623e..3e200331517 100644 --- a/src/VBox/Runtime/testcase/Makefile.kmk +++ b/src/VBox/Runtime/testcase/Makefile.kmk @@ -66,7 +66,7 @@ PROGRAMS += \ tstFile \ tstRTFileAio \ tstRTFileAppend-1 \ - tstRTFileGetSize-1 \ + tstRTFileQuerySize-1 \ tstRTFileModeStringToFlags \ tstFileLock \ tstRTFileOpenEx-1 \ @@ -361,8 +361,8 @@ tstRTFileAio_SOURCES = tstRTFileAio.cpp tstRTFileAppend-1_TEMPLATE = VBOXR3TSTEXE tstRTFileAppend-1_SOURCES = tstRTFileAppend-1.cpp -tstRTFileGetSize-1_TEMPLATE = VBOXR3TSTEXE -tstRTFileGetSize-1_SOURCES = tstRTFileGetSize-1.cpp +tstRTFileQuerySize-1_TEMPLATE = VBOXR3TSTEXE +tstRTFileQuerySize-1_SOURCES = tstRTFileQuerySize-1.cpp tstRTFileModeStringToFlags_TEMPLATE = VBOXR3TSTEXE tstRTFileModeStringToFlags_SOURCES = tstRTFileModeStringToFlags.cpp diff --git a/src/VBox/Runtime/testcase/tstFile.cpp b/src/VBox/Runtime/testcase/tstFile.cpp index 56226ffbc28..152bfdc06ee 100644 --- a/src/VBox/Runtime/testcase/tstFile.cpp +++ b/src/VBox/Runtime/testcase/tstFile.cpp @@ -50,15 +50,15 @@ int main() } RTFOFF cbMax = -2; - rc = RTFileGetMaxSizeEx(File, &cbMax); + rc = RTFileQueryMaxSizeEx(File, &cbMax); if (RT_FAILURE(rc)) { - RTPrintf("tstFile: RTFileGetMaxSizeEx failed: %Rrc\n", rc); + RTPrintf("tstFile: RTFileQueryMaxSizeEx failed: %Rrc\n", rc); cErrors++; } else if (cbMax <= 0) { - RTPrintf("tstFile: RTFileGetMaxSizeEx failed: cbMax=%RTfoff\n", cbMax); + RTPrintf("tstFile: RTFileQueryMaxSizeEx failed: cbMax=%RTfoff\n", cbMax); cErrors++; } else if (RTFileGetMaxSize(File) != cbMax) @@ -79,7 +79,7 @@ int main() else { uint64_t cb; - rc = RTFileGetSize(File, &cb); + rc = RTFileQuerySize(File, &cb); if (RT_FAILURE(rc)) { RTPrintf("Failed to get file size of #1. rc=%Rrc\n", rc); @@ -87,7 +87,7 @@ int main() } else if (cb != _2G + _1M) { - RTPrintf("RTFileGetSize return %RX64 bytes, expected %RX64.\n", cb, _2G + _1M); + RTPrintf("RTFileQuerySize return %RX64 bytes, expected %RX64.\n", cb, _2G + _1M); cErrors++; } else diff --git a/src/VBox/Runtime/testcase/tstRTDvm.cpp b/src/VBox/Runtime/testcase/tstRTDvm.cpp index 258d836570c..296e5eaa767 100644 --- a/src/VBox/Runtime/testcase/tstRTDvm.cpp +++ b/src/VBox/Runtime/testcase/tstRTDvm.cpp @@ -189,11 +189,11 @@ int main(int argc, char **argv) } uint64_t cb = 0; - rc = RTVfsFileGetSize(hVfsDisk, &cb); + rc = RTVfsFileQuerySize(hVfsDisk, &cb); if ( RT_FAILURE(rc) || cb % 512 != 0) /* Assume 512 byte sector size. */ { - RTTestIFailed("RTVfsFileGetSize -> %Rrc", rc); + RTTestIFailed("RTVfsFileQuerySize -> %Rrc", rc); return RTTestSummaryAndDestroy(hTest); } diff --git a/src/VBox/Runtime/testcase/tstRTFileGetSize-1.cpp b/src/VBox/Runtime/testcase/tstRTFileGetSize-1.cpp deleted file mode 100644 index 78c51474ecd..00000000000 --- a/src/VBox/Runtime/testcase/tstRTFileGetSize-1.cpp +++ /dev/null @@ -1,106 +0,0 @@ -/* $Id$ */ -/** @file - * IPRT Testcase - RTFileGetSize. - */ - -/* - * Copyright (C) 2011-2019 Oracle Corporation - * - * This file is part of VirtualBox Open Source Edition (OSE), as - * available from http://www.virtualbox.org. This file is free software; - * you can redistribute it and/or modify it under the terms of the GNU - * General Public License (GPL) as published by the Free Software - * Foundation, in version 2 as it comes in the "COPYING" file of the - * VirtualBox OSE distribution. VirtualBox OSE is distributed in the - * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind. - * - * The contents of this file may alternatively be used under the terms - * of the Common Development and Distribution License Version 1.0 - * (CDDL) only, as it comes in the "COPYING.CDDL" file of the - * VirtualBox OSE distribution, in which case the provisions of the - * CDDL are applicable instead of those of the GPL. - * - * You may elect to license modified versions of this file under the - * terms and conditions of either the GPL or the CDDL or both. - */ - - -/********************************************************************************************************************************* -* Header Files * -*********************************************************************************************************************************/ -#include - -#include -#include -#include -#include -#include - - -static void test1(const char *pszSubTest, const char *pszFilename) -{ - int rc; - RTTestISub(pszSubTest); - - RTFILE hFile; - rc = RTFileOpen(&hFile, pszFilename, RTFILE_O_READ | RTFILE_O_DENY_NONE | RTFILE_O_OPEN); - if (RT_FAILURE(rc)) - { - if ( rc == VERR_ACCESS_DENIED - || rc == VERR_PERMISSION_DENIED - || rc == VERR_FILE_NOT_FOUND) - { - RTTestIPrintf(RTTESTLVL_ALWAYS, "Cannot access '%s', skipping.", pszFilename); - return; - } - RTTESTI_CHECK_RC_RETV(RTFileOpen(&hFile, pszFilename, RTFILE_O_READ | RTFILE_O_DENY_NONE | RTFILE_O_OPEN), VINF_SUCCESS); - } - - uint64_t cbFile = UINT64_MAX - 42; - RTTESTI_CHECK_RC(rc = RTFileGetSize(hFile, &cbFile), VINF_SUCCESS); - if (RT_SUCCESS(rc)) - { - RTTESTI_CHECK(cbFile != UINT64_MAX - 42); - RTTestIValue(pszSubTest, cbFile, RTTESTUNIT_BYTES); - } - - RTFileClose(hFile); - RTTestISubDone(); -} - - -int main(int argc, char **argv) -{ - RTTEST hTest; - int rc = RTTestInitAndCreate("tstRTFileGetSize-1", &hTest); - if (rc) - return rc; - RTTestBanner(hTest); - - for (int i = 0; i < argc; i++) - { - char *pszNm = RTPathFilename(argv[i]); - if (!pszNm) - pszNm = argv[i]; - test1(pszNm, argv[i]); - } - -#ifdef RT_OS_WINDOWS - test1("//./PhysicalDrive0", "//./PhysicalDrive0"); - test1("//./HarddiskVolume1", "//./HarddiskVolume1"); - test1("//./null", "//./nul"); -#else - test1("/dev/null", "/dev/null"); -# ifdef RT_OS_LINUX - test1("/dev/sda", "/dev/sda"); - test1("/dev/sda1", "/dev/sda1"); - test1("/dev/sda5", "/dev/sda5"); -# endif -#endif - - /* - * Summary. - */ - return RTTestSummaryAndDestroy(hTest); -} - diff --git a/src/VBox/Runtime/testcase/tstRTFileQuerySize-1.cpp b/src/VBox/Runtime/testcase/tstRTFileQuerySize-1.cpp new file mode 100644 index 00000000000..f1820823dfb --- /dev/null +++ b/src/VBox/Runtime/testcase/tstRTFileQuerySize-1.cpp @@ -0,0 +1,106 @@ +/* $Id$ */ +/** @file + * IPRT Testcase - RTFileQuerySize. + */ + +/* + * Copyright (C) 2011-2019 Oracle Corporation + * + * This file is part of VirtualBox Open Source Edition (OSE), as + * available from http://www.virtualbox.org. This file is free software; + * you can redistribute it and/or modify it under the terms of the GNU + * General Public License (GPL) as published by the Free Software + * Foundation, in version 2 as it comes in the "COPYING" file of the + * VirtualBox OSE distribution. VirtualBox OSE is distributed in the + * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind. + * + * The contents of this file may alternatively be used under the terms + * of the Common Development and Distribution License Version 1.0 + * (CDDL) only, as it comes in the "COPYING.CDDL" file of the + * VirtualBox OSE distribution, in which case the provisions of the + * CDDL are applicable instead of those of the GPL. + * + * You may elect to license modified versions of this file under the + * terms and conditions of either the GPL or the CDDL or both. + */ + + +/********************************************************************************************************************************* +* Header Files * +*********************************************************************************************************************************/ +#include + +#include +#include +#include +#include +#include + + +static void test1(const char *pszSubTest, const char *pszFilename) +{ + int rc; + RTTestISub(pszSubTest); + + RTFILE hFile; + rc = RTFileOpen(&hFile, pszFilename, RTFILE_O_READ | RTFILE_O_DENY_NONE | RTFILE_O_OPEN); + if (RT_FAILURE(rc)) + { + if ( rc == VERR_ACCESS_DENIED + || rc == VERR_PERMISSION_DENIED + || rc == VERR_FILE_NOT_FOUND) + { + RTTestIPrintf(RTTESTLVL_ALWAYS, "Cannot access '%s', skipping.", pszFilename); + return; + } + RTTESTI_CHECK_RC_RETV(RTFileOpen(&hFile, pszFilename, RTFILE_O_READ | RTFILE_O_DENY_NONE | RTFILE_O_OPEN), VINF_SUCCESS); + } + + uint64_t cbFile = UINT64_MAX - 42; + RTTESTI_CHECK_RC(rc = RTFileQuerySize(hFile, &cbFile), VINF_SUCCESS); + if (RT_SUCCESS(rc)) + { + RTTESTI_CHECK(cbFile != UINT64_MAX - 42); + RTTestIValue(pszSubTest, cbFile, RTTESTUNIT_BYTES); + } + + RTFileClose(hFile); + RTTestISubDone(); +} + + +int main(int argc, char **argv) +{ + RTTEST hTest; + int rc = RTTestInitAndCreate("tstRTFileQuerySize-1", &hTest); + if (rc) + return rc; + RTTestBanner(hTest); + + for (int i = 0; i < argc; i++) + { + char *pszNm = RTPathFilename(argv[i]); + if (!pszNm) + pszNm = argv[i]; + test1(pszNm, argv[i]); + } + +#ifdef RT_OS_WINDOWS + test1("//./PhysicalDrive0", "//./PhysicalDrive0"); + test1("//./HarddiskVolume1", "//./HarddiskVolume1"); + test1("//./null", "//./nul"); +#else + test1("/dev/null", "/dev/null"); +# ifdef RT_OS_LINUX + test1("/dev/sda", "/dev/sda"); + test1("/dev/sda1", "/dev/sda1"); + test1("/dev/sda5", "/dev/sda5"); +# endif +#endif + + /* + * Summary. + */ + return RTTestSummaryAndDestroy(hTest); +} + diff --git a/src/VBox/Runtime/testcase/tstRTFilesystem.cpp b/src/VBox/Runtime/testcase/tstRTFilesystem.cpp index 06494aa3bd8..047ea4e591e 100644 --- a/src/VBox/Runtime/testcase/tstRTFilesystem.cpp +++ b/src/VBox/Runtime/testcase/tstRTFilesystem.cpp @@ -59,10 +59,10 @@ static int tstRTFilesystem(RTTEST hTest, RTVFSFILE hVfsFile) uint32_t cBlocksUnused = 0; uint64_t cbFs = 0; - rc = RTVfsFileGetSize(hVfsFile, &cbFs); + rc = RTVfsFileQuerySize(hVfsFile, &cbFs); if (RT_FAILURE(rc)) { - RTTestIFailed("RTVfsFileGetSize -> %Rrc", rc); + RTTestIFailed("RTVfsFileQuerySize -> %Rrc", rc); return rc; } diff --git a/src/VBox/Runtime/tools/RTLdrCheckImports.cpp b/src/VBox/Runtime/tools/RTLdrCheckImports.cpp index 271ae11c382..c1f655bd92f 100644 --- a/src/VBox/Runtime/tools/RTLdrCheckImports.cpp +++ b/src/VBox/Runtime/tools/RTLdrCheckImports.cpp @@ -276,7 +276,7 @@ static int LoadImportModule(PCRTCHECKIMPORTSOPTS pOpts, PRTCHECKIMPORTMODULE pMo { /* Read it into a memory buffer. */ uint64_t cbFile; - rc = RTVfsFileGetSize(hVfsFile, &cbFile); + rc = RTVfsFileQuerySize(hVfsFile, &cbFile); if (RT_SUCCESS(rc)) { if (cbFile < _4M) @@ -374,7 +374,7 @@ static int LoadImportModule(PCRTCHECKIMPORTSOPTS pOpts, PRTCHECKIMPORTMODULE pMo pszImage, szPath, cbFile); } else - RTMsgError("%s: %s: RTVfsFileGetSize failed on export file: %Rrc", pszImage, szPath, rc); + RTMsgError("%s: %s: RTVfsFileQuerySize failed on export file: %Rrc", pszImage, szPath, rc); RTVfsFileRelease(hVfsFile); return rc; } diff --git a/src/VBox/Runtime/tools/RTSignTool.cpp b/src/VBox/Runtime/tools/RTSignTool.cpp index d04c6d2f64b..4327b6b4904 100644 --- a/src/VBox/Runtime/tools/RTSignTool.cpp +++ b/src/VBox/Runtime/tools/RTSignTool.cpp @@ -780,7 +780,7 @@ static RTEXITCODE SignToolPkcs7Exe_WriteSignatureToFile(PSIGNTOOLPKCS7EXE pThis, */ uint32_t const cbWinCert = RT_UOFFSETOF(WIN_CERTIFICATE, bCertificate); uint64_t offCur = 0; - rc = RTFileGetSize(hFile, &offCur); + rc = RTFileQuerySize(hFile, &offCur); if ( RT_SUCCESS(rc) && offCur < _2G) { @@ -859,7 +859,7 @@ static RTEXITCODE SignToolPkcs7Exe_WriteSignatureToFile(PSIGNTOOLPKCS7EXE pThis, else if (RT_SUCCESS(rc)) RTMsgError("File to big: %'RU64 bytes", offCur); else - RTMsgError("RTFileGetSize failed: %Rrc", rc); + RTMsgError("RTFileQuerySize failed: %Rrc", rc); } } else if (RT_SUCCESS(rc)) diff --git a/src/VBox/Storage/DMG.cpp b/src/VBox/Storage/DMG.cpp index 39eea734bbf..b87315bd80c 100644 --- a/src/VBox/Storage/DMG.cpp +++ b/src/VBox/Storage/DMG.cpp @@ -501,7 +501,7 @@ static int dmgWrapFileReadUser(PDMGIMAGE pThis, RTFOFF off, PVDIOCTX pIoCtx, siz } /** - * vdIfIoIntFileGetSize / RTVfsFileGetSize wrapper. + * vdIfIoIntFileGetSize / RTVfsFileQuerySize wrapper. */ static int dmgWrapFileGetSize(PDMGIMAGE pThis, uint64_t *pcbFile) { @@ -509,7 +509,7 @@ static int dmgWrapFileGetSize(PDMGIMAGE pThis, uint64_t *pcbFile) if (pThis->hDmgFileInXar == NIL_RTVFSFILE) rc = vdIfIoIntFileGetSize(pThis->pIfIoXxx, pThis->pStorage, pcbFile); else - rc = RTVfsFileGetSize(pThis->hDmgFileInXar, pcbFile); + rc = RTVfsFileQuerySize(pThis->hDmgFileInXar, pcbFile); return rc; } @@ -1787,7 +1787,7 @@ static DECLCALLBACK(int) dmgProbe(const char *pszFilename, PVDINTERFACE pVDIfsDi if (hDmgFileInXar == NIL_RTVFSFILE) rc = vdIfIoIntFileGetSize(pIfIo, pStorage, &cbFile); else - rc = RTVfsFileGetSize(hDmgFileInXar, &cbFile); + rc = RTVfsFileQuerySize(hDmgFileInXar, &cbFile); if ( RT_SUCCESS(rc) && cbFile >= sizeof(DMGUDIF)) { diff --git a/src/VBox/Storage/VD.cpp b/src/VBox/Storage/VD.cpp index a38b436c44e..e1aff60efb7 100644 --- a/src/VBox/Storage/VD.cpp +++ b/src/VBox/Storage/VD.cpp @@ -3249,7 +3249,7 @@ static DECLCALLBACK(int) vdIOGetSizeFallback(void *pvUser, void *pvStorage, uint RT_NOREF1(pvUser); PVDIIOFALLBACKSTORAGE pStorage = (PVDIIOFALLBACKSTORAGE)pvStorage; - return RTFileGetSize(pStorage->File, pcbSize); + return RTFileQuerySize(pStorage->File, pcbSize); } /** diff --git a/src/VBox/Storage/VISO.cpp b/src/VBox/Storage/VISO.cpp index f9dc9b08ca5..9907fe2680f 100644 --- a/src/VBox/Storage/VISO.cpp +++ b/src/VBox/Storage/VISO.cpp @@ -343,7 +343,7 @@ static int visoOpenWorker(PVISOIMAGE pThis) if (RT_SUCCESS(rc)) { uint64_t cbImage; - rc = RTVfsFileGetSize(hVfsFile, &cbImage); + rc = RTVfsFileQuerySize(hVfsFile, &cbImage); if (RT_SUCCESS(rc)) { /* diff --git a/src/VBox/Storage/testcase/VDIoBackend.cpp b/src/VBox/Storage/testcase/VDIoBackend.cpp index 23aede2ffe6..a79fcd2afc9 100644 --- a/src/VBox/Storage/testcase/VDIoBackend.cpp +++ b/src/VBox/Storage/testcase/VDIoBackend.cpp @@ -221,7 +221,7 @@ int VDIoBackendStorageGetSize(PVDIOSTORAGE pIoStorage, uint64_t *pcbSize) rc = VDMemDiskGetSize(pIoStorage->u.pMemDisk, pcbSize); } else - rc = RTFileGetSize(pIoStorage->u.hFile, pcbSize); + rc = RTFileQuerySize(pIoStorage->u.hFile, pcbSize); return rc; } diff --git a/src/VBox/Storage/testcase/tstVDIo.cpp b/src/VBox/Storage/testcase/tstVDIo.cpp index 112f2e4ee7e..c3682a0bf75 100644 --- a/src/VBox/Storage/testcase/tstVDIo.cpp +++ b/src/VBox/Storage/testcase/tstVDIo.cpp @@ -1668,7 +1668,7 @@ static DECLCALLBACK(int) vdScriptHandlerIoPatternCreateFromFile(PVDSCRIPTARG paS rc = RTFileOpen(&hFile, pcszFile, RTFILE_O_DENY_NONE | RTFILE_O_OPEN | RTFILE_O_READ); if (RT_SUCCESS(rc)) { - rc = RTFileGetSize(hFile, &cbPattern); + rc = RTFileQuerySize(hFile, &cbPattern); if (RT_SUCCESS(rc)) { pPattern = tstVDIoPatternCreate(pcszName, (size_t)cbPattern); diff --git a/src/VBox/VMM/VMMR3/PDMAsyncCompletionFile.cpp b/src/VBox/VMM/VMMR3/PDMAsyncCompletionFile.cpp index aa708521fa0..8c8adbf3e19 100644 --- a/src/VBox/VMM/VMMR3/PDMAsyncCompletionFile.cpp +++ b/src/VBox/VMM/VMMR3/PDMAsyncCompletionFile.cpp @@ -949,7 +949,7 @@ static DECLCALLBACK(int) pdmacFileEpInitialize(PPDMASYNCCOMPLETIONENDPOINT pEndp { uint64_t cbSize; - rc = RTFileGetSize(hFile, &cbSize); + rc = RTFileQuerySize(hFile, &cbSize); if (RT_SUCCESS(rc) && ((cbSize % 512) == 0)) fFileFlags |= RTFILE_O_NO_CACHE; @@ -1007,7 +1007,7 @@ static DECLCALLBACK(int) pdmacFileEpInitialize(PPDMASYNCCOMPLETIONENDPOINT pEndp { pEpFile->fFlags = fFileFlags; - rc = RTFileGetSize(pEpFile->hFile, (uint64_t *)&pEpFile->cbFile); + rc = RTFileQuerySize(pEpFile->hFile, (uint64_t *)&pEpFile->cbFile); if (RT_SUCCESS(rc)) { /* Initialize the segment cache */ diff --git a/src/VBox/VMM/VMMR3/SSM.cpp b/src/VBox/VMM/VMMR3/SSM.cpp index 50e46516f9c..7e9c6a666da 100644 --- a/src/VBox/VMM/VMMR3/SSM.cpp +++ b/src/VBox/VMM/VMMR3/SSM.cpp @@ -2002,7 +2002,7 @@ static DECLCALLBACK(uint64_t) ssmR3FileTell(void *pvUser) */ static DECLCALLBACK(int) ssmR3FileSize(void *pvUser, uint64_t *pcb) { - return RTFileGetSize((RTFILE)(uintptr_t)pvUser, pcb); + return RTFileQuerySize((RTFILE)(uintptr_t)pvUser, pcb); } diff --git a/src/VBox/VMM/testcase/tstAnimate.cpp b/src/VBox/VMM/testcase/tstAnimate.cpp index 5dfa4956caa..335d1d9320d 100644 --- a/src/VBox/VMM/testcase/tstAnimate.cpp +++ b/src/VBox/VMM/testcase/tstAnimate.cpp @@ -196,7 +196,7 @@ static DECLCALLBACK(int) scriptRun(PVM pVM, RTFILE File) { RTPrintf("info: running script...\n"); uint64_t cb; - int rc = RTFileGetSize(File, &cb); + int rc = RTFileQuerySize(File, &cb); if (RT_SUCCESS(rc)) { if (cb == 0) @@ -803,7 +803,7 @@ extern "C" DECLEXPORT(int) TrustedMain(int argc, char **argv, char **envp) { if (FileRawMem != NIL_RTFILE) { - rc = RTFileGetSize(FileRawMem, &cbMem); + rc = RTFileQuerySize(FileRawMem, &cbMem); AssertReleaseRC(rc); cbMem -= offRawMem; cbMem &= ~(PAGE_SIZE - 1); diff --git a/src/VBox/ValidationKit/tests/unittests/tdUnitTest1.py b/src/VBox/ValidationKit/tests/unittests/tdUnitTest1.py index b40c7400e42..4019950796f 100755 --- a/src/VBox/ValidationKit/tests/unittests/tdUnitTest1.py +++ b/src/VBox/ValidationKit/tests/unittests/tdUnitTest1.py @@ -73,7 +73,7 @@ class tdUnitTest1(vbox.TestDriver): 'testcase/tstRTR0MemUserKernelDriver': '', # Failes when kernel to kernel buffers. 'testcase/tstRTSemRW': '', # line 338: RTSemRWReleaseRead(hSemRW): got VERR_ACCESS_DENIED 'testcase/tstRTStrAlloc': '', # VERR_NO_STR_MEMORY! - 'testcase/tstRTFileGetSize-1': '', # VERR_DEV_IO_ERROR on /dev/null! + 'testcase/tstRTFileQuerySize-1': '', # VERR_DEV_IO_ERROR on /dev/null! }, 'solaris.amd64': { 'testcase/tstLdr-4': '', # failed: Failed to get bits for '/home/vbox/test/tmp/bin/testcase/tstLdrObjR0.r0'/0, diff --git a/src/VBox/ValidationKit/utils/fs/FsPerf.cpp b/src/VBox/ValidationKit/utils/fs/FsPerf.cpp index acb2a75a027..6ac77a73b22 100644 --- a/src/VBox/ValidationKit/utils/fs/FsPerf.cpp +++ b/src/VBox/ValidationKit/utils/fs/FsPerf.cpp @@ -3413,7 +3413,7 @@ void fsPerfChSize(void) RTTESTI_CHECK_RC_RETV(RTFileOpen(&hFile1, InDir(RT_STR_TUPLE("file20")), RTFILE_O_CREATE_REPLACE | RTFILE_O_DENY_NONE | RTFILE_O_READWRITE), VINF_SUCCESS); uint64_t cbFile = UINT64_MAX; - RTTESTI_CHECK_RC(RTFileGetSize(hFile1, &cbFile), VINF_SUCCESS); + RTTESTI_CHECK_RC(RTFileQuerySize(hFile1, &cbFile), VINF_SUCCESS); RTTESTI_CHECK(cbFile == 0); uint8_t abBuf[4096]; @@ -3430,7 +3430,7 @@ void fsPerfChSize(void) continue; RTTESTI_CHECK_RC(RTFileSetSize(hFile1, cbNew), VINF_SUCCESS); - RTTESTI_CHECK_RC(RTFileGetSize(hFile1, &cbFile), VINF_SUCCESS); + RTTESTI_CHECK_RC(RTFileQuerySize(hFile1, &cbFile), VINF_SUCCESS); RTTESTI_CHECK_MSG(cbFile == cbNew, ("cbFile=%#RX64 cbNew=%#RX64\n", cbFile, cbNew)); if (cbNew > cbOld) @@ -6195,7 +6195,7 @@ static void fsPerfRemote(void) RTTESTI_CHECK_RC(FsPerfCommsSend("writepattern 0 8000 0 1000" FSPERF_EOF_STR), VINF_SUCCESS); RTTESTI_CHECK_RC(RTFileSetSize(hFile0, 8000), VINF_SUCCESS); uint64_t cbFile = 0; - RTTESTI_CHECK_RC(RTFileGetSize(hFile0, &cbFile), VINF_SUCCESS); + RTTESTI_CHECK_RC(RTFileQuerySize(hFile0, &cbFile), VINF_SUCCESS); RTTESTI_CHECK_MSG(cbFile == 8000, ("cbFile=%u\n", cbFile)); RTTESTI_CHECK_RC(RTFileRead(hFile0, abBuf, 1, NULL), VERR_EOF); @@ -6206,7 +6206,7 @@ static void fsPerfRemote(void) RTTESTI_CHECK_RC(FsPerfCommsSend("writepattern 0 5000 0 1000" FSPERF_EOF_STR), VINF_SUCCESS); RTTESTI_CHECK_RC(RTFileSetSize(hFile0, 5000), VINF_SUCCESS); RTTESTI_CHECK_RC(RTFileRead(hFile0, abBuf, 1, NULL), VERR_EOF); - RTTESTI_CHECK_RC(RTFileGetSize(hFile0, &cbFile), VINF_SUCCESS); + RTTESTI_CHECK_RC(RTFileQuerySize(hFile0, &cbFile), VINF_SUCCESS); RTTESTI_CHECK_MSG(cbFile == 5000, ("cbFile=%u\n", cbFile)); /* Same, but host truncates rather than adding stuff. */ @@ -6214,7 +6214,7 @@ static void fsPerfRemote(void) RTTESTI_CHECK_RC(RTFileWrite(hFile0, abBuf, 16384, NULL), VINF_SUCCESS); RTTESTI_CHECK_RC(RTFileSetSize(hFile0, 10000), VINF_SUCCESS); RTTESTI_CHECK_RC(FsPerfCommsSend("truncate 0 4000" FSPERF_EOF_STR), VINF_SUCCESS); - RTTESTI_CHECK_RC(RTFileGetSize(hFile0, &cbFile), VINF_SUCCESS); + RTTESTI_CHECK_RC(RTFileQuerySize(hFile0, &cbFile), VINF_SUCCESS); RTTESTI_CHECK_MSG(cbFile == 4000, ("cbFile=%u\n", cbFile)); RTTESTI_CHECK_RC(RTFileRead(hFile0, abBuf, 1, NULL), VERR_EOF); -- cgit v1.2.1