Linux HAM/Amateur Radio development
 help / color / mirror / Atom feed
From: Simon Horman <horms-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org>
To: Joel Granados <joel.granados-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
Cc: mcgrof-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org,
	Catalin Marinas <catalin.marinas-5wv7dgnIgG8@public.gmane.org>,
	Iurii Zaikin <yzaikin-hpIqsD4AKlfQT0dZR+AlfA@public.gmane.org>,
	Jozsef Kadlecsik <kadlec-Cap9r6Oaw4JrovVCs/uTlw@public.gmane.org>,
	Sven Schnelle <svens-tEXmvtCZX7AybS5Ee8rs3A@public.gmane.org>,
	Marcelo Ricardo Leitner
	<marcelo.leitner-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>,
	Steffen Klassert
	<steffen.klassert-opNxpl+3fjRBDgjK7y7TUQ@public.gmane.org>,
	Kees Cook <keescook-F7+t8E8rja9g9hUCZPvPmw@public.gmane.org>,
	"D. Wythe"
	<alibuda-KPsoFbNs7GizrGE5bRqYAgC/G2K4zDHf@public.gmane.org>,
	mptcp-cunTk1MwBs/YUNznpcFYbw@public.gmane.org,
	Jakub Kicinski <kuba-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org>,
	Vasily Gorbik <gor-tEXmvtCZX7AybS5Ee8rs3A@public.gmane.org>,
	Paolo Abeni <pabeni-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>,
	coreteam-Cap9r6Oaw4JrovVCs/uTlw@public.gmane.org,
	Jan Karcher <jaka-tEXmvtCZX7AybS5Ee8rs3A@public.gmane.org>,
	Alexander Aring
	<alex.aring-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>,
	Will Deacon <will-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org>,
	Stefan Schmidt
	<stefan-OrPQZGeq07wqhVmZOOOmNx2eb7JE58TQ@public.gmane.org>,
	Matthieu Baerts
	<matthieu.baerts-g9H5/arvmg7k1uMJSBkQmQ@public.gmane.org>,
	bridge-cunTk1MwBs9QetFLy7KEm3xJsTq8ys+cHZ5vskTnxNA@public.gmane.org,
	linux-arm-kernel-IAPFreCvJWNGWvitb5QawA@public.gmane.org
Subject: Re: [PATCH v2 03/14] sysctl: Add ctl_table_size to ctl_table_header
Date: Mon, 31 Jul 2023 20:30:21 +0200	[thread overview]
Message-ID: <ZMf9vZpGE98oM9W2@kernel.org> (raw)
In-Reply-To: <20230731071728.3493794-4-j.granados-Sze3O3UU22JBDgjK7y7TUQ@public.gmane.org>

On Mon, Jul 31, 2023 at 09:17:17AM +0200, Joel Granados wrote:
> 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-Sze3O3UU22JBDgjK7y7TUQ@public.gmane.org>
> ---
>  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()"
> + *
> + */

Hi Joel,

Please consider also adding kernel doc entries for the other fields of
struct ctl_table_header. According to ./scripts/kernel-doc -none
they are:

  unregistering
  ctl_table_arg
  root
  set
  parent
  node
  inodes


>  struct ctl_table_header {
>  	union {
>  		struct {
>  			struct ctl_table *ctl_table;
> +			int ctl_table_size;
>  			int used;
>  			int count;
>  			int nreg;
> -- 
> 2.30.2
> 

  parent reply	other threads:[~2023-07-31 18:30 UTC|newest]

Thread overview: 36+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-07-31  7:17 [PATCH v2 00/14] sysctl: Add a size argument to register functions in sysctl Joel Granados
2023-07-31  7:17 ` [PATCH v2 01/14] sysctl: Prefer ctl_table_header in proc_sysctl Joel Granados
2023-07-31  7:17 ` [PATCH v2 02/14] sysctl: Use ctl_table_header in list_for_each_table_entry Joel Granados
2023-07-31  7:17 ` [PATCH v2 03/14] sysctl: Add ctl_table_size to ctl_table_header Joel Granados
     [not found]   ` <20230731071728.3493794-4-j.granados-Sze3O3UU22JBDgjK7y7TUQ@public.gmane.org>
2023-07-31 18:30     ` Simon Horman [this message]
2023-07-31 19:07       ` Simon Horman
2023-08-01 10:03         ` Joel Granados
2023-07-31  7:17 ` [PATCH v2 04/14] sysctl: Add size argument to init_header Joel Granados
2023-07-31  7:17 ` [PATCH v2 05/14] sysctl: Add a size arg to __register_sysctl_table Joel Granados
2023-07-31  7:17 ` [PATCH v2 06/14] sysctl: Add size to register_sysctl Joel Granados
2023-07-31  7:17 ` [PATCH v2 07/14] sysctl: Add size arg to __register_sysctl_init Joel Granados
2023-07-31  7:17 ` [PATCH v2 08/14] sysctl: Add size to register_net_sysctl function Joel Granados
2023-07-31  7:17 ` [PATCH v2 09/14] ax.25: Update to register_net_sysctl_sz Joel Granados
     [not found] ` <20230731071728.3493794-1-j.granados-Sze3O3UU22JBDgjK7y7TUQ@public.gmane.org>
2023-07-31  7:17   ` [PATCH v2 10/14] netfilter: " Joel Granados
2023-08-01  6:11     ` Julian Anastasov
2023-07-31  7:17   ` [PATCH v2 11/14] networking: " Joel Granados
2023-08-08 11:20     ` Przemek Kitszel
2023-08-08 14:24       ` Joel Granados
2023-08-08 15:23       ` Joel Granados
2023-07-31  7:17 ` [PATCH v2 12/14] vrf: " Joel Granados
2023-07-31  7:17 ` [PATCH v2 13/14] sysctl: SIZE_MAX->ARRAY_SIZE in register_net_sysctl Joel Granados
2023-07-31  7:17 ` [PATCH v2 14/14] sysctl: Use ctl_table_size as stopping criteria for list macro Joel Granados
2023-07-31 20:50 ` [PATCH v2 00/14] sysctl: Add a size argument to register functions in sysctl Luis Chamberlain
2023-08-01 10:01   ` Joel Granados
2023-07-31 21:36 ` Luis Chamberlain
2023-08-01  9:35   ` Joel Granados
2023-08-07 21:44   ` Luis Chamberlain
2023-08-07 23:00     ` Chris Maness
2023-08-07 23:43       ` Luis Chamberlain
2023-08-08  2:50         ` Chris Maness
2023-08-08  3:00           ` Luis Chamberlain
2023-08-08  3:07             ` Chris Maness
2023-08-08 13:59               ` Joel Granados
2023-08-08 13:58           ` Joel Granados
2023-08-08  2:09     ` Jakub Kicinski
2023-08-08  2:34       ` Luis Chamberlain

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=ZMf9vZpGE98oM9W2@kernel.org \
    --to=horms-dgejt+ai2ygdnm+yrofe0a@public.gmane.org \
    --cc=alex.aring-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org \
    --cc=alibuda-KPsoFbNs7GizrGE5bRqYAgC/G2K4zDHf@public.gmane.org \
    --cc=bridge-cunTk1MwBs9QetFLy7KEm3xJsTq8ys+cHZ5vskTnxNA@public.gmane.org \
    --cc=catalin.marinas-5wv7dgnIgG8@public.gmane.org \
    --cc=coreteam-Cap9r6Oaw4JrovVCs/uTlw@public.gmane.org \
    --cc=gor-tEXmvtCZX7AybS5Ee8rs3A@public.gmane.org \
    --cc=jaka-tEXmvtCZX7AybS5Ee8rs3A@public.gmane.org \
    --cc=joel.granados-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org \
    --cc=kadlec-Cap9r6Oaw4JrovVCs/uTlw@public.gmane.org \
    --cc=keescook-F7+t8E8rja9g9hUCZPvPmw@public.gmane.org \
    --cc=kuba-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org \
    --cc=linux-arm-kernel-IAPFreCvJWNGWvitb5QawA@public.gmane.org \
    --cc=marcelo.leitner-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org \
    --cc=matthieu.baerts-g9H5/arvmg7k1uMJSBkQmQ@public.gmane.org \
    --cc=mcgrof-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org \
    --cc=mptcp-cunTk1MwBs/YUNznpcFYbw@public.gmane.org \
    --cc=pabeni-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org \
    --cc=stefan-OrPQZGeq07wqhVmZOOOmNx2eb7JE58TQ@public.gmane.org \
    --cc=steffen.klassert-opNxpl+3fjRBDgjK7y7TUQ@public.gmane.org \
    --cc=svens-tEXmvtCZX7AybS5Ee8rs3A@public.gmane.org \
    --cc=will-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org \
    --cc=yzaikin-hpIqsD4AKlfQT0dZR+AlfA@public.gmane.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox