From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:41139) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZpCdl-0004O4-4C for qemu-devel@nongnu.org; Thu, 22 Oct 2015 05:58:33 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ZpCdh-0001EW-Uw for qemu-devel@nongnu.org; Thu, 22 Oct 2015 05:58:33 -0400 Received: from mail-vk0-f43.google.com ([209.85.213.43]:36021) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZpCdh-0001ES-QG for qemu-devel@nongnu.org; Thu, 22 Oct 2015 05:58:29 -0400 Received: by vkex70 with SMTP id x70so43433629vke.3 for ; Thu, 22 Oct 2015 02:58:29 -0700 (PDT) MIME-Version: 1.0 In-Reply-To: <5628167C.9020802@redhat.com> References: <5628167C.9020802@redhat.com> From: Peter Maydell Date: Thu, 22 Oct 2015 10:58:09 +0100 Message-ID: Content-Type: text/plain; charset=UTF-8 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" On 21 October 2015 at 23:49, Eric Blake wrote: > 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? You can't call this one container_of, because it's doing container_of plus extra checking. As Gerd says, most of these uses should probably go away, but ideally by conversion to the QOM cast macros rather than just dropping down to use of container_of. thanks -- PMM