All of lore.kernel.org
 help / color / mirror / Atom feed
From: David Howells <dhowells@redhat.com>
To: Christoph Hellwig <hch@infradead.org>
Cc: dhowells@redhat.com, viro@ZenIV.linux.org.uk,
	linux-fsdevel@vger.kernel.org
Subject: Re: [PATCH] Update the exportfs documentation and comments and fix some exportfs issues
Date: Wed, 03 Dec 2008 13:14:03 +0000	[thread overview]
Message-ID: <29974.1228310043@redhat.com> (raw)
In-Reply-To: <20081203124850.GA4075@infradead.org>

Christoph Hellwig <hch@infradead.org> wrote:

> Once you change the prototype please also pass the struct fid * instead
> of the current __u32 array, like the fh_to_dentry / fh_to_parent
> methods.

I can do that, but why not pass a u32* or void* instead in all cases?  The
operations are under no obligation to use struct fid.

> >  (*) The exportfs_encode_fh() function has it's acceptable() function pointer
> >      typedef'd.
> 
> I don't really see the point for that, but I don't care too much.

It's passed around between a number of functions and it makes the function
declarations more readable.

> These two should probably be broken out into a smaller patch, before all
> the cosmetic bits.

Okay.

> > +A filehandle fragment consists of an array of 1 or more 32-bit words.  The
> > +contents and the layout of the data in the array are entirely at the whim of
> > +the filesystem that generated it.
> 
> Not really true anymore, as we have a real struct for it now.

Which isn't used by all exportable filesystems...  Should those filesystems
have specific entries added to the union in struct fid?  Should they be
required to use the raw member of struct fid's union?

In fact, why struct fid at all: why not union fid?

It also seems odd to declare a struct that only has passing acquaintance with
reality.  struct fid is rarely used to its full extent, and may not even be
big enough - something that's decided on a per-use basis.

Furthermore, when the decode routines are called, less data may be presented
than is required to fill out a struct fid, so overlaying a struct fid on it
may include uninitialised data.

As I see it, struct fid doesn't gain anything - except perhaps documentary
purposes for people looking to build packet sniffers.  Even then it's not
really necessary, and nor is it complete.

The i32 branch of struct fid could be hidden inside fs/expfs.c, and the udf
branch inside fs/udf/.  The layouts could then be documented inside the
Documentation directory.

> But all the length calculation is still done in number of 4 byte words.
> Messy..

Yes.  The docs and comments either didn't specify the units, or stipulated
that they were in bytes:-(

This is one reason why I think passing a u32* might be better than struct fid
- that way the length is more obviously the size of the array in u32 units.

> Why the strange indentation?  Two tabs indent for spillover prototypes
> is pretty much standard..

So is aligning the spillover horizontally with the start of the scope (if
that's the right term).  It makes more sense too because relative indentation
gives a visual clue to relative significance.

> > +#define FAT_FILEID	((enum fid_type) 3)
> 
> That cast is completely pointless in C.

True, I suppose.

David

  reply	other threads:[~2008-12-03 13:14 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-12-02 21:02 [PATCH] Update the exportfs documentation and comments and fix some exportfs issues David Howells
2008-12-03  8:27 ` Phillip Lougher
2008-12-03 10:54   ` David Howells
2008-12-04  4:50     ` Phillip Lougher
2008-12-03 12:50   ` Christoph Hellwig
2008-12-03 12:48 ` Christoph Hellwig
2008-12-03 13:14   ` David Howells [this message]
2008-12-03 13:47     ` Jörn Engel
2008-12-03 17:21       ` David Howells

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=29974.1228310043@redhat.com \
    --to=dhowells@redhat.com \
    --cc=hch@infradead.org \
    --cc=linux-fsdevel@vger.kernel.org \
    --cc=viro@ZenIV.linux.org.uk \
    /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.