qemu-block
[Top][All Lists]
Advanced

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

Re: [Qemu-block] [PATCH v7 35/38] libqtest: Merge qtest_{mem, buf}{read,


From: Greg Kurz
Subject: Re: [Qemu-block] [PATCH v7 35/38] libqtest: Merge qtest_{mem, buf}{read, write}() with {mem, buf}{read, write}()
Date: Mon, 11 Sep 2017 23:35:57 +0200

On Mon, 11 Sep 2017 12:20:19 -0500
Eric Blake <address@hidden> wrote:

> Maintaining two layers of libqtest APIs, one that takes an explicit
> QTestState object, and the other that uses the implicit global_qtest,
> is annoying.  In the interest of getting rid of global implicit
> state and having less code to maintain, merge:
>  qtest_memread()
>  qtest_bufread()
>  qtest_memwrite()
>  qtest_bufwrite()
> with their short counterparts.  All callers that previously
> used the short form now make it explicit that they are relying on
> global_qtest, and later patches can then clean things up to remove
> the global variable.
> 
> Signed-off-by: Eric Blake <address@hidden>
> ---
>  tests/libqtest.h         | 69 
> ++++++------------------------------------------
>  tests/libqtest.c         |  8 +++---
>  tests/ahci-test.c        | 16 +++++------
>  tests/e1000e-test.c      | 16 ++++++-----
>  tests/i440fx-test.c      |  8 +++---
>  tests/ide-test.c         | 14 +++++-----
>  tests/libqos/ahci.c      | 22 +++++++--------
>  tests/libqos/pci-pc.c    |  4 +--
>  tests/libqos/pci-spapr.c |  4 +--
>  tests/megasas-test.c     |  2 +-
>  tests/postcopy-test.c    | 12 ++++-----
>  tests/virtio-9p-test.c   |  4 +--
>  tests/virtio-blk-test.c  | 16 +++++------
>  tests/virtio-net-test.c  |  6 ++---
>  tests/virtio-scsi-test.c |  4 +--
>  15 files changed, 78 insertions(+), 127 deletions(-)
> 
[...]
> diff --git a/tests/virtio-9p-test.c b/tests/virtio-9p-test.c
> index 07cbb7f37c..e2a14bc2ff 100644
> --- a/tests/virtio-9p-test.c
> +++ b/tests/virtio-9p-test.c
> @@ -116,7 +116,7 @@ typedef struct {
> 
>  static void v9fs_memwrite(P9Req *req, const void *addr, size_t len)
>  {
> -    memwrite(req->t_msg + req->t_off, addr, len);
> +    memwrite(global_qtest, req->t_msg + req->t_off, addr, len);

Maybe use req->v9p->qs->qts instead of global_qtest ?

>      req->t_off += len;
>  }
> 
> @@ -132,7 +132,7 @@ static void v9fs_memrewind(P9Req *req, size_t len)
> 
>  static void v9fs_memread(P9Req *req, void *addr, size_t len)
>  {
> -    memread(req->r_msg + req->r_off, addr, len);
> +    memread(global_qtest, req->r_msg + req->r_off, addr, len);

Same here.

But this can be done in a follow-up patch. In case you don't respin, for
tests/virtio-9p-test.c:

Acked-by: Greg Kurz <address@hidden>

Attachment: pgpWFZ4veQV3X.pgp
Description: OpenPGP digital signature


reply via email to

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