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