VirtualBox

Changeset 63827 in vbox


Ignore:
Timestamp:
Sep 14, 2016 9:36:03 AM (8 years ago)
Author:
vboxsync
Message:

Storage/iSCSI: Cleanup (part 1, the easy stuff)

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Storage/ISCSI.cpp

    r63802 r63827  
    50815081    PISCSIIMAGE pImage = (PISCSIIMAGE)pBackendData;
    50825082
    5083     Assert(pImage);
    5084     NOREF(pImage);
     5083    AssertPtr(pImage);
     5084    RT_NOREF1(pImage);
    50855085
    50865086    return 0;
     
    50935093    PISCSIIMAGE pImage = (PISCSIIMAGE)pBackendData;
    50945094
    5095     Assert(pImage);
    5096 
    5097     if (pImage)
    5098         return pImage->cbSector;
    5099     else
    5100         return 0;
     5095    AssertPtrReturn(pImage, 0);
     5096
     5097    return pImage->cbSector;
    51015098}
    51025099
     
    51075104    PISCSIIMAGE pImage = (PISCSIIMAGE)pBackendData;
    51085105
    5109     Assert(pImage);
    5110 
    5111     if (pImage)
    5112         return pImage->cbSize;
    5113     else
    5114         return 0;
     5106    AssertPtrReturn(pImage, 0);
     5107
     5108    return pImage->cbSize;
    51155109}
    51165110
     
    51215115    PISCSIIMAGE pImage = (PISCSIIMAGE)pBackendData;
    51225116
    5123     Assert(pImage);
    5124     NOREF(pImage);
    5125 
    5126     if (pImage)
    5127         return pImage->cbSize;
    5128     else
    5129         return 0;
     5117    AssertPtrReturn(pImage, 0);
     5118
     5119    return pImage->cbSize;
    51305120}
    51315121
     
    51365126    LogFlowFunc(("pBackendData=%#p pPCHSGeometry=%#p\n", pBackendData, pPCHSGeometry));
    51375127    PISCSIIMAGE pImage = (PISCSIIMAGE)pBackendData;
    5138     int rc;
    5139 
    5140     Assert(pImage);
    5141 
    5142     if (pImage)
    5143         rc = VERR_VD_GEOMETRY_NOT_SET;
    5144     else
    5145         rc = VERR_VD_NOT_OPENED;
    5146 
    5147     LogFlowFunc(("returns %Rrc (PCHS=%u/%u/%u)\n", rc, pPCHSGeometry->cCylinders, pPCHSGeometry->cHeads, pPCHSGeometry->cSectors));
    5148     return rc;
     5128
     5129    AssertPtrReturn(pImage, VERR_VD_NOT_OPENED);
     5130
     5131    LogFlowFunc(("returns %Rrc (PCHS=%u/%u/%u)\n", VERR_VD_GEOMETRY_NOT_SET,
     5132                 pPCHSGeometry->cCylinders, pPCHSGeometry->cHeads, pPCHSGeometry->cSectors));
     5133    return VERR_VD_GEOMETRY_NOT_SET;
    51495134}
    51505135
     
    51555140    LogFlowFunc(("pBackendData=%#p pPCHSGeometry=%#p PCHS=%u/%u/%u\n", pBackendData, pPCHSGeometry, pPCHSGeometry->cCylinders, pPCHSGeometry->cHeads, pPCHSGeometry->cSectors));
    51565141    PISCSIIMAGE pImage = (PISCSIIMAGE)pBackendData;
     5142
     5143    AssertPtrReturn(pImage, VERR_VD_NOT_OPENED);
     5144
    51575145    int rc;
    5158 
    5159     Assert(pImage);
    5160 
    5161     if (pImage)
    5162     {
    5163         if (pImage->uOpenFlags & VD_OPEN_FLAGS_READONLY)
    5164         {
    5165             rc = VERR_VD_IMAGE_READ_ONLY;
    5166             goto out;
    5167         }
     5146    if (pImage->uOpenFlags & VD_OPEN_FLAGS_READONLY)
     5147        rc = VERR_VD_IMAGE_READ_ONLY;
     5148    else
    51685149        rc = VERR_VD_GEOMETRY_NOT_SET;
    5169     }
    5170     else
    5171         rc = VERR_VD_NOT_OPENED;
    5172 
    5173 out:
     5150
    51745151    LogFlowFunc(("returns %Rrc\n", rc));
    51755152    return rc;
     
    51825159    LogFlowFunc(("pBackendData=%#p pLCHSGeometry=%#p\n", pBackendData, pLCHSGeometry));
    51835160    PISCSIIMAGE pImage = (PISCSIIMAGE)pBackendData;
    5184     int rc;
    5185 
    5186     Assert(pImage);
    5187 
    5188     if (pImage)
    5189         rc = VERR_VD_GEOMETRY_NOT_SET;
    5190     else
    5191         rc = VERR_VD_NOT_OPENED;
    5192 
    5193     LogFlowFunc(("returns %Rrc (LCHS=%u/%u/%u)\n", rc, pLCHSGeometry->cCylinders, pLCHSGeometry->cHeads, pLCHSGeometry->cSectors));
    5194     return rc;
     5161
     5162    AssertPtrReturn(pImage, VERR_VD_NOT_OPENED);
     5163
     5164    LogFlowFunc(("returns %Rrc (LCHS=%u/%u/%u)\n", VERR_VD_GEOMETRY_NOT_SET,
     5165                 pLCHSGeometry->cCylinders, pLCHSGeometry->cHeads, pLCHSGeometry->cSectors));
     5166    return VERR_VD_GEOMETRY_NOT_SET;
    51955167}
    51965168
     
    52015173    LogFlowFunc(("pBackendData=%#p pLCHSGeometry=%#p LCHS=%u/%u/%u\n", pBackendData, pLCHSGeometry, pLCHSGeometry->cCylinders, pLCHSGeometry->cHeads, pLCHSGeometry->cSectors));
    52025174    PISCSIIMAGE pImage = (PISCSIIMAGE)pBackendData;
     5175
     5176    AssertPtrReturn(pImage, VERR_VD_NOT_OPENED);
     5177
    52035178    int rc;
    5204 
    5205     Assert(pImage);
    5206 
    5207     if (pImage)
    5208     {
    5209         if (pImage->uOpenFlags & VD_OPEN_FLAGS_READONLY)
    5210         {
    5211             rc = VERR_VD_IMAGE_READ_ONLY;
    5212             goto out;
    5213         }
     5179    if (pImage->uOpenFlags & VD_OPEN_FLAGS_READONLY)
     5180        rc = VERR_VD_IMAGE_READ_ONLY;
     5181    else
    52145182        rc = VERR_VD_GEOMETRY_NOT_SET;
    5215     }
    5216     else
    5217         rc = VERR_VD_NOT_OPENED;
    5218 
    5219 out:
     5183
    52205184    LogFlowFunc(("returns %Rrc\n", rc));
    52215185    return rc;
     
    52275191    LogFlowFunc(("pBackendData=%#p\n", pBackendData));
    52285192    PISCSIIMAGE pImage = (PISCSIIMAGE)pBackendData;
    5229     unsigned uImageFlags;
    5230 
    5231     Assert(pImage);
    5232     NOREF(pImage);
    5233 
    5234     uImageFlags = VD_IMAGE_FLAGS_FIXED;
    5235 
    5236     LogFlowFunc(("returns %#x\n", uImageFlags));
    5237     return uImageFlags;
     5193
     5194    AssertPtrReturn(pImage, 0);
     5195
     5196    LogFlowFunc(("returns %#x\n", VD_IMAGE_FLAGS_FIXED));
     5197    return VD_IMAGE_FLAGS_FIXED;
    52385198}
    52395199
     
    52435203    LogFlowFunc(("pBackendData=%#p\n", pBackendData));
    52445204    PISCSIIMAGE pImage = (PISCSIIMAGE)pBackendData;
    5245     unsigned uOpenFlags;
    5246 
    5247     Assert(pImage);
    5248 
    5249     if (pImage)
    5250         uOpenFlags = pImage->uOpenFlags;
    5251     else
    5252         uOpenFlags = 0;
    5253 
    5254     LogFlowFunc(("returns %#x\n", uOpenFlags));
    5255     return uOpenFlags;
     5205
     5206    AssertPtrReturn(pImage, 0);
     5207
     5208    LogFlowFunc(("returns %#x\n", pImage->uOpenFlags));
     5209    return pImage->uOpenFlags;
    52565210}
    52575211
     
    52955249    LogFlowFunc(("pBackendData=%#p pszComment=%#p cbComment=%zu\n", pBackendData, pszComment, cbComment));
    52965250    PISCSIIMAGE pImage = (PISCSIIMAGE)pBackendData;
    5297     int rc;
    5298 
    5299     Assert(pImage);
    5300 
    5301     if (pImage)
    5302         rc = VERR_NOT_SUPPORTED;
    5303     else
    5304         rc = VERR_VD_NOT_OPENED;
    5305 
    5306     LogFlowFunc(("returns %Rrc comment='%s'\n", rc, pszComment));
    5307     return rc;
     5251
     5252    AssertPtrReturn(pImage, VERR_VD_NOT_OPENED);
     5253
     5254    LogFlowFunc(("returns %Rrc comment='%s'\n", VERR_NOT_SUPPORTED, pszComment));
     5255    return VERR_NOT_SUPPORTED;
    53085256}
    53095257
     
    53145262    LogFlowFunc(("pBackendData=%#p pszComment=\"%s\"\n", pBackendData, pszComment));
    53155263    PISCSIIMAGE pImage = (PISCSIIMAGE)pBackendData;
     5264
     5265    AssertPtrReturn(pImage, VERR_VD_NOT_OPENED);
     5266
    53165267    int rc;
    5317 
    5318     Assert(pImage);
    5319 
    5320     if (pImage)
    5321     {
    5322         if (!(pImage->uOpenFlags & VD_OPEN_FLAGS_READONLY))
    5323             rc = VERR_NOT_SUPPORTED;
    5324         else
    5325             rc = VERR_VD_IMAGE_READ_ONLY;
    5326     }
     5268    if (!(pImage->uOpenFlags & VD_OPEN_FLAGS_READONLY))
     5269        rc = VERR_NOT_SUPPORTED;
    53275270    else
    5328         rc = VERR_VD_NOT_OPENED;
     5271        rc = VERR_VD_IMAGE_READ_ONLY;
    53295272
    53305273    LogFlowFunc(("returns %Rrc\n", rc));
     
    53385281    LogFlowFunc(("pBackendData=%#p pUuid=%#p\n", pBackendData, pUuid));
    53395282    PISCSIIMAGE pImage = (PISCSIIMAGE)pBackendData;
    5340     int rc;
    5341 
    5342     Assert(pImage);
    5343 
    5344     if (pImage)
    5345         rc = VERR_NOT_SUPPORTED;
    5346     else
    5347         rc = VERR_VD_NOT_OPENED;
    5348 
    5349     LogFlowFunc(("returns %Rrc (%RTuuid)\n", rc, pUuid));
    5350     return rc;
     5283
     5284    AssertPtrReturn(pImage, VERR_VD_NOT_OPENED);
     5285
     5286    LogFlowFunc(("returns %Rrc (%RTuuid)\n", VERR_NOT_SUPPORTED, pUuid));
     5287    return VERR_NOT_SUPPORTED;
    53515288}
    53525289
     
    53575294    LogFlowFunc(("pBackendData=%#p Uuid=%RTuuid\n", pBackendData, pUuid));
    53585295    PISCSIIMAGE pImage = (PISCSIIMAGE)pBackendData;
     5296
     5297    AssertPtrReturn(pImage, VERR_VD_NOT_OPENED);
     5298
    53595299    int rc;
    5360 
    5361     LogFlowFunc(("%RTuuid\n", pUuid));
    5362     Assert(pImage);
    5363 
    5364     if (pImage)
    5365     {
    5366         if (!(pImage->uOpenFlags & VD_OPEN_FLAGS_READONLY))
    5367             rc = VERR_NOT_SUPPORTED;
    5368         else
    5369             rc = VERR_VD_IMAGE_READ_ONLY;
    5370     }
     5300    if (!(pImage->uOpenFlags & VD_OPEN_FLAGS_READONLY))
     5301        rc = VERR_NOT_SUPPORTED;
    53715302    else
    5372         rc = VERR_VD_NOT_OPENED;
     5303        rc = VERR_VD_IMAGE_READ_ONLY;
    53735304
    53745305    LogFlowFunc(("returns %Rrc\n", rc));
     
    53825313    LogFlowFunc(("pBackendData=%#p pUuid=%#p\n", pBackendData, pUuid));
    53835314    PISCSIIMAGE pImage = (PISCSIIMAGE)pBackendData;
    5384     int rc;
    5385 
    5386     Assert(pImage);
    5387 
    5388     if (pImage)
    5389         rc = VERR_NOT_SUPPORTED;
    5390     else
    5391         rc = VERR_VD_NOT_OPENED;
    5392 
    5393     LogFlowFunc(("returns %Rrc (%RTuuid)\n", rc, pUuid));
    5394     return rc;
     5315
     5316    AssertPtrReturn(pImage, VERR_VD_NOT_OPENED);
     5317
     5318    LogFlowFunc(("returns %Rrc (%RTuuid)\n", VERR_NOT_SUPPORTED, pUuid));
     5319    return VERR_NOT_SUPPORTED;
    53955320}
    53965321
     
    54015326    LogFlowFunc(("pBackendData=%#p Uuid=%RTuuid\n", pBackendData, pUuid));
    54025327    PISCSIIMAGE pImage = (PISCSIIMAGE)pBackendData;
     5328
     5329    AssertPtrReturn(pImage, VERR_VD_NOT_OPENED);
     5330
    54035331    int rc;
    5404 
    5405     LogFlowFunc(("%RTuuid\n", pUuid));
    5406     Assert(pImage);
    5407 
    5408     if (pImage)
    5409     {
    5410         if (!(pImage->uOpenFlags & VD_OPEN_FLAGS_READONLY))
    5411             rc = VERR_NOT_SUPPORTED;
    5412         else
    5413             rc = VERR_VD_IMAGE_READ_ONLY;
    5414     }
     5332    if (!(pImage->uOpenFlags & VD_OPEN_FLAGS_READONLY))
     5333        rc = VERR_NOT_SUPPORTED;
    54155334    else
    5416         rc = VERR_VD_NOT_OPENED;
     5335        rc = VERR_VD_IMAGE_READ_ONLY;
    54175336
    54185337    LogFlowFunc(("returns %Rrc\n", rc));
     
    54265345    LogFlowFunc(("pBackendData=%#p pUuid=%#p\n", pBackendData, pUuid));
    54275346    PISCSIIMAGE pImage = (PISCSIIMAGE)pBackendData;
    5428     int rc;
    5429 
    5430     Assert(pImage);
    5431 
    5432     if (pImage)
    5433         rc = VERR_NOT_SUPPORTED;
    5434     else
    5435         rc = VERR_VD_NOT_OPENED;
    5436 
    5437     LogFlowFunc(("returns %Rrc (%RTuuid)\n", rc, pUuid));
    5438     return rc;
     5347
     5348    AssertPtrReturn(pImage, VERR_VD_NOT_OPENED);
     5349
     5350    LogFlowFunc(("returns %Rrc (%RTuuid)\n", VERR_NOT_SUPPORTED, pUuid));
     5351    return VERR_NOT_SUPPORTED;
    54395352}
    54405353
     
    54455358    LogFlowFunc(("pBackendData=%#p Uuid=%RTuuid\n", pBackendData, pUuid));
    54465359    PISCSIIMAGE pImage = (PISCSIIMAGE)pBackendData;
     5360
     5361    AssertPtrReturn(pImage, VERR_VD_NOT_OPENED);
     5362
    54475363    int rc;
    5448 
    5449     LogFlowFunc(("%RTuuid\n", pUuid));
    5450     Assert(pImage);
    5451 
    5452     if (pImage)
    5453     {
    5454         if (!(pImage->uOpenFlags & VD_OPEN_FLAGS_READONLY))
    5455             rc = VERR_NOT_SUPPORTED;
    5456         else
    5457             rc = VERR_VD_IMAGE_READ_ONLY;
    5458     }
     5364    if (!(pImage->uOpenFlags & VD_OPEN_FLAGS_READONLY))
     5365        rc = VERR_NOT_SUPPORTED;
    54595366    else
    5460         rc = VERR_VD_NOT_OPENED;
     5367        rc = VERR_VD_IMAGE_READ_ONLY;
    54615368
    54625369    LogFlowFunc(("returns %Rrc\n", rc));
     
    54705377    LogFlowFunc(("pBackendData=%#p pUuid=%#p\n", pBackendData, pUuid));
    54715378    PISCSIIMAGE pImage = (PISCSIIMAGE)pBackendData;
    5472     int rc;
    5473 
    5474     Assert(pImage);
    5475 
    5476     if (pImage)
    5477         rc = VERR_NOT_SUPPORTED;
    5478     else
    5479         rc = VERR_VD_NOT_OPENED;
    5480 
    5481     LogFlowFunc(("returns %Rrc (%RTuuid)\n", rc, pUuid));
    5482     return rc;
     5379
     5380    AssertPtrReturn(pImage, VERR_VD_NOT_OPENED);
     5381
     5382    LogFlowFunc(("returns %Rrc (%RTuuid)\n", VERR_NOT_SUPPORTED, pUuid));
     5383    return VERR_NOT_SUPPORTED;
    54835384}
    54845385
     
    54895390    LogFlowFunc(("pBackendData=%#p Uuid=%RTuuid\n", pBackendData, pUuid));
    54905391    PISCSIIMAGE pImage = (PISCSIIMAGE)pBackendData;
     5392
     5393    AssertPtrReturn(pImage, VERR_VD_NOT_OPENED);
     5394
    54915395    int rc;
    5492 
    5493     LogFlowFunc(("%RTuuid\n", pUuid));
    5494     Assert(pImage);
    5495 
    5496     if (pImage)
    5497     {
    5498         if (!(pImage->uOpenFlags & VD_OPEN_FLAGS_READONLY))
    5499             rc = VERR_NOT_SUPPORTED;
    5500         else
    5501             rc = VERR_VD_IMAGE_READ_ONLY;
    5502     }
     5396    if (!(pImage->uOpenFlags & VD_OPEN_FLAGS_READONLY))
     5397        rc = VERR_NOT_SUPPORTED;
    55035398    else
    5504         rc = VERR_VD_NOT_OPENED;
     5399        rc = VERR_VD_IMAGE_READ_ONLY;
    55055400
    55065401    LogFlowFunc(("returns %Rrc\n", rc));
     
    55135408    PISCSIIMAGE pImage = (PISCSIIMAGE)pBackendData;
    55145409
    5515     Assert(pImage);
    5516     if (pImage)
    5517     {
    5518         /** @todo put something useful here */
    5519         vdIfErrorMessage(pImage->pIfError, "Header: cVolume=%u\n", pImage->cVolume);
    5520     }
     5410    AssertPtrReturnVoid(pImage);
     5411    /** @todo put something useful here */
     5412    vdIfErrorMessage(pImage->pIfError, "Header: cVolume=%u\n", pImage->cVolume);
    55215413}
    55225414
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