Received: by 2002:a25:8b12:0:0:0:0:0 with SMTP id i18csp140820ybl; Thu, 29 Aug 2019 20:18:26 -0700 (PDT) X-Google-Smtp-Source: APXvYqwFmYwrYav3EUnNvALxBZgYLm9wunaWd5glJfhggfkIoFLOdAWNycHpjdch2N+JgB/ez15v X-Received: by 2002:a17:90a:eb18:: with SMTP id j24mr13051397pjz.82.1567135106348; Thu, 29 Aug 2019 20:18:26 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1567135106; cv=none; d=google.com; s=arc-20160816; b=kJd9VhazYLWgfDWr9EDVB2UUXkhHiNV/j8nY/8flgl1v2BpEnEy73bSPha0/l7Ltt1 QlhYZi4RWid8ceKMfDl3XvS4bQTaL6/elTeYhhdWb+v3W/uTdgABk2jhRvCJ/K/sOie1 ZL3ADiBu9bPuFg5nnhjeO6KL6ySrs6FzPACXELjwiDg01Ng4JFegn3rmvY0WyKtQodVk LsX+W4gIIMwsIYV6+ABm/DmY73vIIZQ3Brw0+vSpP9hv30/hko2ikzSGXo4iXfeZMFfT Il48Icuk8zmXe4lh75GOYw1l5lOUcDrqOq21MtpduGZMJ9PEkBmM3TTbyy9FmxNL4jJB H70Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:date:cc:to:from:subject :message-id; bh=xa2ENQmS9tbPFUjKv8SCqg9qmIzoTORD3SBtuBo59P4=; b=pnEPiA9UlsydwHCOeiTsnzqFLLtLkA6PUJDVZThAaJdLOEMclbll2eT7xOpN5EPYS4 OE2YKoKwv6zOHy0EsT7QReRdHvqHLV+yCJJ/zq548+YfQOAp5eR21fdwyTYN2+vh6lyu iLjBYO4vjo4RXTUKbuLP3zy2Gd8uD2CYFodEw6+ABo69SvmLlyDGx1RiFnmCms0YtDwu Z78519zEEhaVOObxXsSsYUBdWjApk8ESjoXn9nEBCDl1GWn7sjjww6gS7BeoI3hyYbwY V8DhEewyIRyIQF/KGvVwnyykK2DkcW9lnDtu0rIC3BZyYSrKdDbTo8y3mQdKOMXnpVBV lTnw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id h31si3429766pgb.67.2019.08.29.20.18.01; Thu, 29 Aug 2019 20:18:26 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727417AbfH3DQc (ORCPT + 99 others); Thu, 29 Aug 2019 23:16:32 -0400 Received: from smtprelay0182.hostedemail.com ([216.40.44.182]:60515 "EHLO smtprelay.hostedemail.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1727213AbfH3DQc (ORCPT ); Thu, 29 Aug 2019 23:16:32 -0400 Received: from filter.hostedemail.com (clb03-v110.bra.tucows.net [216.40.38.60]) by smtprelay04.hostedemail.com (Postfix) with ESMTP id 2BF0B1800EC3F; Fri, 30 Aug 2019 03:16:31 +0000 (UTC) X-Session-Marker: 6A6F6540706572636865732E636F6D X-Spam-Summary: 2,0,0,,d41d8cd98f00b204,joe@perches.com,:::::::::::::::::::::::,RULES_HIT:41:355:379:599:988:989:1260:1277:1311:1313:1314:1345:1359:1437:1515:1516:1518:1534:1541:1593:1594:1711:1730:1747:1777:1792:2393:2559:2562:2828:3138:3139:3140:3141:3142:3352:3622:3876:3877:4321:4605:5007:6114:6642:10004:10400:10848:11026:11232:11658:11914:12043:12048:12297:12438:12740:12760:12895:13069:13311:13357:13439:14659:14721:21080:21451:21627:30029:30054:30091,0,RBL:23.242.196.136:@perches.com:.lbl8.mailshell.net-62.14.0.180 64.201.201.201,CacheIP:none,Bayesian:0.5,0.5,0.5,Netcheck:none,DomainCache:0,MSF:not bulk,SPF:fn,MSBL:0,DNSBL:neutral,Custom_rules:0:0:0,LFtime:28,LUA_SUMMARY:none X-HE-Tag: music74_8ff1e63ca7e44 X-Filterd-Recvd-Size: 2212 Received: from XPS-9350.home (cpe-23-242-196-136.socal.res.rr.com [23.242.196.136]) (Authenticated sender: joe@perches.com) by omf09.hostedemail.com (Postfix) with ESMTPA; Fri, 30 Aug 2019 03:16:29 +0000 (UTC) Message-ID: <5b2ecf5cec1a6aa3834e9af41886a7fcb18ae86a.camel@perches.com> Subject: Re: [PATCH v2 2/7] erofs: some marcos are much more readable as a function From: Joe Perches To: Gao Xiang , Chao Yu , Dan Carpenter , Christoph Hellwig , Greg Kroah-Hartman , devel@driverdev.osuosl.org Cc: LKML , linux-erofs@lists.ozlabs.org, Chao Yu , Miao Xie , weidu.du@huawei.com, Fang Wei Date: Thu, 29 Aug 2019 20:16:27 -0700 In-Reply-To: <20190830030040.10599-2-gaoxiang25@huawei.com> References: <20190830030040.10599-1-gaoxiang25@huawei.com> <20190830030040.10599-2-gaoxiang25@huawei.com> Content-Type: text/plain; charset="ISO-8859-1" User-Agent: Evolution 3.32.1-2 MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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); }