VirtualBox

source: vbox/trunk/include/VBox/vd-filter-backend.h

Last change on this file was 106061, checked in by vboxsync, 2 months ago

Copyright year updates by scm.

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
File size: 4.6 KB
Line 
1/** @file
2 * Internal VD filter backend interface.
3 */
4
5/*
6 * Copyright (C) 2014-2024 Oracle and/or its affiliates.
7 *
8 * This file is part of VirtualBox base platform packages, as
9 * available from https://www.virtualbox.org.
10 *
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 *
24 * The contents of this file may alternatively be used under the terms
25 * of the Common Development and Distribution License Version 1.0
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
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.
32 *
33 * SPDX-License-Identifier: GPL-3.0-only OR CDDL-1.0
34 */
35
36#ifndef VBOX_INCLUDED_vd_filter_backend_h
37#define VBOX_INCLUDED_vd_filter_backend_h
38#ifndef RT_WITHOUT_PRAGMA_ONCE
39# pragma once
40#endif
41
42#include <VBox/vd.h>
43#include <VBox/vd-common.h>
44#include <VBox/vd-ifs-internal.h>
45
46/**
47 * VD filter backend interface.
48 */
49typedef struct VDFILTERBACKEND
50{
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;
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 */
62 PCVDCONFIGINFO paConfigInfo;
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.
69 * @param fFlags Subset of VD_FILTER_FLAGS_*.
70 * @param pVDIfsFilter Pointer to the per-filter VD interface list.
71 * @param ppvBackendData Opaque state data for this filter instance.
72 */
73 DECLR3CALLBACKMEMBER(int, pfnCreate, (PVDINTERFACE pVDIfsDisk, uint32_t fFlags,
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
111 /** Initialization safty marker. */
112 uint32_t u32VersionEnd;
113} VDFILTERBACKEND;
114/** Pointer to VD filter backend. */
115typedef VDFILTERBACKEND *PVDFILTERBACKEND;
116/** Constant pointer to a VD filter backend. */
117typedef const VDFILTERBACKEND *PCVDFILTERBACKEND;
118
119/** The current version of the VDFILTERBACKEND structure. */
120#define VD_FLTBACKEND_VERSION VD_VERSION_MAKE(0xff02, 1, 0)
121
122#endif /* !VBOX_INCLUDED_vd_filter_backend_h */
Note: See TracBrowser for help on using the repository browser.

© 2024 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette