lkml.org 
[lkml]   [2016]   [Aug]   [2]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
From
Subject[PATCH 0089/1285] Replace numeric parameter like 0444 with macro
Date
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@intel.com>
Signed-off-by: Baole Ni <baolex.ni@intel.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
\
 
 \ /
  Last update: 2016-08-02 21:21    [W:0.026 / U:0.708 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site