]> git.proxmox.com Git - mirror_qemu.git/commit
nbd: Use enum for various negotiation modes
authorEric Blake <eblake@redhat.com>
Thu, 8 Jun 2023 13:56:37 +0000 (08:56 -0500)
committerEric Blake <eblake@redhat.com>
Wed, 19 Jul 2023 20:26:13 +0000 (15:26 -0500)
commitbfe04d0a7d5e8a4f4c9014ee7622af2056685974
tree3d3a227cacfa83af30af271e695d327953952954
parent70fa99f445a6fabe4b46f188cc665cd469cd8293
nbd: Use enum for various negotiation modes

Deciphering the hard-coded list of integer return values from
nbd_start_negotiate() will only get more confusing when adding support
for 64-bit extended headers.  Better is to name things in an enum.
Although the function in question is private to client.c, putting the
enum in a public header and including an enum-to-string conversion
will allow its use in more places in upcoming patches.

The enum is intentionally laid out so that operators like <= can be
used to group multiple modes with similar characteristics, and where
the least powerful mode has value 0, even though this patch does not
exploit that.  No semantic change intended.

Signed-off-by: Eric Blake <eblake@redhat.com>
Message-ID: <20230608135653.2918540-9-eblake@redhat.com>
Reviewed-by: Vladimir Sementsov-Ogievskiy <vsementsov@yandex-team.ru>
include/block/nbd.h
nbd/client.c
nbd/common.c