On Wed, Jun 19, 2013 at 07:12:57AM +1000, Dave Chinner wrote:
> On Mon, Jun 17, 2013 at 09:05:15AM -0700, Christoph Hellwig wrote:
> > On Wed, Jun 12, 2013 at 08:22:35PM +1000, Dave Chinner wrote:
> > > From: Dave Chinner <dchinner@xxxxxxxxxx>
> > >
> > > Many of the definitions within xfs_dir2_priv.h are needed in
> > > userspace outside libxfs. Definitions within xfs_dir2_priv.h are
> > > wholly contained within libxfs, so we need to shuffle some of the
> > > definitions around to keep consistency across files shared between
> > > user and kernel space.
> > I created the xfs_dir2_format.h header so that it would be self
> > contained. Despite not mentioning it in the description this patch
> > also moves typedefs out of xfs_dir2_format.h which is something I'd
> > rather avoid. Where in userspace would we need these defintions but
> > can't include xfs_dir2_format.h?
> They are needed by the declarations of the public dir2 functions
> used by userspace. i.e. they aren't just on-disk format definitions
> - they are API definitions as well.
> This was one of the problems I had with the previous libxfs/kernel
> sync - converting all the userspace code to use xfs_dir2_format.h.
> I had no idea exactly how you intended to structure the usrespace
> code, and so I was really flying blind.
> The separation of dir2.h/format.h/priv.h is fine from the kernel
> side, but I found that a significant number of functions declared in
> xfs_dir2_priv.h are actually public functions in userspace and so
> need to be in xfs_dir2.h, not xfs_dir2_priv.h. And then that
> requires the definitions from xfs_fir2_format.h for the function
> prototypes in xfs_dir2.h....
> Having just done all the other __KERNEL__ changes, I see this
> dir2 change in a different light now. I can probably rework the
> userspace includes to include xfs_dir2_format.h before xfs_dir2.h
> and hence remove the need to modify xfs_dir2_format.h...
Yes, it can. The problem was that xfs_dir2_format.h requires the
definition of struct xfs_mount (due to static inline functions),
but there are no such restrictions on xfs_dir2.h so it can be moved
to after the include for xfs_dir2_format.h.
Ok, so xfs_dir2_format.h doesn't need to change.