From: wenyang.linux@foxmail.com
To: "Eric W . Biederman" <ebiederm@xmission.com>,
Luis Chamberlain <mcgrof@kernel.org>,
Kees Cook <keescook@chromium.org>,
Joel Granados <j.granados@samsung.com>,
Christian Brauner <brauner@kernel.org>
Cc: Dave Young <dyoung@redhat.com>,
Wen Yang <wenyang.linux@foxmail.com>,
linux-kernel@vger.kernel.org
Subject: [RESEND PATCH v2 6/9] sysctl: delete these unnecessary static variables i_zero and i_one_hundred
Date: Tue, 19 Mar 2024 23:57:47 +0800 [thread overview]
Message-ID: <tencent_BB02D44B41929365E965CCEB7EE3CF795508@qq.com> (raw)
In-Reply-To: <26c450f6467b4cbaf94cdb10f047abc6ab0c2a5d.1710863674.git.wenyang.linux@foxmail.com>
From: Wen Yang <wenyang.linux@foxmail.com>
Delete unnecessary static variables (i_zero and i_one_hundred)
and encode them directly in the table entry.
Signed-off-by: Wen Yang <wenyang.linux@foxmail.com>
Cc: Eric W. Biederman <ebiederm@xmission.com>
Cc: Luis Chamberlain <mcgrof@kernel.org>
Cc: Kees Cook <keescook@chromium.org>
Cc: Joel Granados <j.granados@samsung.com>
Cc: Christian Brauner <brauner@kernel.org>
Cc: linux-kernel@vger.kernel.org
---
lib/test_sysctl.c | 12 ++++++------
1 file changed, 6 insertions(+), 6 deletions(-)
diff --git a/lib/test_sysctl.c b/lib/test_sysctl.c
index 9321d850931f..cf298f25d686 100644
--- a/lib/test_sysctl.c
+++ b/lib/test_sysctl.c
@@ -26,8 +26,6 @@
#include <linux/delay.h>
#include <linux/vmalloc.h>
-static int i_zero;
-static int i_one_hundred = 100;
static int match_int_ok = 1;
@@ -78,8 +76,9 @@ static struct ctl_table test_table[] = {
.maxlen = sizeof(int),
.mode = 0644,
.proc_handler = proc_dointvec_minmax,
- .extra1 = &i_zero,
- .extra2 = &i_one_hundred,
+ .min = SYSCTL_NUMERIC_ZERO,
+ .max = SYSCTL_NUMERIC_ONE_HUNDRED,
+ .extra_flags = SYSCTL_TABLE_EXTRA_LONG_INIT_MINMAX,
},
{
.procname = "int_0002",
@@ -108,8 +107,9 @@ static struct ctl_table test_table[] = {
.maxlen = sizeof(test_data.boot_int),
.mode = 0644,
.proc_handler = proc_dointvec,
- .extra1 = SYSCTL_ZERO,
- .extra2 = SYSCTL_ONE,
+ .min = SYSCTL_NUMERIC_ZERO,
+ .max = SYSCTL_NUMERIC_ONE,
+ .extra_flags = SYSCTL_TABLE_EXTRA_LONG_INIT_MINMAX,
},
{
.procname = "uint_0001",
--
2.25.1
next prev parent reply other threads:[~2024-03-19 15:58 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <26c450f6467b4cbaf94cdb10f047abc6ab0c2a5d.1710863674.git.wenyang.linux@foxmail.com>
2024-03-19 15:57 ` [RESEND PATCH v2 2/9] kernel/sysctl-test: add some kunit test cases for min/max detection wenyang.linux
2024-03-19 15:57 ` [RESEND PATCH v2 3/9] rxrpc: delete these unnecessary static variables n_65535, four, max_500, etc wenyang.linux
2024-03-19 15:57 ` [RESEND PATCH v2 4/9] net: ipv6: delete these unnecessary static variables two_five_five and minus_one wenyang.linux
2024-03-19 15:57 ` [RESEND PATCH v2 5/9] svcrdma: delete these unnecessary static variables min_ord, max_ord, etc wenyang.linux
2024-03-19 15:57 ` wenyang.linux [this message]
2024-03-19 15:57 ` [RESEND PATCH v2 7/9] epoll: delete these unnecessary static variables long_zero and long_max wenyang.linux
2024-03-19 15:57 ` [RESEND PATCH v2 8/9] fs: inotify: delete these unnecessary static variables it_zero and it_int_max wenyang.linux
2024-03-20 10:36 ` Jan Kara
2024-03-21 10:55 ` Joel Granados
2024-03-21 11:38 ` Jan Kara
2024-03-21 14:41 ` Wen Yang
2024-03-21 16:32 ` Joel Granados
2024-03-21 16:37 ` Joel Granados
2024-03-19 15:57 ` [RESEND PATCH v2 9/9] ucounts: delete these unnecessary static variables ue_zero and ue_int_max wenyang.linux
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=tencent_BB02D44B41929365E965CCEB7EE3CF795508@qq.com \
--to=wenyang.linux@foxmail.com \
--cc=brauner@kernel.org \
--cc=dyoung@redhat.com \
--cc=ebiederm@xmission.com \
--cc=j.granados@samsung.com \
--cc=keescook@chromium.org \
--cc=linux-kernel@vger.kernel.org \
--cc=mcgrof@kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®