VirtualBox

Ignore:
Timestamp:
Dec 12, 2008 1:50:32 PM (16 years ago)
Author:
vboxsync
Message:

Storage: Eradicated the last bits using the old VDI only backend, keeping only the testcases for now (no longer built).

Completely removed old iSCSI driver.

Added intnet option to addiscsidisk and adjusted documentation.

Made backend name comparisons case-insensitive.

Detect VMDK files not according to VMDK 1.0 and reject with clear error message.

Changed format probing logic to not fall through to the "unsupported" case if it's a known format, i.e. has valid header.

VBoxManage converthd generic format converter made official.

Added format flag to VBoxManage createhd, allows creating VMDK files.

VBoxManage convertdd reimplemented based on new framework, supporting any image format.

VBoxManage internalcommands sethduuid reimplemented based on new framework, supporting any image format.

Cleaned up error codes.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Devices/Storage/VDIHDDCore.cpp

    r14967 r15366  
    117117{
    118118    if (pPreHdr->u32Signature != VDI_IMAGE_SIGNATURE)
    119         return VERR_VDI_INVALID_SIGNATURE;
     119        return VERR_VD_VDI_INVALID_SIGNATURE;
    120120
    121121    if (    VDI_GET_VERSION_MAJOR(pPreHdr->u32Version) != VDI_IMAGE_VERSION_MAJOR
    122122        &&  pPreHdr->u32Version != 0x00000002)    /* old version. */
    123         return VERR_VDI_UNSUPPORTED_VERSION;
     123        return VERR_VD_VDI_UNSUPPORTED_VERSION;
    124124
    125125    return VINF_SUCCESS;
     
    246246                LogRel(("VDI: v1 header size wrong (%d < %d)\n",
    247247                       pHeader->u.v1.cbHeader, sizeof(VDIHEADER1)));
    248                 return VERR_VDI_INVALID_HEADER;
     248                return VERR_VD_VDI_INVALID_HEADER;
    249249            }
    250250
     
    253253                LogRel(("VDI: v1 blocks offset wrong (%d < %d)\n",
    254254                       getImageBlocksOffset(pHeader), sizeof(VDIPREHEADER) + sizeof(VDIHEADER1)));
    255                 return VERR_VDI_INVALID_HEADER;
     255                return VERR_VD_VDI_INVALID_HEADER;
    256256            }
    257257
     
    260260                LogRel(("VDI: v1 image data offset wrong (%d < %d)\n",
    261261                       getImageDataOffset(pHeader), getImageBlocksOffset(pHeader) + getImageBlocks(pHeader) * sizeof(VDIIMAGEBLOCKPOINTER)));
    262                 return VERR_VDI_INVALID_HEADER;
     262                return VERR_VD_VDI_INVALID_HEADER;
    263263            }
    264264
     
    267267        default:
    268268            /* Unsupported. */
    269             return VERR_VDI_UNSUPPORTED_VERSION;
     269            return VERR_VD_VDI_UNSUPPORTED_VERSION;
    270270    }
    271271
     
    342342    }
    343343
    344     return fFailed ? VERR_VDI_INVALID_HEADER : VINF_SUCCESS;
     344    return fFailed ? VERR_VD_VDI_INVALID_HEADER : VINF_SUCCESS;
    345345}
    346346
     
    381381        && strlen(pszComment) >= VDI_IMAGE_COMMENT_SIZE)
    382382    {
    383         rc = vdiError(pImage, VERR_VDI_COMMENT_TOO_LONG, RT_SRC_POS, N_("VDI: comment is too long for '%s'"), pImage->pszFilename);
     383        rc = vdiError(pImage, VERR_VD_VDI_COMMENT_TOO_LONG, RT_SRC_POS, N_("VDI: comment is too long for '%s'"), pImage->pszFilename);
    384384        goto out;
    385385    }
     
    656656            break;
    657657        default:
    658             rc = vdiError(pImage, VERR_VDI_UNSUPPORTED_VERSION, RT_SRC_POS, N_("VDI: unsupported major version %u in '%s'"), GET_MAJOR_HEADER_VERSION(&pImage->Header), pImage->pszFilename);
     658            rc = vdiError(pImage, VERR_VD_VDI_UNSUPPORTED_VERSION, RT_SRC_POS, N_("VDI: unsupported major version %u in '%s'"), GET_MAJOR_HEADER_VERSION(&pImage->Header), pImage->pszFilename);
    659659            goto out;
    660660    }
     
    663663    if (RT_FAILURE(rc))
    664664    {
    665         rc = vdiError(pImage, VERR_VDI_UNSUPPORTED_VERSION, RT_SRC_POS, N_("VDI: invalid header in '%s'"), pImage->pszFilename);
     665        rc = vdiError(pImage, VERR_VD_VDI_INVALID_HEADER, RT_SRC_POS, N_("VDI: invalid header in '%s'"), pImage->pszFilename);
    666666        goto out;
    667667    }
     
    707707            break;
    708708        default:
    709             rc = VERR_VDI_UNSUPPORTED_VERSION;
     709            rc = VERR_VD_VDI_UNSUPPORTED_VERSION;
    710710            break;
    711711    }
     
    10301030
    10311031    if (pImage->paBlocks[uBlock] == VDI_IMAGE_BLOCK_FREE)
    1032         rc = VERR_VDI_BLOCK_FREE;
     1032        rc = VERR_VD_BLOCK_FREE;
    10331033    else if (pImage->paBlocks[uBlock] == VDI_IMAGE_BLOCK_ZERO)
    10341034    {
     
    10691069    if (pImage->uOpenFlags & VD_OPEN_FLAGS_READONLY)
    10701070    {
    1071         rc = VERR_VDI_IMAGE_READ_ONLY;
     1071        rc = VERR_VD_IMAGE_READ_ONLY;
    10721072        goto out;
    10731073    }
     
    11381138            *pcbPreRead = offWrite % getImageBlockSize(&pImage->Header);
    11391139            *pcbPostRead = getImageBlockSize(&pImage->Header) - cbToWrite - *pcbPreRead;
    1140             rc = VERR_VDI_BLOCK_FREE;
     1140            rc = VERR_VD_BLOCK_FREE;
    11411141        }
    11421142    }
     
    12011201        *penmImageType = vdiTranslateTypeVDI2VD(getImageType(&pImage->Header));
    12021202    else
    1203         rc = VERR_VDI_NOT_OPENED;
     1203        rc = VERR_VD_NOT_OPENED;
    12041204
    12051205    LogFlowFunc(("returns %Rrc enmImageType=%u\n", rc, *penmImageType));
     
    12671267        }
    12681268        else
    1269             rc = VERR_VDI_GEOMETRY_NOT_SET;
    1270     }
    1271     else
    1272         rc = VERR_VDI_NOT_OPENED;
     1269            rc = VERR_VD_GEOMETRY_NOT_SET;
     1270    }
     1271    else
     1272        rc = VERR_VD_NOT_OPENED;
    12731273
    12741274    LogFlowFunc(("returns %Rrc (PCHS=%u/%u/%u)\n", rc, pPCHSGeometry->cCylinders, pPCHSGeometry->cHeads, pPCHSGeometry->cSectors));
     
    12901290        if (pImage->uOpenFlags & VD_OPEN_FLAGS_READONLY)
    12911291        {
    1292             rc = VERR_VDI_IMAGE_READ_ONLY;
     1292            rc = VERR_VD_IMAGE_READ_ONLY;
    12931293            goto out;
    12941294        }
     
    12981298    }
    12991299    else
    1300         rc = VERR_VDI_NOT_OPENED;
     1300        rc = VERR_VD_NOT_OPENED;
    13011301
    13021302out:
     
    13321332        }
    13331333        else
    1334             rc = VERR_VDI_GEOMETRY_NOT_SET;
    1335     }
    1336     else
    1337         rc = VERR_VDI_NOT_OPENED;
     1334            rc = VERR_VD_GEOMETRY_NOT_SET;
     1335    }
     1336    else
     1337        rc = VERR_VD_NOT_OPENED;
    13381338
    13391339    LogFlowFunc(("returns %Rrc (LCHS=%u/%u/%u)\n", rc, pLCHSGeometry->cCylinders, pLCHSGeometry->cHeads, pLCHSGeometry->cSectors));
     
    13561356        if (pImage->uOpenFlags & VD_OPEN_FLAGS_READONLY)
    13571357        {
    1358             rc = VERR_VDI_IMAGE_READ_ONLY;
     1358            rc = VERR_VD_IMAGE_READ_ONLY;
    13591359            goto out;
    13601360        }
     
    13741374    }
    13751375    else
    1376         rc = VERR_VDI_NOT_OPENED;
     1376        rc = VERR_VD_NOT_OPENED;
    13771377
    13781378out:
     
    14661466    }
    14671467    else
    1468         rc = VERR_VDI_NOT_OPENED;
     1468        rc = VERR_VD_NOT_OPENED;
    14691469
    14701470    LogFlowFunc(("returns %Rrc comment=\"%s\"\n", rc, pszComment));
     
    14831483    if (pImage->uOpenFlags & VD_OPEN_FLAGS_READONLY)
    14841484    {
    1485         rc = VERR_VDI_IMAGE_READ_ONLY;
     1485        rc = VERR_VD_IMAGE_READ_ONLY;
    14861486        goto out;
    14871487    }
     
    14931493        {
    14941494            LogFunc(("pszComment is too long, %d bytes!\n", cchComment));
    1495             rc = VERR_VDI_COMMENT_TOO_LONG;
     1495            rc = VERR_VD_VDI_COMMENT_TOO_LONG;
    14961496            goto out;
    14971497        }
     
    15101510        }
    15111511        else
    1512             rc = VERR_VDI_UNSUPPORTED_VERSION;
    1513     }
    1514     else
    1515         rc = VERR_VDI_NOT_OPENED;
     1512            rc = VERR_VD_VDI_UNSUPPORTED_VERSION;
     1513    }
     1514    else
     1515        rc = VERR_VD_NOT_OPENED;
    15161516
    15171517out:
     
    15351535    }
    15361536    else
    1537         rc = VERR_VDI_NOT_OPENED;
     1537        rc = VERR_VD_NOT_OPENED;
    15381538
    15391539    LogFlowFunc(("returns %Rrc (%RTuuid)\n", rc, pUuid));
     
    15621562            {
    15631563                LogFunc(("Version is not supported!\n"));
    1564                 rc = VERR_VDI_UNSUPPORTED_VERSION;
     1564                rc = VERR_VD_VDI_UNSUPPORTED_VERSION;
    15651565            }
    15661566        }
    15671567        else
    1568             rc = VERR_VDI_IMAGE_READ_ONLY;
    1569     }
    1570     else
    1571         rc = VERR_VDI_NOT_OPENED;
     1568            rc = VERR_VD_IMAGE_READ_ONLY;
     1569    }
     1570    else
     1571        rc = VERR_VD_NOT_OPENED;
    15721572
    15731573    LogFlowFunc(("returns %Rrc\n", rc));
     
    15901590    }
    15911591    else
    1592         rc = VERR_VDI_NOT_OPENED;
     1592        rc = VERR_VD_NOT_OPENED;
    15931593
    15941594    LogFlowFunc(("returns %Rrc (%RTuuid)\n", rc, pUuid));
     
    16171617            {
    16181618                LogFunc(("Version is not supported!\n"));
    1619                 rc = VERR_VDI_UNSUPPORTED_VERSION;
     1619                rc = VERR_VD_VDI_UNSUPPORTED_VERSION;
    16201620            }
    16211621        }
    16221622        else
    1623             rc = VERR_VDI_IMAGE_READ_ONLY;
    1624     }
    1625     else
    1626         rc = VERR_VDI_NOT_OPENED;
     1623            rc = VERR_VD_IMAGE_READ_ONLY;
     1624    }
     1625    else
     1626        rc = VERR_VD_NOT_OPENED;
    16271627
    16281628    LogFlowFunc(("returns %Rrc\n", rc));
     
    16451645    }
    16461646    else
    1647         rc = VERR_VDI_NOT_OPENED;
     1647        rc = VERR_VD_NOT_OPENED;
    16481648
    16491649    LogFlowFunc(("returns %Rrc (%RTuuid)\n", rc, pUuid));
     
    16721672            {
    16731673                LogFunc(("Version is not supported!\n"));
    1674                 rc = VERR_VDI_UNSUPPORTED_VERSION;
     1674                rc = VERR_VD_VDI_UNSUPPORTED_VERSION;
    16751675            }
    16761676        }
    16771677        else
    1678             rc = VERR_VDI_IMAGE_READ_ONLY;
    1679     }
    1680     else
    1681         rc = VERR_VDI_NOT_OPENED;
     1678            rc = VERR_VD_IMAGE_READ_ONLY;
     1679    }
     1680    else
     1681        rc = VERR_VD_NOT_OPENED;
    16821682
    16831683    LogFlowFunc(("returns %Rrc\n", rc));
     
    17001700    }
    17011701    else
    1702         rc = VERR_VDI_NOT_OPENED;
     1702        rc = VERR_VD_NOT_OPENED;
    17031703
    17041704    LogFlowFunc(("returns %Rrc (%RTuuid)\n", rc, pUuid));
     
    17241724            {
    17251725                LogFunc(("Version is not supported!\n"));
    1726                 rc = VERR_VDI_UNSUPPORTED_VERSION;
     1726                rc = VERR_VD_VDI_UNSUPPORTED_VERSION;
    17271727            }
    17281728        }
    17291729        else
    1730             rc = VERR_VDI_IMAGE_READ_ONLY;
    1731     }
    1732     else
    1733         rc = VERR_VDI_NOT_OPENED;
     1730            rc = VERR_VD_IMAGE_READ_ONLY;
     1731    }
     1732    else
     1733        rc = VERR_VD_NOT_OPENED;
    17341734
    17351735    LogFlowFunc(("returns %Rrc\n", rc));
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