mirror of
https://github.com/mii443/qemu.git
synced 2025-08-22 15:15:46 +00:00
qapi block: Elide redundant has_FOO in generated C
The has_FOO for pointer-valued FOO are redundant, except for arrays. They are also a nuisance to work with. Recent commit "qapi: Start to elide redundant has_FOO in generated C" provided the means to elide them step by step. This is the step for qapi/block*.json. Said commit explains the transformation in more detail. There is one instance of the invariant violation mentioned there: qcow2_signal_corruption() passes false, "" when node_name is an empty string. Take care to pass NULL then. The previous two commits cleaned up two more. Additionally, helper bdrv_latency_histogram_stats() loses its output parameters and returns a value instead. Cc: Kevin Wolf <kwolf@redhat.com> Cc: Hanna Reitz <hreitz@redhat.com> Cc: qemu-block@nongnu.org Signed-off-by: Markus Armbruster <armbru@redhat.com> Message-Id: <20221104160712.3005652-11-armbru@redhat.com> [Fixes for #ifndef LIBRBD_SUPPORTS_ENCRYPTION and MacOS squashed in]
This commit is contained in:
@ -173,8 +173,8 @@ void nbd_server_start_options(NbdServerOptions *arg, Error **errp)
|
||||
}
|
||||
|
||||
void qmp_nbd_server_start(SocketAddressLegacy *addr,
|
||||
bool has_tls_creds, const char *tls_creds,
|
||||
bool has_tls_authz, const char *tls_authz,
|
||||
const char *tls_creds,
|
||||
const char *tls_authz,
|
||||
bool has_max_connections, uint32_t max_connections,
|
||||
Error **errp)
|
||||
{
|
||||
@ -200,8 +200,7 @@ void qmp_nbd_server_add(NbdServerAddOptions *arg, Error **errp)
|
||||
* block-export-add would default to the node-name, but we may have to use
|
||||
* the device name as a default here for compatibility.
|
||||
*/
|
||||
if (!arg->has_name) {
|
||||
arg->has_name = true;
|
||||
if (!arg->name) {
|
||||
arg->name = g_strdup(arg->device);
|
||||
}
|
||||
|
||||
@ -215,7 +214,7 @@ void qmp_nbd_server_add(NbdServerAddOptions *arg, Error **errp)
|
||||
};
|
||||
QAPI_CLONE_MEMBERS(BlockExportOptionsNbdBase, &export_opts->u.nbd,
|
||||
qapi_NbdServerAddOptions_base(arg));
|
||||
if (arg->has_bitmap) {
|
||||
if (arg->bitmap) {
|
||||
BlockDirtyBitmapOrStr *el = g_new(BlockDirtyBitmapOrStr, 1);
|
||||
|
||||
*el = (BlockDirtyBitmapOrStr) {
|
||||
|
Reference in New Issue
Block a user