qemu-patch-raspberry4/include/block/export.h
Kevin Wolf 9b562c646b block/export: Remove magic from block-export-add
nbd-server-add tries to be convenient and adds two questionable
features that we don't want to share in block-export-add, even for NBD
exports:

1. When requesting a writable export of a read-only device, the export
   is silently downgraded to read-only. This should be an error in the
   context of block-export-add.

2. When using a BlockBackend name, unplugging the device from the guest
   will automatically stop the NBD server, too. This may sometimes be
   what you want, but it could also be very surprising. Let's keep
   things explicit with block-export-add. If the user wants to stop the
   export, they should tell us so.

Move these things into the nbd-server-add QMP command handler so that
they apply only there.

Signed-off-by: Kevin Wolf <kwolf@redhat.com>
Reviewed-by: Max Reitz <mreitz@redhat.com>
Message-Id: <20200924152717.287415-8-kwolf@redhat.com>
Acked-by: Stefan Hajnoczi <stefanha@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
2020-10-02 15:46:40 +02:00

36 lines
817 B
C

/*
* 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;
};
BlockExport *blk_exp_add(BlockExportOptions *export, Error **errp);
#endif