From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:40608) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1a3b8A-0003VK-IV for qemu-devel@nongnu.org; Mon, 30 Nov 2015 21:57:27 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1a3b85-0006Pj-5G for qemu-devel@nongnu.org; Mon, 30 Nov 2015 21:57:26 -0500 Received: from mx1.redhat.com ([209.132.183.28]:48742) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1a3b84-0006Ol-RN for qemu-devel@nongnu.org; Mon, 30 Nov 2015 21:57:21 -0500 Received: from int-mx09.intmail.prod.int.phx2.redhat.com (int-mx09.intmail.prod.int.phx2.redhat.com [10.5.11.22]) by mx1.redhat.com (Postfix) with ESMTPS id 17BFC71 for ; Tue, 1 Dec 2015 02:57:20 +0000 (UTC) Date: Tue, 1 Dec 2015 10:57:08 +0800 From: Peter Xu Message-ID: <20151201025706.GE21032@pxdev.xzpeter.org> References: <1448883140-20249-1-git-send-email-peterx@redhat.com> <1448883140-20249-4-git-send-email-peterx@redhat.com> <565C486C.1050900@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: <565C486C.1050900@redhat.com> Subject: Re: [Qemu-devel] [PATCH v3 03/12] dump-guest-memory: using static DumpState, add DumpStatus List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Paolo Bonzini Cc: drjones@redhat.com, lersek@redhat.com, armbru@redhat.com, qemu-devel@nongnu.org, famz@redhat.com, lcapitulino@redhat.com On Mon, Nov 30, 2015 at 02:00:28PM +0100, Paolo Bonzini wrote: > > +/* init dump state with specific status */ > > +static void dump_state_prepare(DumpState *s, DumpStatus status) > > +{ > > + bzero(s, sizeof(*s)); > > + s->status = status; > > Either use memcpy, or > > s = (DumpState) { .status = status }; > > The latter is C99 and it's quite common in QEMU. Thanks to let me know this. :) Will use it in v4. > > > +} > > + > > +static DumpState *dump_state_get_global(void) > > No need for dump_state_get_global, just use a static variable. Then you > can use &dump_state in qmp_dump_guest_memory. Ok. > > > +{ > > + static DumpState state; > > You can also initialize it together with the definition, using > > static DumpState state = { .status = DUMP_STATUS_NONE }; > Yes. Thanks. Peter