[Devel] [PATCH] sched: Make functions parameters differ from global variable name

Kirill Tkhai ktkhai at virtuozzo.com
Thu Jul 6 18:56:27 MSK 2017


We already have avenrun global varibale, and the function
parameters and local variable with the same names confuse
reader. Rename them in sane way.

Signed-off-by: Kirill Tkhai <ktkhai at virtuozzo.com>
---
 kernel/sched/core.c |    8 ++++----
 kernel/ve/ve.c      |    6 +++---
 kernel/ve/vecalls.c |    4 ++--
 3 files changed, 9 insertions(+), 9 deletions(-)

diff --git a/kernel/sched/core.c b/kernel/sched/core.c
index fcc10227b45..7c1c3f2fda6 100644
--- a/kernel/sched/core.c
+++ b/kernel/sched/core.c
@@ -10044,16 +10044,16 @@ int cpu_cgroup_get_stat(struct cgroup *cgrp, struct kernel_cpustat *kstat)
 	return 0;
 }
 
-int cpu_cgroup_get_avenrun(struct cgroup *cgrp, unsigned long *avenrun)
+int cpu_cgroup_get_avenrun(struct cgroup *cgrp, unsigned long *avnrun)
 {
 	struct task_group *tg = cgroup_tg(cgrp);
 
 	if (tg == &root_task_group)
 		return -ENOSYS;
 
-	avenrun[0] = tg->avenrun[0];
-	avenrun[1] = tg->avenrun[1];
-	avenrun[2] = tg->avenrun[2];
+	avnrun[0] = tg->avenrun[0];
+	avnrun[1] = tg->avenrun[1];
+	avnrun[2] = tg->avenrun[2];
 
 	return 0;
 }
diff --git a/kernel/ve/ve.c b/kernel/ve/ve.c
index 0533d79e062..df2c3d9d0f7 100644
--- a/kernel/ve/ve.c
+++ b/kernel/ve/ve.c
@@ -1550,15 +1550,15 @@ int ve_show_loadavg(struct ve_struct *ve, struct seq_file *p)
 	return err;
 }
 
-int cpu_cgroup_get_avenrun(struct cgroup *cgrp, unsigned long *avenrun);
+int cpu_cgroup_get_avenrun(struct cgroup *cgrp, unsigned long *avnrun);
 
-int ve_get_cpu_avenrun(struct ve_struct *ve, unsigned long *avenrun)
+int ve_get_cpu_avenrun(struct ve_struct *ve, unsigned long *avnrun)
 {
 	struct cgroup_subsys_state *css;
 	int err;
 
 	css = ve_get_init_css(ve, cpu_cgroup_subsys_id);
-	err = cpu_cgroup_get_avenrun(css->cgroup, avenrun);
+	err = cpu_cgroup_get_avenrun(css->cgroup, avnrun);
 	css_put(css);
 	return err;
 }
diff --git a/kernel/ve/vecalls.c b/kernel/ve/vecalls.c
index 5ce3e293531..346541e21ea 100644
--- a/kernel/ve/vecalls.c
+++ b/kernel/ve/vecalls.c
@@ -50,7 +50,7 @@ static int fill_cpu_stat(envid_t veid, struct vz_cpu_stat __user *buf)
 	int retval;
 	int i;
 	unsigned long tmp;
-	unsigned long avenrun[3];
+	unsigned long avnrun[3];
 	struct kernel_cpustat kstat;
 
 	if (!ve_is_super(get_exec_env()) && (veid != get_exec_env()->veid))
@@ -68,7 +68,7 @@ static int fill_cpu_stat(envid_t veid, struct vz_cpu_stat __user *buf)
 	if (retval)
 		goto out_free;
 
-	retval = ve_get_cpu_avenrun(ve, avenrun);
+	retval = ve_get_cpu_avenrun(ve, avnrun);
 	if (retval)
 		goto out_free;
 



More information about the Devel mailing list