Re: [PATCH V2 4/4] xfs: Convert xfs_attr_sf macros to inline functions

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

 



On Thu, Sep 03, 2020 at 10:14:36AM +0100, Christoph Hellwig wrote:
> > +/* total space in use */
> > +static inline int xfs_attr_sf_totsize(struct xfs_inode *dp) {
> > +	struct xfs_attr_shortform *sf =
> > +		(struct xfs_attr_shortform *)dp->i_afp->if_u1.if_data;
> > +	return be16_to_cpu(sf->hdr.totsize);
> > +}
> 
> The opening curly brace should go on a line of its own.
> 

Thanks for spotting this, I'll fix on the next version
> > +/* space name/value uses */
> > +static inline int xfs_attr_sf_entsize_byname(uint8_t nlen, uint8_t vlen) {
> > +	return sizeof(struct xfs_attr_sf_entry) + nlen + vlen;
> > +}
> > +
> > +/* space an entry uses */
> > +static inline int xfs_attr_sf_entsize(struct xfs_attr_sf_entry *sfep) {
> > +	return struct_size(sfep, nameval, sfep->namelen + sfep->valuelen);
> > +}
> > +
> > +/* next entry in struct */
> > +static inline struct xfs_attr_sf_entry *
> > +xfs_attr_sf_nextentry(struct xfs_attr_sf_entry *sfep) {
> > +	return (struct xfs_attr_sf_entry *)((char *)(sfep) +
> > +					    xfs_attr_sf_entsize(sfep));
> > +}
> 
> Same for these.  Also if you cast to void * instead of char * in
> xfs_attr_sf_nextentry (and gcc extension we make heavy use of), you
> don't need the case back.

I believe you meant cast here? For sure, looks a good simplification, I'll add
it. Thanks again!


-- 
Carlos




[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