aboutsummaryrefslogtreecommitdiffstats
path: root/include/linux/sysctl.h
diff options
context:
space:
mode:
authorJoel Granados <joel.granados@gmail.com>2023-08-09 12:49:55 +0200
committerLuis Chamberlain <mcgrof@kernel.org>2023-08-15 15:26:17 -0700
commit1e887723545e037b5e200e77edf79802f58fc818 (patch)
tree49569df649d1ab3cec185c5d14ed062c1fd4600b /include/linux/sysctl.h
parent18d4b42e9de61546c22c6f47dfc85ca1dbe9459a (diff)
downloadlinux-1e887723545e037b5e200e77edf79802f58fc818.tar.gz
sysctl: Add ctl_table_size to ctl_table_header
The new ctl_table_size element will hold the size of the ctl_table arrays contained in the ctl_table_header. This value should eventually be passed by the callers to the sysctl register infrastructure. And while this commit introduces the variable, it does not set nor use it because that requires case by case considerations for each caller. It provides two important things: (1) A place to put the result of the ctl_table array calculation when it gets introduced for each caller. And (2) the size that will be used as the additional stopping criteria in the list_for_each_table_entry macro (to be added when all the callers are migrated) Signed-off-by: Joel Granados <j.granados@samsung.com> Signed-off-by: Luis Chamberlain <mcgrof@kernel.org>
Diffstat (limited to 'include/linux/sysctl.h')
-rw-r--r--include/linux/sysctl.h14
1 files changed, 12 insertions, 2 deletions
diff --git a/include/linux/sysctl.h b/include/linux/sysctl.h
index 59d451f455bfb..33252ad58ebef 100644
--- a/include/linux/sysctl.h
+++ b/include/linux/sysctl.h
@@ -159,12 +159,22 @@ struct ctl_node {
struct ctl_table_header *header;
};
-/* struct ctl_table_header is used to maintain dynamic lists of
- struct ctl_table trees. */
+/**
+ * struct ctl_table_header - maintains dynamic lists of struct ctl_table trees
+ * @ctl_table: pointer to the first element in ctl_table array
+ * @ctl_table_size: number of elements pointed by @ctl_table
+ * @used: The entry will never be touched when equal to 0.
+ * @count: Upped every time something is added to @inodes and downed every time
+ * something is removed from inodes
+ * @nreg: When nreg drops to 0 the ctl_table_header will be unregistered.
+ * @rcu: Delays the freeing of the inode. Introduced with "unfuck proc_sysctl ->d_compare()"
+ *
+ */
struct ctl_table_header {
union {
struct {
struct ctl_table *ctl_table;
+ int ctl_table_size;
int used;
int count;
int nreg;