From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:53227) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1b8VDe-0006s5-W0 for qemu-devel@nongnu.org; Thu, 02 Jun 2016 12:11:42 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1b8VDV-00007T-Sz for qemu-devel@nongnu.org; Thu, 02 Jun 2016 12:11:38 -0400 Received: from e17.ny.us.ibm.com ([129.33.205.207]:51912) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1b8VDV-000077-Oi for qemu-devel@nongnu.org; Thu, 02 Jun 2016 12:11:29 -0400 Received: from localhost by e17.ny.us.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Thu, 2 Jun 2016 12:11:28 -0400 References: <1464717764-9040-1-git-send-email-duanj@linux.vnet.ibm.com> <1464717764-9040-5-git-send-email-duanj@linux.vnet.ibm.com> <877fe7iqj3.fsf@oc4731375738.ibm.com> From: Jianjun Duan Message-ID: <57505AA6.6080201@linux.vnet.ibm.com> Date: Thu, 2 Jun 2016 09:11:18 -0700 MIME-Version: 1.0 In-Reply-To: <877fe7iqj3.fsf@oc4731375738.ibm.com> Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit Subject: Re: [Qemu-devel] [QEMU RFC PATCH v3 4/6] Migration: migrate QTAILQ List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Sascha Silbe , qemu-devel@nongnu.org Cc: veroniabahaa@gmail.com, peter.maydell@linaro.org, mst@redhat.com, quintela@redhat.com, mark.cave-ayland@ilande.co.uk, mdroth@linux.vnet.ibm.com, mreitz@redhat.com, blauwirbel@gmail.com, amit.shah@redhat.com, qemu-ppc@nongnu.org, kraxel@redhat.com, kwolf@redhat.com, dmitry@daynix.com, pbonzini@redhat.com, rth@twiddle.net, leon.alrae@imgtec.com, aurelien@aurel32.net, david@gibson.dropbear.id.au Hi Sascha, On 06/02/2016 08:01 AM, Sascha Silbe wrote: > Dear Jianjun, > > Jianjun Duan writes: > > [include/migration/vmstate.h] >> @@ -185,6 +185,8 @@ enum VMStateFlags { >> * to determine the number of entries in the array. Only valid in >> * combination with one of VMS_VARRAY*. */ >> VMS_MULTIPLY_ELEMENTS = 0x4000, >> + /* For fields which need customized handling, such as QTAILQ in queue.h*/ >> + VMS_CSTM = 0x8000, > > Can you describe (in the comment) how this customised handling is > performed, please? I.e. describe what exactly happens if the flag is > set, from the point of view of an API consumer. I will add more comments. When this flag is set VMStateInfo.get/put will be used in vmstate_load/save_state instead of recursive call. And the user should implement VMStateInfo.get/put to handle the concerned data structure. > Also, why do you need this flag at all? The only change I can see is > that you pass additional information to VMStateInfo.get() / .put(), > using NULL if it's not set. Why don't you just always pass the > additional information? If the additional information is not needed by > get() / put() the parameter will be unused anyway. You can do it without creating this flag. Instead just to check if info is set in the field. However I think it is more readable and more robust to check this flag in vmstate_load/get_state. > Sascha > Thanks, Jianjun