From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S966279AbcHBN2j (ORCPT ); Tue, 2 Aug 2016 09:28:39 -0400 Received: from smtprelay0177.hostedemail.com ([216.40.44.177]:43623 "EHLO smtprelay.hostedemail.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S966665AbcHBN1M (ORCPT ); Tue, 2 Aug 2016 09:27:12 -0400 X-Session-Marker: 726F737465647440676F6F646D69732E6F7267 X-Spam-Summary: 2,0,0,,d41d8cd98f00b204,rostedt@goodmis.org,:::::::::::::::::::::::::::::::::::,RULES_HIT:41:355:379:541:599:800:960:966:973:988:989:1260:1277:1311:1313:1314:1345:1359:1437:1515:1516:1518:1534:1542:1593:1594:1711:1730:1747:1777:1792:2196:2199:2393:2553:2559:2562:2901:3138:3139:3140:3141:3142:3354:3622:3865:3866:3867:3868:3871:3874:4385:5007:6261:6742:7875:7903:9040:10004:10400:10848:10967:11026:11232:11473:11658:11914:12043:12438:12517:12519:12555:12683:12740:13439:14095:14096:14181:14659:14721:21080:21324:30012:30054:30064:30090:30091,0,RBL:none,CacheIP:none,Bayesian:0.5,0.5,0.5,Netcheck:none,DomainCache:0,MSF:not bulk,SPF:fn,MSBL:0,DNSBL:none,Custom_rules:0:0:0,LFtime:2,LUA_SUMMARY:none X-HE-Tag: shelf10_3da920844e518 X-Filterd-Recvd-Size: 3527 Date: Tue, 2 Aug 2016 09:27:02 -0400 From: Steven Rostedt To: Baole Ni Cc: sjenning@redhat.com, jiangshanlai@gmail.com, mathieu.desnoyers@efficios.com, m.chehab@samsung.com, gregkh@linuxfoundation.org, m.szyprowski@samsung.com, kyungmin.park@samsung.com, k.kozlowski@samsung.com, linux-mm@kvack.org, linux-kernel@vger.kernel.org, chuansheng.liu@intel.com, oleg@redhat.com, gang.chen.5i5j@gmail.com, mhocko@suse.com, koct9i@gmail.com, aarcange@redhat.com, aryabinin@virtuozzo.com Subject: Re: [PATCH 1082/1285] Replace numeric parameter like 0444 with macro Message-ID: <20160802092702.147e4e57@gandalf.local.home> In-Reply-To: <20160802121448.22258-1-baolex.ni@intel.com> References: <20160802121448.22258-1-baolex.ni@intel.com> X-Mailer: Claws Mail 3.13.2 (GTK+ 2.24.30; x86_64-pc-linux-gnu) MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, 2 Aug 2016 20:14:48 +0800 Baole Ni wrote: > I find that the developers often just specified the numeric value > when calling a macro which is defined with a parameter for access permission. > As we know, these numeric value for access permission have had the corresponding macro, > and that using macro can improve the robustness and readability of the code, > thus, I suggest replacing the numeric parameter with the macro. > NACK! I find 0444 more readable than S_IRUSR | S_IRGRP | S_IROTH. -- Steve > Signed-off-by: Chuansheng Liu > Signed-off-by: Baole Ni > --- > mm/zswap.c | 8 ++++---- > 1 file changed, 4 insertions(+), 4 deletions(-) > > diff --git a/mm/zswap.c b/mm/zswap.c > index 275b22c..aede3ee 100644 > --- a/mm/zswap.c > +++ b/mm/zswap.c > @@ -78,7 +78,7 @@ static u64 zswap_duplicate_entry; > > /* Enable/disable zswap (disabled by default) */ > static bool zswap_enabled; > -module_param_named(enabled, zswap_enabled, bool, 0644); > +module_param_named(enabled, zswap_enabled, bool, S_IRUSR | S_IWUSR | S_IRGRP | S_IROTH); > > /* Crypto compressor to use */ > #define ZSWAP_COMPRESSOR_DEFAULT "lzo" > @@ -91,7 +91,7 @@ static struct kernel_param_ops zswap_compressor_param_ops = { > .free = param_free_charp, > }; > module_param_cb(compressor, &zswap_compressor_param_ops, > - &zswap_compressor, 0644); > + &zswap_compressor, S_IRUSR | S_IWUSR | S_IRGRP | S_IROTH); > > /* Compressed storage zpool to use */ > #define ZSWAP_ZPOOL_DEFAULT "zbud" > @@ -102,11 +102,11 @@ static struct kernel_param_ops zswap_zpool_param_ops = { > .get = param_get_charp, > .free = param_free_charp, > }; > -module_param_cb(zpool, &zswap_zpool_param_ops, &zswap_zpool_type, 0644); > +module_param_cb(zpool, &zswap_zpool_param_ops, &zswap_zpool_type, S_IRUSR | S_IWUSR | S_IRGRP | S_IROTH); > > /* The maximum percentage of memory that the compressed pool can occupy */ > static unsigned int zswap_max_pool_percent = 20; > -module_param_named(max_pool_percent, zswap_max_pool_percent, uint, 0644); > +module_param_named(max_pool_percent, zswap_max_pool_percent, uint, S_IRUSR | S_IWUSR | S_IRGRP | S_IROTH); > > /********************************* > * data structures