Skip to content

Commit 1e88772

Browse files
Joelgranadosmcgrof
authored andcommitted
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 <[email protected]> Signed-off-by: Luis Chamberlain <[email protected]>
1 parent 18d4b42 commit 1e88772

File tree

1 file changed

+12
-2
lines changed

1 file changed

+12
-2
lines changed

include/linux/sysctl.h

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -159,12 +159,22 @@ struct ctl_node {
159159
struct ctl_table_header *header;
160160
};
161161

162-
/* struct ctl_table_header is used to maintain dynamic lists of
163-
struct ctl_table trees. */
162+
/**
163+
* struct ctl_table_header - maintains dynamic lists of struct ctl_table trees
164+
* @ctl_table: pointer to the first element in ctl_table array
165+
* @ctl_table_size: number of elements pointed by @ctl_table
166+
* @used: The entry will never be touched when equal to 0.
167+
* @count: Upped every time something is added to @inodes and downed every time
168+
* something is removed from inodes
169+
* @nreg: When nreg drops to 0 the ctl_table_header will be unregistered.
170+
* @rcu: Delays the freeing of the inode. Introduced with "unfuck proc_sysctl ->d_compare()"
171+
*
172+
*/
164173
struct ctl_table_header {
165174
union {
166175
struct {
167176
struct ctl_table *ctl_table;
177+
int ctl_table_size;
168178
int used;
169179
int count;
170180
int nreg;

0 commit comments

Comments
 (0)