VirtualBox

Changeset 73592 in vbox for trunk/src/VBox


Ignore:
Timestamp:
Aug 9, 2018 4:05:17 PM (7 years ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
124233
Message:

FE/Qt: bugref:6596 Don't check medium size in FAT file systems if the medium is split into 2GB parts

Location:
trunk/src/VBox/Frontends/VirtualBox/src
Files:
6 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Frontends/VirtualBox/src/globals/UIMessageCenter.cpp

    r73586 r73592  
    16901690void UIMessageCenter::cannotCreateHardDiskStorageInFAT(const QString &strLocation, QWidget *pParent /* = 0 */) const
    16911691{
    1692     error(pParent, MessageType_Error,
     1692    alert(pParent, MessageType_Info,
    16931693          tr("Failed to create the hard disk storage <nobr><b>%1</b>.</nobr> FAT file systems has 4GB (minus some overhead) size limit")
    1694           .arg(strLocation), QString());
     1694          .arg(strLocation));
    16951695}
    16961696
  • trunk/src/VBox/Frontends/VirtualBox/src/wizards/newvd/UIWizardNewVD.cpp

    r73586 r73592  
    3838#endif /* !VBOX_WITH_PRECOMPILED_HEADERS */
    3939
     40/* Other VBox includes: */
     41#include <iprt/cdefs.h>
     42#include <iprt/path.h>
    4043
    4144UIWizardNewVD::UIWizardNewVD(QWidget *pParent,
     
    115118}
    116119
     120bool UIWizardNewVD::checkFATSizeLimitation()
     121{
     122    qulonglong uVariant = field("mediumVariant").toULongLong();
     123    /* If the hard disk is split into 2GB parts then no need to make further checks: */
     124    if (uVariant & KMediumVariant_VmdkSplit2G)
     125        return true;
     126
     127    QString strMediumPath = field("mediumPath").toString();
     128    qulonglong uSize = field("mediumSize").toULongLong();
     129
     130    RTFSTYPE enmType;
     131    int rc = RTFsQueryType(QFileInfo(strMediumPath).absolutePath().toLatin1().constData(), &enmType);
     132    if (RT_SUCCESS(rc))
     133    {
     134        if (enmType == RTFSTYPE_FAT)
     135        {
     136            /* Limit the medium size to 4GB. minus 128 MB for file overhead: */
     137            qulonglong fatLimit = _4G - _128M;
     138            if (uSize >= fatLimit)
     139                return false;
     140        }
     141    }
     142    return true;
     143}
     144
    117145void UIWizardNewVD::retranslateUi()
    118146{
  • trunk/src/VBox/Frontends/VirtualBox/src/wizards/newvd/UIWizardNewVD.h

    r72021 r73592  
    6464    bool createVirtualDisk();
    6565
     66    /* Checks if the medium file is bigger than what is allowed in FAT file systems. */
     67    bool checkFATSizeLimitation();
     68
    6669    /* Who will be able to create virtual-disk: */
    6770    friend class UIWizardNewVDPageBasic3;
  • trunk/src/VBox/Frontends/VirtualBox/src/wizards/newvd/UIWizardNewVDPageBasic3.cpp

    r73591 r73592  
    4747
    4848#endif /* !VBOX_WITH_PRECOMPILED_HEADERS */
    49 
    50 /* Other VBox includes: */
    51 #include <iprt/cdefs.h>
    52 #include <iprt/path.h>
    5349
    5450UIWizardNewVDPage3::UIWizardNewVDPage3(const QString &strDefaultName, const QString &strDefaultPath)
     
    262258    fResult = !QFileInfo(strMediumPath).exists();
    263259    if (!fResult)
     260    {
    264261        msgCenter().cannotOverwriteHardDiskStorage(strMediumPath, this);
    265 
    266     if (fResult)
    267         fResult = checkFATSizeLimitation();
    268 
     262        return fResult;
     263    }
     264
     265    fResult = qobject_cast<UIWizardNewVD*>(wizard())->checkFATSizeLimitation();
    269266    if (!fResult)
     267    {
    270268        msgCenter().cannotCreateHardDiskStorageInFAT(strMediumPath, this);
    271     else
    272     {
    273         /* Lock finish button: */
    274         startProcessing();
    275 
    276         /* Try to create virtual hard drive file: */
    277         fResult = qobject_cast<UIWizardNewVD*>(wizard())->createVirtualDisk();
    278         /* Unlock finish button: */
    279         endProcessing();
    280     }
     269        return fResult;
     270    }
     271
     272    /* Lock finish button: */
     273    startProcessing();
     274
     275    /* Try to create virtual hard drive file: */
     276    fResult = qobject_cast<UIWizardNewVD*>(wizard())->createVirtualDisk();
     277    /* Unlock finish button: */
     278    endProcessing();
    281279
    282280    /* Return result: */
    283281    return fResult;
    284282}
    285 
    286 bool UIWizardNewVDPage3::checkFATSizeLimitation()
    287 {
    288     QString strMediumPath(mediumPath());
    289     RTFSTYPE enmType;
    290     int rc = RTFsQueryType(QFileInfo(strMediumPath).absolutePath().toLatin1().constData(), &enmType);
    291     if (RT_SUCCESS(rc))
    292     {
    293         if (enmType == RTFSTYPE_FAT)
    294         {
    295             /* Limit the medium size to 4GB. minus 128 MB for file overhead: */
    296             qulonglong fatLimit = _4G - _128M;
    297             if (mediumSize() >= fatLimit)
    298                 return false;
    299         }
    300     }
    301     return true;
    302 }
  • trunk/src/VBox/Frontends/VirtualBox/src/wizards/newvd/UIWizardNewVDPageBasic3.h

    r73586 r73592  
    4545    static QString absoluteFilePath(const QString &strFileName, const QString &strDefaultPath);
    4646    static QString defaultExtension(const CMediumFormat &mediumFormatRef);
    47 
    48     /* Checks if the medium file is bigger than what is allowed in FAT file systems. */
    49     bool checkFATSizeLimitation();
    5047
    5148    /* Stuff for 'mediumPath' field: */
  • trunk/src/VBox/Frontends/VirtualBox/src/wizards/newvd/UIWizardNewVDPageExpert.cpp

    r73586 r73592  
    260260    bool fResult = true;
    261261
    262     /* Lock finish button: */
    263     startProcessing();
    264 
    265262    /* Make sure such virtual-disk doesn't exists: */
    266263    QString strMediumPath(mediumPath());
    267264    fResult = !QFileInfo(strMediumPath).exists();
    268265    if (!fResult)
     266    {
    269267        msgCenter().cannotOverwriteHardDiskStorage(strMediumPath, this);
    270 
    271     if (fResult)
    272         fResult = checkFATSizeLimitation();
    273 
     268        return fResult;
     269    }
     270
     271    fResult = qobject_cast<UIWizardNewVD*>(wizard())->checkFATSizeLimitation();
    274272    if (!fResult)
     273    {
    275274        msgCenter().cannotCreateHardDiskStorageInFAT(strMediumPath, this);
     275        return fResult;
     276    }
     277
     278    /* Lock finish button: */
     279    startProcessing();
    276280
    277281    /* Try to create virtual-disk: */
    278     if (fResult)
    279         fResult = qobject_cast<UIWizardNewVD*>(wizard())->createVirtualDisk();
     282    fResult = qobject_cast<UIWizardNewVD*>(wizard())->createVirtualDisk();
    280283
    281284    /* Unlock finish button: */
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