[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20241123181244.183918-1-alexjlzheng@tencent.com>
Date: Sun, 24 Nov 2024 02:12:44 +0800
From: Jinliang Zheng <alexjlzheng@...il.com>
To: alexjlzheng@...il.com
Cc: adobriyan@...il.com,
alexjlzheng@...cent.com,
brauner@...nel.org,
flyingpeng@...cent.com,
jack@...e.cz,
joel.granados@...nel.org,
kees@...nel.org,
linux-fsdevel@...r.kernel.org,
linux-kernel@...r.kernel.org,
mcgrof@...nel.org,
viro@...iv.linux.org.uk
Subject: [PATCH 3/6] sysctl: refactor __do_proc_doulongvec_minmax()
Extract the local variables min and max as parameters in
__do_proc_doulongvec_minmax() to facilitate code reuse in subsequent
patches. There are no functional changes.
Signed-off-by: Jinliang Zheng <alexjlzheng@...cent.com>
---
kernel/sysctl.c | 11 ++++++-----
1 file changed, 6 insertions(+), 5 deletions(-)
diff --git a/kernel/sysctl.c b/kernel/sysctl.c
index 79e6cb1d5c48..05b48b204ed4 100644
--- a/kernel/sysctl.c
+++ b/kernel/sysctl.c
@@ -1020,9 +1020,10 @@ static int sysrq_sysctl_handler(const struct ctl_table *table, int write,
static int __do_proc_doulongvec_minmax(void *data,
const struct ctl_table *table, int write,
void *buffer, size_t *lenp, loff_t *ppos,
- unsigned long convmul, unsigned long convdiv)
+ unsigned long convmul, unsigned long convdiv,
+ unsigned long *min, unsigned long *max)
{
- unsigned long *i, *min, *max;
+ unsigned long *i;
int vleft, first = 1, err = 0;
size_t left;
char *p;
@@ -1033,8 +1034,6 @@ static int __do_proc_doulongvec_minmax(void *data,
}
i = data;
- min = table->extra1;
- max = table->extra2;
vleft = table->maxlen / sizeof(unsigned long);
left = *lenp;
@@ -1095,8 +1094,10 @@ static int do_proc_doulongvec_minmax(const struct ctl_table *table, int write,
void *buffer, size_t *lenp, loff_t *ppos, unsigned long convmul,
unsigned long convdiv)
{
+ unsigned long *min = table->extra1;
+ unsigned long *max = table->extra2;
return __do_proc_doulongvec_minmax(table->data, table, write,
- buffer, lenp, ppos, convmul, convdiv);
+ buffer, lenp, ppos, convmul, convdiv, min, max);
}
/**
--
2.41.1
Powered by blists - more mailing lists