All of lore.kernel.org
 help / color / mirror / Atom feed
From: Andrei Borzenkov <arvidjaar@gmail.com>
To: Jan Kara <jack@suse.cz>
Cc: The development of GNU GRUB <grub-devel@gnu.org>
Subject: Re: [PATCH 4/4] xfs: V5 filesystem format support
Date: Wed, 13 May 2015 07:50:38 +0300	[thread overview]
Message-ID: <20150513075038.1b20f613@opensuse.site> (raw)
In-Reply-To: <20150512134740.GA20095@quack.suse.cz>

В Tue, 12 May 2015 15:47:40 +0200
Jan Kara <jack@suse.cz> пишет:

> > > +{
> > > +	return ((grub_uint8_t *)(de + 1)) + de->len - 1 +
> > The outer parens are somehow confusing.
> 
>   I can remove them but I find it better to explicitely show where the
> typecast happens with parenthesis...
> 

OK

> > +
> > > +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.


  reply	other threads:[~2015-05-13  4:50 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 [this message]
2015-05-13  7:12         ` Jan Kara
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=20150513075038.1b20f613@opensuse.site \
    --to=arvidjaar@gmail.com \
    --cc=grub-devel@gnu.org \
    --cc=jack@suse.cz \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.