qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [PATCH 2/2] migration: Perform vmsd structure check during tests


From: Peter Maydell
Subject: Re: [PATCH 2/2] migration: Perform vmsd structure check during tests
Date: Mon, 28 Nov 2022 13:38:35 +0000

On Mon, 28 Nov 2022 at 13:09, Juan Quintela <quintela@redhat.com> wrote:
>
> From: "Dr. David Alan Gilbert" <dgilbert@redhat.com>
>
> Perform a check on vmsd structures during test runs in the hope
> of catching any missing terminators and other simple screwups.
>
> Signed-off-by: Dr. David Alan Gilbert <dgilbert@redhat.com>
> Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
> Reviewed-by: Juan Quintela <quintela@redhat.com>
> Signed-off-by: Juan Quintela <quintela@redhat.com>

> +/*
> + * Perform some basic checks on vmsd's at registration
> + * time.
> + */
> +static void vmstate_check(const VMStateDescription *vmsd)
> +{
> +    const VMStateField *field = vmsd->fields;
> +    const VMStateDescription **subsection = vmsd->subsections;
> +
> +    if (field) {
> +        while (field->name) {
> +            if (field->flags & (VMS_STRUCT | VMS_VSTRUCT)) {
> +                /* Recurse to sub structures */
> +                vmstate_check(field->vmsd);
> +            }
> +            /* Carry on */
> +            field++;
> +        }
> +        /* Check for the end of field list canary */
> +        if (field->flags != VMS_END) {
> +            error_report("VMSTATE not ending with VMS_END: %s", vmsd->name);

This is always a bug, right, so what prevents us from assert()ing it?

thanks
-- PMM



reply via email to

[Prev in Thread] Current Thread [Next in Thread]