mirror of
https://github.com/Motorhead1991/qemu.git
synced 2025-08-03 07:43:54 -06:00
block/export: Add BlockExport infrastructure and block-export-add
We want to have a common set of commands for all types of block exports. Currently, this is only NBD, but we're going to add more types. This patch adds the basic BlockExport and BlockExportDriver structs and a QMP command block-export-add that creates a new export based on the given BlockExportOptions. qmp_nbd_server_add() becomes a wrapper around qmp_block_export_add(). Signed-off-by: Kevin Wolf <kwolf@redhat.com> Reviewed-by: Max Reitz <mreitz@redhat.com> Message-Id: <20200924152717.287415-5-kwolf@redhat.com> Acked-by: Stefan Hajnoczi <stefanha@redhat.com> Reviewed-by: Eric Blake <eblake@redhat.com> Signed-off-by: Kevin Wolf <kwolf@redhat.com>
This commit is contained in:
parent
143ea7670c
commit
56ee86261e
9 changed files with 134 additions and 10 deletions
33
include/block/export.h
Normal file
33
include/block/export.h
Normal file
|
@ -0,0 +1,33 @@
|
|||
/*
|
||||
* Declarations for block exports
|
||||
*
|
||||
* Copyright (c) 2012, 2020 Red Hat, Inc.
|
||||
*
|
||||
* Authors:
|
||||
* Paolo Bonzini <pbonzini@redhat.com>
|
||||
* Kevin Wolf <kwolf@redhat.com>
|
||||
*
|
||||
* This work is licensed under the terms of the GNU GPL, version 2 or
|
||||
* later. See the COPYING file in the top-level directory.
|
||||
*/
|
||||
|
||||
#ifndef BLOCK_EXPORT_H
|
||||
#define BLOCK_EXPORT_H
|
||||
|
||||
#include "qapi/qapi-types-block-export.h"
|
||||
|
||||
typedef struct BlockExport BlockExport;
|
||||
|
||||
typedef struct BlockExportDriver {
|
||||
/* The export type that this driver services */
|
||||
BlockExportType type;
|
||||
|
||||
/* Creates and starts a new block export */
|
||||
BlockExport *(*create)(BlockExportOptions *, Error **);
|
||||
} BlockExportDriver;
|
||||
|
||||
struct BlockExport {
|
||||
const BlockExportDriver *drv;
|
||||
};
|
||||
|
||||
#endif
|
Loading…
Add table
Add a link
Reference in a new issue