Received: from list by lists.gnu.org with archive (Exim 4.71) id 1YsQqq-0004g8-IS for mharc-grub-devel@gnu.org; Wed, 13 May 2015 03:13:08 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:43196) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YsQqn-0004cW-On for grub-devel@gnu.org; Wed, 13 May 2015 03:13:06 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1YsQqj-0008Oq-M5 for grub-devel@gnu.org; Wed, 13 May 2015 03:13:05 -0400 Received: from cantor2.suse.de ([195.135.220.15]:55539 helo=mx2.suse.de) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YsQqj-0008Oc-EY for grub-devel@gnu.org; Wed, 13 May 2015 03:13:01 -0400 X-Virus-Scanned: by amavisd-new at test-mx.suse.de Received: from relay1.suse.de (charybdis-ext.suse.de [195.135.220.254]) by mx2.suse.de (Postfix) with ESMTP id 7333FAAF2 for ; Wed, 13 May 2015 07:13:00 +0000 (UTC) Received: by quack.suse.cz (Postfix, from userid 1000) id C54C08281E; Wed, 13 May 2015 09:12:56 +0200 (CEST) Date: Wed, 13 May 2015 09:12:56 +0200 From: Jan Kara To: The development of GNU GRUB Subject: Re: [PATCH 4/4] xfs: V5 filesystem format support Message-ID: <20150513071256.GA16517@quack.suse.cz> References: <1405351291-24767-1-git-send-email-jack@suse.cz> <1405351291-24767-5-git-send-email-jack@suse.cz> <20150512082340.78aa6ee5@opensuse.site> <20150512134740.GA20095@quack.suse.cz> <20150513075038.1b20f613@opensuse.site> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: <20150513075038.1b20f613@opensuse.site> User-Agent: Mutt/1.5.21 (2010-09-15) Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x (no timestamps) [generic] X-Received-From: 195.135.220.15 Cc: Jan Kara X-BeenThere: grub-devel@gnu.org X-Mailman-Version: 2.1.14 Precedence: list Reply-To: The development of GNU GRUB List-Id: The development of GNU GRUB List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 13 May 2015 07:13:06 -0000 On Wed 13-05-15 07:50:38, Andrei Borzenkov wrote: > =D0=92 Tue, 12 May 2015 15:47:40 +0200 > Jan Kara =D0=BF=D0=B8=D1=88=D0=B5=D1=82: > > > + > > > > +static grub_uint64_t * > > > > +grub_xfs_btree_keys(struct grub_xfs_data *data, > > > > + struct grub_xfs_btree_node *leaf) > > > > +{ > > > > + char *p =3D (char *)(leaf + 1); > > > > + > > > > + if (data->hascrc) > > > > + p +=3D 48; /* crc, uuid, ... */ > > > > + /* > > > > + * We have to first type to void * to avoid complaints about p= ossible > > > > + * alignment issues on some architectures > > > > + */ > > > > + return (grub_uint64_t *)(void *)p; > > >=20 > > > Leaving it as grub_uint64_t keys and using &keys[6] would avoid thi= s > > > warning as well, not? Also having keys[0] will likely simplify othe= r > > > places as well (we do require GCC in any case). > >=20 > > Well, the trouble with this is that we'd need two structures defined = - > > one for crc-enabled fs and one for old fs. That seemed like a wasted = effort > > to me when we could do: > > if (data->hascrc) > > p +=3D 48; /* crc, uuid, ... */ > > like the above. The same holds for inodes, directory entries, etc. I'= d > > prefer not to bloat the code with structure definitions we don't actu= ally > > use but if you really insisted, I could do that. So what do you think= ? >=20 > Why 2 structures? What I actually meant was >=20 > struct grub_xfs_btree_node > { > grub_uint8_t magic[4]; > grub_uint16_t level; > grub_uint16_t numrecs; > grub_uint64_t left; > grub_uint64_t right; > grub_uint64_t keys[0]; > } GRUB_PACKED; >=20 > if (data->hascrc) > return &leaf->keys[6] > else > return &leaf->keys[0] >=20 > with suitable comment. It is not perfect either but at least leaves > compiler check in place. Ah, I see. I probably won't call it 'keys' but something like 'data' an= d add a comment explaining what's going on. Honza --=20 Jan Kara SUSE Labs, CR