[50991] | 1 | /** @file
|
---|
| 2 | * Internal VD filter backend interface.
|
---|
| 3 | */
|
---|
| 4 |
|
---|
| 5 | /*
|
---|
[98103] | 6 | * Copyright (C) 2014-2023 Oracle and/or its affiliates.
|
---|
[50991] | 7 | *
|
---|
[96407] | 8 | * This file is part of VirtualBox base platform packages, as
|
---|
| 9 | * available from https://www.virtualbox.org.
|
---|
[50991] | 10 | *
|
---|
[96407] | 11 | * This program is free software; you can redistribute it and/or
|
---|
| 12 | * modify it under the terms of the GNU General Public License
|
---|
| 13 | * as published by the Free Software Foundation, in version 3 of the
|
---|
| 14 | * License.
|
---|
| 15 | *
|
---|
| 16 | * This program is distributed in the hope that it will be useful, but
|
---|
| 17 | * WITHOUT ANY WARRANTY; without even the implied warranty of
|
---|
| 18 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
---|
| 19 | * General Public License for more details.
|
---|
| 20 | *
|
---|
| 21 | * You should have received a copy of the GNU General Public License
|
---|
| 22 | * along with this program; if not, see <https://www.gnu.org/licenses>.
|
---|
| 23 | *
|
---|
[50991] | 24 | * The contents of this file may alternatively be used under the terms
|
---|
| 25 | * of the Common Development and Distribution License Version 1.0
|
---|
[96407] | 26 | * (CDDL), a copy of it is provided in the "COPYING.CDDL" file included
|
---|
| 27 | * in the VirtualBox distribution, in which case the provisions of the
|
---|
[50991] | 28 | * CDDL are applicable instead of those of the GPL.
|
---|
| 29 | *
|
---|
| 30 | * You may elect to license modified versions of this file under the
|
---|
| 31 | * terms and conditions of either the GPL or the CDDL or both.
|
---|
[96407] | 32 | *
|
---|
| 33 | * SPDX-License-Identifier: GPL-3.0-only OR CDDL-1.0
|
---|
[50991] | 34 | */
|
---|
| 35 |
|
---|
[76558] | 36 | #ifndef VBOX_INCLUDED_vd_filter_backend_h
|
---|
| 37 | #define VBOX_INCLUDED_vd_filter_backend_h
|
---|
[76507] | 38 | #ifndef RT_WITHOUT_PRAGMA_ONCE
|
---|
| 39 | # pragma once
|
---|
| 40 | #endif
|
---|
[50991] | 41 |
|
---|
| 42 | #include <VBox/vd.h>
|
---|
[63905] | 43 | #include <VBox/vd-common.h>
|
---|
[50991] | 44 | #include <VBox/vd-ifs-internal.h>
|
---|
| 45 |
|
---|
| 46 | /**
|
---|
| 47 | * VD filter backend interface.
|
---|
| 48 | */
|
---|
| 49 | typedef struct VDFILTERBACKEND
|
---|
| 50 | {
|
---|
[63905] | 51 | /** Structure version. VD_FLTBACKEND_VERSION defines the current version. */
|
---|
| 52 | uint32_t u32Version;
|
---|
| 53 | /** The name of the backend (constant string). */
|
---|
| 54 | const char *pszBackendName;
|
---|
[50991] | 55 |
|
---|
| 56 | /**
|
---|
| 57 | * Pointer to an array of structs describing each supported config key.
|
---|
| 58 | * Terminated by a NULL config key. Note that some backends do not support
|
---|
| 59 | * the configuration interface, so this pointer may just contain NULL.
|
---|
| 60 | * Mandatory if the backend sets VD_CAP_CONFIG.
|
---|
| 61 | */
|
---|
[63905] | 62 | PCVDCONFIGINFO paConfigInfo;
|
---|
[50991] | 63 |
|
---|
| 64 | /**
|
---|
| 65 | * Creates a new filter instance.
|
---|
| 66 | *
|
---|
| 67 | * @returns VBox status code.
|
---|
| 68 | * @param pVDIfsDisk Pointer to the per-disk VD interface list.
|
---|
[54835] | 69 | * @param fFlags Subset of VD_FILTER_FLAGS_*.
|
---|
[50991] | 70 | * @param pVDIfsFilter Pointer to the per-filter VD interface list.
|
---|
| 71 | * @param ppvBackendData Opaque state data for this filter instance.
|
---|
| 72 | */
|
---|
[54835] | 73 | DECLR3CALLBACKMEMBER(int, pfnCreate, (PVDINTERFACE pVDIfsDisk, uint32_t fFlags,
|
---|
[50991] | 74 | PVDINTERFACE pVDIfsFilter,
|
---|
| 75 | void **ppvBackendData));
|
---|
| 76 |
|
---|
| 77 | /**
|
---|
| 78 | * Destroys a filter instance.
|
---|
| 79 | *
|
---|
| 80 | * @returns VBox status code.
|
---|
| 81 | * @param pvBackendData Opaque state data for the filter instance to destroy.
|
---|
| 82 | */
|
---|
| 83 | DECLR3CALLBACKMEMBER(int, pfnDestroy, (void *pvBackendData));
|
---|
| 84 |
|
---|
| 85 | /**
|
---|
| 86 | * Filters the data of a read from the image chain. The filter is applied
|
---|
| 87 | * after everything was read.
|
---|
| 88 | *
|
---|
| 89 | * @returns VBox status code.
|
---|
| 90 | * @param pvBackendData Opaque state data for the filter instance.
|
---|
| 91 | * @param uOffset Start offset of the read.
|
---|
| 92 | * @param cbRead Number of bytes read.
|
---|
| 93 | * @param pIoCtx The I/O context holding the read data.
|
---|
| 94 | */
|
---|
| 95 | DECLR3CALLBACKMEMBER(int, pfnFilterRead, (void *pvBackendData, uint64_t uOffset, size_t cbRead,
|
---|
| 96 | PVDIOCTX pIoCtx));
|
---|
| 97 |
|
---|
| 98 | /**
|
---|
| 99 | * Filters the data of a write to the image chain. The filter is applied
|
---|
| 100 | * before everything is written.
|
---|
| 101 | *
|
---|
| 102 | * @returns VBox status code.
|
---|
| 103 | * @param pvBackendData Opaque state data for the filter instance.
|
---|
| 104 | * @param uOffset Start offset of the write.
|
---|
| 105 | * @param cbWrite Number of bytes to be written.
|
---|
| 106 | * @param pIoCtx The I/O context holding the data to write.
|
---|
| 107 | */
|
---|
| 108 | DECLR3CALLBACKMEMBER(int, pfnFilterWrite, (void *pvBackendData, uint64_t uOffset, size_t cbWrite,
|
---|
| 109 | PVDIOCTX pIoCtx));
|
---|
| 110 |
|
---|
[63905] | 111 | /** Initialization safty marker. */
|
---|
| 112 | uint32_t u32VersionEnd;
|
---|
[50991] | 113 | } VDFILTERBACKEND;
|
---|
| 114 | /** Pointer to VD filter backend. */
|
---|
| 115 | typedef VDFILTERBACKEND *PVDFILTERBACKEND;
|
---|
| 116 | /** Constant pointer to a VD filter backend. */
|
---|
| 117 | typedef const VDFILTERBACKEND *PCVDFILTERBACKEND;
|
---|
| 118 |
|
---|
[63905] | 119 | /** The current version of the VDFILTERBACKEND structure. */
|
---|
| 120 | #define VD_FLTBACKEND_VERSION VD_VERSION_MAKE(0xff02, 1, 0)
|
---|
| 121 |
|
---|
[76585] | 122 | #endif /* !VBOX_INCLUDED_vd_filter_backend_h */
|
---|