[PATCH 0083/1285] Replace numeric parameter like 0444 with macro
From: Baole Ni
Date: Tue Aug 02 2016 - 14:32:45 EST
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@xxxxxxxxx>
Signed-off-by: Baole Ni <baolex.ni@xxxxxxxxx>
---
drivers/block/drbd/drbd_main.c | 16 ++++++++--------
1 file changed, 8 insertions(+), 8 deletions(-)
diff --git a/drivers/block/drbd/drbd_main.c b/drivers/block/drbd/drbd_main.c
index 2ba1494..467e9da 100644
--- a/drivers/block/drbd/drbd_main.c
+++ b/drivers/block/drbd/drbd_main.c
@@ -80,10 +80,10 @@ MODULE_ALIAS_BLOCKDEV_MAJOR(DRBD_MAJOR);
MODULE_PARM_DESC(allow_oos, "DONT USE!");
/* thanks to these macros, if compiled into the kernel (not-module),
* this becomes the boot parameter drbd.minor_count */
-module_param(minor_count, uint, 0444);
-module_param(disable_sendpage, bool, 0644);
+module_param(minor_count, uint, S_IRUSR | S_IRGRP | S_IROTH);
+module_param(disable_sendpage, bool, S_IRUSR | S_IWUSR | S_IRGRP | S_IROTH);
module_param(allow_oos, bool, 0);
-module_param(proc_details, int, 0644);
+module_param(proc_details, int, S_IRUSR | S_IWUSR | S_IRGRP | S_IROTH);
#ifdef CONFIG_DRBD_FAULT_INJECTION
int enable_faults;
@@ -91,13 +91,13 @@ int fault_rate;
static int fault_count;
int fault_devs;
/* bitmap of enabled faults */
-module_param(enable_faults, int, 0664);
+module_param(enable_faults, int, S_IRUSR | S_IWUSR | S_IRGRP | S_IWGRP | S_IROTH);
/* fault rate % value - applies to all enabled faults */
-module_param(fault_rate, int, 0664);
+module_param(fault_rate, int, S_IRUSR | S_IWUSR | S_IRGRP | S_IWGRP | S_IROTH);
/* count of faults inserted */
-module_param(fault_count, int, 0664);
+module_param(fault_count, int, S_IRUSR | S_IWUSR | S_IRGRP | S_IWGRP | S_IROTH);
/* bitmap of devices to insert faults on */
-module_param(fault_devs, int, 0644);
+module_param(fault_devs, int, S_IRUSR | S_IWUSR | S_IRGRP | S_IROTH);
#endif
/* module parameter, defined */
@@ -110,7 +110,7 @@ int proc_details; /* Detail level in proc drbd*/
* to run. Default is /sbin/drbdadm */
char usermode_helper[80] = "/sbin/drbdadm";
-module_param_string(usermode_helper, usermode_helper, sizeof(usermode_helper), 0644);
+module_param_string(usermode_helper, usermode_helper, sizeof(usermode_helper), S_IRUSR | S_IWUSR | S_IRGRP | S_IROTH);
/* in 2.6.x, our device mapping and config info contains our virtual gendisks
* as member "struct gendisk *vdisk;"
--
2.9.2