[<prev] [next>] [day] [month] [year] [list]
Message-Id: <20160802103944.19689-1-baolex.ni@intel.com>
Date: Tue, 2 Aug 2016 18:39:44 +0800
From: Baole Ni <baolex.ni@...el.com>
To: jikos@...nel.org, lars.ellenberg@...bit.com, pavel@....cz,
gregkh@...uxfoundation.org, hpa@...or.com, x86@...nel.org
Cc: linux-kernel@...r.kernel.org, chuansheng.liu@...el.com,
baolex.ni@...el.com
Subject: [PATCH 0089/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>
---
drivers/block/pktcdvd.c | 18 +++++++++---------
1 file changed, 9 insertions(+), 9 deletions(-)
diff --git a/drivers/block/pktcdvd.c b/drivers/block/pktcdvd.c
index d06c62e..8049a89 100644
--- a/drivers/block/pktcdvd.c
+++ b/drivers/block/pktcdvd.c
@@ -175,12 +175,12 @@ static void pkt_kobj_release(struct kobject *kobj)
write_queue/congestion_on
**********************************************************/
-DEF_ATTR(kobj_pkt_attr_st1, "reset", 0200);
-DEF_ATTR(kobj_pkt_attr_st2, "packets_started", 0444);
-DEF_ATTR(kobj_pkt_attr_st3, "packets_finished", 0444);
-DEF_ATTR(kobj_pkt_attr_st4, "kb_written", 0444);
-DEF_ATTR(kobj_pkt_attr_st5, "kb_read", 0444);
-DEF_ATTR(kobj_pkt_attr_st6, "kb_read_gather", 0444);
+DEF_ATTR(kobj_pkt_attr_st1, "reset", S_IWUSR);
+DEF_ATTR(kobj_pkt_attr_st2, "packets_started", S_IRUSR | S_IRGRP | S_IROTH);
+DEF_ATTR(kobj_pkt_attr_st3, "packets_finished", S_IRUSR | S_IRGRP | S_IROTH);
+DEF_ATTR(kobj_pkt_attr_st4, "kb_written", S_IRUSR | S_IRGRP | S_IROTH);
+DEF_ATTR(kobj_pkt_attr_st5, "kb_read", S_IRUSR | S_IRGRP | S_IROTH);
+DEF_ATTR(kobj_pkt_attr_st6, "kb_read_gather", S_IRUSR | S_IRGRP | S_IROTH);
static struct attribute *kobj_pkt_attrs_stat[] = {
&kobj_pkt_attr_st1,
@@ -192,9 +192,9 @@ static struct attribute *kobj_pkt_attrs_stat[] = {
NULL
};
-DEF_ATTR(kobj_pkt_attr_wq1, "size", 0444);
-DEF_ATTR(kobj_pkt_attr_wq2, "congestion_off", 0644);
-DEF_ATTR(kobj_pkt_attr_wq3, "congestion_on", 0644);
+DEF_ATTR(kobj_pkt_attr_wq1, "size", S_IRUSR | S_IRGRP | S_IROTH);
+DEF_ATTR(kobj_pkt_attr_wq2, "congestion_off", S_IRUSR | S_IWUSR | S_IRGRP | S_IROTH);
+DEF_ATTR(kobj_pkt_attr_wq3, "congestion_on", S_IRUSR | S_IWUSR | S_IRGRP | S_IROTH);
static struct attribute *kobj_pkt_attrs_wqueue[] = {
&kobj_pkt_attr_wq1,
--
2.9.2
Powered by blists - more mailing lists