X-Git-Url: https://git.proxmox.com/?a=blobdiff_plain;f=blockdev-nbd.c;h=922cf5657b99f23f4a8afc707c0e0bf79d03bbd0;hb=HEAD;hp=d1721a3e26fd6e2a314ea271ed5f70c13f12cb4a;hpb=de148eb79c7894178a1c2da6f2320b9ce6b0daee;p=qemu.git diff --git a/blockdev-nbd.c b/blockdev-nbd.c index d1721a3e2..922cf5657 100644 --- a/blockdev-nbd.c +++ b/blockdev-nbd.c @@ -9,15 +9,15 @@ * later. See the COPYING file in the top-level directory. */ -#include "blockdev.h" -#include "hw/block-common.h" -#include "monitor.h" -#include "qerror.h" -#include "sysemu.h" +#include "sysemu/blockdev.h" +#include "hw/block/block.h" +#include "monitor/monitor.h" +#include "qapi/qmp/qerror.h" +#include "sysemu/sysemu.h" #include "qmp-commands.h" #include "trace.h" -#include "nbd.h" -#include "qemu_socket.h" +#include "block/nbd.h" +#include "qemu/sockets.h" static int server_fd = -1; @@ -69,12 +69,6 @@ static void nbd_close_notifier(Notifier *n, void *data) g_free(cn); } -static void nbd_server_put_ref(NBDExport *exp) -{ - BlockDriverState *bs = nbd_export_get_blockdev(exp); - drive_put_ref(drive_get_by_blockdev(bs)); -} - void qmp_nbd_server_add(const char *device, bool has_writable, bool writable, Error **errp) { @@ -99,17 +93,15 @@ void qmp_nbd_server_add(const char *device, bool has_writable, bool writable, } if (!has_writable) { - writable = true; + writable = false; } if (bdrv_is_read_only(bs)) { writable = false; } - exp = nbd_export_new(bs, 0, -1, writable ? 0 : NBD_FLAG_READ_ONLY, - nbd_server_put_ref); + exp = nbd_export_new(bs, 0, -1, writable ? 0 : NBD_FLAG_READ_ONLY, NULL); nbd_export_set_name(exp, device); - drive_get_ref(drive_get_by_blockdev(bs)); n = g_malloc0(sizeof(NBDCloseNotifier)); n->n.notify = nbd_close_notifier;