Received: from eggs.gnu.org ([2001:4830:134:3::10]:52122) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bzNL3-0003AR-Aq for qemu-devel@nongnu.org; Wed, 26 Oct 2016 08:29:50 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1bzNL0-0006Md-7K for qemu-devel@nongnu.org; Wed, 26 Oct 2016 08:29:49 -0400 Received: from mx0b-001b2d01.pphosted.com ([148.163.158.5]:40593 helo=mx0a-001b2d01.pphosted.com) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1bzNL0-0006MX-0W for qemu-devel@nongnu.org; Wed, 26 Oct 2016 08:29:46 -0400 Received: from pps.filterd (m0098419.ppops.net [127.0.0.1]) by mx0b-001b2d01.pphosted.com (8.16.0.17/8.16.0.17) with SMTP id u9QCTDUg016722 for ; Wed, 26 Oct 2016 08:29:44 -0400 Received: from e06smtp14.uk.ibm.com (e06smtp14.uk.ibm.com [195.75.94.110]) by mx0b-001b2d01.pphosted.com with ESMTP id 26ar2nxgge-1 (version=TLSv1.2 cipher=AES256-SHA bits=256 verify=NOT) for ; Wed, 26 Oct 2016 08:29:44 -0400 Received: from localhost by e06smtp14.uk.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Wed, 26 Oct 2016 13:29:42 +0100 References: <1477090378-31597-1-git-send-email-duanj@linux.vnet.ibm.com> <1477090378-31597-3-git-send-email-duanj@linux.vnet.ibm.com> From: Halil Pasic Date: Wed, 26 Oct 2016 14:29:37 +0200 MIME-Version: 1.0 In-Reply-To: <1477090378-31597-3-git-send-email-duanj@linux.vnet.ibm.com> Content-Type: text/plain; charset=windows-1252 Content-Transfer-Encoding: 8bit Message-Id: Subject: Re: [Qemu-devel] [QEMU PATCH v7 2/3] migration: migrate QTAILQ List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Jianjun Duan , qemu-devel@nongnu.org Cc: veroniabahaa@gmail.com, peter.maydell@linaro.org, dgilbert@redhat.com, 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 On 10/22/2016 12:52 AM, Jianjun Duan wrote: > +#define RAW_FIELD(base, offset) \ > + ((char *) (base) + offset) > + Seems you partially adopted Paolo's suggestion for improving the macros. Is there a particular reason why you did not follow it more closely? I find the solution with field_at_offset(base, offset, type) more readable than with RAW_FIELD(base, offset). > +/* > + * Offsets of layout of a tail queue head. > + */ > +#define QTAILQ_FIRST_OFFSET 0 > +#define QTAILQ_LAST_OFFSET (sizeof(void *)) > +/* > + * Raw access of elements of a tail queue > + */ > +#define QTAILQ_RAW_FIRST(head) \ > + (*((void **) (RAW_FIELD(head, QTAILQ_FIRST_OFFSET)))) > +#define QTAILQ_RAW_LAST(head) \ > + (*((void ***) (RAW_FIELD(head, QTAILQ_LAST_OFFSET)))) > + > +/* > + * Offsets of layout of a tail queue element. > + */ > +#define QTAILQ_NEXT_OFFSET 0 > +#define QTAILQ_PREV_OFFSET (sizeof(void *)) > + > +/* > + * Raw access of elements of a tail entry > + */ > +#define QTAILQ_RAW_NEXT(elm, entry) \ > + (*((void **) (RAW_FIELD(elm, entry + QTAILQ_NEXT_OFFSET)))) > +#define QTAILQ_RAW_PREV(elm, entry) \ > + (*((void ***) (RAW_FIELD(elm, entry + QTAILQ_PREV_OFFSET)))) > +/* > + * Tail queue tranversal using pointer arithmetic. > + */