On Fri, Jan 22, 2021 at 13:50:27 +0100, Michal Privoznik wrote:
> As advertised in one of previous commits, we want' to be able to
> change 'requested-size' attribute of virtio-mem on the fly. This
> commit does exactly that. Changing anything else is checked for
> and forbidden.
>
> Once guest has changed the allocation, QEMU emits an event which
> we will use to track the allocation. In the next commit.
>
> Signed-off-by: Michal Privoznik <[email protected]>
> ---
[...]
> diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c
> index f8c5a40b24..b6fe5e4436 100644
> --- a/src/conf/domain_conf.c
> +++ b/src/conf/domain_conf.c
> @@ -17297,6 +17297,29 @@ virDomainMemoryFindInactiveByDef(virDomainDefPtr def,
> }
>
>
> +ssize_t
> +virDomainMemoryFindByDeviceInfo(virDomainDefPtr def,
> + virDomainDeviceInfoPtr info)
> +{
> + size_t i;
> +
> + for (i = 0; i < def->nmems; i++) {
> + virDomainMemoryDefPtr tmp = def->mems[i];
> +
> + if (!virDomainDeviceInfoAddressIsEqual(&tmp->info, info))
> + continue;
> +
> + /* alias, if present */
This comment makes it look ...
> + if (STRNEQ_NULLABLE(tmp->info.alias, info->alias))
... as if you wanted to check alias only optionally ... when provided by
the user, but STREQ_NULLABLE will reject it if user doesn't provide it
while definition does.
The intentions are also unclear because the expected function semantics
are undocumented.