From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:42037) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZpAGp-0003if-MP for qemu-devel@nongnu.org; Thu, 22 Oct 2015 03:26:44 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ZpAGm-0008Rf-Et for qemu-devel@nongnu.org; Thu, 22 Oct 2015 03:26:43 -0400 Received: from mx1.redhat.com ([209.132.183.28]:33971) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZpAGm-0008RU-9b for qemu-devel@nongnu.org; Thu, 22 Oct 2015 03:26:40 -0400 Received: from int-mx14.intmail.prod.int.phx2.redhat.com (int-mx14.intmail.prod.int.phx2.redhat.com [10.5.11.27]) by mx1.redhat.com (Postfix) with ESMTPS id E6EE246 for ; Thu, 22 Oct 2015 07:26:39 +0000 (UTC) Message-ID: <1445498796.13733.74.camel@redhat.com> From: Gerd Hoffmann Date: Thu, 22 Oct 2015 09:26:36 +0200 In-Reply-To: <5628167C.9020802@redhat.com> References: <5628167C.9020802@redhat.com> Content-Type: text/plain; charset="UTF-8" Mime-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: Re: [Qemu-devel] DO_UPCAST confusion List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Eric Blake Cc: "qemu-devel@nongnu.org" Hi, > > state = DO_UPCAST(InternalSnapshotState, common, common); > > I much prefer the name container_of() (which is a bit more obvious that > it is finding the container or derived type that embeds the parent > type), but if we have to keep the ugly name, could we at least clean up > the comment to make sense, and fix the name to be DO_DOWNCAST to match > what it is actually doing? We don't have to keep it. DO_UPCAST is there for historical reasons, was added with qdev. It used to be used alot more, and the move from qdev to QOM already killed alot of it. But so far nobody went out cleaning up the remaining places. Feel free to go ahead and zap it. But if you touch all the places anyway please I'd much prefer a conversion to container_of() right away instead of renaming it to something else. cheers, Gerd