grub-devel.gnu.org archive mirror
 help / color / mirror / Atom feed
From: Jan Kara <jack@suse.cz>
To: The development of GNU GRUB <grub-devel@gnu.org>
Cc: Jan Kara <jack@suse.cz>
Subject: Re: [PATCH 4/4] xfs: V5 filesystem format support
Date: Wed, 13 May 2015 09:12:56 +0200	[thread overview]
Message-ID: <20150513071256.GA16517@quack.suse.cz> (raw)
In-Reply-To: <20150513075038.1b20f613@opensuse.site>

On Wed 13-05-15 07:50:38, Andrei Borzenkov wrote:
> В Tue, 12 May 2015 15:47:40 +0200
> Jan Kara <jack@suse.cz> пишет:
> > > +
> > > > +static grub_uint64_t *
> > > > +grub_xfs_btree_keys(struct grub_xfs_data *data,
> > > > +		    struct grub_xfs_btree_node *leaf)
> > > > +{
> > > > +  char *p = (char *)(leaf + 1);
> > > > +
> > > > +  if (data->hascrc)
> > > > +    p += 48;	/* crc, uuid, ... */
> > > > +  /*
> > > > +   * We have to first type to void * to avoid complaints about possible
> > > > +   * alignment issues on some architectures
> > > > +   */
> > > > +  return (grub_uint64_t *)(void *)p;
> > > 
> > > Leaving it as grub_uint64_t keys and using &keys[6] would avoid this
> > > warning as well, not? Also having keys[0] will likely simplify other
> > > places as well (we do require GCC in any case).
> > 
> > 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 += 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 actually
> > use but if you really insisted, I could do that. So what do you think?
> 
> Why 2 structures? What I actually meant was
> 
> 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;
> 
> if (data->hascrc)
>   return &leaf->keys[6]
> else
>   return &leaf->keys[0]
> 
> 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' and
add a comment explaining what's going on.

								Honza
-- 
Jan Kara <jack@suse.cz>
SUSE Labs, CR


  reply	other threads:[~2015-05-13  7:13 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-07-14 15:21 [PATCH 0/4] Support for XFS v5 superblock Jan Kara
2014-07-14 15:21 ` [PATCH 1/4] xfs: Add helper for inode size Jan Kara
2015-05-11 11:53   ` Andrei Borzenkov
2015-05-11 12:15     ` Jan Kara
2015-05-12  5:26       ` Andrei Borzenkov
2015-05-12  8:07         ` Jan Kara
2014-07-14 15:21 ` [PATCH 2/4] xfs: Fix termination loop for directory iteration Jan Kara
2015-05-11 11:49   ` Andrei Borzenkov
2014-07-14 15:21 ` [PATCH 3/4] xfs: Convert inode numbers to cpu endianity immediately after reading Jan Kara
2015-05-12  5:22   ` Andrei Borzenkov
2014-07-14 15:21 ` [PATCH 4/4] xfs: V5 filesystem format support Jan Kara
2015-05-12  5:23   ` Andrei Borzenkov
2015-05-12 13:47     ` Jan Kara
2015-05-13  4:50       ` Andrei Borzenkov
2015-05-13  7:12         ` Jan Kara [this message]
2014-07-21 17:31 ` [PATCH 0/4] Support for XFS v5 superblock Jan Kara
2014-07-21 21:42   ` Vladimir 'φ-coder/phcoder' Serbinenko
2014-09-23  7:39 ` Jan Kara

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20150513071256.GA16517@quack.suse.cz \
    --to=jack@suse.cz \
    --cc=grub-devel@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).