lkml.org 
[lkml]   [2019]   [Aug]   [29]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH v2 2/7] erofs: some marcos are much more readable as a function
Hi Joe,

On Thu, Aug 29, 2019 at 08:16:27PM -0700, Joe Perches wrote:
> On Fri, 2019-08-30 at 11:00 +0800, Gao Xiang wrote:
> > As Christoph suggested [1], these marcos are much
> > more readable as a function
>
> s/marcos/macros/
> .
> []
> > diff --git a/fs/erofs/erofs_fs.h b/fs/erofs/erofs_fs.h
> []
> > @@ -168,16 +168,24 @@ struct erofs_xattr_entry {
> > char e_name[0]; /* attribute name */
> > } __packed;
> >
> > -#define ondisk_xattr_ibody_size(count) ({\
> > - u32 __count = le16_to_cpu(count); \
> > - ((__count) == 0) ? 0 : \
> > - sizeof(struct erofs_xattr_ibody_header) + \
> > - sizeof(__u32) * ((__count) - 1); })
> > +static inline unsigned int erofs_xattr_ibody_size(__le16 d_icount)
> > +{
> > + unsigned int icount = le16_to_cpu(d_icount);
> > +
> > + if (!icount)
> > + return 0;
> > +
> > + return sizeof(struct erofs_xattr_ibody_header) +
> > + sizeof(__u32) * (icount - 1);
>
> Maybe use struct_size()?
>
> {
> struct erofs_xattr_ibody_header *ibh;
> unsigned int icount = le16_to_cpu(d_icount);
>
> if (!icount)
> return 0;
>
> return struct_size(ibh, h_shared_xattrs, icount - 1);
> }

Okay, That is fine, will resend this patch.

Thanks,
Gao Xiang

>

\
 
 \ /
  Last update: 2019-08-30 05:21    [W:0.101 / U:1.676 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site