mirror of
https://github.com/torvalds/linux.git
synced 2026-11-06 21:58:01 +01:00
sysctl: Add jiffies converter entries to the test module
lib/test_sysctl.c covers proc_dointvec(), proc_douintvec(), proc_dostring(), proc_do_large_bitmap() and proc_dou8vec_minmax(), but none of the jiffies converters. Their int paths report the sign separately from the magnitude, which is a shape the existing entries do not exercise at all. Add one entry per affected int converter: proc_dointvec_jiffies(), proc_dointvec_ms_jiffies() and proc_dointvec_userhz_jiffies(). Each is seeded with HZ jiffies, which is one second in every converter's own unit, so the three read back as 1, 1000 and 100 respectively. Signed-off-by: Zhan Xusheng <zhanxusheng@xiaomi.com> Reviewed-by: Bradley Morgan <brads@mainlining.org> Tested-by: Bradley Morgan <brads@mainlining.org> # POWER10 Signed-off-by: Joel Granados <joel.granados@kernel.org>
This commit is contained in:
parent
6d8dc12317
commit
a2c375789a
|
|
@ -15,6 +15,7 @@
|
|||
#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
|
||||
|
||||
#include <linux/init.h>
|
||||
#include <linux/jiffies.h>
|
||||
#include <linux/list.h>
|
||||
#include <linux/module.h>
|
||||
#include <linux/printk.h>
|
||||
|
|
@ -48,6 +49,10 @@ struct test_sysctl_data {
|
|||
|
||||
int boot_int;
|
||||
|
||||
int int_jiffies;
|
||||
int int_ms_jiffies;
|
||||
int int_userhz_jiffies;
|
||||
|
||||
unsigned int uint_0001;
|
||||
|
||||
char string_0001[65];
|
||||
|
|
@ -67,6 +72,11 @@ static struct test_sysctl_data test_data = {
|
|||
|
||||
.boot_int = 0,
|
||||
|
||||
/* One second in each converter's unit; all three store HZ jiffies. */
|
||||
.int_jiffies = HZ,
|
||||
.int_ms_jiffies = HZ,
|
||||
.int_userhz_jiffies = HZ,
|
||||
|
||||
.uint_0001 = 314,
|
||||
|
||||
.string_0001 = "(none)",
|
||||
|
|
@ -113,6 +123,27 @@ static const struct ctl_table test_table[] = {
|
|||
.extra1 = SYSCTL_ZERO,
|
||||
.extra2 = SYSCTL_ONE,
|
||||
},
|
||||
{
|
||||
.procname = "int_jiffies",
|
||||
.data = &test_data.int_jiffies,
|
||||
.maxlen = sizeof(int),
|
||||
.mode = 0644,
|
||||
.proc_handler = proc_dointvec_jiffies,
|
||||
},
|
||||
{
|
||||
.procname = "int_ms_jiffies",
|
||||
.data = &test_data.int_ms_jiffies,
|
||||
.maxlen = sizeof(int),
|
||||
.mode = 0644,
|
||||
.proc_handler = proc_dointvec_ms_jiffies,
|
||||
},
|
||||
{
|
||||
.procname = "int_userhz_jiffies",
|
||||
.data = &test_data.int_userhz_jiffies,
|
||||
.maxlen = sizeof(int),
|
||||
.mode = 0644,
|
||||
.proc_handler = proc_dointvec_userhz_jiffies,
|
||||
},
|
||||
{
|
||||
.procname = "uint_0001",
|
||||
.data = &test_data.uint_0001,
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user