VirtualBox

Changeset 96861 in vbox for trunk/src/VBox/Runtime/common


Ignore:
Timestamp:
Sep 26, 2022 10:52:54 AM (2 years ago)
Author:
vboxsync
Message:

IPRT/Vfs,Main/Unattended: Detect fedora ISOs, various code cleanups. Added a parameter to RTVfsQueryLabel so we can get the primary volume ID of an ISO (required for fedora ISOs, as the joliet version is truncated). bugref:9781

Location:
trunk/src/VBox/Runtime/common
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Runtime/common/fs/isovfs.cpp

    r96407 r96861  
    50605060    {
    50615061        case RTVFSQIEX_VOL_LABEL:
    5062         {
    5063             if (pThis->enmType == RTFSISOVOLTYPE_UDF)
     5062        case RTVFSQIEX_VOL_LABEL_ALT:
     5063        {
     5064            if (pThis->enmType == RTFSISOVOLTYPE_UDF
     5065                && (   enmInfo == RTVFSQIEX_VOL_LABEL
     5066                    || pThis->offPrimaryVolDesc == 0))
    50645067                return rtFsIsoVol_ReturnUdfDString(pThis->Udf.VolInfo.achLogicalVolumeID,
    50655068                                                   sizeof(pThis->Udf.VolInfo.achLogicalVolumeID), pvInfo, cbInfo, pcbRet);
     5069
     5070            bool const fPrimary = enmInfo == RTVFSQIEX_VOL_LABEL_ALT
     5071                               || pThis->enmType == RTFSISOVOLTYPE_ISO9960;
     5072
    50665073            int rc = RTVfsFileReadAt(pThis->hVfsBacking,
    5067                                      pThis->enmType == RTFSISOVOLTYPE_ISO9960
    5068                                      ? pThis->offPrimaryVolDesc : pThis->offSecondaryVolDesc,
     5074                                     fPrimary ? pThis->offPrimaryVolDesc : pThis->offSecondaryVolDesc,
    50695075                                     uBuf.ab, RT_MAX(RT_MIN(pThis->cbSector, sizeof(uBuf)), sizeof(uBuf.PriVolDesc)), NULL);
    50705076            AssertRCReturn(rc, rc);
    5071             switch (enmInfo)
    5072             {
    5073                 case RTVFSQIEX_VOL_LABEL:
    5074                     if (pThis->enmType == RTFSISOVOLTYPE_ISO9960)
    5075                         return rtFsIsoVol_ReturnIso9660DString(uBuf.PriVolDesc.achVolumeId, sizeof(uBuf.PriVolDesc.achVolumeId),
    5076                                                                pvInfo, cbInfo, pcbRet);
    5077                     return rtFsIsoVol_ReturnIso9660D1String(uBuf.SupVolDesc.achVolumeId, sizeof(uBuf.SupVolDesc.achVolumeId),
    5078                                                             pvInfo, cbInfo, pcbRet);
    5079                 default:
    5080                     AssertFailedReturn(VERR_INTERNAL_ERROR);
    5081             }
    5082             break;
     5077
     5078            if (fPrimary)
     5079                return rtFsIsoVol_ReturnIso9660DString(uBuf.PriVolDesc.achVolumeId, sizeof(uBuf.PriVolDesc.achVolumeId),
     5080                                                       pvInfo, cbInfo, pcbRet);
     5081            return rtFsIsoVol_ReturnIso9660D1String(uBuf.SupVolDesc.achVolumeId, sizeof(uBuf.SupVolDesc.achVolumeId),
     5082                                                    pvInfo, cbInfo, pcbRet);
    50835083        }
    50845084
  • trunk/src/VBox/Runtime/common/vfs/vfsbase.cpp

    r96407 r96861  
    23192319
    23202320
    2321 RTDECL(int) RTVfsQueryLabel(RTVFS hVfs, char *pszLabel, size_t cbLabel, size_t *pcbActual)
     2321RTDECL(int) RTVfsQueryLabel(RTVFS hVfs, bool fAlternative, char *pszLabel, size_t cbLabel, size_t *pcbActual)
    23222322{
    23232323    RTVFSINTERNAL *pThis = hVfs;
     
    23362336
    23372337        RTVfsLockAcquireRead(pThis->Base.hLock);
    2338         rc = pThis->pOps->Obj.pfnQueryInfoEx(pThis->Base.pvThis, RTVFSQIEX_VOL_LABEL, pszLabel, cbLabel, pcbActual);
     2338        rc = pThis->pOps->Obj.pfnQueryInfoEx(pThis->Base.pvThis, !fAlternative ? RTVFSQIEX_VOL_LABEL : RTVFSQIEX_VOL_LABEL_ALT,
     2339                                             pszLabel, cbLabel, pcbActual);
    23392340        RTVfsLockReleaseRead(pThis->Base.hLock);
    23402341    }
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