qemu-devel
[Top][All Lists]
Advanced

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

Re: [Qemu-devel] [PATCH v2 07/12] Rework ram_control_load_hook to hook d


From: Juan Quintela
Subject: Re: [Qemu-devel] [PATCH v2 07/12] Rework ram_control_load_hook to hook during block load
Date: Wed, 01 Jul 2015 10:49:30 +0200
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/24.5 (gnu/linux)

"Dr. David Alan Gilbert (git)" <address@hidden> wrote:
> From: "Dr. David Alan Gilbert" <address@hidden>
>
> We need the names of RAMBlocks as they're loaded for RDMA,
> reuse a slightly modified ram_control_load_hook:
>   a) Pass a 'data' parameter to use for the name in the block-reg
>      case
>   b) Only some hook types now require the presence of a hook function.
>
> Signed-off-by: Dr. David Alan Gilbert <address@hidden>

> @@ -1569,6 +1569,8 @@ static int ram_load(QEMUFile *f, void *opaque, int 
> version_id)
>                                  error_report_err(local_err);
>                              }
>                          }
> +                        ram_control_load_hook(f, RAM_CONTROL_BLOCK_REG,
> +                                              block->idstr);
>                          break;
>                      }
>                  }
> @@ -1637,7 +1639,7 @@ static int ram_load(QEMUFile *f, void *opaque, int 
> version_id)
>              break;
>          default:
>              if (flags & RAM_SAVE_FLAG_HOOK) {
> -                ram_control_load_hook(f, flags);
> +                ram_control_load_hook(f, RAM_CONTROL_HOOK, NULL);

Using a function in only two places, and passing two additional
parameters for that ....

> +static int rdma_load_hook(QEMUFile *f, void *opaque, uint64_t flags, void 
> *data)
> +{
> +    switch (flags) {
> +    case RAM_CONTROL_BLOCK_REG:
> +        /* TODO A later patch */
> +        return 0;
> +        break;
> +
> +    case RAM_CONTROL_HOOK:
> +        return qemu_rdma_registration_handle(f, opaque);
> +
> +    default:
> +        /* Shouldn't be called with any other values */
> +        abort();
> +    }

And you are doing two completely different things depending of the flag ....

Later, Juan.



reply via email to

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