[50991] | 1 | /** @file
|
---|
| 2 | * Internal VD filter backend interface.
|
---|
| 3 | */
|
---|
| 4 |
|
---|
| 5 | /*
|
---|
| 6 | * Copyright (C) 2014 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 pVDIfsFilter Pointer to the per-filter VD interface list.
|
---|
| 61 | * @param ppvBackendData Opaque state data for this filter instance.
|
---|
| 62 | */
|
---|
| 63 | DECLR3CALLBACKMEMBER(int, pfnCreate, (PVDINTERFACE pVDIfsDisk,
|
---|
| 64 | PVDINTERFACE pVDIfsFilter,
|
---|
| 65 | void **ppvBackendData));
|
---|
| 66 |
|
---|
| 67 | /**
|
---|
| 68 | * Destroys a filter instance.
|
---|
| 69 | *
|
---|
| 70 | * @returns VBox status code.
|
---|
| 71 | * @param pvBackendData Opaque state data for the filter instance to destroy.
|
---|
| 72 | */
|
---|
| 73 | DECLR3CALLBACKMEMBER(int, pfnDestroy, (void *pvBackendData));
|
---|
| 74 |
|
---|
| 75 | /**
|
---|
| 76 | * Filters the data of a read from the image chain. The filter is applied
|
---|
| 77 | * after everything was read.
|
---|
| 78 | *
|
---|
| 79 | * @returns VBox status code.
|
---|
| 80 | * @param pvBackendData Opaque state data for the filter instance.
|
---|
| 81 | * @param uOffset Start offset of the read.
|
---|
| 82 | * @param cbRead Number of bytes read.
|
---|
| 83 | * @param pIoCtx The I/O context holding the read data.
|
---|
| 84 | */
|
---|
| 85 | DECLR3CALLBACKMEMBER(int, pfnFilterRead, (void *pvBackendData, uint64_t uOffset, size_t cbRead,
|
---|
| 86 | PVDIOCTX pIoCtx));
|
---|
| 87 |
|
---|
| 88 | /**
|
---|
| 89 | * Filters the data of a write to the image chain. The filter is applied
|
---|
| 90 | * before everything is written.
|
---|
| 91 | *
|
---|
| 92 | * @returns VBox status code.
|
---|
| 93 | * @param pvBackendData Opaque state data for the filter instance.
|
---|
| 94 | * @param uOffset Start offset of the write.
|
---|
| 95 | * @param cbWrite Number of bytes to be written.
|
---|
| 96 | * @param pIoCtx The I/O context holding the data to write.
|
---|
| 97 | */
|
---|
| 98 | DECLR3CALLBACKMEMBER(int, pfnFilterWrite, (void *pvBackendData, uint64_t uOffset, size_t cbWrite,
|
---|
| 99 | PVDIOCTX pIoCtx));
|
---|
| 100 |
|
---|
| 101 | } VDFILTERBACKEND;
|
---|
| 102 | /** Pointer to VD filter backend. */
|
---|
| 103 | typedef VDFILTERBACKEND *PVDFILTERBACKEND;
|
---|
| 104 | /** Constant pointer to a VD filter backend. */
|
---|
| 105 | typedef const VDFILTERBACKEND *PCVDFILTERBACKEND;
|
---|
| 106 |
|
---|
| 107 | #endif
|
---|