Re: [PATCH v13.2.1 26/31] xfs: add parent pointer ioctls

Darrick J. Wong
2024-04-18T16:49:55Z

On Wed, Apr 17, 2024 at 09:21:15PM -0700, Christoph Hellwig wrote:
> On Wed, Apr 17, 2024 at 03:25:03PM -0700, Darrick J. Wong wrote:
> > > + /* parent pointer ioctls */
> > > + XFS_CHECK_STRUCT_SIZE(struct xfs_getparents_rec, 32);
> >
> > It turns out that the i386 (or probably just 32-bit) build robots trip
> > over this statement, probably because of the implied padding after the
> > gpr_name[] flexarray. I'll change this to:
> >
> > XFS_CHECK_OFFSET(struct xfs_getparents_rec, gpr_name, 26);
> >
> > and let's see what they say. armhf checks out locally.
>
> Please make the padding explicit and keep the
> XFS_CHECK_STRUCT_SIZE, otherwise the ioctl won't work for 32-bit
> i386 binaries on an x86_64 kernel.

Ok, now I have:

struct xfs_getparents_rec {
struct xfs_handle gpr_parent; /* Handle to parent */
__u32 gpr_reclen; /* Length of entire record */
__u32 gpr_reserved; /* zero */
char gpr_name[]; /* Null-terminated filename */
};

This is now a 32-byte structure, with gpr_name starting at byte 32.

--D