2016-08-02 12:57:56

by Baole Ni

[permalink] [raw]
Subject: [PATCH 1046/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 <[email protected]>
Signed-off-by: Baole Ni <[email protected]>
---
fs/lockd/svc.c | 12 ++++++------
1 file changed, 6 insertions(+), 6 deletions(-)

diff --git a/fs/lockd/svc.c b/fs/lockd/svc.c
index 154a107..8f1f2d5 100644
--- a/fs/lockd/svc.c
+++ b/fs/lockd/svc.c
@@ -644,15 +644,15 @@ MODULE_DESCRIPTION("NFS file locking service version " LOCKD_VERSION ".");
MODULE_LICENSE("GPL");

module_param_call(nlm_grace_period, param_set_grace_period, param_get_ulong,
- &nlm_grace_period, 0644);
+ &nlm_grace_period, S_IRUSR | S_IWUSR | S_IRGRP | S_IROTH);
module_param_call(nlm_timeout, param_set_timeout, param_get_ulong,
- &nlm_timeout, 0644);
+ &nlm_timeout, S_IRUSR | S_IWUSR | S_IRGRP | S_IROTH);
module_param_call(nlm_udpport, param_set_port, param_get_int,
- &nlm_udpport, 0644);
+ &nlm_udpport, S_IRUSR | S_IWUSR | S_IRGRP | S_IROTH);
module_param_call(nlm_tcpport, param_set_port, param_get_int,
- &nlm_tcpport, 0644);
-module_param(nsm_use_hostnames, bool, 0644);
-module_param(nlm_max_connections, uint, 0644);
+ &nlm_tcpport, S_IRUSR | S_IWUSR | S_IRGRP | S_IROTH);
+module_param(nsm_use_hostnames, bool, S_IRUSR | S_IWUSR | S_IRGRP | S_IROTH);
+module_param(nlm_max_connections, uint, S_IRUSR | S_IWUSR | S_IRGRP | S_IROTH);

static int lockd_init_net(struct net *net)
{
--
2.9.2