• Joel Granados's avatar
    sysctl: Add size to register_net_sysctl function · 95d49778
    Joel Granados authored
    This commit adds size to the register_net_sysctl indirection function to
    facilitate the removal of the sentinel elements (last empty markers)
    from the ctl_table arrays. Though we don't actually remove any sentinels
    in this commit, register_net_sysctl* now has the capability of
    forwarding table_size for when that happens.
    
    We create a new function register_net_sysctl_sz with an extra size
    argument. A macro replaces the existing register_net_sysctl. The size in
    the macro is SIZE_MAX instead of ARRAY_SIZE to avoid compilation errors
    while we systematically migrate to register_net_sysctl_sz. Will change
    to ARRAY_SIZE in subsequent commits.
    
    Care is taken to add table_size to the stopping criteria in such a way
    that when we remove the empty sentinel element, it will continue
    stopping in the last element of the ctl_table array.
    Signed-off-by: default avatarJoel Granados <j.granados@samsung.com>
    Suggested-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
    Signed-off-by: default avatarLuis Chamberlain <mcgrof@kernel.org>
    95d49778
net_namespace.h 13.5 KB