1 | /** @file
|
---|
2 | * Internal VD filter backend interface.
|
---|
3 | */
|
---|
4 |
|
---|
5 | /*
|
---|
6 | * Copyright (C) 2014-2015 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 __vd_filter_backend_h__
|
---|
27 | #define __vd_filter_backend_h__
|
---|
28 |
|
---|
29 | #include <VBox/vd.h>
|
---|
30 | #include <VBox/vd-ifs-internal.h>
|
---|
31 |
|
---|
32 | /**
|
---|
33 | * VD filter backend interface.
|
---|
34 | */
|
---|
35 | typedef struct VDFILTERBACKEND
|
---|
36 | {
|
---|
37 | /**
|
---|
38 | * The name of the backend (constant string).
|
---|
39 | */
|
---|
40 | const char *pszBackendName;
|
---|
41 |
|
---|
42 | /**
|
---|
43 | * The size of the structure.
|
---|
44 | */
|
---|
45 | uint32_t cbSize;
|
---|
46 |
|
---|
47 | /**
|
---|
48 | * Pointer to an array of structs describing each supported config key.
|
---|
49 | * Terminated by a NULL config key. Note that some backends do not support
|
---|
50 | * the configuration interface, so this pointer may just contain NULL.
|
---|
51 | * Mandatory if the backend sets VD_CAP_CONFIG.
|
---|
52 | */
|
---|
53 | PCVDCONFIGINFO paConfigInfo;
|
---|
54 |
|
---|
55 | /**
|
---|
56 | * Creates a new filter instance.
|
---|
57 | *
|
---|
58 | * @returns VBox status code.
|
---|
59 | * @param pVDIfsDisk Pointer to the per-disk VD interface list.
|
---|
60 | * @param fFlags Subset of VD_FILTER_FLAGS_*.
|
---|
61 | * @param pVDIfsFilter Pointer to the per-filter VD interface list.
|
---|
62 | * @param ppvBackendData Opaque state data for this filter instance.
|
---|
63 | */
|
---|
64 | DECLR3CALLBACKMEMBER(int, pfnCreate, (PVDINTERFACE pVDIfsDisk, uint32_t fFlags,
|
---|
65 | PVDINTERFACE pVDIfsFilter,
|
---|
66 | void **ppvBackendData));
|
---|
67 |
|
---|
68 | /**
|
---|
69 | * Destroys a filter instance.
|
---|
70 | *
|
---|
71 | * @returns VBox status code.
|
---|
72 | * @param pvBackendData Opaque state data for the filter instance to destroy.
|
---|
73 | */
|
---|
74 | DECLR3CALLBACKMEMBER(int, pfnDestroy, (void *pvBackendData));
|
---|
75 |
|
---|
76 | /**
|
---|
77 | * Filters the data of a read from the image chain. The filter is applied
|
---|
78 | * after everything was read.
|
---|
79 | *
|
---|
80 | * @returns VBox status code.
|
---|
81 | * @param pvBackendData Opaque state data for the filter instance.
|
---|
82 | * @param uOffset Start offset of the read.
|
---|
83 | * @param cbRead Number of bytes read.
|
---|
84 | * @param pIoCtx The I/O context holding the read data.
|
---|
85 | */
|
---|
86 | DECLR3CALLBACKMEMBER(int, pfnFilterRead, (void *pvBackendData, uint64_t uOffset, size_t cbRead,
|
---|
87 | PVDIOCTX pIoCtx));
|
---|
88 |
|
---|
89 | /**
|
---|
90 | * Filters the data of a write to the image chain. The filter is applied
|
---|
91 | * before everything is written.
|
---|
92 | *
|
---|
93 | * @returns VBox status code.
|
---|
94 | * @param pvBackendData Opaque state data for the filter instance.
|
---|
95 | * @param uOffset Start offset of the write.
|
---|
96 | * @param cbWrite Number of bytes to be written.
|
---|
97 | * @param pIoCtx The I/O context holding the data to write.
|
---|
98 | */
|
---|
99 | DECLR3CALLBACKMEMBER(int, pfnFilterWrite, (void *pvBackendData, uint64_t uOffset, size_t cbWrite,
|
---|
100 | PVDIOCTX pIoCtx));
|
---|
101 |
|
---|
102 | } VDFILTERBACKEND;
|
---|
103 | /** Pointer to VD filter backend. */
|
---|
104 | typedef VDFILTERBACKEND *PVDFILTERBACKEND;
|
---|
105 | /** Constant pointer to a VD filter backend. */
|
---|
106 | typedef const VDFILTERBACKEND *PCVDFILTERBACKEND;
|
---|
107 |
|
---|
108 | #endif
|
---|