2024-03-09 10:33:46

by Wen Yang

[permalink] [raw]
Subject: [PATCH v2 7/9] epoll: delete these unnecessary static variables long_zero and long_max

From: Wen Yang <[email protected]>

Delete unnecessary static variables (long_zero and long_max)
and encode them directly in the table entry.

Signed-off-by: Wen Yang <[email protected]>
Cc: Eric W. Biederman <[email protected]>
Cc: Luis Chamberlain <[email protected]>
Cc: Kees Cook <[email protected]>
Cc: Joel Granados <[email protected]>
Cc: Christian Brauner <[email protected]>
Cc: Jan Kara <[email protected]>
Cc: "Darrick J. Wong" <[email protected]>
Cc: [email protected]
---
fs/eventpoll.c | 19 +++++++------------
1 file changed, 7 insertions(+), 12 deletions(-)

diff --git a/fs/eventpoll.c b/fs/eventpoll.c
index 3534d36a1474..7cfc4fb0ca3c 100644
--- a/fs/eventpoll.c
+++ b/fs/eventpoll.c
@@ -309,19 +309,14 @@ static void unlist_file(struct epitems_head *head)

#include <linux/sysctl.h>

-static long long_zero;
-static long long_max = LONG_MAX;
-
static struct ctl_table epoll_table[] = {
- {
- .procname = "max_user_watches",
- .data = &max_user_watches,
- .maxlen = sizeof(max_user_watches),
- .mode = 0644,
- .proc_handler = proc_doulongvec_minmax,
- .extra1 = &long_zero,
- .extra2 = &long_max,
- },
+ CTL_TABLE_ENTRY_MINMAX("max_user_watches",
+ &max_user_watches,
+ sizeof(max_user_watches),
+ 0644,
+ proc_doulongvec_minmax,
+ SYSCTL_NUMERIC_ZERO,
+ SYSCTL_NUMERIC_LONG_MAX),
};

static void __init epoll_sysctls_init(void)
--
2.25.1