VirtualBox

Changeset 85877 in vbox for trunk/include


Ignore:
Timestamp:
Aug 24, 2020 5:03:23 PM (4 years ago)
Author:
vboxsync
Message:

Main: bugref:9224: DVM API changes

Location:
trunk/include/iprt
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/include/iprt/dvm.h

    r85121 r85877  
    241241
    242242/**
     243 * Gets the UUID of the disk if applicable.
     244 *
     245 * Disks using the MBR format may return the 32-bit disk identity in the
     246 * u32TimeLow field and set the rest to zero.
     247 *
     248 * @returns IPRT status code.
     249 * @retval  VERR_NOT_SUPPORTED if the partition scheme doesn't do UUIDs.
     250 * @retval  VINF_NOT_SUPPORTED if non-UUID disk ID is returned.
     251 * @param   hVolMgr     The volume manager handle.
     252 * @param   pUuid       Where to return the UUID.
     253 *
     254 * @todo It's quite possible this should be turned into a map-level edition of
     255 *       RTDvmVolumeQueryProp...
     256 */
     257RTDECL(int) RTDvmMapQueryDiskUuid(RTDVM hVolMgr, PRTUUID pUuid);
     258
     259/**
    243260 * Gets the number of valid partitions in the map.
    244261 *
     
    355372
    356373/**
    357  * Queries the range of the given volume on the underyling medium.
     374 * Queries the range of the given volume on the underlying medium.
    358375 *
    359376 * @returns IPRT status code.
     
    361378 * @param   hVol            The volume handle.
    362379 * @param   poffStart       Where to store the start offset in bytes on the underlying medium.
    363  * @param   poffEnd         Where to store the end offset in bytes on the underlying medium (inclusive).
    364  */
    365 RTDECL(int) RTDvmVolumeQueryRange(RTDVMVOLUME hVol, uint64_t *poffStart, uint64_t *poffEnd);
     380 * @param   poffLast        Where to store the last offset in bytes on the underlying medium (inclusive).
     381 */
     382RTDECL(int) RTDvmVolumeQueryRange(RTDVMVOLUME hVol, uint64_t *poffStart, uint64_t *poffLast);
     383
     384/**
     385 * Returns the partition/whatever table location of the volume.
     386 *
     387 * For volume format with a single table, like GPT and BSD-labels, it will
     388 * return the location of that table.  Though for GPT, the fake MBR will not be
     389 * included.
     390 *
     391 * For logical (extended) MBR-style volumes, this will return the location of
     392 * the extended partition table.  For primary volumes the MBR location is
     393 * returned.  The special MBR case is why this operation is done on the volume
     394 * rather than the volume manager.
     395 *
     396 * Using RTDvmVolumeGetIndex with RTDVMVOLIDX_IN_PART_TABLE should get you
     397 * the index in the table returned by this function.
     398 *
     399 * @returns IPRT status code.
     400 * @param   hVol            The volume handle.
     401 * @param   poffTable       Where to return the byte offset on the underlying
     402 *                          media of the (partition/volume/whatever) table.
     403 * @param   pcbTable        Where to return the table size in bytes.  (This does
     404 *                          not include any alignment padding or such, just
     405 *                          padding up to sector/block size.)
     406 */
     407RTDECL(int) RTDvmVolumeQueryTableLocation(RTDVMVOLUME hVol, uint64_t *poffTable, uint64_t *pcbTable);
     408
     409/**
     410 * RTDvmVolumeGetIndex indexes.
     411 */
     412typedef enum RTDVMVOLIDX
     413{
     414    /** Invalid zero value. */
     415    RTDVMVOLIDX_INVALID = 0,
     416    /** Only consider user visible ones, i.e. don't count MBR extended partition
     417     *  entries and such like. */
     418    RTDVMVOLIDX_USER_VISIBLE,
     419    /** Index when all volumes, user visible, hidden, special, whatever ones are
     420     * included.
     421     *
     422     * For MBR this is 1-based index where all primary entires are included whether
     423     * in use or not.  Only non-empty entries in extended tables are counted, though
     424     * the forward link is included. */
     425    RTDVMVOLIDX_ALL,
     426    /** The raw index within the partition/volume/whatever table.  This have a kind
     427     *  of special meaning to MBR, where there are multiple tables. */
     428    RTDVMVOLIDX_IN_TABLE,
     429    /** Follows the linux /dev/sdaX convention as closely as absolutely possible. */
     430    RTDVMVOLIDX_LINUX,
     431    /** End of valid indexes. */
     432    RTDVMVOLIDX_END,
     433    /** Make sure the type is 32-bit.   */
     434    RTDVMVOLIDX_32BIT_HACK = 0x7fffffff
     435} RTDVMVOLIDX;
     436
     437/**
     438 * Gets the tiven index for the specified volume.
     439 *
     440 * @returns The requested index, UINT32_MAX on failure.
     441 * @param   hVol            The volume handle.
     442 * @param   enmIndex        Which kind of index to get for the volume.
     443 */
     444RTDECL(uint32_t) RTDvmVolumeGetIndex(RTDVMVOLUME hVol, RTDVMVOLIDX enmIndex);
     445
     446/**
     447 * Volume properties queriable via RTDvmVolumeQueryProp.
     448 *
     449 * @note Integer values can typically be queried in multiple sizes.  This is
     450 *       handled by the frontend code.  The format specific backends only
     451 *       have to handle the smallest allowed size.
     452 */
     453typedef enum RTDVMVOLPROP
     454{
     455    /** Customary invalid zero value. */
     456    RTDVMVOLPROP_INVALID = 0,
     457    /** unsigned[16,32,64]:     MBR first cylinder (0-based, CHS). */
     458    RTDVMVOLPROP_MBR_FIRST_CYLINDER,
     459    /** unsigned[8,16,32,64]:   MBR first head (0-based, CHS). */
     460    RTDVMVOLPROP_MBR_FIRST_HEAD,
     461    /** unsigned[8,16,32,64]:   MBR first sector (1-based, CHS). */
     462    RTDVMVOLPROP_MBR_FIRST_SECTOR,
     463    /** unsigned[16,32,64]:     MBR last cylinder (0-based, CHS). */
     464    RTDVMVOLPROP_MBR_LAST_CYLINDER,
     465    /** unsigned[8,16,32,64]:   MBR last head (0-based, CHS). */
     466    RTDVMVOLPROP_MBR_LAST_HEAD,
     467    /** unsigned[8,16,32,64]:   MBR last sector (1-based, CHS). */
     468    RTDVMVOLPROP_MBR_LAST_SECTOR,
     469    /** unsigned[8,16,32,64]:   MBR partition type. */
     470    RTDVMVOLPROP_MBR_TYPE,
     471    /** RTUUID:                 GPT volume type. */
     472    RTDVMVOLPROP_GPT_TYPE,
     473    /** RTUUID:                 GPT volume UUID. */
     474    RTDVMVOLPROP_GPT_UUID,
     475    /** End of valid values. */
     476    RTDVMVOLPROP_END,
     477    /** Make sure the type is 32-bit. */
     478    RTDVMVOLPROP_32BIT_HACK = 0x7fffffff
     479} RTDVMVOLPROP;
     480
     481/**
     482 * Query a generic volume property.
     483 *
     484 * This is an extensible interface for retriving mostly format specific
     485 * information, or information that's not commonly used.  (It's modelled after
     486 * RTLdrQueryPropEx.)
     487 *
     488 * @returns IPRT status code.
     489 * @retval  VERR_NOT_SUPPORTED if the property query isn't supported (either all
     490 *          or that specific property).  The caller  must  handle this result.
     491 * @retval  VERR_NOT_FOUND is currently not returned, but intended for cases
     492 *          where it wasn't present in the tables.
     493 * @retval  VERR_INVALID_FUNCTION if the @a enmProperty value is wrong.
     494 * @retval  VERR_INVALID_PARAMETER if the fixed buffer size is wrong. Correct
     495 *          size in @a *pcbRet.
     496 * @retval  VERR_BUFFER_OVERFLOW if the property doesn't have a fixed size
     497 *          buffer and the buffer isn't big enough. Correct size in @a *pcbRet.
     498 * @retval  VERR_INVALID_HANDLE if the handle is invalid.
     499 * @param   hVol        Handle to the volume.
     500 * @param   enmProperty The property to query.
     501 * @param   pvBuf       Pointer to the input / output buffer.  In most cases
     502 *                      it's only used for returning data.
     503 * @param   cbBuf       The size of the buffer.
     504 * @param   pcbRet      Where to return the amount of data returned.  On
     505 *                      buffer size errors, this is set to the correct size.
     506 *                      Optional.
     507 * @sa      RTDvmVolumeGetPropU64
     508 */
     509RTDECL(int) RTDvmVolumeQueryProp(RTDVMVOLUME hVol, RTDVMVOLPROP enmProperty, void *pvBuf, size_t cbBuf, size_t *pcbBuf);
     510
     511/**
     512 * Wrapper around RTDvmVolumeQueryProp for simplifying getting unimportant
     513 * integer properties.
     514 *
     515 * @returns The property value if supported and found, the default value if not.
     516 *          Errors other than VERR_NOT_SUPPORTED and VERR_NOT_FOUND are
     517 *          asserted.
     518 * @param   hVol        Handle to the volume.
     519 * @param   enmProperty The property to query.
     520 * @param   uDefault    The value to return on error.
     521 * @sa      RTDvmVolumeQueryProp
     522 */
     523RTDECL(uint64_t) RTDvmVolumeGetPropU64(RTDVMVOLUME hVol, RTDVMVOLPROP enmProperty, uint64_t uDefault);
    366524
    367525/**
  • trunk/include/iprt/mangling.h

    r85875 r85877  
    833833# define RTDvmMapQueryFirstVolume                       RT_MANGLER(RTDvmMapQueryFirstVolume)
    834834# define RTDvmMapQueryNextVolume                        RT_MANGLER(RTDvmMapQueryNextVolume)
     835# define RTDvmMapQueryDiskUuid                          RT_MANGLER(RTDvmMapQueryDiskUuid)
    835836# define RTDvmVolumeRetain                              RT_MANGLER(RTDvmVolumeRetain)
    836837# define RTDvmVolumeRelease                             RT_MANGLER(RTDvmVolumeRelease)
     838# define RTDvmVolumeGetIndex                            RT_MANGLER(RTDvmVolumeGetIndex)
     839# define RTDvmVolumeGetPropU64                          RT_MANGLER(RTDvmVolumeGetPropU64)
    837840# define RTDvmVolumeGetSize                             RT_MANGLER(RTDvmVolumeGetSize)
    838841# define RTDvmVolumeQueryName                           RT_MANGLER(RTDvmVolumeQueryName)
     842# define RTDvmVolumeQueryProp                           RT_MANGLER(RTDvmVolumeQueryProp)
     843# define RTDvmVolumeQueryTableLocation                  RT_MANGLER(RTDvmVolumeQueryTableLocation)
    839844# define RTDvmVolumeGetType                             RT_MANGLER(RTDvmVolumeGetType)
    840845# define RTDvmVolumeGetFlags                            RT_MANGLER(RTDvmVolumeGetFlags)
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