Re: [PATCH 7/8] xfs: remove struct xfs_attr_shortform

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Sun, Dec 17, 2023 at 06:03:49PM +0100, Christoph Hellwig wrote:
> sparse complains about struct xfs_attr_shortform because it embedds a

embeds

> structure with a variable sized array in a variable sized array.
> 
> Given that xfs_attr_shortform is not a very useful struture, and the dir2
> equivalent has been removed a long time ago, remove it as well and
> instead provide a xfs_attr_sf_firstentry helper that returns the first
> xfs_attr_sf_entry behind a xfs_attr_sf_hdr.
> 
> Signed-off-by: Christoph Hellwig <hch@xxxxxx>

....

> diff --git a/fs/xfs/libxfs/xfs_da_format.h b/fs/xfs/libxfs/xfs_da_format.h
> index f9015f88eca706..650fedce40449e 100644
> --- a/fs/xfs/libxfs/xfs_da_format.h
> +++ b/fs/xfs/libxfs/xfs_da_format.h
> @@ -580,18 +580,17 @@ xfs_dir2_block_leaf_p(struct xfs_dir2_block_tail *btp)
>  /*
>   * Entries are packed toward the top as tight as possible.
>   */
> -struct xfs_attr_shortform {
> -	struct xfs_attr_sf_hdr {	/* constant-structure header block */
> -		__be16	totsize;	/* total bytes in shortform list */
> -		__u8	count;	/* count of active entries */
> -		__u8	padding;
> -	} hdr;
> -	struct xfs_attr_sf_entry {
> -		uint8_t namelen;	/* actual length of name (no NULL) */
> -		uint8_t valuelen;	/* actual length of value (no NULL) */
> -		uint8_t flags;	/* flags bits (see xfs_attr_leaf.h) */
> -		uint8_t nameval[];	/* name & value bytes concatenated */
> -	} list[];			/* variable sized array */
> +struct xfs_attr_sf_hdr {	/* constant-structure header block */
> +	__be16	totsize;	/* total bytes in shortform list */
> +	__u8	count;	/* count of active entries */
> +	__u8	padding;
> +};
> +
> +struct xfs_attr_sf_entry {
> +	__u8	namelen;	/* actual length of name (no NULL) */
> +	__u8	valuelen;	/* actual length of value (no NULL) */
> +	__u8	flags;		/* flags bits (see xfs_attr_leaf.h) */

May as well correct the comment while you are touching this
structure; xfs_attr_leaf.h has not existed for a long time. Perhaps
just "/* XFS_ATTR_* flags */" as they are defined a little further
down this same file...

-Dave.
-- 
Dave Chinner
david@xxxxxxxxxxxxx




[Index of Archives]     [XFS Filesystem Development (older mail)]     [Linux Filesystem Development]     [Linux Audio Users]     [Yosemite Trails]     [Linux Kernel]     [Linux RAID]     [Linux SCSI]


  Powered by Linux