From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S966952AbcHBNx6 (ORCPT ); Tue, 2 Aug 2016 09:53:58 -0400 Received: from mga11.intel.com ([192.55.52.93]:47649 "EHLO mga11.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S965236AbcHBM50 (ORCPT ); Tue, 2 Aug 2016 08:57:26 -0400 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.28,460,1464678000"; d="scan'208";a="1033605911" From: Baole Ni To: swhiteho@redhat.com, rpeterso@redhat.com, david.vrabel@citrix.com, tomi.valkeinen@ti.com, m.chehab@samsung.com, gregkh@linuxfoundation.org, m.szyprowski@samsung.com, kyungmin.park@samsung.com, k.kozlowski@samsung.com Cc: cluster-devel@redhat.com, linux-kernel@vger.kernel.org, chuansheng.liu@intel.com, baolex.ni@intel.com, mhalcrow@google.com, kirill.shutemov@linux.intel.com, oneukum@suse.com Subject: [PATCH 1043/1285] Replace numeric parameter like 0444 with macro Date: Tue, 2 Aug 2016 20:11:13 +0800 Message-Id: <20160802121113.19645-1-baolex.ni@intel.com> X-Mailer: git-send-email 2.9.2 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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. Signed-off-by: Chuansheng Liu Signed-off-by: Baole Ni --- fs/gfs2/sys.c | 38 +++++++++++++++++++------------------- 1 file changed, 19 insertions(+), 19 deletions(-) diff --git a/fs/gfs2/sys.c b/fs/gfs2/sys.c index c9ff1cf..cb5338e 100644 --- a/fs/gfs2/sys.c +++ b/fs/gfs2/sys.c @@ -285,16 +285,16 @@ static ssize_t demote_rq_store(struct gfs2_sbd *sdp, const char *buf, size_t len #define GFS2_ATTR(name, mode, show, store) \ static struct gfs2_attr gfs2_attr_##name = __ATTR(name, mode, show, store) -GFS2_ATTR(id, 0444, id_show, NULL); -GFS2_ATTR(fsname, 0444, fsname_show, NULL); -GFS2_ATTR(uuid, 0444, uuid_show, NULL); -GFS2_ATTR(freeze, 0644, freeze_show, freeze_store); -GFS2_ATTR(withdraw, 0644, withdraw_show, withdraw_store); -GFS2_ATTR(statfs_sync, 0200, NULL, statfs_sync_store); -GFS2_ATTR(quota_sync, 0200, NULL, quota_sync_store); -GFS2_ATTR(quota_refresh_user, 0200, NULL, quota_refresh_user_store); -GFS2_ATTR(quota_refresh_group, 0200, NULL, quota_refresh_group_store); -GFS2_ATTR(demote_rq, 0200, NULL, demote_rq_store); +GFS2_ATTR(id, S_IRUSR | S_IRGRP | S_IROTH, id_show, NULL); +GFS2_ATTR(fsname, S_IRUSR | S_IRGRP | S_IROTH, fsname_show, NULL); +GFS2_ATTR(uuid, S_IRUSR | S_IRGRP | S_IROTH, uuid_show, NULL); +GFS2_ATTR(freeze, S_IRUSR | S_IWUSR | S_IRGRP | S_IROTH, freeze_show, freeze_store); +GFS2_ATTR(withdraw, S_IRUSR | S_IWUSR | S_IRGRP | S_IROTH, withdraw_show, withdraw_store); +GFS2_ATTR(statfs_sync, S_IWUSR, NULL, statfs_sync_store); +GFS2_ATTR(quota_sync, S_IWUSR, NULL, quota_sync_store); +GFS2_ATTR(quota_refresh_user, S_IWUSR, NULL, quota_refresh_user_store); +GFS2_ATTR(quota_refresh_group, S_IWUSR, NULL, quota_refresh_group_store); +GFS2_ATTR(demote_rq, S_IWUSR, NULL, demote_rq_store); static struct attribute *gfs2_attrs[] = { &gfs2_attr_id.attr, @@ -522,15 +522,15 @@ out: #define GDLM_ATTR(_name,_mode,_show,_store) \ static struct gfs2_attr gdlm_attr_##_name = __ATTR(_name,_mode,_show,_store) -GDLM_ATTR(proto_name, 0444, proto_name_show, NULL); -GDLM_ATTR(block, 0644, block_show, block_store); -GDLM_ATTR(withdraw, 0644, wdack_show, wdack_store); -GDLM_ATTR(jid, 0644, jid_show, jid_store); -GDLM_ATTR(first, 0644, lkfirst_show, lkfirst_store); -GDLM_ATTR(first_done, 0444, first_done_show, NULL); -GDLM_ATTR(recover, 0600, NULL, recover_store); -GDLM_ATTR(recover_done, 0444, recover_done_show, NULL); -GDLM_ATTR(recover_status, 0444, recover_status_show, NULL); +GDLM_ATTR(proto_name, S_IRUSR | S_IRGRP | S_IROTH, proto_name_show, NULL); +GDLM_ATTR(block, S_IRUSR | S_IWUSR | S_IRGRP | S_IROTH, block_show, block_store); +GDLM_ATTR(withdraw, S_IRUSR | S_IWUSR | S_IRGRP | S_IROTH, wdack_show, wdack_store); +GDLM_ATTR(jid, S_IRUSR | S_IWUSR | S_IRGRP | S_IROTH, jid_show, jid_store); +GDLM_ATTR(first, S_IRUSR | S_IWUSR | S_IRGRP | S_IROTH, lkfirst_show, lkfirst_store); +GDLM_ATTR(first_done, S_IRUSR | S_IRGRP | S_IROTH, first_done_show, NULL); +GDLM_ATTR(recover, S_IRUSR | S_IWUSR, NULL, recover_store); +GDLM_ATTR(recover_done, S_IRUSR | S_IRGRP | S_IROTH, recover_done_show, NULL); +GDLM_ATTR(recover_status, S_IRUSR | S_IRGRP | S_IROTH, recover_status_show, NULL); static struct attribute *lock_module_attrs[] = { &gdlm_attr_proto_name.attr, -- 2.9.2