LVS
lvs-devel
Google
 
Web LinuxVirtualServer.org

[PATCH v3 03/14] sysctl: Add ctl_table_size to ctl_table_header

To: mcgrof@xxxxxxxxxx
Subject: [PATCH v3 03/14] sysctl: Add ctl_table_size to ctl_table_header
Cc: rds-devel@xxxxxxxxxxxxxx, "David S. Miller" <davem@xxxxxxxxxxxxx>, Florian Westphal <fw@xxxxxxxxx>, willy@xxxxxxxxxxxxx, Jan Karcher <jaka@xxxxxxxxxxxxx>, Wen Gu <guwen@xxxxxxxxxxxxxxxxx>, Simon Horman <horms@xxxxxxxxxxxx>, Tony Lu <tonylu@xxxxxxxxxxxxxxxxx>, linux-wpan@xxxxxxxxxxxxxxx, Matthieu Baerts <matthieu.baerts@xxxxxxxxxxxx>, Christian Borntraeger <borntraeger@xxxxxxxxxxxxx>, mptcp@xxxxxxxxxxxxxxx, Heiko Carstens <hca@xxxxxxxxxxxxx>, Stefan Schmidt <stefan@xxxxxxxxxxxxxxxxxx>, Will Deacon <will@xxxxxxxxxx>, Julian Anastasov <ja@xxxxxx>, netfilter-devel@xxxxxxxxxxxxxxx, Joerg Reuter <jreuter@xxxxxxxx>, linux-kernel@xxxxxxxxxxxxxxx, Alexander Gordeev <agordeev@xxxxxxxxxxxxx>, linux-sctp@xxxxxxxxxxxxxxx, Xin Long <lucien.xin@xxxxxxxxx>, Herbert Xu <herbert@xxxxxxxxxxxxxxxxxxx>, linux-hams@xxxxxxxxxxxxxxx, Vasily Gorbik <gor@xxxxxxxxxxxxx>, coreteam@xxxxxxxxxxxxx, Ralf Baechle <ralf@xxxxxxxxxxxxxx>, Steffen Klassert <steffen.klassert@xxxxxxxxxxx>, Pablo Neira Ayuso <pablo@xxxxxxxxxxxxx>, keescook@xxxxxxxxxxxx, Roopa Prabhu <roopa@xxxxxxxxxx>, David Ahern <dsahern@xxxxxxxxxx>, linux-arm-kernel@xxxxxxxxxxxxxxxxxxx, Catalin Marinas <catalin.marinas@xxxxxxx>, Jozsef Kadlecsik <kadlec@xxxxxxxxxxxxx>, Wenjia Zhang <wenjia@xxxxxxxxxxxxx>, josh@xxxxxxxxxxxxxxxx, linux-fsdevel@xxxxxxxxxxxxxxx, Alexander Aring <alex.aring@xxxxxxxxx>, Nikolay Aleksandrov <razor@xxxxxxxxxxxxx>, netdev@xxxxxxxxxxxxxxx, Santosh Shilimkar <santosh.shilimkar@xxxxxxxxxx>, linux-s390@xxxxxxxxxxxxxxx, Sven Schnelle <svens@xxxxxxxxxxxxx>, "D. Wythe" <alibuda@xxxxxxxxxxxxxxxxx>, Eric Dumazet <edumazet@xxxxxxxxxx>, lvs-devel@xxxxxxxxxxxxxxx, linux-rdma@xxxxxxxxxxxxxxx, Paolo Abeni <pabeni@xxxxxxxxxx>, Iurii Zaikin <yzaikin@xxxxxxxxxx>, Marcelo Ricardo Leitner <marcelo.leitner@xxxxxxxxx>, bridge@xxxxxxxxxxxxxxxxxxxxxxxxxx, Karsten Graul <kgraul@xxxxxxxxxxxxx>, Mat Martineau <martineau@xxxxxxxxxx>, Miquel Raynal <miquel.raynal@xxxxxxxxxxx>, Jakub Kicinski <kuba@xxxxxxxxxx>, Joel Granados <j.granados@xxxxxxxxxxx>
From: Joel Granados <joel.granados@xxxxxxxxx>
Date: Wed, 9 Aug 2023 12:49:55 +0200
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@xxxxxxxxxxx>
---
 include/linux/sysctl.h | 14 ++++++++++++--
 1 file changed, 12 insertions(+), 2 deletions(-)

diff --git a/include/linux/sysctl.h b/include/linux/sysctl.h
index 59d451f455bf..33252ad58ebe 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;
-- 
2.30.2


<Prev in Thread] Current Thread [Next in Thread>