[PATCH] xfsprogs: fix unaligned access in libxfs

Christoph Hellwig hch at infradead.org
Fri Aug 28 17:15:30 CDT 2009


On Fri, Aug 28, 2009 at 04:39:49PM -0500, Alex Elder wrote:
> > +static inline __uint32_t __get_unaligned_be32(const __uint8_t *p)
> 
> 
> It would be nice for this interface (and others) to take a (void *)
> argument, but that would also mean immediately casting it to do
> pointer arithmetic portably.  Not a big deal.

the __ routines are internal implementation details, the kernel
has non-__ prefixed versions that take void pointers, but I didn't
bother to add them to xfsprogs as we only do unaligned access to
64bit values.

That beeing said I dislike the interface taking void pointers as
it removes important error checking.  The actually visible interface
should take __be16/32/64 types to enforce they are used on the right
type.  Once I get some time I will push for that in the kernel again,
but for xfsprogs I really do want to stick to the kernel interfaces so
that we can share the code unmodified.




More information about the xfs mailing list