- Timestamp:
- Sep 27, 2013 6:19:03 PM (12 years ago)
- svn:sync-xref-src-repo-rev:
- 89380
- Location:
- trunk/src/VBox/Storage
- Files:
-
- 11 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Storage/DMG.cpp
r46613 r48743 1804 1804 } 1805 1805 1806 /** @copydoc VBOXHDDBACKEND::pfnGetSectorSize */ 1807 static uint32_t dmgGetSectorSize(void *pBackendData) 1808 { 1809 LogFlowFunc(("pBackendData=%#p\n", pBackendData)); 1810 PDMGIMAGE pThis = (PDMGIMAGE)pBackendData; 1811 uint32_t cb = 0; 1812 1813 AssertPtr(pThis); 1814 1815 if (pThis && pThis->pStorage) 1816 cb = 2048; 1817 1818 LogFlowFunc(("returns %u\n", cb)); 1819 return cb; 1820 } 1821 1806 1822 /** @copydoc VBOXHDDBACKEND::pfnGetSize */ 1807 1823 static uint64_t dmgGetSize(void *pBackendData) … … 2274 2290 /* pfnGetVersion */ 2275 2291 dmgGetVersion, 2292 /* pfnGetSectorSize */ 2293 dmgGetSectorSize, 2276 2294 /* pfnGetSize */ 2277 2295 dmgGetSize, -
trunk/src/VBox/Storage/ISCSI.cpp
r45486 r48743 4243 4243 pImage->cbSector = RT_BE2H_U32(*(uint32_t *)&data12[8]); 4244 4244 pImage->cbSize = pImage->cVolume * pImage->cbSector; 4245 if (pImage->cVolume == 0 || pImage->cbS ector != 512 || pImage->cbSize < pImage->cVolume)4245 if (pImage->cVolume == 0 || pImage->cbSize < pImage->cVolume) 4246 4246 { 4247 4247 rc = vdIfError(pImage->pIfError, VERR_VD_ISCSI_INVALID_TYPE, … … 4326 4326 pImage->cbSector = (data8[4] << 24) | (data8[5] << 16) | (data8[6] << 8) | data8[7]; 4327 4327 pImage->cbSize = pImage->cVolume * pImage->cbSector; 4328 if (pImage->cVolume == 0 || pImage->cbSector != 512)4328 if (pImage->cVolume == 0) 4329 4329 { 4330 4330 rc = vdIfError(pImage->pIfError, VERR_VD_ISCSI_INVALID_TYPE, 4331 RT_SRC_POS, N_("iSCSI: fallback capacity detectio for target address %s, target name %s, SCSI LUN %lld reports media sector count=%llu sector size=%u"),4331 RT_SRC_POS, N_("iSCSI: fallback capacity detection for target address %s, target name %s, SCSI LUN %lld reports media sector count=%llu sector size=%u"), 4332 4332 pImage->pszTargetAddress, pImage->pszTargetName, 4333 4333 pImage->LUN, pImage->cVolume, pImage->cbSector); … … 4907 4907 4908 4908 return 0; 4909 } 4910 4911 /** @copydoc VBOXHDDBACKEND::pfnGetSectorSize */ 4912 static uint32_t iscsiGetSectorSize(void *pBackendData) 4913 { 4914 LogFlowFunc(("pBackendData=%#p\n", pBackendData)); 4915 PISCSIIMAGE pImage = (PISCSIIMAGE)pBackendData; 4916 4917 Assert(pImage); 4918 4919 if (pImage) 4920 return pImage->cbSector; 4921 else 4922 return 0; 4909 4923 } 4910 4924 … … 5411 5425 /* pfnGetVersion */ 5412 5426 iscsiGetVersion, 5427 /* pfnGetSectorSize */ 5428 iscsiGetSectorSize, 5413 5429 /* pfnGetSize */ 5414 5430 iscsiGetSize, -
trunk/src/VBox/Storage/Parallels.cpp
r46613 r48743 758 758 else 759 759 return 0; 760 } 761 762 /** @copydoc VBOXHDDBACKEND::pfnGetSectorSize */ 763 static uint32_t parallelsGetSectorSize(void *pBackendData) 764 { 765 LogFlowFunc(("pBackendData=%#p\n", pBackendData)); 766 PPARALLELSIMAGE pImage = (PPARALLELSIMAGE)pBackendData; 767 uint32_t cb = 0; 768 769 AssertPtr(pImage); 770 771 if (pImage && pImage->pStorage) 772 cb = 512; 773 774 LogFlowFunc(("returns %llu\n", cb)); 775 return cb; 760 776 } 761 777 … … 1221 1237 /* pfnGetVersion */ 1222 1238 parallelsGetVersion, 1239 /* pfnGetSectorSize */ 1240 parallelsGetSectorSize, 1223 1241 /* pfnGetSize */ 1224 1242 parallelsGetSize, -
trunk/src/VBox/Storage/QCOW.cpp
r46613 r48743 1937 1937 } 1938 1938 1939 /** @copydoc VBOXHDDBACKEND::pfnGetSectorSize */ 1940 static uint32_t qcowGetSectorSize(void *pBackendData) 1941 { 1942 LogFlowFunc(("pBackendData=%#p\n", pBackendData)); 1943 PQCOWIMAGE pImage = (PQCOWIMAGE)pBackendData; 1944 uint32_t cb = 0; 1945 1946 AssertPtr(pImage); 1947 1948 if (pImage && pImage->pStorage) 1949 cb = 512; 1950 1951 LogFlowFunc(("returns %u\n", cb)); 1952 return cb; 1953 } 1954 1939 1955 /** @copydoc VBOXHDDBACKEND::pfnGetSize */ 1940 1956 static uint64_t qcowGetSize(void *pBackendData) … … 2478 2494 /* pfnGetVersion */ 2479 2495 qcowGetVersion, 2496 /* pfnGetSectorSize */ 2497 qcowGetSectorSize, 2480 2498 /* pfnGetSize */ 2481 2499 qcowGetSize, -
trunk/src/VBox/Storage/QED.cpp
r46613 r48743 2025 2025 } 2026 2026 2027 /** @copydoc VBOXHDDBACKEND::pfnGetSectorSize */ 2028 static uint32_t qedGetSectorSize(void *pBackendData) 2029 { 2030 LogFlowFunc(("pBackendData=%#p\n", pBackendData)); 2031 PQEDIMAGE pImage = (PQEDIMAGE)pBackendData; 2032 uint32_t cb = 0; 2033 2034 AssertPtr(pImage); 2035 2036 if (pImage && pImage->pStorage) 2037 cb = 512; 2038 2039 LogFlowFunc(("returns %u\n", cb)); 2040 return cb; 2041 } 2042 2027 2043 /** @copydoc VBOXHDDBACKEND::pfnGetSize */ 2028 2044 static uint64_t qedGetSize(void *pBackendData) … … 2616 2632 /* pfnGetVersion */ 2617 2633 qedGetVersion, 2634 /* pfnGetSectorSize */ 2635 qedGetSectorSize, 2618 2636 /* pfnGetSize */ 2619 2637 qedGetSize, -
trunk/src/VBox/Storage/RAW.cpp
r47297 r48743 65 65 /** Logical geometry of this image. */ 66 66 VDGEOMETRY LCHSGeometry; 67 67 /** Sector size of the image. */ 68 uint32_t cbSector; 68 69 } RAWIMAGE, *PRAWIMAGE; 69 70 … … 457 458 rc = rawOpenImage(pImage, uOpenFlags); 458 459 if (RT_SUCCESS(rc)) 460 { 461 if (enmType == VDTYPE_DVD) 462 pImage->cbSector = 2048; 463 else 464 pImage->cbSector = 512; 459 465 *ppBackendData = pImage; 466 } 460 467 else 461 468 RTMemFree(pImage); … … 663 670 else 664 671 return 0; 672 } 673 674 /** @copydoc VBOXHDDBACKEND::pfnGetSize */ 675 static uint32_t rawGetSectorSize(void *pBackendData) 676 { 677 LogFlowFunc(("pBackendData=%#p\n", pBackendData)); 678 PRAWIMAGE pImage = (PRAWIMAGE)pBackendData; 679 uint32_t cb = 0; 680 681 AssertPtr(pImage); 682 683 if (pImage && pImage->pStorage) 684 cb = pImage->cbSector; 685 686 LogFlowFunc(("returns %u\n", cb)); 687 return cb; 665 688 } 666 689 … … 1138 1161 /* pfnGetVersion */ 1139 1162 rawGetVersion, 1163 /* pfnGetSectorSize */ 1164 rawGetSectorSize, 1140 1165 /* pfnGetSize */ 1141 1166 rawGetSize, -
trunk/src/VBox/Storage/VD.cpp
r48574 r48743 8223 8223 8224 8224 /** 8225 * Get sector size of an image in HDD container. 8226 * 8227 * @return Virtual disk sector size in bytes. 8228 * @return 0 if image with specified number was not opened. 8229 * @param pDisk Pointer to HDD container. 8230 * @param nImage Image number, counts from 0. 0 is always base image of container. 8231 */ 8232 VBOXDDU_DECL(uint32_t) VDGetSectorSize(PVBOXHDD pDisk, unsigned nImage) 8233 { 8234 uint64_t cbSector; 8235 int rc2; 8236 bool fLockRead = false; 8237 8238 LogFlowFunc(("pDisk=%#p nImage=%u\n", pDisk, nImage)); 8239 do 8240 { 8241 /* sanity check */ 8242 AssertPtrBreakStmt(pDisk, cbSector = 0); 8243 AssertMsg(pDisk->u32Signature == VBOXHDDDISK_SIGNATURE, ("u32Signature=%08x\n", pDisk->u32Signature)); 8244 8245 rc2 = vdThreadStartRead(pDisk); 8246 AssertRC(rc2); 8247 fLockRead = true; 8248 8249 PVDIMAGE pImage = vdGetImageByNumber(pDisk, nImage); 8250 AssertPtrBreakStmt(pImage, cbSector = 0); 8251 cbSector = pImage->Backend->pfnGetSectorSize(pImage->pBackendData); 8252 } while (0); 8253 8254 if (RT_UNLIKELY(fLockRead)) 8255 { 8256 rc2 = vdThreadFinishRead(pDisk); 8257 AssertRC(rc2); 8258 } 8259 8260 LogFlowFunc(("returns %u\n", cbSector)); 8261 return cbSector; 8262 } 8263 8264 /** 8225 8265 * Get total capacity of an image in HDD container. 8226 8266 * -
trunk/src/VBox/Storage/VDI.cpp
r46613 r48743 1769 1769 LogFlowFunc(("returns %#x\n", uVersion)); 1770 1770 return uVersion; 1771 } 1772 1773 /** @copydoc VBOXHDDBACKEND::pfnGetSectorSize */ 1774 static uint32_t vdiGetSectorSize(void *pBackendData) 1775 { 1776 LogFlowFunc(("pBackendData=%#p\n", pBackendData)); 1777 PVDIIMAGEDESC pImage = (PVDIIMAGEDESC)pBackendData; 1778 uint64_t cbSector = 0; 1779 1780 AssertPtr(pImage); 1781 1782 if (pImage && pImage->pStorage) 1783 cbSector = 512; 1784 1785 LogFlowFunc(("returns %zu\n", cbSector)); 1786 return cbSector; 1771 1787 } 1772 1788 … … 3212 3228 /* pfnGetVersion */ 3213 3229 vdiGetVersion, 3230 /* pfnGetSectorSize */ 3231 vdiGetSectorSize, 3214 3232 /* pfnGetSize */ 3215 3233 vdiGetSize, -
trunk/src/VBox/Storage/VHD.cpp
r46613 r48743 1851 1851 LogFlowFunc(("returns %u\n", ver)); 1852 1852 return ver; 1853 } 1854 1855 /** @copydoc VBOXHDDBACKEND::pfnGetSectorSize */ 1856 static uint32_t vhdGetSectorSize(void *pBackendData) 1857 { 1858 LogFlowFunc(("pBackendData=%#p\n", pBackendData)); 1859 PVHDIMAGE pImage = (PVHDIMAGE)pBackendData; 1860 uint32_t cb = 0; 1861 1862 AssertPtr(pImage); 1863 1864 if (pImage) 1865 cb = 512; 1866 1867 LogFlowFunc(("returns %zu\n", cb)); 1868 return cb; 1853 1869 } 1854 1870 … … 3207 3223 /* pfnGetVersion */ 3208 3224 vhdGetVersion, 3225 /* pfnGetSectorSize */ 3226 vhdGetSectorSize, 3209 3227 /* pfnGetSize */ 3210 3228 vhdGetSize, -
trunk/src/VBox/Storage/VHDX.cpp
r46613 r48743 1991 1991 } 1992 1992 1993 /** @copydoc VBOXHDDBACKEND::pfnGetSectorSize */ 1994 static uint32_t vhdxGetSectorSize(void *pBackendData) 1995 { 1996 LogFlowFunc(("pBackendData=%#p\n", pBackendData)); 1997 PVHDXIMAGE pImage = (PVHDXIMAGE)pBackendData; 1998 uint32_t cb = 0; 1999 2000 AssertPtr(pImage); 2001 2002 if (pImage && pImage->pStorage) 2003 cb = pImage->cbLogicalSector; 2004 2005 LogFlowFunc(("returns %u\n", cb)); 2006 return cb; 2007 } 2008 1993 2009 /** @copydoc VBOXHDDBACKEND::pfnGetSize */ 1994 2010 static uint64_t vhdxGetSize(void *pBackendData) … … 2445 2461 /* pfnGetVersion */ 2446 2462 vhdxGetVersion, 2463 /* pfnGetSectorSize */ 2464 vhdxGetSectorSize, 2447 2465 /* pfnGetSize */ 2448 2466 vhdxGetSize, -
trunk/src/VBox/Storage/VMDK.cpp
r47832 r48743 5974 5974 } 5975 5975 5976 /** @copydoc VBOXHDDBACKEND::pfnGetSectorSize */ 5977 static uint32_t vmdkGetSectorSize(void *pBackendData) 5978 { 5979 LogFlowFunc(("pBackendData=%#p\n", pBackendData)); 5980 PVMDKIMAGE pImage = (PVMDKIMAGE)pBackendData; 5981 5982 AssertPtr(pImage); 5983 5984 if (pImage) 5985 return 512; 5986 else 5987 return 0; 5988 } 5989 5976 5990 /** @copydoc VBOXHDDBACKEND::pfnGetSize */ 5977 5991 static uint64_t vmdkGetSize(void *pBackendData) … … 6572 6586 /* pfnGetVersion */ 6573 6587 vmdkGetVersion, 6588 /* pfnGetSectorSize */ 6589 vmdkGetSectorSize, 6574 6590 /* pfnGetSize */ 6575 6591 vmdkGetSize,
Note:
See TracChangeset
for help on using the changeset viewer.