From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:51296) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VrGsF-000391-K0 for qemu-devel@nongnu.org; Thu, 12 Dec 2013 19:45:04 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1VrGsB-0000Mf-1q for qemu-devel@nongnu.org; Thu, 12 Dec 2013 19:44:59 -0500 Received: from [222.73.24.84] (port=35890 helo=song.cn.fujitsu.com) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VrGsA-0000Lw-Li for qemu-devel@nongnu.org; Thu, 12 Dec 2013 19:44:54 -0500 Message-ID: <52AA581D.9010207@cn.fujitsu.com> Date: Fri, 13 Dec 2013 08:43:09 +0800 From: Li Guang MIME-Version: 1.0 References: <1386749341-9843-1-git-send-email-lig.fnst@cn.fujitsu.com> <1386749341-9843-2-git-send-email-lig.fnst@cn.fujitsu.com> In-Reply-To: Content-Transfer-Encoding: 7bit Content-Type: text/plain; charset=UTF-8; format=flowed Subject: Re: [Qemu-devel] [PATCH v11 1/5] vmstate: add VMSTATE_PTIMER_ARRAY List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Peter Maydell Cc: Peter Crosthwaite , =?UTF-8?B?QW5kcmVhcyBGw6RyYmVy?= , QEMU Developers , Stefan Hajnoczi , Juan Quintela Peter Maydell wrote: > On 11 December 2013 08:08, liguang wrote: > >> +static int get_ptimer(QEMUFile *f, void *pv, size_t size) >> +{ >> + ptimer_state *v = pv; >> + uint64_t count; >> + >> + count = qemu_get_be64(f); >> + if (count != -1) { >> + ptimer_set_count(v, count); >> + } else { >> + ptimer_stop(v); >> + } >> + >> + return 0; >> +} >> + >> +static void put_ptimer(QEMUFile *f, void *pv, size_t size) >> +{ >> + ptimer_state *v = pv; >> + uint64_t count; >> + >> + count = ptimer_get_count(v); >> + qemu_put_be64(f, count); >> +} >> + >> +const VMStateInfo vmstate_info_ptimer = { >> + .name = "ptimer", >> + .get = get_ptimer, >> + .put = put_ptimer, >> +}; >> > Sorry, I led you a bit astray with my last review comment; > this is definitely wrong because it isn't saving and > restoring each ptimer_state according to the vmstate_ptimer > definition, it's only saving a single 64 bit count. > Doing this right isn't quite as obvious as I thought > because we haven't needed to do "array of pointers to > structures" yet, so there's a missing macro. > > I've written a patch which does this correctly -- I'll > send it out shortly and you can add it to your patch > series in place of this one. > > Ok, thanks!