]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
sysctl: Move proc_doulongvec_ms_jiffies_minmax to kernel/time/jiffies.c
authorJoel Granados <joel.granados@kernel.org>
Tue, 14 Oct 2025 11:35:42 +0000 (13:35 +0200)
committerJoel Granados <joel.granados@kernel.org>
Thu, 27 Nov 2025 14:45:37 +0000 (15:45 +0100)
Move proc_doulongvec_ms_jiffies_minmax to kernel/time/jiffies.c. Create
a non static wrapper function proc_doulongvec_minmax_conv that
forwards the custom convmul and convdiv argument values to the internal
do_proc_doulongvec_minmax. Remove unused linux/times.h include from
kernel/sysctl.c.

Signed-off-by: Joel Granados <joel.granados@kernel.org>
include/linux/jiffies.h
include/linux/sysctl.h
kernel/sysctl.c
kernel/time/jiffies.c

index 72d589a8a0d6c03e4e19022c7f7767e3badee191..fdef2c155c27202ae8ba910f170a62521294dc36 100644 (file)
@@ -620,5 +620,7 @@ int proc_dointvec_userhz_jiffies(const struct ctl_table *table, int dir,
                                 void *buffer, size_t *lenp, loff_t *ppos);
 int proc_dointvec_ms_jiffies(const struct ctl_table *table, int dir, void *buffer,
                             size_t *lenp, loff_t *ppos);
+int proc_doulongvec_ms_jiffies_minmax(const struct ctl_table *table, int dir,
+                                     void *buffer, size_t *lenp, loff_t *ppos);
 
 #endif
index db4020f6933bc5d0a29d6aecaf46ef3c48c579d1..30f6a184d3f46ffe8ca74fd0e2d73887dc7bce75 100644 (file)
@@ -193,8 +193,9 @@ int proc_douintvec_minmax(const struct ctl_table *table, int write, void *buffer
 int proc_dou8vec_minmax(const struct ctl_table *table, int write, void *buffer,
                        size_t *lenp, loff_t *ppos);
 int proc_doulongvec_minmax(const struct ctl_table *, int, void *, size_t *, loff_t *);
-int proc_doulongvec_ms_jiffies_minmax(const struct ctl_table *table, int, void *,
-               size_t *, loff_t *);
+int proc_doulongvec_minmax_conv(const struct ctl_table *table, int dir,
+                               void *buffer, size_t *lenp, loff_t *ppos,
+                               unsigned long convmul, unsigned long convdiv);
 int proc_do_large_bitmap(const struct ctl_table *, int, void *, size_t *, loff_t *);
 int proc_do_static_key(const struct ctl_table *table, int write, void *buffer,
                size_t *lenp, loff_t *ppos);
index bcbf69c10426a18cb549760d7d763acd2f2258d9..998400323ae96469783c086d1f1f552eddb58df1 100644 (file)
@@ -13,7 +13,6 @@
 #include <linux/highuid.h>
 #include <linux/writeback.h>
 #include <linux/initrd.h>
-#include <linux/times.h>
 #include <linux/limits.h>
 #include <linux/syscalls.h>
 #include <linux/capability.h>
@@ -825,6 +824,14 @@ out:
        return err;
 }
 
+int proc_doulongvec_minmax_conv(const struct ctl_table *table, int dir,
+                               void *buffer, size_t *lenp, loff_t *ppos,
+                               unsigned long convmul, unsigned long convdiv)
+{
+       return do_proc_doulongvec_minmax(table, dir, buffer, lenp, ppos,
+                                        convmul, convdiv);
+}
+
 /**
  * proc_doulongvec_minmax - read a vector of long integers with min/max values
  * @table: the sysctl table
@@ -844,31 +851,7 @@ out:
 int proc_doulongvec_minmax(const struct ctl_table *table, int dir,
                           void *buffer, size_t *lenp, loff_t *ppos)
 {
-       return do_proc_doulongvec_minmax(table, dir, buffer, lenp, ppos, 1l, 1l);
-}
-
-/**
- * proc_doulongvec_ms_jiffies_minmax - read a vector of millisecond values with min/max values
- * @table: the sysctl table
- * @dir: %TRUE if this is a write to the sysctl file
- * @buffer: the user buffer
- * @lenp: the size of the user buffer
- * @ppos: file position
- *
- * Reads/writes up to table->maxlen/sizeof(unsigned long) unsigned long
- * values from/to the user buffer, treated as an ASCII string. The values
- * are treated as milliseconds, and converted to jiffies when they are stored.
- *
- * This routine will ensure the values are within the range specified by
- * table->extra1 (min) and table->extra2 (max).
- *
- * Returns 0 on success.
- */
-int proc_doulongvec_ms_jiffies_minmax(const struct ctl_table *table, int dir,
-                                     void *buffer, size_t *lenp, loff_t *ppos)
-{
-       return do_proc_doulongvec_minmax(table, dir, buffer,
-                                        lenp, ppos, HZ, 1000l);
+       return proc_doulongvec_minmax_conv(table, dir, buffer, lenp, ppos, 1l, 1l);
 }
 
 int proc_dointvec_conv(const struct ctl_table *table, int dir, void *buffer,
@@ -1076,8 +1059,9 @@ int proc_doulongvec_minmax(const struct ctl_table *table, int dir,
        return -ENOSYS;
 }
 
-int proc_doulongvec_ms_jiffies_minmax(const struct ctl_table *table, int dir,
-                                     void *buffer, size_t *lenp, loff_t *ppos)
+int proc_doulongvec_minmax_conv(const struct ctl_table *table, int dir,
+                               void *buffer, size_t *lenp, loff_t *ppos,
+                               unsigned long convmul, unsigned long convdiv)
 {
        return -ENOSYS;
 }
@@ -1193,5 +1177,4 @@ EXPORT_SYMBOL(proc_dointvec_minmax);
 EXPORT_SYMBOL_GPL(proc_douintvec_minmax);
 EXPORT_SYMBOL(proc_dostring);
 EXPORT_SYMBOL(proc_doulongvec_minmax);
-EXPORT_SYMBOL(proc_doulongvec_ms_jiffies_minmax);
 EXPORT_SYMBOL(proc_do_large_bitmap);
index 8e845a68382c8d99d4572cd1cb0e67b81c2d2ead..d31a6d40d38dc4db696f0bbe205121d73c242177 100644 (file)
@@ -190,6 +190,7 @@ int proc_dointvec_ms_jiffies(const struct ctl_table *table, int dir, void *buffe
        return proc_dointvec_conv(table, dir, buffer, lenp, ppos,
                                  do_proc_int_conv_ms_jiffies);
 }
+EXPORT_SYMBOL(proc_dointvec_ms_jiffies);
 
 int proc_dointvec_ms_jiffies_minmax(const struct ctl_table *table, int dir,
                          void *buffer, size_t *lenp, loff_t *ppos)
@@ -197,5 +198,29 @@ int proc_dointvec_ms_jiffies_minmax(const struct ctl_table *table, int dir,
        return proc_dointvec_conv(table, dir, buffer, lenp, ppos,
                                  do_proc_int_conv_ms_jiffies_minmax);
 }
-EXPORT_SYMBOL(proc_dointvec_ms_jiffies);
+
+/**
+ * proc_doulongvec_ms_jiffies_minmax - read a vector of millisecond values with min/max values
+ * @table: the sysctl table
+ * @dir: %TRUE if this is a write to the sysctl file
+ * @buffer: the user buffer
+ * @lenp: the size of the user buffer
+ * @ppos: file position
+ *
+ * Reads/writes up to table->maxlen/sizeof(unsigned long) unsigned long
+ * values from/to the user buffer, treated as an ASCII string. The values
+ * are treated as milliseconds, and converted to jiffies when they are stored.
+ *
+ * This routine will ensure the values are within the range specified by
+ * table->extra1 (min) and table->extra2 (max).
+ *
+ * Returns 0 on success.
+ */
+int proc_doulongvec_ms_jiffies_minmax(const struct ctl_table *table, int dir,
+                                     void *buffer, size_t *lenp, loff_t *ppos)
+{
+       return proc_doulongvec_minmax_conv(table, dir, buffer, lenp, ppos,
+                                          HZ, 1000l);
+}
+EXPORT_SYMBOL(proc_doulongvec_ms_jiffies_minmax);