[<prev] [next>] [day] [month] [year] [list]
Message-Id: <20160802121113.19645-1-baolex.ni@intel.com>
Date: Tue, 2 Aug 2016 20:11:13 +0800
From: Baole Ni <baolex.ni@...el.com>
To: swhiteho@...hat.com, rpeterso@...hat.com, david.vrabel@...rix.com,
tomi.valkeinen@...com, m.chehab@...sung.com,
gregkh@...uxfoundation.org, m.szyprowski@...sung.com,
kyungmin.park@...sung.com, k.kozlowski@...sung.com
Cc: cluster-devel@...hat.com, linux-kernel@...r.kernel.org,
chuansheng.liu@...el.com, baolex.ni@...el.com, mhalcrow@...gle.com,
kirill.shutemov@...ux.intel.com, oneukum@...e.com
Subject: [PATCH 1043/1285] Replace numeric parameter like 0444 with macro
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 <chuansheng.liu@...el.com>
Signed-off-by: Baole Ni <baolex.ni@...el.com>
---
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
Powered by blists - more mailing lists