public inbox for linux-xfs@vger.kernel.org
 help / color / mirror / Atom feed
From: Carlos Maiolino <cmaiolino@redhat.com>
To: Christoph Hellwig <hch@infradead.org>
Cc: linux-xfs@vger.kernel.org
Subject: Re: [PATCH V2 4/4] xfs: Convert xfs_attr_sf macros to inline functions
Date: Thu, 3 Sep 2020 12:38:21 +0200	[thread overview]
Message-ID: <20200903103821.wt75v7p2mzuauzca@eorzea> (raw)
In-Reply-To: <20200903091436.GD10584@infradead.org>

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


  reply	other threads:[~2020-09-03 10:38 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-09-02 14:40 [PATCH 0/4 V2] Clean up xfs_attr_sf_entry Carlos Maiolino
2020-09-02 14:40 ` [PATCH V2 1/4] xfs: remove typedef xfs_attr_sf_entry_t Carlos Maiolino
2020-09-02 17:35   ` Darrick J. Wong
2020-09-03  8:52   ` Christoph Hellwig
2020-09-02 14:40 ` [PATCH V2 2/4] xfs: Remove typedef xfs_attr_shortform_t Carlos Maiolino
2020-09-02 17:36   ` Darrick J. Wong
2020-09-03  8:28     ` Carlos Maiolino
2020-09-03  8:53   ` Christoph Hellwig
2020-09-02 14:40 ` [PATCH V2 3/4] xfs: Use variable-size array for nameval in xfs_attr_sf_entry Carlos Maiolino
2020-09-02 17:52   ` Darrick J. Wong
2020-09-03  9:11   ` Christoph Hellwig
2020-09-02 14:40 ` [PATCH V2 4/4] xfs: Convert xfs_attr_sf macros to inline functions Carlos Maiolino
2020-09-02 17:54   ` Darrick J. Wong
2020-09-03 10:36     ` Carlos Maiolino
2020-09-03  9:14   ` Christoph Hellwig
2020-09-03 10:38     ` Carlos Maiolino [this message]
2020-09-03 10:39       ` Christoph Hellwig

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20200903103821.wt75v7p2mzuauzca@eorzea \
    --to=cmaiolino@redhat.com \
    --cc=hch@infradead.org \
    --cc=linux-xfs@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox