e4f367251aede667a6de69baa54ef9eb5f150871vboxsync/** @file
e4f367251aede667a6de69baa54ef9eb5f150871vboxsync * VD Container API - internal interfaces.
e4f367251aede667a6de69baa54ef9eb5f150871vboxsync */
e4f367251aede667a6de69baa54ef9eb5f150871vboxsync
e4f367251aede667a6de69baa54ef9eb5f150871vboxsync/*
c7814cf6e1240a519cbec0441e033d0e2470ed00vboxsync * Copyright (C) 2011-2013 Oracle Corporation
e4f367251aede667a6de69baa54ef9eb5f150871vboxsync *
e4f367251aede667a6de69baa54ef9eb5f150871vboxsync * This file is part of VirtualBox Open Source Edition (OSE), as
e4f367251aede667a6de69baa54ef9eb5f150871vboxsync * available from http://www.virtualbox.org. This file is free software;
e4f367251aede667a6de69baa54ef9eb5f150871vboxsync * you can redistribute it and/or modify it under the terms of the GNU
e4f367251aede667a6de69baa54ef9eb5f150871vboxsync * General Public License (GPL) as published by the Free Software
e4f367251aede667a6de69baa54ef9eb5f150871vboxsync * Foundation, in version 2 as it comes in the "COPYING" file of the
e4f367251aede667a6de69baa54ef9eb5f150871vboxsync * VirtualBox OSE distribution. VirtualBox OSE is distributed in the
e4f367251aede667a6de69baa54ef9eb5f150871vboxsync * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
e4f367251aede667a6de69baa54ef9eb5f150871vboxsync *
e4f367251aede667a6de69baa54ef9eb5f150871vboxsync * The contents of this file may alternatively be used under the terms
e4f367251aede667a6de69baa54ef9eb5f150871vboxsync * of the Common Development and Distribution License Version 1.0
e4f367251aede667a6de69baa54ef9eb5f150871vboxsync * (CDDL) only, as it comes in the "COPYING.CDDL" file of the
e4f367251aede667a6de69baa54ef9eb5f150871vboxsync * VirtualBox OSE distribution, in which case the provisions of the
e4f367251aede667a6de69baa54ef9eb5f150871vboxsync * CDDL are applicable instead of those of the GPL.
e4f367251aede667a6de69baa54ef9eb5f150871vboxsync *
e4f367251aede667a6de69baa54ef9eb5f150871vboxsync * You may elect to license modified versions of this file under the
e4f367251aede667a6de69baa54ef9eb5f150871vboxsync * terms and conditions of either the GPL or the CDDL or both.
e4f367251aede667a6de69baa54ef9eb5f150871vboxsync */
e4f367251aede667a6de69baa54ef9eb5f150871vboxsync
e4f367251aede667a6de69baa54ef9eb5f150871vboxsync#ifndef ___VBox_VD_Interfaces_Internal_h
e4f367251aede667a6de69baa54ef9eb5f150871vboxsync#define ___VBox_VD_Interfaces_Internal_h
e4f367251aede667a6de69baa54ef9eb5f150871vboxsync
e4f367251aede667a6de69baa54ef9eb5f150871vboxsync#include <iprt/sg.h>
e4f367251aede667a6de69baa54ef9eb5f150871vboxsync#include <VBox/vd-ifs.h>
e4f367251aede667a6de69baa54ef9eb5f150871vboxsync
e4f367251aede667a6de69baa54ef9eb5f150871vboxsyncRT_C_DECLS_BEGIN
e4f367251aede667a6de69baa54ef9eb5f150871vboxsync
e4f367251aede667a6de69baa54ef9eb5f150871vboxsync/**
e4f367251aede667a6de69baa54ef9eb5f150871vboxsync * Interface to get the parent state.
e4f367251aede667a6de69baa54ef9eb5f150871vboxsync *
e4f367251aede667a6de69baa54ef9eb5f150871vboxsync * Per-operation interface. Optional, present only if there is a parent, and
e4f367251aede667a6de69baa54ef9eb5f150871vboxsync * used only internally for compacting.
e4f367251aede667a6de69baa54ef9eb5f150871vboxsync */
e4f367251aede667a6de69baa54ef9eb5f150871vboxsynctypedef struct VDINTERFACEPARENTSTATE
e4f367251aede667a6de69baa54ef9eb5f150871vboxsync{
e4f367251aede667a6de69baa54ef9eb5f150871vboxsync /**
e4f367251aede667a6de69baa54ef9eb5f150871vboxsync * Common interface header.
e4f367251aede667a6de69baa54ef9eb5f150871vboxsync */
e4f367251aede667a6de69baa54ef9eb5f150871vboxsync VDINTERFACE Core;
e4f367251aede667a6de69baa54ef9eb5f150871vboxsync
e4f367251aede667a6de69baa54ef9eb5f150871vboxsync /**
e4f367251aede667a6de69baa54ef9eb5f150871vboxsync * Read data callback.
e4f367251aede667a6de69baa54ef9eb5f150871vboxsync *
e4f367251aede667a6de69baa54ef9eb5f150871vboxsync * @return VBox status code.
e4f367251aede667a6de69baa54ef9eb5f150871vboxsync * @return VERR_VD_NOT_OPENED if no image is opened in HDD container.
e4f367251aede667a6de69baa54ef9eb5f150871vboxsync * @param pvUser The opaque data passed for the operation.
e4f367251aede667a6de69baa54ef9eb5f150871vboxsync * @param uOffset Offset of first reading byte from start of disk.
e4f367251aede667a6de69baa54ef9eb5f150871vboxsync * Must be aligned to a sector boundary.
e4f367251aede667a6de69baa54ef9eb5f150871vboxsync * @param pvBuffer Pointer to buffer for reading data.
e4f367251aede667a6de69baa54ef9eb5f150871vboxsync * @param cbBuffer Number of bytes to read.
e4f367251aede667a6de69baa54ef9eb5f150871vboxsync * Must be aligned to a sector boundary.
e4f367251aede667a6de69baa54ef9eb5f150871vboxsync */
e4f367251aede667a6de69baa54ef9eb5f150871vboxsync DECLR3CALLBACKMEMBER(int, pfnParentRead, (void *pvUser, uint64_t uOffset, void *pvBuffer, size_t cbBuffer));
e4f367251aede667a6de69baa54ef9eb5f150871vboxsync
e4f367251aede667a6de69baa54ef9eb5f150871vboxsync} VDINTERFACEPARENTSTATE, *PVDINTERFACEPARENTSTATE;
e4f367251aede667a6de69baa54ef9eb5f150871vboxsync
e4f367251aede667a6de69baa54ef9eb5f150871vboxsync
e4f367251aede667a6de69baa54ef9eb5f150871vboxsync/**
e4f367251aede667a6de69baa54ef9eb5f150871vboxsync * Get parent state interface from interface list.
e4f367251aede667a6de69baa54ef9eb5f150871vboxsync *
e4f367251aede667a6de69baa54ef9eb5f150871vboxsync * @return Pointer to the first parent state interface in the list.
e4f367251aede667a6de69baa54ef9eb5f150871vboxsync * @param pVDIfs Pointer to the interface list.
e4f367251aede667a6de69baa54ef9eb5f150871vboxsync */
e4f367251aede667a6de69baa54ef9eb5f150871vboxsyncDECLINLINE(PVDINTERFACEPARENTSTATE) VDIfParentStateGet(PVDINTERFACE pVDIfs)
e4f367251aede667a6de69baa54ef9eb5f150871vboxsync{
e4f367251aede667a6de69baa54ef9eb5f150871vboxsync PVDINTERFACE pIf = VDInterfaceGet(pVDIfs, VDINTERFACETYPE_PARENTSTATE);
e4f367251aede667a6de69baa54ef9eb5f150871vboxsync
e4f367251aede667a6de69baa54ef9eb5f150871vboxsync /* Check that the interface descriptor is a progress interface. */
e4f367251aede667a6de69baa54ef9eb5f150871vboxsync AssertMsgReturn( !pIf
e4f367251aede667a6de69baa54ef9eb5f150871vboxsync || ( (pIf->enmInterface == VDINTERFACETYPE_PARENTSTATE)
e4f367251aede667a6de69baa54ef9eb5f150871vboxsync && (pIf->cbSize == sizeof(VDINTERFACEPARENTSTATE))),
e4f367251aede667a6de69baa54ef9eb5f150871vboxsync ("Not a parent state interface"), NULL);
e4f367251aede667a6de69baa54ef9eb5f150871vboxsync
e4f367251aede667a6de69baa54ef9eb5f150871vboxsync return (PVDINTERFACEPARENTSTATE)pIf;
e4f367251aede667a6de69baa54ef9eb5f150871vboxsync}
e4f367251aede667a6de69baa54ef9eb5f150871vboxsync
e4f367251aede667a6de69baa54ef9eb5f150871vboxsync/** Forward declaration. Only visible in the VBoxHDD module. */
e4f367251aede667a6de69baa54ef9eb5f150871vboxsync/** I/O context */
e4f367251aede667a6de69baa54ef9eb5f150871vboxsynctypedef struct VDIOCTX *PVDIOCTX;
e4f367251aede667a6de69baa54ef9eb5f150871vboxsync/** Storage backend handle. */
e4f367251aede667a6de69baa54ef9eb5f150871vboxsynctypedef struct VDIOSTORAGE *PVDIOSTORAGE;
e4f367251aede667a6de69baa54ef9eb5f150871vboxsync/** Pointer to a storage backend handle. */
e4f367251aede667a6de69baa54ef9eb5f150871vboxsynctypedef PVDIOSTORAGE *PPVDIOSTORAGE;
e4f367251aede667a6de69baa54ef9eb5f150871vboxsync
e4f367251aede667a6de69baa54ef9eb5f150871vboxsync/**
e4f367251aede667a6de69baa54ef9eb5f150871vboxsync * Completion callback for meta/userdata reads or writes.
e4f367251aede667a6de69baa54ef9eb5f150871vboxsync *
e4f367251aede667a6de69baa54ef9eb5f150871vboxsync * @return VBox status code.
e4f367251aede667a6de69baa54ef9eb5f150871vboxsync * VINF_SUCCESS if everything was successful and the transfer can continue.
e4f367251aede667a6de69baa54ef9eb5f150871vboxsync * VERR_VD_ASYNC_IO_IN_PROGRESS if there is another data transfer pending.
e4f367251aede667a6de69baa54ef9eb5f150871vboxsync * @param pBackendData The opaque backend data.
e4f367251aede667a6de69baa54ef9eb5f150871vboxsync * @param pIoCtx I/O context associated with this request.
e4f367251aede667a6de69baa54ef9eb5f150871vboxsync * @param pvUser Opaque user data passed during a read/write request.
e4f367251aede667a6de69baa54ef9eb5f150871vboxsync * @param rcReq Status code for the completed request.
e4f367251aede667a6de69baa54ef9eb5f150871vboxsync */
e4f367251aede667a6de69baa54ef9eb5f150871vboxsynctypedef DECLCALLBACK(int) FNVDXFERCOMPLETED(void *pBackendData, PVDIOCTX pIoCtx, void *pvUser, int rcReq);
e4f367251aede667a6de69baa54ef9eb5f150871vboxsync/** Pointer to FNVDXFERCOMPLETED() */
e4f367251aede667a6de69baa54ef9eb5f150871vboxsynctypedef FNVDXFERCOMPLETED *PFNVDXFERCOMPLETED;
e4f367251aede667a6de69baa54ef9eb5f150871vboxsync
e4f367251aede667a6de69baa54ef9eb5f150871vboxsync/** Metadata transfer handle. */
e4f367251aede667a6de69baa54ef9eb5f150871vboxsynctypedef struct VDMETAXFER *PVDMETAXFER;
e4f367251aede667a6de69baa54ef9eb5f150871vboxsync/** Pointer to a metadata transfer handle. */
e4f367251aede667a6de69baa54ef9eb5f150871vboxsynctypedef PVDMETAXFER *PPVDMETAXFER;
e4f367251aede667a6de69baa54ef9eb5f150871vboxsync
e4f367251aede667a6de69baa54ef9eb5f150871vboxsync
e4f367251aede667a6de69baa54ef9eb5f150871vboxsync/**
e4f367251aede667a6de69baa54ef9eb5f150871vboxsync * Internal I/O interface between the generic VD layer and the backends.
e4f367251aede667a6de69baa54ef9eb5f150871vboxsync *
e4f367251aede667a6de69baa54ef9eb5f150871vboxsync * Per-image. Always passed to backends.
e4f367251aede667a6de69baa54ef9eb5f150871vboxsync */
e4f367251aede667a6de69baa54ef9eb5f150871vboxsynctypedef struct VDINTERFACEIOINT
e4f367251aede667a6de69baa54ef9eb5f150871vboxsync{
e4f367251aede667a6de69baa54ef9eb5f150871vboxsync /**
e4f367251aede667a6de69baa54ef9eb5f150871vboxsync * Common interface header.
e4f367251aede667a6de69baa54ef9eb5f150871vboxsync */
e4f367251aede667a6de69baa54ef9eb5f150871vboxsync VDINTERFACE Core;
e4f367251aede667a6de69baa54ef9eb5f150871vboxsync
e4f367251aede667a6de69baa54ef9eb5f150871vboxsync /**
e4f367251aede667a6de69baa54ef9eb5f150871vboxsync * Open callback
e4f367251aede667a6de69baa54ef9eb5f150871vboxsync *
e4f367251aede667a6de69baa54ef9eb5f150871vboxsync * @return VBox status code.
e4f367251aede667a6de69baa54ef9eb5f150871vboxsync * @param pvUser The opaque data passed on container creation.
e4f367251aede667a6de69baa54ef9eb5f150871vboxsync * @param pszLocation Name of the location to open.
e4f367251aede667a6de69baa54ef9eb5f150871vboxsync * @param fOpen Flags for opening the backend.
e4f367251aede667a6de69baa54ef9eb5f150871vboxsync * See RTFILE_O_* #defines, inventing another set
e4f367251aede667a6de69baa54ef9eb5f150871vboxsync * of open flags is not worth the mapping effort.
e4f367251aede667a6de69baa54ef9eb5f150871vboxsync * @param ppStorage Where to store the storage handle.
e4f367251aede667a6de69baa54ef9eb5f150871vboxsync */
e4f367251aede667a6de69baa54ef9eb5f150871vboxsync DECLR3CALLBACKMEMBER(int, pfnOpen, (void *pvUser, const char *pszLocation,
e4f367251aede667a6de69baa54ef9eb5f150871vboxsync uint32_t fOpen, PPVDIOSTORAGE ppStorage));
e4f367251aede667a6de69baa54ef9eb5f150871vboxsync
e4f367251aede667a6de69baa54ef9eb5f150871vboxsync /**
e4f367251aede667a6de69baa54ef9eb5f150871vboxsync * Close callback.
e4f367251aede667a6de69baa54ef9eb5f150871vboxsync *
e4f367251aede667a6de69baa54ef9eb5f150871vboxsync * @return VBox status code.
e4f367251aede667a6de69baa54ef9eb5f150871vboxsync * @param pvUser The opaque data passed on container creation.
e4f367251aede667a6de69baa54ef9eb5f150871vboxsync * @param pStorage The storage handle to close.
e4f367251aede667a6de69baa54ef9eb5f150871vboxsync */
e4f367251aede667a6de69baa54ef9eb5f150871vboxsync DECLR3CALLBACKMEMBER(int, pfnClose, (void *pvUser, PVDIOSTORAGE pStorage));
e4f367251aede667a6de69baa54ef9eb5f150871vboxsync
e4f367251aede667a6de69baa54ef9eb5f150871vboxsync /**
e4f367251aede667a6de69baa54ef9eb5f150871vboxsync * Delete callback.
e4f367251aede667a6de69baa54ef9eb5f150871vboxsync *
e4f367251aede667a6de69baa54ef9eb5f150871vboxsync * @return VBox status code.
e4f367251aede667a6de69baa54ef9eb5f150871vboxsync * @param pvUser The opaque data passed on container creation.
e4f367251aede667a6de69baa54ef9eb5f150871vboxsync * @param pcszFilename Name of the file to delete.
e4f367251aede667a6de69baa54ef9eb5f150871vboxsync */
e4f367251aede667a6de69baa54ef9eb5f150871vboxsync DECLR3CALLBACKMEMBER(int, pfnDelete, (void *pvUser, const char *pcszFilename));
e4f367251aede667a6de69baa54ef9eb5f150871vboxsync
e4f367251aede667a6de69baa54ef9eb5f150871vboxsync /**
e4f367251aede667a6de69baa54ef9eb5f150871vboxsync * Move callback.
e4f367251aede667a6de69baa54ef9eb5f150871vboxsync *
e4f367251aede667a6de69baa54ef9eb5f150871vboxsync * @return VBox status code.
e4f367251aede667a6de69baa54ef9eb5f150871vboxsync * @param pvUser The opaque data passed on container creation.
e4f367251aede667a6de69baa54ef9eb5f150871vboxsync * @param pcszSrc The path to the source file.
e4f367251aede667a6de69baa54ef9eb5f150871vboxsync * @param pcszDst The path to the destination file.
e4f367251aede667a6de69baa54ef9eb5f150871vboxsync * This file will be created.
e4f367251aede667a6de69baa54ef9eb5f150871vboxsync * @param fMove A combination of the RTFILEMOVE_* flags.
e4f367251aede667a6de69baa54ef9eb5f150871vboxsync */
e4f367251aede667a6de69baa54ef9eb5f150871vboxsync DECLR3CALLBACKMEMBER(int, pfnMove, (void *pvUser, const char *pcszSrc, const char *pcszDst, unsigned fMove));
e4f367251aede667a6de69baa54ef9eb5f150871vboxsync
e4f367251aede667a6de69baa54ef9eb5f150871vboxsync /**
e4f367251aede667a6de69baa54ef9eb5f150871vboxsync * Returns the free space on a disk.
e4f367251aede667a6de69baa54ef9eb5f150871vboxsync *
e4f367251aede667a6de69baa54ef9eb5f150871vboxsync * @return VBox status code.
e4f367251aede667a6de69baa54ef9eb5f150871vboxsync * @param pvUser The opaque data passed on container creation.
e4f367251aede667a6de69baa54ef9eb5f150871vboxsync * @param pcszFilename Name of a file to identify the disk.
e4f367251aede667a6de69baa54ef9eb5f150871vboxsync * @param pcbFreeSpace Where to store the free space of the disk.
e4f367251aede667a6de69baa54ef9eb5f150871vboxsync */
e4f367251aede667a6de69baa54ef9eb5f150871vboxsync DECLR3CALLBACKMEMBER(int, pfnGetFreeSpace, (void *pvUser, const char *pcszFilename, int64_t *pcbFreeSpace));
e4f367251aede667a6de69baa54ef9eb5f150871vboxsync
e4f367251aede667a6de69baa54ef9eb5f150871vboxsync /**
e4f367251aede667a6de69baa54ef9eb5f150871vboxsync * Returns the last modification timestamp of a file.
e4f367251aede667a6de69baa54ef9eb5f150871vboxsync *
e4f367251aede667a6de69baa54ef9eb5f150871vboxsync * @return VBox status code.
e4f367251aede667a6de69baa54ef9eb5f150871vboxsync * @param pvUser The opaque data passed on container creation.
e4f367251aede667a6de69baa54ef9eb5f150871vboxsync * @param pcszFilename Name of a file to identify the disk.
e4f367251aede667a6de69baa54ef9eb5f150871vboxsync * @param pModificationTime Where to store the timestamp of the file.
e4f367251aede667a6de69baa54ef9eb5f150871vboxsync */
e4f367251aede667a6de69baa54ef9eb5f150871vboxsync DECLR3CALLBACKMEMBER(int, pfnGetModificationTime, (void *pvUser, const char *pcszFilename, PRTTIMESPEC pModificationTime));
e4f367251aede667a6de69baa54ef9eb5f150871vboxsync
e4f367251aede667a6de69baa54ef9eb5f150871vboxsync /**
e4f367251aede667a6de69baa54ef9eb5f150871vboxsync * Returns the size of the opened storage backend.
e4f367251aede667a6de69baa54ef9eb5f150871vboxsync *
e4f367251aede667a6de69baa54ef9eb5f150871vboxsync * @return VBox status code.
e4f367251aede667a6de69baa54ef9eb5f150871vboxsync * @param pvUser The opaque data passed on container creation.
e4f367251aede667a6de69baa54ef9eb5f150871vboxsync * @param pStorage The storage handle to get the size from.
e4f367251aede667a6de69baa54ef9eb5f150871vboxsync * @param pcbSize Where to store the size of the storage backend.
e4f367251aede667a6de69baa54ef9eb5f150871vboxsync */
e4f367251aede667a6de69baa54ef9eb5f150871vboxsync DECLR3CALLBACKMEMBER(int, pfnGetSize, (void *pvUser, PVDIOSTORAGE pStorage,
e4f367251aede667a6de69baa54ef9eb5f150871vboxsync uint64_t *pcbSize));
e4f367251aede667a6de69baa54ef9eb5f150871vboxsync
e4f367251aede667a6de69baa54ef9eb5f150871vboxsync /**
e4f367251aede667a6de69baa54ef9eb5f150871vboxsync * Sets the size of the opened storage backend if possible.
e4f367251aede667a6de69baa54ef9eb5f150871vboxsync *
e4f367251aede667a6de69baa54ef9eb5f150871vboxsync * @return VBox status code.
e4f367251aede667a6de69baa54ef9eb5f150871vboxsync * @retval VERR_NOT_SUPPORTED if the backend does not support this operation.
e4f367251aede667a6de69baa54ef9eb5f150871vboxsync * @param pvUser The opaque data passed on container creation.
e4f367251aede667a6de69baa54ef9eb5f150871vboxsync * @param pStorage The storage handle.
e4f367251aede667a6de69baa54ef9eb5f150871vboxsync * @param cbSize The new size of the image.
e4f367251aede667a6de69baa54ef9eb5f150871vboxsync */
e4f367251aede667a6de69baa54ef9eb5f150871vboxsync DECLR3CALLBACKMEMBER(int, pfnSetSize, (void *pvUser, PVDIOSTORAGE pStorage,
e4f367251aede667a6de69baa54ef9eb5f150871vboxsync uint64_t cbSize));
e4f367251aede667a6de69baa54ef9eb5f150871vboxsync
e4f367251aede667a6de69baa54ef9eb5f150871vboxsync /**
c4e146628a037393bad1d63b1860e97606277f48vboxsync * Initiate a read request for user data.
e4f367251aede667a6de69baa54ef9eb5f150871vboxsync *
e4f367251aede667a6de69baa54ef9eb5f150871vboxsync * @return VBox status code.
e4f367251aede667a6de69baa54ef9eb5f150871vboxsync * @param pvUser The opaque user data passed on container creation.
e4f367251aede667a6de69baa54ef9eb5f150871vboxsync * @param pStorage The storage handle.
e4f367251aede667a6de69baa54ef9eb5f150871vboxsync * @param uOffset The offset to start reading from.
c4e146628a037393bad1d63b1860e97606277f48vboxsync * @param pIoCtx I/O context passed in the read/write callback.
e4f367251aede667a6de69baa54ef9eb5f150871vboxsync * @param cbRead How many bytes to read.
e4f367251aede667a6de69baa54ef9eb5f150871vboxsync */
c4e146628a037393bad1d63b1860e97606277f48vboxsync DECLR3CALLBACKMEMBER(int, pfnReadUser, (void *pvUser, PVDIOSTORAGE pStorage,
c4e146628a037393bad1d63b1860e97606277f48vboxsync uint64_t uOffset, PVDIOCTX pIoCtx,
c4e146628a037393bad1d63b1860e97606277f48vboxsync size_t cbRead));
e4f367251aede667a6de69baa54ef9eb5f150871vboxsync
e4f367251aede667a6de69baa54ef9eb5f150871vboxsync /**
c4e146628a037393bad1d63b1860e97606277f48vboxsync * Initiate a write request for user data.
e4f367251aede667a6de69baa54ef9eb5f150871vboxsync *
e4f367251aede667a6de69baa54ef9eb5f150871vboxsync * @return VBox status code.
e4f367251aede667a6de69baa54ef9eb5f150871vboxsync * @param pvUser The opaque user data passed on container creation.
e4f367251aede667a6de69baa54ef9eb5f150871vboxsync * @param pStorage The storage handle.
e4f367251aede667a6de69baa54ef9eb5f150871vboxsync * @param uOffset The offset to start writing to.
c4e146628a037393bad1d63b1860e97606277f48vboxsync * @param pIoCtx I/O context passed in the read/write callback.
e4f367251aede667a6de69baa54ef9eb5f150871vboxsync * @param cbWrite How many bytes to write.
e4f367251aede667a6de69baa54ef9eb5f150871vboxsync * @param pfnCompleted Completion callback.
e4f367251aede667a6de69baa54ef9eb5f150871vboxsync * @param pvCompleteUser Opaque user data passed in the completion callback.
e4f367251aede667a6de69baa54ef9eb5f150871vboxsync */
c4e146628a037393bad1d63b1860e97606277f48vboxsync DECLR3CALLBACKMEMBER(int, pfnWriteUser, (void *pvUser, PVDIOSTORAGE pStorage,
c4e146628a037393bad1d63b1860e97606277f48vboxsync uint64_t uOffset, PVDIOCTX pIoCtx,
c4e146628a037393bad1d63b1860e97606277f48vboxsync size_t cbWrite,
c4e146628a037393bad1d63b1860e97606277f48vboxsync PFNVDXFERCOMPLETED pfnComplete,
c4e146628a037393bad1d63b1860e97606277f48vboxsync void *pvCompleteUser));
e4f367251aede667a6de69baa54ef9eb5f150871vboxsync
e4f367251aede667a6de69baa54ef9eb5f150871vboxsync /**
c4e146628a037393bad1d63b1860e97606277f48vboxsync * Reads metadata from storage.
e4f367251aede667a6de69baa54ef9eb5f150871vboxsync * The current I/O context will be halted.
e4f367251aede667a6de69baa54ef9eb5f150871vboxsync *
e4f367251aede667a6de69baa54ef9eb5f150871vboxsync * @returns VBox status code.
e4f367251aede667a6de69baa54ef9eb5f150871vboxsync * @param pvUser The opaque user data passed on container creation.
e4f367251aede667a6de69baa54ef9eb5f150871vboxsync * @param pStorage The storage handle.
e4f367251aede667a6de69baa54ef9eb5f150871vboxsync * @param uOffset Offset to start reading from.
e4f367251aede667a6de69baa54ef9eb5f150871vboxsync * @param pvBuffer Where to store the data.
e4f367251aede667a6de69baa54ef9eb5f150871vboxsync * @param cbBuffer How many bytes to read.
e4f367251aede667a6de69baa54ef9eb5f150871vboxsync * @param pIoCtx The I/O context which triggered the read.
e4f367251aede667a6de69baa54ef9eb5f150871vboxsync * @param ppMetaXfer Where to store the metadata transfer handle on success.
e4f367251aede667a6de69baa54ef9eb5f150871vboxsync * @param pfnCompleted Completion callback.
e4f367251aede667a6de69baa54ef9eb5f150871vboxsync * @param pvCompleteUser Opaque user data passed in the completion callback.
c4e146628a037393bad1d63b1860e97606277f48vboxsync *
c4e146628a037393bad1d63b1860e97606277f48vboxsync * @notes If pIoCtx is NULL the metadata read is handled synchronously
c4e146628a037393bad1d63b1860e97606277f48vboxsync * i.e. the call returns only if the data is available in the given
c4e146628a037393bad1d63b1860e97606277f48vboxsync * buffer. ppMetaXfer, pfnCompleted and pvCompleteUser are ignored in that case.
c4e146628a037393bad1d63b1860e97606277f48vboxsync * Use the synchronous version only when opening/closing the image
c4e146628a037393bad1d63b1860e97606277f48vboxsync * or when doing certain operations like resizing, compacting or repairing
c4e146628a037393bad1d63b1860e97606277f48vboxsync * the disk.
e4f367251aede667a6de69baa54ef9eb5f150871vboxsync */
c4e146628a037393bad1d63b1860e97606277f48vboxsync DECLR3CALLBACKMEMBER(int, pfnReadMeta, (void *pvUser, PVDIOSTORAGE pStorage,
c4e146628a037393bad1d63b1860e97606277f48vboxsync uint64_t uOffset, void *pvBuffer,
c4e146628a037393bad1d63b1860e97606277f48vboxsync size_t cbBuffer, PVDIOCTX pIoCtx,
c4e146628a037393bad1d63b1860e97606277f48vboxsync PPVDMETAXFER ppMetaXfer,
c4e146628a037393bad1d63b1860e97606277f48vboxsync PFNVDXFERCOMPLETED pfnComplete,
c4e146628a037393bad1d63b1860e97606277f48vboxsync void *pvCompleteUser));
e4f367251aede667a6de69baa54ef9eb5f150871vboxsync
e4f367251aede667a6de69baa54ef9eb5f150871vboxsync /**
c4e146628a037393bad1d63b1860e97606277f48vboxsync * Writes metadata to storage.
e4f367251aede667a6de69baa54ef9eb5f150871vboxsync *
e4f367251aede667a6de69baa54ef9eb5f150871vboxsync * @returns VBox status code.
e4f367251aede667a6de69baa54ef9eb5f150871vboxsync * @param pvUser The opaque user data passed on container creation.
e4f367251aede667a6de69baa54ef9eb5f150871vboxsync * @param pStorage The storage handle.
e4f367251aede667a6de69baa54ef9eb5f150871vboxsync * @param uOffset Offset to start writing to.
e4f367251aede667a6de69baa54ef9eb5f150871vboxsync * @param pvBuffer Written data.
e4f367251aede667a6de69baa54ef9eb5f150871vboxsync * @param cbBuffer How many bytes to write.
e4f367251aede667a6de69baa54ef9eb5f150871vboxsync * @param pIoCtx The I/O context which triggered the write.
e4f367251aede667a6de69baa54ef9eb5f150871vboxsync * @param pfnCompleted Completion callback.
e4f367251aede667a6de69baa54ef9eb5f150871vboxsync * @param pvCompleteUser Opaque user data passed in the completion callback.
c4e146628a037393bad1d63b1860e97606277f48vboxsync *
c4e146628a037393bad1d63b1860e97606277f48vboxsync * @notes See pfnReadMeta().
e4f367251aede667a6de69baa54ef9eb5f150871vboxsync */
c4e146628a037393bad1d63b1860e97606277f48vboxsync DECLR3CALLBACKMEMBER(int, pfnWriteMeta, (void *pvUser, PVDIOSTORAGE pStorage,
c4e146628a037393bad1d63b1860e97606277f48vboxsync uint64_t uOffset, const void *pvBuffer,
c4e146628a037393bad1d63b1860e97606277f48vboxsync size_t cbBuffer, PVDIOCTX pIoCtx,
c4e146628a037393bad1d63b1860e97606277f48vboxsync PFNVDXFERCOMPLETED pfnComplete,
c4e146628a037393bad1d63b1860e97606277f48vboxsync void *pvCompleteUser));
e4f367251aede667a6de69baa54ef9eb5f150871vboxsync
e4f367251aede667a6de69baa54ef9eb5f150871vboxsync /**
e4f367251aede667a6de69baa54ef9eb5f150871vboxsync * Releases a metadata transfer handle.
e4f367251aede667a6de69baa54ef9eb5f150871vboxsync * The free space can be used for another transfer.
e4f367251aede667a6de69baa54ef9eb5f150871vboxsync *
e4f367251aede667a6de69baa54ef9eb5f150871vboxsync * @returns nothing.
e4f367251aede667a6de69baa54ef9eb5f150871vboxsync * @param pvUser The opaque user data passed on container creation.
e4f367251aede667a6de69baa54ef9eb5f150871vboxsync * @param pMetaXfer The metadata transfer handle to release.
e4f367251aede667a6de69baa54ef9eb5f150871vboxsync */
e4f367251aede667a6de69baa54ef9eb5f150871vboxsync DECLR3CALLBACKMEMBER(void, pfnMetaXferRelease, (void *pvUser, PVDMETAXFER pMetaXfer));
e4f367251aede667a6de69baa54ef9eb5f150871vboxsync
e4f367251aede667a6de69baa54ef9eb5f150871vboxsync /**
c4e146628a037393bad1d63b1860e97606277f48vboxsync * Initiates a flush request.
e4f367251aede667a6de69baa54ef9eb5f150871vboxsync *
e4f367251aede667a6de69baa54ef9eb5f150871vboxsync * @return VBox status code.
e4f367251aede667a6de69baa54ef9eb5f150871vboxsync * @param pvUser The opaque data passed on container creation.
e4f367251aede667a6de69baa54ef9eb5f150871vboxsync * @param pStorage The storage handle to flush.
e4f367251aede667a6de69baa54ef9eb5f150871vboxsync * @param pIoCtx I/O context which triggered the flush.
e4f367251aede667a6de69baa54ef9eb5f150871vboxsync * @param pfnCompleted Completion callback.
e4f367251aede667a6de69baa54ef9eb5f150871vboxsync * @param pvCompleteUser Opaque user data passed in the completion callback.
c4e146628a037393bad1d63b1860e97606277f48vboxsync *
c4e146628a037393bad1d63b1860e97606277f48vboxsync * @notes See pfnReadMeta().
e4f367251aede667a6de69baa54ef9eb5f150871vboxsync */
c4e146628a037393bad1d63b1860e97606277f48vboxsync DECLR3CALLBACKMEMBER(int, pfnFlush, (void *pvUser, PVDIOSTORAGE pStorage,
c4e146628a037393bad1d63b1860e97606277f48vboxsync PVDIOCTX pIoCtx,
c4e146628a037393bad1d63b1860e97606277f48vboxsync PFNVDXFERCOMPLETED pfnComplete,
c4e146628a037393bad1d63b1860e97606277f48vboxsync void *pvCompleteUser));
e4f367251aede667a6de69baa54ef9eb5f150871vboxsync
e4f367251aede667a6de69baa54ef9eb5f150871vboxsync /**
e4f367251aede667a6de69baa54ef9eb5f150871vboxsync * Copies a buffer into the I/O context.
e4f367251aede667a6de69baa54ef9eb5f150871vboxsync *
e4f367251aede667a6de69baa54ef9eb5f150871vboxsync * @return Number of bytes copied.
e4f367251aede667a6de69baa54ef9eb5f150871vboxsync * @param pvUser The opaque user data passed on container creation.
e4f367251aede667a6de69baa54ef9eb5f150871vboxsync * @param pIoCtx I/O context to copy the data to.
e4f367251aede667a6de69baa54ef9eb5f150871vboxsync * @param pvBuffer Buffer to copy.
e4f367251aede667a6de69baa54ef9eb5f150871vboxsync * @param cbBuffer Number of bytes to copy.
e4f367251aede667a6de69baa54ef9eb5f150871vboxsync */
e4f367251aede667a6de69baa54ef9eb5f150871vboxsync DECLR3CALLBACKMEMBER(size_t, pfnIoCtxCopyTo, (void *pvUser, PVDIOCTX pIoCtx,
d7856d565919537fcfd3ea1630608ba3ed2a25bcvboxsync const void *pvBuffer, size_t cbBuffer));
e4f367251aede667a6de69baa54ef9eb5f150871vboxsync
e4f367251aede667a6de69baa54ef9eb5f150871vboxsync /**
e4f367251aede667a6de69baa54ef9eb5f150871vboxsync * Copies data from the I/O context into a buffer.
e4f367251aede667a6de69baa54ef9eb5f150871vboxsync *
e4f367251aede667a6de69baa54ef9eb5f150871vboxsync * @return Number of bytes copied.
e4f367251aede667a6de69baa54ef9eb5f150871vboxsync * @param pvUser The opaque user data passed on container creation.
e4f367251aede667a6de69baa54ef9eb5f150871vboxsync * @param pIoCtx I/O context to copy the data from.
e4f367251aede667a6de69baa54ef9eb5f150871vboxsync * @param pvBuffer Destination buffer.
e4f367251aede667a6de69baa54ef9eb5f150871vboxsync * @param cbBuffer Number of bytes to copy.
e4f367251aede667a6de69baa54ef9eb5f150871vboxsync */
e4f367251aede667a6de69baa54ef9eb5f150871vboxsync DECLR3CALLBACKMEMBER(size_t, pfnIoCtxCopyFrom, (void *pvUser, PVDIOCTX pIoCtx,
e4f367251aede667a6de69baa54ef9eb5f150871vboxsync void *pvBuffer, size_t cbBuffer));
e4f367251aede667a6de69baa54ef9eb5f150871vboxsync
e4f367251aede667a6de69baa54ef9eb5f150871vboxsync /**
e4f367251aede667a6de69baa54ef9eb5f150871vboxsync * Sets the buffer of the given context to a specific byte.
e4f367251aede667a6de69baa54ef9eb5f150871vboxsync *
e4f367251aede667a6de69baa54ef9eb5f150871vboxsync * @return Number of bytes set.
e4f367251aede667a6de69baa54ef9eb5f150871vboxsync * @param pvUser The opaque user data passed on container creation.
e4f367251aede667a6de69baa54ef9eb5f150871vboxsync * @param pIoCtx I/O context to copy the data from.
e4f367251aede667a6de69baa54ef9eb5f150871vboxsync * @param ch The byte to set.
e4f367251aede667a6de69baa54ef9eb5f150871vboxsync * @param cbSet Number of bytes to set.
e4f367251aede667a6de69baa54ef9eb5f150871vboxsync */
e4f367251aede667a6de69baa54ef9eb5f150871vboxsync DECLR3CALLBACKMEMBER(size_t, pfnIoCtxSet, (void *pvUser, PVDIOCTX pIoCtx,
e4f367251aede667a6de69baa54ef9eb5f150871vboxsync int ch, size_t cbSet));
e4f367251aede667a6de69baa54ef9eb5f150871vboxsync
e4f367251aede667a6de69baa54ef9eb5f150871vboxsync /**
e4f367251aede667a6de69baa54ef9eb5f150871vboxsync * Creates a segment array from the I/O context data buffer.
e4f367251aede667a6de69baa54ef9eb5f150871vboxsync *
e4f367251aede667a6de69baa54ef9eb5f150871vboxsync * @returns Number of bytes the array describes.
e4f367251aede667a6de69baa54ef9eb5f150871vboxsync * @param pvUser The opaque user data passed on container creation.
e4f367251aede667a6de69baa54ef9eb5f150871vboxsync * @param pIoCtx I/O context to copy the data from.
e4f367251aede667a6de69baa54ef9eb5f150871vboxsync * @param paSeg The uninitialized segment array.
e4f367251aede667a6de69baa54ef9eb5f150871vboxsync * If NULL pcSeg will contain the number of segments needed
e4f367251aede667a6de69baa54ef9eb5f150871vboxsync * to describe the requested amount of data.
e4f367251aede667a6de69baa54ef9eb5f150871vboxsync * @param pcSeg The number of segments the given array has.
e4f367251aede667a6de69baa54ef9eb5f150871vboxsync * This will hold the actual number of entries needed upon return.
e4f367251aede667a6de69baa54ef9eb5f150871vboxsync * @param cbData Number of bytes the new array should describe.
e4f367251aede667a6de69baa54ef9eb5f150871vboxsync */
e4f367251aede667a6de69baa54ef9eb5f150871vboxsync DECLR3CALLBACKMEMBER(size_t, pfnIoCtxSegArrayCreate, (void *pvUser, PVDIOCTX pIoCtx,
e4f367251aede667a6de69baa54ef9eb5f150871vboxsync PRTSGSEG paSeg, unsigned *pcSeg,
e4f367251aede667a6de69baa54ef9eb5f150871vboxsync size_t cbData));
e4f367251aede667a6de69baa54ef9eb5f150871vboxsync /**
e4f367251aede667a6de69baa54ef9eb5f150871vboxsync * Marks the given number of bytes as completed and continues the I/O context.
e4f367251aede667a6de69baa54ef9eb5f150871vboxsync *
e4f367251aede667a6de69baa54ef9eb5f150871vboxsync * @returns nothing.
e4f367251aede667a6de69baa54ef9eb5f150871vboxsync * @param pvUser The opaque user data passed on container creation.
e4f367251aede667a6de69baa54ef9eb5f150871vboxsync * @param pIoCtx The I/O context.
e4f367251aede667a6de69baa54ef9eb5f150871vboxsync * @param rcReq Status code the request completed with.
e4f367251aede667a6de69baa54ef9eb5f150871vboxsync * @param cbCompleted Number of bytes completed.
e4f367251aede667a6de69baa54ef9eb5f150871vboxsync */
e4f367251aede667a6de69baa54ef9eb5f150871vboxsync DECLR3CALLBACKMEMBER(void, pfnIoCtxCompleted, (void *pvUser, PVDIOCTX pIoCtx,
e4f367251aede667a6de69baa54ef9eb5f150871vboxsync int rcReq, size_t cbCompleted));
5eca1f6baf7020cb7a872fbf7086872e7e812301vboxsync
5eca1f6baf7020cb7a872fbf7086872e7e812301vboxsync /**
5eca1f6baf7020cb7a872fbf7086872e7e812301vboxsync * Returns whether the given I/O context must be treated synchronously.
5eca1f6baf7020cb7a872fbf7086872e7e812301vboxsync *
5eca1f6baf7020cb7a872fbf7086872e7e812301vboxsync * @returns true if the I/O context must be processed synchronously
5eca1f6baf7020cb7a872fbf7086872e7e812301vboxsync * false otherwise.
5eca1f6baf7020cb7a872fbf7086872e7e812301vboxsync * @param pvUser The opaque user data passed on container creation.
5eca1f6baf7020cb7a872fbf7086872e7e812301vboxsync * @param pIoCtx The I/O context.
5eca1f6baf7020cb7a872fbf7086872e7e812301vboxsync */
5eca1f6baf7020cb7a872fbf7086872e7e812301vboxsync DECLR3CALLBACKMEMBER(bool, pfnIoCtxIsSynchronous, (void *pvUser, PVDIOCTX pIoCtx));
5eca1f6baf7020cb7a872fbf7086872e7e812301vboxsync
5eca1f6baf7020cb7a872fbf7086872e7e812301vboxsync /**
5eca1f6baf7020cb7a872fbf7086872e7e812301vboxsync * Returns whether the user buffer of the I/O context is complete zero
5eca1f6baf7020cb7a872fbf7086872e7e812301vboxsync * from to current position upto the given number of bytes.
5eca1f6baf7020cb7a872fbf7086872e7e812301vboxsync *
5eca1f6baf7020cb7a872fbf7086872e7e812301vboxsync * @returns true if the I/O context user buffer consists solely of zeros
5eca1f6baf7020cb7a872fbf7086872e7e812301vboxsync * false otherwise.
5eca1f6baf7020cb7a872fbf7086872e7e812301vboxsync * @param pvUser The opaque user data passed on container creation.
5eca1f6baf7020cb7a872fbf7086872e7e812301vboxsync * @param pIoCtx The I/O context.
5eca1f6baf7020cb7a872fbf7086872e7e812301vboxsync * @param cbCheck Number of bytes to check for zeros.
5eca1f6baf7020cb7a872fbf7086872e7e812301vboxsync * @param fAdvance Flag whether to advance the buffer pointer if true
5eca1f6baf7020cb7a872fbf7086872e7e812301vboxsync * is returned.
5eca1f6baf7020cb7a872fbf7086872e7e812301vboxsync */
5eca1f6baf7020cb7a872fbf7086872e7e812301vboxsync DECLR3CALLBACKMEMBER(bool, pfnIoCtxIsZero, (void *pvUser, PVDIOCTX pIoCtx,
5eca1f6baf7020cb7a872fbf7086872e7e812301vboxsync size_t cbCheck, bool fAdvance));
5eca1f6baf7020cb7a872fbf7086872e7e812301vboxsync
e7bd3b41269a08b3f1c33641fb9fe0b809598c9evboxsync /**
e7bd3b41269a08b3f1c33641fb9fe0b809598c9evboxsync * Returns the data unit size, i.e. the smallest size for a transfer.
e7bd3b41269a08b3f1c33641fb9fe0b809598c9evboxsync * (similar to the sector size of disks).
e7bd3b41269a08b3f1c33641fb9fe0b809598c9evboxsync *
e7bd3b41269a08b3f1c33641fb9fe0b809598c9evboxsync * @returns The data unit size.
e7bd3b41269a08b3f1c33641fb9fe0b809598c9evboxsync * @param pvUser The opaque user data passed on container creation.
e7bd3b41269a08b3f1c33641fb9fe0b809598c9evboxsync * @param pIoCtx The I/O context.
e7bd3b41269a08b3f1c33641fb9fe0b809598c9evboxsync */
e7bd3b41269a08b3f1c33641fb9fe0b809598c9evboxsync DECLR3CALLBACKMEMBER(size_t, pfnIoCtxGetDataUnitSize, (void *pvUser, PVDIOCTX pIoCtx));
e7bd3b41269a08b3f1c33641fb9fe0b809598c9evboxsync
e4f367251aede667a6de69baa54ef9eb5f150871vboxsync} VDINTERFACEIOINT, *PVDINTERFACEIOINT;
e4f367251aede667a6de69baa54ef9eb5f150871vboxsync
e4f367251aede667a6de69baa54ef9eb5f150871vboxsync/**
e4f367251aede667a6de69baa54ef9eb5f150871vboxsync * Get internal I/O interface from interface list.
e4f367251aede667a6de69baa54ef9eb5f150871vboxsync *
e4f367251aede667a6de69baa54ef9eb5f150871vboxsync * @return Pointer to the first internal I/O interface in the list.
e4f367251aede667a6de69baa54ef9eb5f150871vboxsync * @param pVDIfs Pointer to the interface list.
e4f367251aede667a6de69baa54ef9eb5f150871vboxsync */
e4f367251aede667a6de69baa54ef9eb5f150871vboxsyncDECLINLINE(PVDINTERFACEIOINT) VDIfIoIntGet(PVDINTERFACE pVDIfs)
e4f367251aede667a6de69baa54ef9eb5f150871vboxsync{
e4f367251aede667a6de69baa54ef9eb5f150871vboxsync PVDINTERFACE pIf = VDInterfaceGet(pVDIfs, VDINTERFACETYPE_IOINT);
e4f367251aede667a6de69baa54ef9eb5f150871vboxsync
e4f367251aede667a6de69baa54ef9eb5f150871vboxsync /* Check that the interface descriptor is a progress interface. */
e4f367251aede667a6de69baa54ef9eb5f150871vboxsync AssertMsgReturn( !pIf
e4f367251aede667a6de69baa54ef9eb5f150871vboxsync || ( (pIf->enmInterface == VDINTERFACETYPE_IOINT)
e4f367251aede667a6de69baa54ef9eb5f150871vboxsync && (pIf->cbSize == sizeof(VDINTERFACEIOINT))),
e4f367251aede667a6de69baa54ef9eb5f150871vboxsync ("Not an internal I/O interface"), NULL);
e4f367251aede667a6de69baa54ef9eb5f150871vboxsync
e4f367251aede667a6de69baa54ef9eb5f150871vboxsync return (PVDINTERFACEIOINT)pIf;
e4f367251aede667a6de69baa54ef9eb5f150871vboxsync}
e4f367251aede667a6de69baa54ef9eb5f150871vboxsync
e4f367251aede667a6de69baa54ef9eb5f150871vboxsyncDECLINLINE(int) vdIfIoIntFileOpen(PVDINTERFACEIOINT pIfIoInt, const char *pszFilename,
e4f367251aede667a6de69baa54ef9eb5f150871vboxsync uint32_t fOpen, PPVDIOSTORAGE ppStorage)
e4f367251aede667a6de69baa54ef9eb5f150871vboxsync{
e4f367251aede667a6de69baa54ef9eb5f150871vboxsync return pIfIoInt->pfnOpen(pIfIoInt->Core.pvUser, pszFilename, fOpen, ppStorage);
e4f367251aede667a6de69baa54ef9eb5f150871vboxsync}
e4f367251aede667a6de69baa54ef9eb5f150871vboxsync
e4f367251aede667a6de69baa54ef9eb5f150871vboxsyncDECLINLINE(int) vdIfIoIntFileClose(PVDINTERFACEIOINT pIfIoInt, PVDIOSTORAGE pStorage)
e4f367251aede667a6de69baa54ef9eb5f150871vboxsync{
e4f367251aede667a6de69baa54ef9eb5f150871vboxsync return pIfIoInt->pfnClose(pIfIoInt->Core.pvUser, pStorage);
e4f367251aede667a6de69baa54ef9eb5f150871vboxsync}
e4f367251aede667a6de69baa54ef9eb5f150871vboxsync
e4f367251aede667a6de69baa54ef9eb5f150871vboxsyncDECLINLINE(int) vdIfIoIntFileDelete(PVDINTERFACEIOINT pIfIoInt, const char *pszFilename)
e4f367251aede667a6de69baa54ef9eb5f150871vboxsync{
e4f367251aede667a6de69baa54ef9eb5f150871vboxsync return pIfIoInt->pfnDelete(pIfIoInt->Core.pvUser, pszFilename);
e4f367251aede667a6de69baa54ef9eb5f150871vboxsync}
e4f367251aede667a6de69baa54ef9eb5f150871vboxsync
e4f367251aede667a6de69baa54ef9eb5f150871vboxsyncDECLINLINE(int) vdIfIoIntFileMove(PVDINTERFACEIOINT pIfIoInt, const char *pszSrc,
e4f367251aede667a6de69baa54ef9eb5f150871vboxsync const char *pszDst, unsigned fMove)
e4f367251aede667a6de69baa54ef9eb5f150871vboxsync{
e4f367251aede667a6de69baa54ef9eb5f150871vboxsync return pIfIoInt->pfnMove(pIfIoInt->Core.pvUser, pszSrc, pszDst, fMove);
e4f367251aede667a6de69baa54ef9eb5f150871vboxsync}
e4f367251aede667a6de69baa54ef9eb5f150871vboxsync
e4f367251aede667a6de69baa54ef9eb5f150871vboxsyncDECLINLINE(int) vdIfIoIntFileGetFreeSpace(PVDINTERFACEIOINT pIfIoInt, const char *pszFilename,
e4f367251aede667a6de69baa54ef9eb5f150871vboxsync int64_t *pcbFree)
e4f367251aede667a6de69baa54ef9eb5f150871vboxsync{
e4f367251aede667a6de69baa54ef9eb5f150871vboxsync return pIfIoInt->pfnGetFreeSpace(pIfIoInt->Core.pvUser, pszFilename, pcbFree);
e4f367251aede667a6de69baa54ef9eb5f150871vboxsync}
e4f367251aede667a6de69baa54ef9eb5f150871vboxsync
e4f367251aede667a6de69baa54ef9eb5f150871vboxsyncDECLINLINE(int) vdIfIoIntFileGetModificationTime(PVDINTERFACEIOINT pIfIoInt, const char *pcszFilename,
e4f367251aede667a6de69baa54ef9eb5f150871vboxsync PRTTIMESPEC pModificationTime)
e4f367251aede667a6de69baa54ef9eb5f150871vboxsync{
e4f367251aede667a6de69baa54ef9eb5f150871vboxsync return pIfIoInt->pfnGetModificationTime(pIfIoInt->Core.pvUser, pcszFilename,
e4f367251aede667a6de69baa54ef9eb5f150871vboxsync pModificationTime);
e4f367251aede667a6de69baa54ef9eb5f150871vboxsync}
e4f367251aede667a6de69baa54ef9eb5f150871vboxsync
e4f367251aede667a6de69baa54ef9eb5f150871vboxsyncDECLINLINE(int) vdIfIoIntFileGetSize(PVDINTERFACEIOINT pIfIoInt, PVDIOSTORAGE pStorage,
e4f367251aede667a6de69baa54ef9eb5f150871vboxsync uint64_t *pcbSize)
e4f367251aede667a6de69baa54ef9eb5f150871vboxsync{
e4f367251aede667a6de69baa54ef9eb5f150871vboxsync return pIfIoInt->pfnGetSize(pIfIoInt->Core.pvUser, pStorage, pcbSize);
e4f367251aede667a6de69baa54ef9eb5f150871vboxsync}
e4f367251aede667a6de69baa54ef9eb5f150871vboxsync
e4f367251aede667a6de69baa54ef9eb5f150871vboxsyncDECLINLINE(int) vdIfIoIntFileSetSize(PVDINTERFACEIOINT pIfIoInt, PVDIOSTORAGE pStorage,
e4f367251aede667a6de69baa54ef9eb5f150871vboxsync uint64_t cbSize)
e4f367251aede667a6de69baa54ef9eb5f150871vboxsync{
e4f367251aede667a6de69baa54ef9eb5f150871vboxsync return pIfIoInt->pfnSetSize(pIfIoInt->Core.pvUser, pStorage, cbSize);
e4f367251aede667a6de69baa54ef9eb5f150871vboxsync}
e4f367251aede667a6de69baa54ef9eb5f150871vboxsync
e4f367251aede667a6de69baa54ef9eb5f150871vboxsyncDECLINLINE(int) vdIfIoIntFileWriteSync(PVDINTERFACEIOINT pIfIoInt, PVDIOSTORAGE pStorage,
c4e146628a037393bad1d63b1860e97606277f48vboxsync uint64_t uOffset, const void *pvBuffer, size_t cbBuffer)
e4f367251aede667a6de69baa54ef9eb5f150871vboxsync{
c4e146628a037393bad1d63b1860e97606277f48vboxsync return pIfIoInt->pfnWriteMeta(pIfIoInt->Core.pvUser, pStorage,
c4e146628a037393bad1d63b1860e97606277f48vboxsync uOffset, pvBuffer, cbBuffer, NULL,
c4e146628a037393bad1d63b1860e97606277f48vboxsync NULL, NULL);
e4f367251aede667a6de69baa54ef9eb5f150871vboxsync}
e4f367251aede667a6de69baa54ef9eb5f150871vboxsync
e4f367251aede667a6de69baa54ef9eb5f150871vboxsyncDECLINLINE(int) vdIfIoIntFileReadSync(PVDINTERFACEIOINT pIfIoInt, PVDIOSTORAGE pStorage,
c4e146628a037393bad1d63b1860e97606277f48vboxsync uint64_t uOffset, void *pvBuffer, size_t cbBuffer)
e4f367251aede667a6de69baa54ef9eb5f150871vboxsync{
c4e146628a037393bad1d63b1860e97606277f48vboxsync return pIfIoInt->pfnReadMeta(pIfIoInt->Core.pvUser, pStorage,
c4e146628a037393bad1d63b1860e97606277f48vboxsync uOffset, pvBuffer, cbBuffer, NULL,
c4e146628a037393bad1d63b1860e97606277f48vboxsync NULL, NULL, NULL);
e4f367251aede667a6de69baa54ef9eb5f150871vboxsync}
e4f367251aede667a6de69baa54ef9eb5f150871vboxsync
e4f367251aede667a6de69baa54ef9eb5f150871vboxsyncDECLINLINE(int) vdIfIoIntFileFlushSync(PVDINTERFACEIOINT pIfIoInt, PVDIOSTORAGE pStorage)
e4f367251aede667a6de69baa54ef9eb5f150871vboxsync{
c4e146628a037393bad1d63b1860e97606277f48vboxsync return pIfIoInt->pfnFlush(pIfIoInt->Core.pvUser, pStorage, NULL, NULL, NULL);
e4f367251aede667a6de69baa54ef9eb5f150871vboxsync}
e4f367251aede667a6de69baa54ef9eb5f150871vboxsync
c4e146628a037393bad1d63b1860e97606277f48vboxsyncDECLINLINE(int) vdIfIoIntFileReadUser(PVDINTERFACEIOINT pIfIoInt, PVDIOSTORAGE pStorage,
c4e146628a037393bad1d63b1860e97606277f48vboxsync uint64_t uOffset, PVDIOCTX pIoCtx, size_t cbRead)
e4f367251aede667a6de69baa54ef9eb5f150871vboxsync{
c4e146628a037393bad1d63b1860e97606277f48vboxsync return pIfIoInt->pfnReadUser(pIfIoInt->Core.pvUser, pStorage,
c4e146628a037393bad1d63b1860e97606277f48vboxsync uOffset, pIoCtx, cbRead);
e4f367251aede667a6de69baa54ef9eb5f150871vboxsync}
e4f367251aede667a6de69baa54ef9eb5f150871vboxsync
c4e146628a037393bad1d63b1860e97606277f48vboxsyncDECLINLINE(int) vdIfIoIntFileWriteUser(PVDINTERFACEIOINT pIfIoInt, PVDIOSTORAGE pStorage,
c4e146628a037393bad1d63b1860e97606277f48vboxsync uint64_t uOffset, PVDIOCTX pIoCtx, size_t cbWrite,
c4e146628a037393bad1d63b1860e97606277f48vboxsync PFNVDXFERCOMPLETED pfnComplete,
c4e146628a037393bad1d63b1860e97606277f48vboxsync void *pvCompleteUser)
e4f367251aede667a6de69baa54ef9eb5f150871vboxsync{
c4e146628a037393bad1d63b1860e97606277f48vboxsync return pIfIoInt->pfnWriteUser(pIfIoInt->Core.pvUser, pStorage,
c4e146628a037393bad1d63b1860e97606277f48vboxsync uOffset, pIoCtx, cbWrite, pfnComplete,
c4e146628a037393bad1d63b1860e97606277f48vboxsync pvCompleteUser);
e4f367251aede667a6de69baa54ef9eb5f150871vboxsync}
e4f367251aede667a6de69baa54ef9eb5f150871vboxsync
c4e146628a037393bad1d63b1860e97606277f48vboxsyncDECLINLINE(int) vdIfIoIntFileReadMeta(PVDINTERFACEIOINT pIfIoInt, PVDIOSTORAGE pStorage,
c4e146628a037393bad1d63b1860e97606277f48vboxsync uint64_t uOffset, void *pvBuffer,
c4e146628a037393bad1d63b1860e97606277f48vboxsync size_t cbBuffer, PVDIOCTX pIoCtx,
c4e146628a037393bad1d63b1860e97606277f48vboxsync PPVDMETAXFER ppMetaXfer,
c4e146628a037393bad1d63b1860e97606277f48vboxsync PFNVDXFERCOMPLETED pfnComplete,
c4e146628a037393bad1d63b1860e97606277f48vboxsync void *pvCompleteUser)
e4f367251aede667a6de69baa54ef9eb5f150871vboxsync{
c4e146628a037393bad1d63b1860e97606277f48vboxsync return pIfIoInt->pfnReadMeta(pIfIoInt->Core.pvUser, pStorage,
c4e146628a037393bad1d63b1860e97606277f48vboxsync uOffset, pvBuffer, cbBuffer, pIoCtx,
c4e146628a037393bad1d63b1860e97606277f48vboxsync ppMetaXfer, pfnComplete, pvCompleteUser);
e4f367251aede667a6de69baa54ef9eb5f150871vboxsync}
e4f367251aede667a6de69baa54ef9eb5f150871vboxsync
c4e146628a037393bad1d63b1860e97606277f48vboxsyncDECLINLINE(int) vdIfIoIntFileWriteMeta(PVDINTERFACEIOINT pIfIoInt, PVDIOSTORAGE pStorage,
c4e146628a037393bad1d63b1860e97606277f48vboxsync uint64_t uOffset, void *pvBuffer,
c4e146628a037393bad1d63b1860e97606277f48vboxsync size_t cbBuffer, PVDIOCTX pIoCtx,
c4e146628a037393bad1d63b1860e97606277f48vboxsync PFNVDXFERCOMPLETED pfnComplete,
c4e146628a037393bad1d63b1860e97606277f48vboxsync void *pvCompleteUser)
e4f367251aede667a6de69baa54ef9eb5f150871vboxsync{
c4e146628a037393bad1d63b1860e97606277f48vboxsync return pIfIoInt->pfnWriteMeta(pIfIoInt->Core.pvUser, pStorage,
c4e146628a037393bad1d63b1860e97606277f48vboxsync uOffset, pvBuffer, cbBuffer, pIoCtx,
c4e146628a037393bad1d63b1860e97606277f48vboxsync pfnComplete, pvCompleteUser);
e4f367251aede667a6de69baa54ef9eb5f150871vboxsync}
e4f367251aede667a6de69baa54ef9eb5f150871vboxsync
e4f367251aede667a6de69baa54ef9eb5f150871vboxsyncDECLINLINE(void) vdIfIoIntMetaXferRelease(PVDINTERFACEIOINT pIfIoInt, PVDMETAXFER pMetaXfer)
e4f367251aede667a6de69baa54ef9eb5f150871vboxsync{
e4f367251aede667a6de69baa54ef9eb5f150871vboxsync pIfIoInt->pfnMetaXferRelease(pIfIoInt->Core.pvUser, pMetaXfer);
e4f367251aede667a6de69baa54ef9eb5f150871vboxsync}
e4f367251aede667a6de69baa54ef9eb5f150871vboxsync
c4e146628a037393bad1d63b1860e97606277f48vboxsyncDECLINLINE(int) vdIfIoIntFileFlush(PVDINTERFACEIOINT pIfIoInt, PVDIOSTORAGE pStorage,
c4e146628a037393bad1d63b1860e97606277f48vboxsync PVDIOCTX pIoCtx, PFNVDXFERCOMPLETED pfnComplete,
c4e146628a037393bad1d63b1860e97606277f48vboxsync void *pvCompleteUser)
e4f367251aede667a6de69baa54ef9eb5f150871vboxsync{
c4e146628a037393bad1d63b1860e97606277f48vboxsync return pIfIoInt->pfnFlush(pIfIoInt->Core.pvUser, pStorage, pIoCtx, pfnComplete,
c4e146628a037393bad1d63b1860e97606277f48vboxsync pvCompleteUser);
e4f367251aede667a6de69baa54ef9eb5f150871vboxsync}
e4f367251aede667a6de69baa54ef9eb5f150871vboxsync
d7856d565919537fcfd3ea1630608ba3ed2a25bcvboxsyncDECLINLINE(size_t) vdIfIoIntIoCtxCopyTo(PVDINTERFACEIOINT pIfIoInt, PVDIOCTX pIoCtx,
d7856d565919537fcfd3ea1630608ba3ed2a25bcvboxsync const void *pvBuffer, size_t cbBuffer)
d7856d565919537fcfd3ea1630608ba3ed2a25bcvboxsync{
d7856d565919537fcfd3ea1630608ba3ed2a25bcvboxsync return pIfIoInt->pfnIoCtxCopyTo(pIfIoInt->Core.pvUser, pIoCtx, pvBuffer, cbBuffer);
d7856d565919537fcfd3ea1630608ba3ed2a25bcvboxsync}
d7856d565919537fcfd3ea1630608ba3ed2a25bcvboxsync
d7856d565919537fcfd3ea1630608ba3ed2a25bcvboxsyncDECLINLINE(size_t) vdIfIoIntIoCtxCopyFrom(PVDINTERFACEIOINT pIfIoInt, PVDIOCTX pIoCtx,
d7856d565919537fcfd3ea1630608ba3ed2a25bcvboxsync void *pvBuffer, size_t cbBuffer)
d7856d565919537fcfd3ea1630608ba3ed2a25bcvboxsync{
6fd8db3822fa68ed84bee1743ab6a0d046c7e8c8vboxsync return pIfIoInt->pfnIoCtxCopyFrom(pIfIoInt->Core.pvUser, pIoCtx, pvBuffer, cbBuffer);
d7856d565919537fcfd3ea1630608ba3ed2a25bcvboxsync}
d7856d565919537fcfd3ea1630608ba3ed2a25bcvboxsync
e4f367251aede667a6de69baa54ef9eb5f150871vboxsyncDECLINLINE(size_t) vdIfIoIntIoCtxSet(PVDINTERFACEIOINT pIfIoInt, PVDIOCTX pIoCtx,
e4f367251aede667a6de69baa54ef9eb5f150871vboxsync int ch, size_t cbSet)
e4f367251aede667a6de69baa54ef9eb5f150871vboxsync{
e4f367251aede667a6de69baa54ef9eb5f150871vboxsync return pIfIoInt->pfnIoCtxSet(pIfIoInt->Core.pvUser, pIoCtx, ch, cbSet);
e4f367251aede667a6de69baa54ef9eb5f150871vboxsync}
e4f367251aede667a6de69baa54ef9eb5f150871vboxsync
d7856d565919537fcfd3ea1630608ba3ed2a25bcvboxsyncDECLINLINE(size_t) vdIfIoIntIoCtxSegArrayCreate(PVDINTERFACEIOINT pIfIoInt, PVDIOCTX pIoCtx,
d7856d565919537fcfd3ea1630608ba3ed2a25bcvboxsync PRTSGSEG paSeg, unsigned *pcSeg,
d7856d565919537fcfd3ea1630608ba3ed2a25bcvboxsync size_t cbData)
d7856d565919537fcfd3ea1630608ba3ed2a25bcvboxsync{
d7856d565919537fcfd3ea1630608ba3ed2a25bcvboxsync return pIfIoInt->pfnIoCtxSegArrayCreate(pIfIoInt->Core.pvUser, pIoCtx, paSeg, pcSeg, cbData);
d7856d565919537fcfd3ea1630608ba3ed2a25bcvboxsync}
d7856d565919537fcfd3ea1630608ba3ed2a25bcvboxsync
5eca1f6baf7020cb7a872fbf7086872e7e812301vboxsyncDECLINLINE(bool) vdIfIoIntIoCtxIsSynchronous(PVDINTERFACEIOINT pIfIoInt, PVDIOCTX pIoCtx)
5eca1f6baf7020cb7a872fbf7086872e7e812301vboxsync{
5eca1f6baf7020cb7a872fbf7086872e7e812301vboxsync return pIfIoInt->pfnIoCtxIsSynchronous(pIfIoInt->Core.pvUser, pIoCtx);
5eca1f6baf7020cb7a872fbf7086872e7e812301vboxsync}
5eca1f6baf7020cb7a872fbf7086872e7e812301vboxsync
5eca1f6baf7020cb7a872fbf7086872e7e812301vboxsyncDECLINLINE(bool) vdIfIoIntIoCtxIsZero(PVDINTERFACEIOINT pIfIoInt, PVDIOCTX pIoCtx,
5eca1f6baf7020cb7a872fbf7086872e7e812301vboxsync size_t cbCheck, bool fAdvance)
5eca1f6baf7020cb7a872fbf7086872e7e812301vboxsync{
5eca1f6baf7020cb7a872fbf7086872e7e812301vboxsync return pIfIoInt->pfnIoCtxIsZero(pIfIoInt->Core.pvUser, pIoCtx, cbCheck, fAdvance);
5eca1f6baf7020cb7a872fbf7086872e7e812301vboxsync}
5eca1f6baf7020cb7a872fbf7086872e7e812301vboxsync
e7bd3b41269a08b3f1c33641fb9fe0b809598c9evboxsyncDECLINLINE(size_t) vdIfIoIntIoCtxGetDataUnitSize(PVDINTERFACEIOINT pIfIoInt, PVDIOCTX pIoCtx)
e7bd3b41269a08b3f1c33641fb9fe0b809598c9evboxsync{
e7bd3b41269a08b3f1c33641fb9fe0b809598c9evboxsync return pIfIoInt->pfnIoCtxGetDataUnitSize(pIfIoInt->Core.pvUser, pIoCtx);
e7bd3b41269a08b3f1c33641fb9fe0b809598c9evboxsync}
5eca1f6baf7020cb7a872fbf7086872e7e812301vboxsync
5af981fb39925101cec5e22afb746e2125b55ce4vboxsync/**
5af981fb39925101cec5e22afb746e2125b55ce4vboxsync * Interface for the metadata traverse callback.
5af981fb39925101cec5e22afb746e2125b55ce4vboxsync *
5af981fb39925101cec5e22afb746e2125b55ce4vboxsync * Per-operation interface. Present only for the metadata traverse callback.
5af981fb39925101cec5e22afb746e2125b55ce4vboxsync */
5af981fb39925101cec5e22afb746e2125b55ce4vboxsynctypedef struct VDINTERFACETRAVERSEMETADATA
5af981fb39925101cec5e22afb746e2125b55ce4vboxsync{
5af981fb39925101cec5e22afb746e2125b55ce4vboxsync /**
5af981fb39925101cec5e22afb746e2125b55ce4vboxsync * Common interface header.
5af981fb39925101cec5e22afb746e2125b55ce4vboxsync */
5af981fb39925101cec5e22afb746e2125b55ce4vboxsync VDINTERFACE Core;
5af981fb39925101cec5e22afb746e2125b55ce4vboxsync
5af981fb39925101cec5e22afb746e2125b55ce4vboxsync /**
5af981fb39925101cec5e22afb746e2125b55ce4vboxsync * Traverse callback.
5af981fb39925101cec5e22afb746e2125b55ce4vboxsync *
5af981fb39925101cec5e22afb746e2125b55ce4vboxsync * @returns VBox status code.
5af981fb39925101cec5e22afb746e2125b55ce4vboxsync * @param pvUser The opaque data passed for the operation.
5af981fb39925101cec5e22afb746e2125b55ce4vboxsync * @param pvMetadataChunk Pointer to a chunk of the image metadata.
5af981fb39925101cec5e22afb746e2125b55ce4vboxsync * @param cbMetadataChunk Size of the metadata chunk
5af981fb39925101cec5e22afb746e2125b55ce4vboxsync */
5af981fb39925101cec5e22afb746e2125b55ce4vboxsync DECLR3CALLBACKMEMBER(int, pfnMetadataCallback, (void *pvUser, const void *pvMetadataChunk,
5af981fb39925101cec5e22afb746e2125b55ce4vboxsync size_t cbMetadataChunk));
5af981fb39925101cec5e22afb746e2125b55ce4vboxsync
5af981fb39925101cec5e22afb746e2125b55ce4vboxsync} VDINTERFACETRAVERSEMETADATA, *PVDINTERFACETRAVERSEMETADATA;
5af981fb39925101cec5e22afb746e2125b55ce4vboxsync
5af981fb39925101cec5e22afb746e2125b55ce4vboxsync
5af981fb39925101cec5e22afb746e2125b55ce4vboxsync/**
5af981fb39925101cec5e22afb746e2125b55ce4vboxsync * Get parent state interface from interface list.
5af981fb39925101cec5e22afb746e2125b55ce4vboxsync *
5af981fb39925101cec5e22afb746e2125b55ce4vboxsync * @return Pointer to the first parent state interface in the list.
5af981fb39925101cec5e22afb746e2125b55ce4vboxsync * @param pVDIfs Pointer to the interface list.
5af981fb39925101cec5e22afb746e2125b55ce4vboxsync */
5af981fb39925101cec5e22afb746e2125b55ce4vboxsyncDECLINLINE(PVDINTERFACETRAVERSEMETADATA) VDIfTraverseMetadataGet(PVDINTERFACE pVDIfs)
5af981fb39925101cec5e22afb746e2125b55ce4vboxsync{
5af981fb39925101cec5e22afb746e2125b55ce4vboxsync PVDINTERFACE pIf = VDInterfaceGet(pVDIfs, VDINTERFACETYPE_TRAVERSEMETADATA);
5af981fb39925101cec5e22afb746e2125b55ce4vboxsync
5af981fb39925101cec5e22afb746e2125b55ce4vboxsync /* Check that the interface descriptor the correct interface. */
5af981fb39925101cec5e22afb746e2125b55ce4vboxsync AssertMsgReturn( !pIf
5af981fb39925101cec5e22afb746e2125b55ce4vboxsync || ( (pIf->enmInterface == VDINTERFACETYPE_TRAVERSEMETADATA)
5af981fb39925101cec5e22afb746e2125b55ce4vboxsync && (pIf->cbSize == sizeof(VDINTERFACETRAVERSEMETADATA))),
5af981fb39925101cec5e22afb746e2125b55ce4vboxsync ("Not a traverse metadata interface"), NULL);
5af981fb39925101cec5e22afb746e2125b55ce4vboxsync
5af981fb39925101cec5e22afb746e2125b55ce4vboxsync return (PVDINTERFACETRAVERSEMETADATA)pIf;
5af981fb39925101cec5e22afb746e2125b55ce4vboxsync}
5af981fb39925101cec5e22afb746e2125b55ce4vboxsync
e4f367251aede667a6de69baa54ef9eb5f150871vboxsyncRT_C_DECLS_END
e4f367251aede667a6de69baa54ef9eb5f150871vboxsync
e4f367251aede667a6de69baa54ef9eb5f150871vboxsync/** @} */
e4f367251aede667a6de69baa54ef9eb5f150871vboxsync
e4f367251aede667a6de69baa54ef9eb5f150871vboxsync#endif