Re: [PATCH v7 01/19] xfs: Replace attribute parameters with struct xfs_name

Dave Chinner
2020-02-25T00:49:54Z

On Sun, Feb 23, 2020 at 09:03:05AM -0700, Allison Collins wrote:
> On 2/23/20 2:34 AM, Amir Goldstein wrote:
> > On Sun, Feb 23, 2020 at 4:07 AM Allison Collins
> > A struct inititializer macro would have been nice, so code like this:
> >
> > + struct xfs_name xname;
> > +
> > + xfs_name_init(&xname, name);
> >
> > Would become:
> > + struct xfs_name xname = XFS_NAME_STR_INIT(name);
> >
> > As a matter of fact, in most of the cases a named local variable is
> > not needed at
> > all and the code could be written with an anonymous local struct variable macro:
> >
> > + error = xfs_attr_remove(XFS_I(inode), XFS_NAME_STR(name), flags);
> >
> The macro does look nice. I would be the third iteration of initializers
> that this patch has been through though. Can I get a consensus of how many
> people like the macro?

Not me. All it means is that every time I look at this code I have
to go look at what that shouty macro does, then have to understand
it's being "smart and clever" to save a couple of lines of clear,
obviously correct code.

That's not an improvement.

Cheers,

Dave.
--
Dave Chinner
david@fromorbit.com