qemu-devel
[Top][All Lists]
Advanced

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

Re: [Qemu-devel] [PATCH v6] s390x/pci: add common function measurement b


From: Pierre Morel
Subject: Re: [Qemu-devel] [PATCH v6] s390x/pci: add common function measurement block
Date: Mon, 7 Jan 2019 10:22:10 +0100
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.2.1

On 07/01/2019 10:11, Thomas Huth wrote:
On 2019-01-07 10:08, Pierre Morel wrote:
On 04/01/2019 15:39, Cornelia Huck wrote:
On Thu,  3 Jan 2019 11:17:00 +0100
Pierre Morel <address@hidden> wrote:

+static void fmb_update(void *opaque)
+{
+    S390PCIBusDevice *pbdev = opaque;
+    int64_t t = qemu_clock_get_ms(QEMU_CLOCK_VIRTUAL);
+    int i;
+
+    /* Update U bit */
+    pbdev->fmb.last_update *= 2;
+    pbdev->fmb.last_update |= UPDATE_U_BIT;
+    if (fmb_do_update(pbdev, offsetof(ZpciFmb, last_update),
+                      pbdev->fmb.last_update,
+                      sizeof(((ZpciFmb *)0)->last_update))) {

I really don't want to be a pain, but... this looks weird. Why not
simply sizeof(pbdev->fmb.last_update)?

Isn't it preferable to use the size of the destination?

But "(ZpciFmb *)0" in the context of QEMU isn't the destination either,
it's an invalid pointer. So I think I agree with Cornelia,
"sizeof(pbdev->fmb.last_update)" looks much easier to read and
understand here.

  Thomas



sizeof() returns the field length, the pointer value is not relevant.
But I will do as you wish if you both prefer to use this.
Anyway, this should be the same.

regards,
Pierre

--
Pierre Morel
Linux/KVM/QEMU in Böblingen - Germany




reply via email to

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