From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-2.3 required=3.0 tests=HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,USER_AGENT_SANE_1 autolearn=no autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 9906FC3A5A2 for ; Tue, 3 Sep 2019 11:27:14 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 73E9F22CF7 for ; Tue, 3 Sep 2019 11:27:14 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728967AbfICL1N (ORCPT ); Tue, 3 Sep 2019 07:27:13 -0400 Received: from atrey.karlin.mff.cuni.cz ([195.113.26.193]:44464 "EHLO atrey.karlin.mff.cuni.cz" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728270AbfICL1N (ORCPT ); Tue, 3 Sep 2019 07:27:13 -0400 Received: by atrey.karlin.mff.cuni.cz (Postfix, from userid 512) id BFF3C819EF; Tue, 3 Sep 2019 13:26:54 +0200 (CEST) Date: Tue, 3 Sep 2019 13:27:07 +0200 From: Pavel Machek To: dsterba@suse.cz, Pavel Machek , Joe Perches , Gao Xiang , Christoph Hellwig , Alexander Viro , Greg Kroah-Hartman , Andrew Morton , Stephen Rothwell , Theodore Ts'o , Amir Goldstein , "Darrick J . Wong" , Dave Chinner , Jaegeuk Kim , Jan Kara , Linus Torvalds , linux-fsdevel@vger.kernel.org, devel@driverdev.osuosl.org, LKML , linux-erofs@lists.ozlabs.org, Chao Yu , Miao Xie , Li Guifu , Fang Wei Subject: Re: [PATCH v6 01/24] erofs: add on-disk layout Message-ID: <20190903112707.GA3844@amd> References: <20190802125347.166018-1-gaoxiang25@huawei.com> <20190802125347.166018-2-gaoxiang25@huawei.com> <20190829095954.GB20598@infradead.org> <20190829103252.GA64893@architecture4> <67d6efbbc9ac6db23215660cb970b7ef29dc0c1d.camel@perches.com> <20190830120714.GN2752@twin.jikos.cz> <20190902084303.GC19557@amd> <20190902140712.GV2752@twin.jikos.cz> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="yrj/dFKFPuw6o+aM" Content-Disposition: inline In-Reply-To: <20190902140712.GV2752@twin.jikos.cz> User-Agent: Mutt/1.5.23 (2014-03-12) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org --yrj/dFKFPuw6o+aM Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable Hi! > > No. gdb tells you what the actual offsets _are_. >=20 > Ok, reading your reply twice, I think we have different perspectives. I > don't trust the comments. >=20 > The tool I had in mind is pahole that parses dwarf information about the > structures, the same as gdb does. The actual value of the struct members > is the thing that needs to be investigated in memory dumps or disk image > dumps. >=20 > > > > The expected offset is somewhat valuable, but > > > > perhaps the form is a bit off given the visual > > > > run-in to the field types. > > > >=20 > > > > The extra work with this form is manipulating all > > > > the offsets whenever a structure change occurs. > > >=20 > > > ... while this is error prone. > >=20 > > While the comment tells you what they _should be_. >=20 > That's exactly the source of confusion and bugs. For me an acceptable > way of asserting that a value has certain offset is a build check, eg. > like >=20 > BUILD_BUG_ON(strct my_superblock, magic, 16); Yes, that would work, too. As would documentation file with the disk structures. Best regards, Pavel --=20 DENX Software Engineering GmbH, Managing Director: Wolfgang Denk HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany --yrj/dFKFPuw6o+aM Content-Type: application/pgp-signature; name="signature.asc" Content-Description: Digital signature -----BEGIN PGP SIGNATURE----- Version: GnuPG v1 iEYEARECAAYFAl1uTgsACgkQMOfwapXb+vL2IgCgs+lvDMnGJBdzf4Ded3ls5qz4 u/sAn1m34p0fdk6NLGSW8jaPems7I5EL =38MN -----END PGP SIGNATURE----- --yrj/dFKFPuw6o+aM--