mirror_qemu/include
Eric Blake 3fa4c76590 nbd: Merge nbd_export_set_name into nbd_export_new
The existing NBD code had a weird split where nbd_export_new()
created an export but did not add it to the list of exported
names until a later nbd_export_set_name() came along and grabbed
a second reference on the object; later, the first call to
nbd_export_close() drops the second reference while removing
the export from the list.  This is in part because the QAPI
NbdServerRemoveNode enum documents the possibility of adding a
mode where we could do a soft disconnect: preventing new clients,
but waiting for existing clients to gracefully quit, based on
the mode used when calling nbd_export_close().

But in spite of all that, note that we never change the name of
an NBD export while it is exposed, which means it is easier to
just inline the process of setting the name as part of creating
the export.

Inline the contents of nbd_export_set_name() and
nbd_export_set_description() into the two points in an export
lifecycle where they matter, then adjust both callers to pass
the name up front.  Note that for creation, all callers pass a
non-NULL name, (passing NULL at creation was for old style
servers, but we removed support for that in commit 7f7dfe2a),
so we can add an assert and do things unconditionally; but for
cleanup, because of the dual nature of nbd_export_close(), we
still have to be careful to avoid use-after-free.  Along the
way, add a comment reminding ourselves of the potential of
adding a middle mode disconnect.

Signed-off-by: Eric Blake <eblake@redhat.com>
Reviewed-by: Vladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com>
Message-Id: <20190111194720.15671-5-eblake@redhat.com>
2019-01-14 10:09:46 -06:00
..
block nbd: Merge nbd_export_set_name into nbd_export_new 2019-01-14 10:09:46 -06:00
chardev char: add a QEMU_CHAR_FEATURE_GCONTEXT flag 2018-12-12 09:55:57 +01:00
crypto crypto: support multiple threads accessing one QCryptoBlock 2018-12-12 11:16:49 +00:00
disas target/mips: Add disassembler support for nanoMIPS 2018-10-25 22:13:33 +02:00
exec qemu/queue.h: simplify reverse access to QTAILQ 2019-01-11 15:46:55 +01:00
fpu softfloat: add float{32,64}_is_zero_or_normal 2018-12-17 08:25:25 +00:00
hw * HAX support for Linux hosts (Alejandro) 2019-01-11 15:46:09 +00:00
io io: return 0 for EOF in TLS session read after shutdown 2018-11-19 11:16:46 -06:00
libdecnumber Clean up ill-advised or unusual header guards 2016-07-12 16:20:46 +02:00
migration vmstate: constify VMStateField 2018-11-27 15:35:15 +01:00
monitor monitor: Remove "x-oob", offer capability "oob" unconditionally 2018-12-12 10:28:27 +01:00
net qemu/queue.h: simplify reverse access to QTAILQ 2019-01-11 15:46:55 +01:00
qapi qapi: Rewrite string-input-visitor's integer and list parsing 2018-12-13 19:10:06 +01:00
qemu * HAX support for Linux hosts (Alejandro) 2019-01-11 15:46:09 +00:00
qom qemu/queue.h: typedef QTAILQ heads 2019-01-11 15:46:55 +01:00
scsi avoid TABs in files that only contain a few 2019-01-11 15:46:56 +01:00
standard-headers linux-headers: update 2018-10-12 11:32:18 +02:00
sysemu avoid TABs in files that only contain a few 2019-01-11 15:46:56 +01:00
ui input: avoid malloc for mouse events 2019-01-11 11:57:17 +01:00
elf.h avoid TABs in files that only contain a few 2019-01-11 15:46:56 +01:00
glib-compat.h glib: enforce the minimum required version and warn about old APIs 2018-06-29 12:22:28 +01:00
qemu-common.h qemu-common.h: update copyright date to 2018 2018-10-16 17:52:06 +02:00
qemu-io.h qemu-io: Let command functions return error code 2018-06-11 16:18:45 +02:00
trace-tcg.h trace: get rid of generated-events.h/generated-events.c 2016-10-12 09:54:52 +02:00