From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:57083) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Zywwc-0003uQ-7M for qemu-devel@nongnu.org; Wed, 18 Nov 2015 02:14:19 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ZywwY-0006ka-1m for qemu-devel@nongnu.org; Wed, 18 Nov 2015 02:14:18 -0500 Received: from relay.parallels.com ([195.214.232.42]:45479) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZywwX-0006kW-Pi for qemu-devel@nongnu.org; Wed, 18 Nov 2015 02:14:13 -0500 Message-ID: <564C2535.6060106@virtuozzo.com> Date: Wed, 18 Nov 2015 10:13:57 +0300 From: Vladimir Sementsov-Ogievskiy MIME-Version: 1.0 References: <1447674737-32430-1-git-send-email-den@openvz.org> <564B4DB4.1070005@redhat.com> <564C1787.8040500@virtuozzo.com> <564C1D32.5070301@redhat.com> In-Reply-To: <564C1D32.5070301@redhat.com> Content-Type: text/plain; charset="utf-8"; format=flowed Content-Transfer-Encoding: 7bit Subject: Re: [Qemu-devel] [PATCH 1/1] parallels: add format spec List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Eric Blake , "Denis V. Lunev" Cc: John Snow , qemu-devel@nongnu.org, Stefan Hajnoczi On 18.11.2015 09:39, Eric Blake wrote: > On 11/17/2015 11:15 PM, Vladimir Sementsov-Ogievskiy wrote: > >>> You may want to compare to the qcow2 spec, which also lists expected >>> byte offsets for each field (rather than having to count how many >>> earlier fields of which widths were specified). >> I've compared qed spec with qcow2 spec and like the first one. What the >> need of specifying each offset? Creating a c-structure is simpler when >> you see types. and than offsetof and sizeof may be used if needed. >> Nobody will #define numeric offsets I think. > You'd be surprised (libvirt has some hard-coded numeric offsets: > https://libvirt.org/git/?p=libvirt.git;a=blob;f=src/util/virstoragefile.c;h=2aa1d90;hb=5ed7afa9d#l159) > > Also, listing offsets makes it obvious that you are NOT relying on > compiler padding, and makes it obvious whether you have been careful > that all 64-bit quantities are 8-byte-aligned without wasting space. > > The original cow format (not qcow or qcow2) has the awful distinction of > NOT having specified offsets, and had different layouts on 32-bit > platforms than it did on 64-bit platforms; hence, we retired it in > commit 550830f9 as unsupportable. > Thanks for explanation, I'll rework this. May be, it's definitely better to be absolutely accurate than get more comfort, when it is about specification.. -- Best regards, Vladimir * now, @virtuozzo.com instead of @parallels.com. Sorry for this inconvenience.