xfs
[Top] [All Lists]

Re: [PATCH 18/27] xfs: avoid usage of struct xfs_dir2_data

To: Alex Elder <aelder@xxxxxxx>
Subject: Re: [PATCH 18/27] xfs: avoid usage of struct xfs_dir2_data
From: Christoph Hellwig <hch@xxxxxxxxxxxxx>
Date: Wed, 6 Jul 2011 04:45:49 -0400
Cc: Christoph Hellwig <hch@xxxxxxxxxxxxx>, xfs@xxxxxxxxxxx
In-reply-to: <1309923502.3381.35.camel@doink>
References: <20110701094321.936534538@xxxxxxxxxxxxxxxxxxxxxx> <20110701094606.003170984@xxxxxxxxxxxxxxxxxxxxxx> <1309923502.3381.35.camel@doink>
User-agent: Mutt/1.5.21 (2010-09-15)
On Tue, Jul 05, 2011 at 10:38:22PM -0500, Alex Elder wrote:
> On Fri, 2011-07-01 at 05:43 -0400, Christoph Hellwig wrote:
> > In most places we can simply pass around and use the struct 
> > xfs_dir2_data_hdr,
> > which is the first and most important member of struct xfs_dir2_data instead
> > of the full structure.
> > 
> > Signed-off-by: Christoph Hellwig <hch@xxxxxx>
> 
> In xfs_dir2_data_freescan() you get the address of the
> dir2_data_t by forcibly casting the address of the
> header to that type.  We all know that's fine, but
> it's an unsavory practice.  Why don't you pass the
> full dir2_data_t in that case where it's needed?
> Are you simply trying to avoid passing *any* pointers
> to variable-sized types?

I'm restricting the dir2_data_t scope to where we needed it,
to kill it (and thus the cast) off entirely in the next patch.

> (Update: I think you eliminate that line in the next
> patch anyway...)

Exactly!

<Prev in Thread] Current Thread [Next in Thread>