dvm.h revision e52b0dfe3d9ead70e24f2ce4ed3faa6c79c00618
63f06dce77bb2d9b1c5aa5deeb47a1069987fd1end * IPRT Disk Volume Management API (DVM).
63f06dce77bb2d9b1c5aa5deeb47a1069987fd1end * Copyright (C) 2011 Oracle Corporation
63f06dce77bb2d9b1c5aa5deeb47a1069987fd1end * This file is part of VirtualBox Open Source Edition (OSE), as
63f06dce77bb2d9b1c5aa5deeb47a1069987fd1end * available from http://www.virtualbox.org. This file is free software;
63f06dce77bb2d9b1c5aa5deeb47a1069987fd1end * you can redistribute it and/or modify it under the terms of the GNU
63f06dce77bb2d9b1c5aa5deeb47a1069987fd1end * General Public License (GPL) as published by the Free Software
63f06dce77bb2d9b1c5aa5deeb47a1069987fd1end * Foundation, in version 2 as it comes in the "COPYING" file of the
63f06dce77bb2d9b1c5aa5deeb47a1069987fd1end * VirtualBox OSE distribution. VirtualBox OSE is distributed in the
63f06dce77bb2d9b1c5aa5deeb47a1069987fd1end * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
63f06dce77bb2d9b1c5aa5deeb47a1069987fd1end * The contents of this file may alternatively be used under the terms
63f06dce77bb2d9b1c5aa5deeb47a1069987fd1end * of the Common Development and Distribution License Version 1.0
63f06dce77bb2d9b1c5aa5deeb47a1069987fd1end * (CDDL) only, as it comes in the "COPYING.CDDL" file of the
63f06dce77bb2d9b1c5aa5deeb47a1069987fd1end * VirtualBox OSE distribution, in which case the provisions of the
63f06dce77bb2d9b1c5aa5deeb47a1069987fd1end * CDDL are applicable instead of those of the GPL.
63f06dce77bb2d9b1c5aa5deeb47a1069987fd1end * You may elect to license modified versions of this file under the
63f06dce77bb2d9b1c5aa5deeb47a1069987fd1end * terms and conditions of either the GPL or the CDDL or both.
63f06dce77bb2d9b1c5aa5deeb47a1069987fd1end/** @defgroup grp_dvm IPRT Disk Volume Management
63f06dce77bb2d9b1c5aa5deeb47a1069987fd1end * Volume type.
63f06dce77bb2d9b1c5aa5deeb47a1069987fd1end * Comparable to the FS type in MBR partition maps
63f06dce77bb2d9b1c5aa5deeb47a1069987fd1end * or the partition type GUIDs in GPT tables.
ecc5150d35c0dc5ee5119c2717e6660fa331abbftakashi /** Invalid. */
4a7be288e6fc28a6cb940e26542dbf574bc907b9pctony /** Unknown. */
80eed96ee3d8cfa0b66d9fb1cfe63fd83254d38bnilgun /** Volume hosts a NTFS filesystem. */
63f06dce77bb2d9b1c5aa5deeb47a1069987fd1end /** Volume hosts a FAT16 filesystem. */
e1e8390280254f7f0580d701e583f670643d4f3fnilgun /** Volume hosts a FAT32 filesystem. */
63f06dce77bb2d9b1c5aa5deeb47a1069987fd1end /** Volume hosts a Linux swap. */
e1e8390280254f7f0580d701e583f670643d4f3fnilgun /** Volume hosts a Linux filesystem. */
63f06dce77bb2d9b1c5aa5deeb47a1069987fd1end /** Volume hosts a Linux LVM. */
08cf4a15275e4cb65a424b3a1db5410bfb51085cjim /** Volume hosts a Linux SoftRaid. */
63f06dce77bb2d9b1c5aa5deeb47a1069987fd1end /** Volume hosts a FreeBSD disklabel. */
63f06dce77bb2d9b1c5aa5deeb47a1069987fd1end /** Volume hosts a NetBSD disklabel. */
1ac39787115a288f5e848344b1b1e8dccb1c58f1nd /** Volume hosts a OpenBSD disklabel. */
63f06dce77bb2d9b1c5aa5deeb47a1069987fd1end /** Volume hosts a Mac OS X HFS or HFS+ filesystem. */
63f06dce77bb2d9b1c5aa5deeb47a1069987fd1end /** Volume hosts a Solaris volume. */
623eebe956d9c2d6d073ed3eae855b56030b40e9noodl /** Usual 32bit hack. */
63f06dce77bb2d9b1c5aa5deeb47a1069987fd1end/** @defgroup grp_dvm_vol_flags Volume flags used by DVMVolumeGetFlags.
63f06dce77bb2d9b1c5aa5deeb47a1069987fd1end/** Volume flags - Volume is bootable. */
63f06dce77bb2d9b1c5aa5deeb47a1069987fd1end/** Volume flags - Volume is active. */
63f06dce77bb2d9b1c5aa5deeb47a1069987fd1end/** A handle to a volume manager. */
63f06dce77bb2d9b1c5aa5deeb47a1069987fd1end/** A pointer to a volume manager handle. */
f3ec420152ca921e4c1ce77782f51b53f659018dnd/** NIL volume manager handle. */
63f06dce77bb2d9b1c5aa5deeb47a1069987fd1end/** A handle to a volume in a volume map. */
63f06dce77bb2d9b1c5aa5deeb47a1069987fd1end/** A pointer to a volume handle. */
63f06dce77bb2d9b1c5aa5deeb47a1069987fd1end/** NIL volume handle. */
63f06dce77bb2d9b1c5aa5deeb47a1069987fd1end * Callback to read data from the underlying medium.
63f06dce77bb2d9b1c5aa5deeb47a1069987fd1end * @returns IPRT status code.
63f06dce77bb2d9b1c5aa5deeb47a1069987fd1end * @param pvUser Opaque user data passed on creation.
63f06dce77bb2d9b1c5aa5deeb47a1069987fd1end * @param off Offset to start reading from.
1ac39787115a288f5e848344b1b1e8dccb1c58f1nd * @param pvBuf Where to store the read data.
63f06dce77bb2d9b1c5aa5deeb47a1069987fd1end * @param cbRead How many bytes to read.
63f06dce77bb2d9b1c5aa5deeb47a1069987fd1endtypedef DECLCALLBACK(int) FNDVMREAD(void *pvUser, uint64_t off, void *pvBuf, size_t cbRead);
63f06dce77bb2d9b1c5aa5deeb47a1069987fd1end/** Pointer to a read callback. */
63f06dce77bb2d9b1c5aa5deeb47a1069987fd1end * Callback to write data to the underlying medium.
63f06dce77bb2d9b1c5aa5deeb47a1069987fd1end * @returns IPRT status code.
63f06dce77bb2d9b1c5aa5deeb47a1069987fd1end * @param pvUser Opaque user data passed on creation.
63f06dce77bb2d9b1c5aa5deeb47a1069987fd1end * @param off Offset to start writing to.
63f06dce77bb2d9b1c5aa5deeb47a1069987fd1end * @param pvBuf The data to write.
63f06dce77bb2d9b1c5aa5deeb47a1069987fd1end * @param cbRead How many bytes to write.
63f06dce77bb2d9b1c5aa5deeb47a1069987fd1endtypedef DECLCALLBACK(int) FNDVMWRITE(void *pvUser, uint64_t off, const void *pvBuf, size_t cbWrite);
d0828c8a321dc5e9ea60550f052294669c08cf93jim/** Pointer to a read callback. */
63f06dce77bb2d9b1c5aa5deeb47a1069987fd1end * Create a new volume manager.
63f06dce77bb2d9b1c5aa5deeb47a1069987fd1end * @returns IPRT status.
63f06dce77bb2d9b1c5aa5deeb47a1069987fd1end * @param phVolMgr Where to store the handle to the volume manager on
2704de98885368683621b01c8f8f4e4b01557611takashi * @param pfnRead Read callback for the underlying
d0828c8a321dc5e9ea60550f052294669c08cf93jim * @param pfnWrite Write callback for the underlying
63f06dce77bb2d9b1c5aa5deeb47a1069987fd1end * @param cbDisk Size of the underlying disk in bytes.
1d980e5489836e977ba59b419e27b0ec875c4bd3takashi * @param cbSector Size of one sector in bytes.
1d980e5489836e977ba59b419e27b0ec875c4bd3takashi * @param pvUser Opaque user data passed to the callbacks.
1d980e5489836e977ba59b419e27b0ec875c4bd3takashiRTDECL(int) RTDvmCreate(PRTDVM phVolMgr, PFNDVMREAD pfnRead,
63f06dce77bb2d9b1c5aa5deeb47a1069987fd1end * Retain a given volume manager.
63f06dce77bb2d9b1c5aa5deeb47a1069987fd1end * @returns New reference count on success, UINT32_MAX on failure.
63f06dce77bb2d9b1c5aa5deeb47a1069987fd1end * @param hVolMgr The volume manager to retain.
27d778df0b517e1578f907d2e51eb961cd8ee5fbjim * Releases a given volume manager.
63f06dce77bb2d9b1c5aa5deeb47a1069987fd1end * @returns New reference count on success (0 if closed), UINT32_MAX on failure.
63f06dce77bb2d9b1c5aa5deeb47a1069987fd1end * @param hVolMgr The volume manager to release.
604c89126c27104f659d7a51b0113e3bd435faf8fielding * Probes the underyling disk for the best volume manager format handler
50cb7e2b30597f481fee57bac945190f06ebcc58jorton * and opens it.
63f06dce77bb2d9b1c5aa5deeb47a1069987fd1end * @returns IPRT status code.
63f06dce77bb2d9b1c5aa5deeb47a1069987fd1end * @retval VERR_NOT_FOUND if no backend can handle the volume map on the disk.
63f06dce77bb2d9b1c5aa5deeb47a1069987fd1end * @param hVolMgr The volume manager handle.
50cb7e2b30597f481fee57bac945190f06ebcc58jorton * Initializes a new volume map using the given format handler.
f772e8f448c223e5ea306f1bf92d97d968f972d5jim * @returns IPRT status code.
f772e8f448c223e5ea306f1bf92d97d968f972d5jim * @param hVolMgr The volume manager handle.
4a7be288e6fc28a6cb940e26542dbf574bc907b9pctony * @param pszFmt The format to use for the new map.
d87bca6b7382e9f3648aec4fb3419b225c39ee41jimRTDECL(int) RTDvmMapInitialize(RTDVM hVolMgr, const char *pszFmt);
f3ec420152ca921e4c1ce77782f51b53f659018dnd * Gets the currently used format of the disk map.
63f06dce77bb2d9b1c5aa5deeb47a1069987fd1end * @returns Name of the format.
63f06dce77bb2d9b1c5aa5deeb47a1069987fd1end * @param hVolMgr The volume manager handle.
e1e8390280254f7f0580d701e583f670643d4f3fnilgun * Gets the number of valid partitions in the map.
63f06dce77bb2d9b1c5aa5deeb47a1069987fd1end * @returns The number of valid volumes in the map or UINT32_MAX on failure.
63f06dce77bb2d9b1c5aa5deeb47a1069987fd1end * @param hVolMgr The volume manager handle.
e1e8390280254f7f0580d701e583f670643d4f3fnilgunRTDECL(uint32_t) RTDvmMapGetValidVolumes(RTDVM hVolMgr);
63f06dce77bb2d9b1c5aa5deeb47a1069987fd1end * Gets the maximum number of partitions the map can hold.
1d980e5489836e977ba59b419e27b0ec875c4bd3takashi * @returns The maximum number of volumes in the map or UINT32_MAX on failure.
63f06dce77bb2d9b1c5aa5deeb47a1069987fd1end * @param hVolMgr The volume manager handle.
63f06dce77bb2d9b1c5aa5deeb47a1069987fd1end * Get the first valid volume from a map.
63f06dce77bb2d9b1c5aa5deeb47a1069987fd1end * @returns IPRT status code.
63f06dce77bb2d9b1c5aa5deeb47a1069987fd1end * @param hVolMgr The volume manager handle.
b036ef2952fb6924b308f954b39786443460ddc6rpluem * @param phVol Where to store the handle to the first volume on
63f06dce77bb2d9b1c5aa5deeb47a1069987fd1end * success. Release with RTDvmVolumeRelease().