dvmgpt.cpp revision 4e47bb772df0d04d1ded3e06354de547d52e2d06
956a0e3c076406b83d635174a201fd8761ee5133vboxsync * IPRT Disk Volume Management API (DVM) - GPT format backend.
956a0e3c076406b83d635174a201fd8761ee5133vboxsync * Copyright (C) 2011 Oracle Corporation
956a0e3c076406b83d635174a201fd8761ee5133vboxsync * This file is part of VirtualBox Open Source Edition (OSE), as
956a0e3c076406b83d635174a201fd8761ee5133vboxsync * available from http://www.virtualbox.org. This file is free software;
956a0e3c076406b83d635174a201fd8761ee5133vboxsync * you can redistribute it and/or modify it under the terms of the GNU
956a0e3c076406b83d635174a201fd8761ee5133vboxsync * General Public License (GPL) as published by the Free Software
956a0e3c076406b83d635174a201fd8761ee5133vboxsync * Foundation, in version 2 as it comes in the "COPYING" file of the
956a0e3c076406b83d635174a201fd8761ee5133vboxsync * VirtualBox OSE distribution. VirtualBox OSE is distributed in the
956a0e3c076406b83d635174a201fd8761ee5133vboxsync * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
956a0e3c076406b83d635174a201fd8761ee5133vboxsync * The contents of this file may alternatively be used under the terms
956a0e3c076406b83d635174a201fd8761ee5133vboxsync * of the Common Development and Distribution License Version 1.0
956a0e3c076406b83d635174a201fd8761ee5133vboxsync * (CDDL) only, as it comes in the "COPYING.CDDL" file of the
956a0e3c076406b83d635174a201fd8761ee5133vboxsync * VirtualBox OSE distribution, in which case the provisions of the
956a0e3c076406b83d635174a201fd8761ee5133vboxsync * CDDL are applicable instead of those of the GPL.
956a0e3c076406b83d635174a201fd8761ee5133vboxsync * You may elect to license modified versions of this file under the
956a0e3c076406b83d635174a201fd8761ee5133vboxsync * terms and conditions of either the GPL or the CDDL or both.
68fb2428898c55a7172e6a75a0a8d7ce259919bdvboxsync/*******************************************************************************
68fb2428898c55a7172e6a75a0a8d7ce259919bdvboxsync* Header Files *
68fb2428898c55a7172e6a75a0a8d7ce259919bdvboxsync*******************************************************************************/
68fb2428898c55a7172e6a75a0a8d7ce259919bdvboxsync/*******************************************************************************
68fb2428898c55a7172e6a75a0a8d7ce259919bdvboxsync* Structures and Typedefs *
68fb2428898c55a7172e6a75a0a8d7ce259919bdvboxsync*******************************************************************************/
956a0e3c076406b83d635174a201fd8761ee5133vboxsync/** The GPT signature. */
956a0e3c076406b83d635174a201fd8761ee5133vboxsync * GPT on disk header.
956a0e3c076406b83d635174a201fd8761ee5133vboxsynctypedef struct GptHdr
956a0e3c076406b83d635174a201fd8761ee5133vboxsync /** Signature ("EFI PART"). */
956a0e3c076406b83d635174a201fd8761ee5133vboxsync /** Revision. */
956a0e3c076406b83d635174a201fd8761ee5133vboxsync /** Header size. */
956a0e3c076406b83d635174a201fd8761ee5133vboxsync /** CRC of header. */
956a0e3c076406b83d635174a201fd8761ee5133vboxsync/** Pointer to a GPT header. */
956a0e3c076406b83d635174a201fd8761ee5133vboxsync * Complete GPT table header for revision 1.0.
956a0e3c076406b83d635174a201fd8761ee5133vboxsynctypedef struct GptHdrRev1
956a0e3c076406b83d635174a201fd8761ee5133vboxsync /** Header. */
956a0e3c076406b83d635174a201fd8761ee5133vboxsync /** Reserved. */
956a0e3c076406b83d635174a201fd8761ee5133vboxsync /** Current LBA. */
956a0e3c076406b83d635174a201fd8761ee5133vboxsync /** Backup LBA. */
956a0e3c076406b83d635174a201fd8761ee5133vboxsync /** First usable LBA for partitions. */
956a0e3c076406b83d635174a201fd8761ee5133vboxsync /** Last usable LBA for partitions. */
956a0e3c076406b83d635174a201fd8761ee5133vboxsync /** Disk UUID. */
956a0e3c076406b83d635174a201fd8761ee5133vboxsync /** LBA of first partition entry. */
956a0e3c076406b83d635174a201fd8761ee5133vboxsync /** Number of partition entries. */
956a0e3c076406b83d635174a201fd8761ee5133vboxsync /** Partition entry size. */
956a0e3c076406b83d635174a201fd8761ee5133vboxsync /** CRC of partition entries. */
956a0e3c076406b83d635174a201fd8761ee5133vboxsync/** Pointer to a revision 1.0 GPT header. */
956a0e3c076406b83d635174a201fd8761ee5133vboxsync * GPT partition table entry.
956a0e3c076406b83d635174a201fd8761ee5133vboxsynctypedef struct GptEntry
956a0e3c076406b83d635174a201fd8761ee5133vboxsync /** Partition type UUID. */
956a0e3c076406b83d635174a201fd8761ee5133vboxsync /** Partition UUID. */
956a0e3c076406b83d635174a201fd8761ee5133vboxsync /** First LBA. */
956a0e3c076406b83d635174a201fd8761ee5133vboxsync /** Last LBA. */
956a0e3c076406b83d635174a201fd8761ee5133vboxsync /** Attribute flags. */
956a0e3c076406b83d635174a201fd8761ee5133vboxsync /** Partition name (UTF-16LE code units). */
956a0e3c076406b83d635174a201fd8761ee5133vboxsync/** Pointer to a GPT entry. */
956a0e3c076406b83d635174a201fd8761ee5133vboxsync/** Partition flags - System partition. */
956a0e3c076406b83d635174a201fd8761ee5133vboxsync/** Partition flags - Partition is readonly. */
956a0e3c076406b83d635174a201fd8761ee5133vboxsync/** Partition flags - Partition is hidden. */
956a0e3c076406b83d635174a201fd8761ee5133vboxsync/** Partition flags - Don't automount this partition. */
956a0e3c076406b83d635174a201fd8761ee5133vboxsync * GPT volume manager data.
956a0e3c076406b83d635174a201fd8761ee5133vboxsync /** Pointer to the underlying disk. */
956a0e3c076406b83d635174a201fd8761ee5133vboxsync /** GPT header. */
956a0e3c076406b83d635174a201fd8761ee5133vboxsync /** GPT array. */
956a0e3c076406b83d635174a201fd8761ee5133vboxsync /** Number of occupied partition entries. */
956a0e3c076406b83d635174a201fd8761ee5133vboxsync/** Pointer to the MBR volume manager. */
956a0e3c076406b83d635174a201fd8761ee5133vboxsync * GPT volume data.
956a0e3c076406b83d635174a201fd8761ee5133vboxsync /** Pointer to the volume manager. */
956a0e3c076406b83d635174a201fd8761ee5133vboxsync /** Partition table entry index. */
956a0e3c076406b83d635174a201fd8761ee5133vboxsync /** Start offset of the volume. */
956a0e3c076406b83d635174a201fd8761ee5133vboxsync /** Size of the volume. */
956a0e3c076406b83d635174a201fd8761ee5133vboxsync /** Pointer to the GPT entry in the array. */
956a0e3c076406b83d635174a201fd8761ee5133vboxsync/** Pointer to an MBR volume. */
956a0e3c076406b83d635174a201fd8761ee5133vboxsynctypedef RTDVMVOLUMEFMTINTERNAL *PRTDVMVOLUMEFMTINTERNAL;
956a0e3c076406b83d635174a201fd8761ee5133vboxsync * GPT partition type to DVM volume type mapping entry.
956a0e3c076406b83d635174a201fd8761ee5133vboxsync /** Type UUID. */
956a0e3c076406b83d635174a201fd8761ee5133vboxsync const char *pcszUuid;
956a0e3c076406b83d635174a201fd8761ee5133vboxsync /** DVM volume type. */
956a0e3c076406b83d635174a201fd8761ee5133vboxsync/** Pointer to a MBR FS Type to volume type mapping entry. */
956a0e3c076406b83d635174a201fd8761ee5133vboxsynctypedef RTDVMGPTPARTTYPE2VOLTYPE *PRTDVMGPTPARTTYPE2VOLTYPE;
956a0e3c076406b83d635174a201fd8761ee5133vboxsync/** Converts a LBA number to the byte offset. */
956a0e3c076406b83d635174a201fd8761ee5133vboxsync#define RTDVM_GPT_LBA2BYTE(lba, disk) ((lba) * (disk)->cbSector)
956a0e3c076406b83d635174a201fd8761ee5133vboxsync/** Converts a Byte offset to the LBA number. */
956a0e3c076406b83d635174a201fd8761ee5133vboxsync#define RTDVM_GPT_BYTE2LBA(lba, disk) ((lba) / (disk)->cbSector)
68fb2428898c55a7172e6a75a0a8d7ce259919bdvboxsync/*******************************************************************************
68fb2428898c55a7172e6a75a0a8d7ce259919bdvboxsync* Global Variables *
68fb2428898c55a7172e6a75a0a8d7ce259919bdvboxsync*******************************************************************************/
956a0e3c076406b83d635174a201fd8761ee5133vboxsync * Mapping of partition types to DVM volume types.
956a0e3c076406b83d635174a201fd8761ee5133vboxsync * From http://en.wikipedia.org/wiki/GUID_Partition_Table
956a0e3c076406b83d635174a201fd8761ee5133vboxsyncstatic const RTDVMGPTPARTTYPE2VOLTYPE g_aPartType2DvmVolTypes[] =
956a0e3c076406b83d635174a201fd8761ee5133vboxsync {"0657FD6D-A4AB-43C4-84E5-0933C84B4F4F", RTDVMVOLTYPE_LINUX_SWAP},
956a0e3c076406b83d635174a201fd8761ee5133vboxsync {"EBD0A0A2-B9E5-4433-87C0-68B6B72699C7", RTDVMVOLTYPE_LINUX_NATIVE},
956a0e3c076406b83d635174a201fd8761ee5133vboxsync {"E6D6D379-F507-44C2-A23C-238F2A3DF928", RTDVMVOLTYPE_LINUX_LVM},
956a0e3c076406b83d635174a201fd8761ee5133vboxsync {"A19D880F-05FC-4D3B-A006-743F0F84911E", RTDVMVOLTYPE_LINUX_SOFTRAID},
956a0e3c076406b83d635174a201fd8761ee5133vboxsync {"83BD6B9D-7F41-11DC-BE0B-001560B84F0F", RTDVMVOLTYPE_FREEBSD}, /* Boot */
956a0e3c076406b83d635174a201fd8761ee5133vboxsync {"516E7CB4-6ECF-11D6-8FF8-00022D09712B", RTDVMVOLTYPE_FREEBSD}, /* Data */
956a0e3c076406b83d635174a201fd8761ee5133vboxsync {"516E7CB5-6ECF-11D6-8FF8-00022D09712B", RTDVMVOLTYPE_FREEBSD}, /* Swap */
956a0e3c076406b83d635174a201fd8761ee5133vboxsync {"516E7CB6-6ECF-11D6-8FF8-00022D09712B", RTDVMVOLTYPE_FREEBSD}, /* UFS */
956a0e3c076406b83d635174a201fd8761ee5133vboxsync {"516E7CB8-6ECF-11D6-8FF8-00022D09712B", RTDVMVOLTYPE_FREEBSD}, /* Vinum */
956a0e3c076406b83d635174a201fd8761ee5133vboxsync {"516E7CBA-6ECF-11D6-8FF8-00022D09712B", RTDVMVOLTYPE_FREEBSD}, /* ZFS */
956a0e3c076406b83d635174a201fd8761ee5133vboxsync {"49F48D32-B10E-11DC-B99B-0019D1879648", RTDVMVOLTYPE_NETBSD}, /* Swap */
956a0e3c076406b83d635174a201fd8761ee5133vboxsync {"49F48D5A-B10E-11DC-B99B-0019D1879648", RTDVMVOLTYPE_NETBSD}, /* FFS */
956a0e3c076406b83d635174a201fd8761ee5133vboxsync {"49F48D82-B10E-11DC-B99B-0019D1879648", RTDVMVOLTYPE_NETBSD}, /* LFS */
956a0e3c076406b83d635174a201fd8761ee5133vboxsync {"49F48DAA-B10E-11DC-B99B-0019D1879648", RTDVMVOLTYPE_NETBSD}, /* Raid */
956a0e3c076406b83d635174a201fd8761ee5133vboxsync {"2DB519C4-B10F-11DC-B99B-0019D1879648", RTDVMVOLTYPE_NETBSD}, /* Concatenated */
956a0e3c076406b83d635174a201fd8761ee5133vboxsync {"2DB519EC-B10F-11DC-B99B-0019D1879648", RTDVMVOLTYPE_NETBSD}, /* Encrypted */
956a0e3c076406b83d635174a201fd8761ee5133vboxsync {"48465300-0000-11AA-AA11-00306543ECAC", RTDVMVOLTYPE_MAC_OSX_HFS},
956a0e3c076406b83d635174a201fd8761ee5133vboxsync {"6A82CB45-1DD2-11B2-99A6-080020736631", RTDVMVOLTYPE_SOLARIS}, /* Boot */
956a0e3c076406b83d635174a201fd8761ee5133vboxsync {"6A85CF4D-1DD2-11B2-99A6-080020736631", RTDVMVOLTYPE_SOLARIS}, /* Root */
956a0e3c076406b83d635174a201fd8761ee5133vboxsync {"6A87C46F-1DD2-11B2-99A6-080020736631", RTDVMVOLTYPE_SOLARIS}, /* Swap */
956a0e3c076406b83d635174a201fd8761ee5133vboxsync {"6A8B642B-1DD2-11B2-99A6-080020736631", RTDVMVOLTYPE_SOLARIS}, /* Backup */
956a0e3c076406b83d635174a201fd8761ee5133vboxsync {"6A898CC3-1DD2-11B2-99A6-080020736631", RTDVMVOLTYPE_SOLARIS}, /* /usr */
956a0e3c076406b83d635174a201fd8761ee5133vboxsync {"6A8EF2E9-1DD2-11B2-99A6-080020736631", RTDVMVOLTYPE_SOLARIS}, /* /var */
956a0e3c076406b83d635174a201fd8761ee5133vboxsync {"6A90BA39-1DD2-11B2-99A6-080020736631", RTDVMVOLTYPE_SOLARIS}, /* /home */
956a0e3c076406b83d635174a201fd8761ee5133vboxsync {"6A9283A5-1DD2-11B2-99A6-080020736631", RTDVMVOLTYPE_SOLARIS}, /* Alternate sector */
68fb2428898c55a7172e6a75a0a8d7ce259919bdvboxsyncstatic DECLCALLBACK(int) rtDvmFmtGptProbe(PCRTDVMDISK pDisk, uint32_t *puScore)
956a0e3c076406b83d635174a201fd8761ee5133vboxsync /* Read from the disk and check for the signature. */
68fb2428898c55a7172e6a75a0a8d7ce259919bdvboxsync rc = rtDvmDiskRead(pDisk, RTDVM_GPT_LBA2BYTE(1, pDisk), &Hdr, sizeof(GptHdr));
956a0e3c076406b83d635174a201fd8761ee5133vboxsync && !strncmp(&Hdr.abSignature[0], RTDVM_GPT_SIGNATURE, RT_ELEMENTS(Hdr.abSignature))
956a0e3c076406b83d635174a201fd8761ee5133vboxsync && RT_LE2H_U32(Hdr.cbHeader) == sizeof(GptHdrRev1))
68fb2428898c55a7172e6a75a0a8d7ce259919bdvboxsyncstatic DECLCALLBACK(int) rtDvmFmtGptOpen(PCRTDVMDISK pDisk, PRTDVMFMT phVolMgrFmt)
956a0e3c076406b83d635174a201fd8761ee5133vboxsync pThis = (PRTDVMFMTINTERNAL)RTMemAllocZ(sizeof(RTDVMFMTINTERNAL));
956a0e3c076406b83d635174a201fd8761ee5133vboxsync /* Read the complete GPT header and convert to host endianess. */
68fb2428898c55a7172e6a75a0a8d7ce259919bdvboxsync rc = rtDvmDiskRead(pDisk, RTDVM_GPT_LBA2BYTE(1, pDisk), &pThis->HdrRev1, sizeof(pThis->HdrRev1));
956a0e3c076406b83d635174a201fd8761ee5133vboxsync pThis->HdrRev1.Hdr.u32Revision = RT_LE2H_U32(pThis->HdrRev1.Hdr.u32Revision);
956a0e3c076406b83d635174a201fd8761ee5133vboxsync pThis->HdrRev1.Hdr.cbHeader = RT_LE2H_U32(pThis->HdrRev1.Hdr.cbHeader);
956a0e3c076406b83d635174a201fd8761ee5133vboxsync pThis->HdrRev1.Hdr.u32Crc = RT_LE2H_U32(pThis->HdrRev1.Hdr.u32Crc);
956a0e3c076406b83d635174a201fd8761ee5133vboxsync pThis->HdrRev1.u64LbaCurrent = RT_LE2H_U64(pThis->HdrRev1.u64LbaCurrent);
956a0e3c076406b83d635174a201fd8761ee5133vboxsync pThis->HdrRev1.u64LbaBackup = RT_LE2H_U64(pThis->HdrRev1.u64LbaBackup);
956a0e3c076406b83d635174a201fd8761ee5133vboxsync pThis->HdrRev1.u64LbaFirstPartition = RT_LE2H_U64(pThis->HdrRev1.u64LbaFirstPartition);
956a0e3c076406b83d635174a201fd8761ee5133vboxsync pThis->HdrRev1.u64LbaLastPartition = RT_LE2H_U64(pThis->HdrRev1.u64LbaLastPartition);
956a0e3c076406b83d635174a201fd8761ee5133vboxsync /** @todo: Disk UUID */
956a0e3c076406b83d635174a201fd8761ee5133vboxsync pThis->HdrRev1.u64LbaPartitionEntries = RT_LE2H_U64(pThis->HdrRev1.u64LbaPartitionEntries);
956a0e3c076406b83d635174a201fd8761ee5133vboxsync pThis->HdrRev1.cPartitionEntries = RT_LE2H_U32(pThis->HdrRev1.cPartitionEntries);
956a0e3c076406b83d635174a201fd8761ee5133vboxsync pThis->HdrRev1.cbPartitionEntry = RT_LE2H_U32(pThis->HdrRev1.cbPartitionEntry);
956a0e3c076406b83d635174a201fd8761ee5133vboxsync pThis->HdrRev1.u32CrcPartitionEntries = RT_LE2H_U32(pThis->HdrRev1.u32CrcPartitionEntries);
956a0e3c076406b83d635174a201fd8761ee5133vboxsync if (pThis->HdrRev1.cbPartitionEntry == sizeof(GptEntry))
956a0e3c076406b83d635174a201fd8761ee5133vboxsync pThis->paGptEntries = (PGptEntry)RTMemAllocZ(pThis->HdrRev1.cPartitionEntries * pThis->HdrRev1.cbPartitionEntry);
68fb2428898c55a7172e6a75a0a8d7ce259919bdvboxsync rc = rtDvmDiskRead(pDisk, RTDVM_GPT_LBA2BYTE(pThis->HdrRev1.u64LbaPartitionEntries, pDisk),
956a0e3c076406b83d635174a201fd8761ee5133vboxsync pThis->paGptEntries, pThis->HdrRev1.cPartitionEntries * pThis->HdrRev1.cbPartitionEntry);
956a0e3c076406b83d635174a201fd8761ee5133vboxsync /* Count the occupied entries. */
956a0e3c076406b83d635174a201fd8761ee5133vboxsync for (unsigned i = 0; i < pThis->HdrRev1.cPartitionEntries; i++)
956a0e3c076406b83d635174a201fd8761ee5133vboxsync if (!RTUuidIsNull(&pThis->paGptEntries[i].UuidType))
956a0e3c076406b83d635174a201fd8761ee5133vboxsync /* Convert to host endianess. */
956a0e3c076406b83d635174a201fd8761ee5133vboxsync /** @todo: Uuids */
956a0e3c076406b83d635174a201fd8761ee5133vboxsync pThis->paGptEntries[i].u64LbaFirst = RT_LE2H_U64(pThis->paGptEntries[i].u64LbaFirst);
956a0e3c076406b83d635174a201fd8761ee5133vboxsync pThis->paGptEntries[i].u64LbaLast = RT_LE2H_U64(pThis->paGptEntries[i].u64LbaLast);
956a0e3c076406b83d635174a201fd8761ee5133vboxsync pThis->paGptEntries[i].u64Flags = RT_LE2H_U64(pThis->paGptEntries[i].u64Flags);
956a0e3c076406b83d635174a201fd8761ee5133vboxsync for (unsigned cwc = 0; cwc < RT_ELEMENTS(pThis->paGptEntries[i].aPartitionName); cwc++)
956a0e3c076406b83d635174a201fd8761ee5133vboxsync pThis->paGptEntries[i].aPartitionName[cwc] = RT_LE2H_U16(pThis->paGptEntries[i].aPartitionName[cwc]);
68fb2428898c55a7172e6a75a0a8d7ce259919bdvboxsyncstatic DECLCALLBACK(int) rtDvmFmtGptInitialize(PCRTDVMDISK pDisk, PRTDVMFMT phVolMgrFmt)
68fb2428898c55a7172e6a75a0a8d7ce259919bdvboxsyncstatic DECLCALLBACK(void) rtDvmFmtGptClose(RTDVMFMT hVolMgrFmt)
956a0e3c076406b83d635174a201fd8761ee5133vboxsync memset(&pThis->HdrRev1, 0, sizeof(pThis->HdrRev1));
68fb2428898c55a7172e6a75a0a8d7ce259919bdvboxsyncstatic DECLCALLBACK(uint32_t) rtDvmFmtGptGetValidVolumes(RTDVMFMT hVolMgrFmt)
68fb2428898c55a7172e6a75a0a8d7ce259919bdvboxsyncstatic DECLCALLBACK(uint32_t) rtDvmFmtGptGetMaxVolumes(RTDVMFMT hVolMgrFmt)
956a0e3c076406b83d635174a201fd8761ee5133vboxsync * Creates a new volume.
956a0e3c076406b83d635174a201fd8761ee5133vboxsync * @returns IPRT status code.
956a0e3c076406b83d635174a201fd8761ee5133vboxsync * @param pThis The MBR volume manager data.
956a0e3c076406b83d635174a201fd8761ee5133vboxsync * @param pGptEntry The GPT entry.
956a0e3c076406b83d635174a201fd8761ee5133vboxsync * @param idx The index in the partition array.
956a0e3c076406b83d635174a201fd8761ee5133vboxsync * @param phVolFmt Where to store the volume data on success.
68fb2428898c55a7172e6a75a0a8d7ce259919bdvboxsyncstatic int rtDvmFmtMbrVolumeCreate(PRTDVMFMTINTERNAL pThis, PGptEntry pGptEntry,
956a0e3c076406b83d635174a201fd8761ee5133vboxsync PRTDVMVOLUMEFMTINTERNAL pVol = (PRTDVMVOLUMEFMTINTERNAL)RTMemAllocZ(sizeof(RTDVMVOLUMEFMTINTERNAL));
956a0e3c076406b83d635174a201fd8761ee5133vboxsync pVol->offStart = RTDVM_GPT_LBA2BYTE(pGptEntry->u64LbaFirst, pThis->pDisk);
956a0e3c076406b83d635174a201fd8761ee5133vboxsync pVol->cbVolume = RTDVM_GPT_LBA2BYTE(pGptEntry->u64LbaLast - pGptEntry->u64LbaFirst + 1, pThis->pDisk);
68fb2428898c55a7172e6a75a0a8d7ce259919bdvboxsyncstatic DECLCALLBACK(int) rtDvmFmtGptQueryFirstVolume(RTDVMFMT hVolMgrFmt, PRTDVMVOLUMEFMT phVolFmt)
956a0e3c076406b83d635174a201fd8761ee5133vboxsync /* Search for the first non empty entry. */
956a0e3c076406b83d635174a201fd8761ee5133vboxsync for (unsigned i = 0; i < pThis->HdrRev1.cPartitionEntries; i++)
68fb2428898c55a7172e6a75a0a8d7ce259919bdvboxsync rc = rtDvmFmtMbrVolumeCreate(pThis, pGptEntry, i, phVolFmt);
68fb2428898c55a7172e6a75a0a8d7ce259919bdvboxsyncstatic DECLCALLBACK(int) rtDvmFmtGptQueryNextVolume(RTDVMFMT hVolMgrFmt, RTDVMVOLUMEFMT hVolFmt, PRTDVMVOLUMEFMT phVolFmtNext)
956a0e3c076406b83d635174a201fd8761ee5133vboxsync for (unsigned i = pVol->idxEntry + 1; i < pThis->HdrRev1.cPartitionEntries; i++)
68fb2428898c55a7172e6a75a0a8d7ce259919bdvboxsync rc = rtDvmFmtMbrVolumeCreate(pThis, pGptEntry, i, phVolFmtNext);
68fb2428898c55a7172e6a75a0a8d7ce259919bdvboxsyncstatic DECLCALLBACK(void) rtDvmFmtGptVolumeClose(RTDVMVOLUMEFMT hVolFmt)
68fb2428898c55a7172e6a75a0a8d7ce259919bdvboxsyncstatic DECLCALLBACK(uint64_t) rtDvmFmtGptVolumeGetSize(RTDVMVOLUMEFMT hVolFmt)
68fb2428898c55a7172e6a75a0a8d7ce259919bdvboxsyncstatic DECLCALLBACK(int) rtDvmFmtGptVolumeQueryName(RTDVMVOLUMEFMT hVolFmt, char **ppszVolName)
956a0e3c076406b83d635174a201fd8761ee5133vboxsync rc = RTUtf16ToUtf8Ex(&pVol->pGptEntry->aPartitionName[0], RT_ELEMENTS(pVol->pGptEntry->aPartitionName),
68fb2428898c55a7172e6a75a0a8d7ce259919bdvboxsyncstatic DECLCALLBACK(RTDVMVOLTYPE) rtDvmFmtGptVolumeGetType(RTDVMVOLUMEFMT hVolFmt)
956a0e3c076406b83d635174a201fd8761ee5133vboxsync for (unsigned i = 0; i < RT_ELEMENTS(g_aPartType2DvmVolTypes); i++)
956a0e3c076406b83d635174a201fd8761ee5133vboxsync if (!RTUuidCompareStr(&pVol->pGptEntry->UuidType, g_aPartType2DvmVolTypes[i].pcszUuid))
956a0e3c076406b83d635174a201fd8761ee5133vboxsync enmVolType = g_aPartType2DvmVolTypes[i].enmVolType;
68fb2428898c55a7172e6a75a0a8d7ce259919bdvboxsyncstatic DECLCALLBACK(uint64_t) rtDvmFmtGptVolumeGetFlags(RTDVMVOLUMEFMT hVolFmt)
68fb2428898c55a7172e6a75a0a8d7ce259919bdvboxsyncstatic DECLCALLBACK(int) rtDvmFmtGptVolumeRead(RTDVMVOLUMEFMT hVolFmt, uint64_t off, void *pvBuf, size_t cbRead)
956a0e3c076406b83d635174a201fd8761ee5133vboxsync AssertReturn(off + cbRead <= pVol->cbVolume, VERR_INVALID_PARAMETER);
68fb2428898c55a7172e6a75a0a8d7ce259919bdvboxsync return rtDvmDiskRead(pVol->pVolMgr->pDisk, pVol->offStart + off, pvBuf, cbRead);
68fb2428898c55a7172e6a75a0a8d7ce259919bdvboxsyncstatic DECLCALLBACK(int) rtDvmFmtGptVolumeWrite(RTDVMVOLUMEFMT hVolFmt, uint64_t off, const void *pvBuf, size_t cbWrite)
956a0e3c076406b83d635174a201fd8761ee5133vboxsync AssertReturn(off + cbWrite <= pVol->cbVolume, VERR_INVALID_PARAMETER);
68fb2428898c55a7172e6a75a0a8d7ce259919bdvboxsync return rtDvmDiskWrite(pVol->pVolMgr->pDisk, pVol->offStart + off, pvBuf, cbWrite);
956a0e3c076406b83d635174a201fd8761ee5133vboxsync /* pcszFmt */
956a0e3c076406b83d635174a201fd8761ee5133vboxsync /* pfnProbe */
956a0e3c076406b83d635174a201fd8761ee5133vboxsync /* pfnOpen */
956a0e3c076406b83d635174a201fd8761ee5133vboxsync /* pfnInitialize */
956a0e3c076406b83d635174a201fd8761ee5133vboxsync /* pfnClose */
956a0e3c076406b83d635174a201fd8761ee5133vboxsync /* pfnGetValidVolumes */
956a0e3c076406b83d635174a201fd8761ee5133vboxsync /* pfnGetMaxVolumes */
956a0e3c076406b83d635174a201fd8761ee5133vboxsync /* pfnQueryFirstVolume */
956a0e3c076406b83d635174a201fd8761ee5133vboxsync /* pfnQueryNextVolume */
956a0e3c076406b83d635174a201fd8761ee5133vboxsync /* pfnVolumeClose */
956a0e3c076406b83d635174a201fd8761ee5133vboxsync /* pfnVolumeGetSize */
956a0e3c076406b83d635174a201fd8761ee5133vboxsync /* pfnVolumeQueryName */
956a0e3c076406b83d635174a201fd8761ee5133vboxsync /* pfnVolumeGetType */
956a0e3c076406b83d635174a201fd8761ee5133vboxsync /* pfnVolumeGetFlags */
956a0e3c076406b83d635174a201fd8761ee5133vboxsync /* pfnVolumeRead */
956a0e3c076406b83d635174a201fd8761ee5133vboxsync /* pfnVolumeWrite */