mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Joel Granados <joel.granados@kernel.org>
To: Kees Cook <kees@kernel.org>, Alexey Gladkov <legion@kernel.org>,
	 David Laight <david.laight.linux@gmail.com>,
	Wen Yang <wen.yang@linux.dev>
Cc: Eric Dumazet <edumazet@kernel.org>,
	Jakub Kicinski <kuba@kernel.org>,
	 Paolo Abeni <pabeni@redhat.com>, Simon Horman <horms@kernel.org>,
	 Linus Torvalds <torvalds@linux-foundation.org>,
	 linux-kernel@vger.kernel.org, linux-fsdevel@vger.kernel.org,
	 netdev@vger.kernel.org, Joel Granados <joel.granados@kernel.org>
Subject: [PATCH RFC 1/9] sysctl: Add struct ctl_table_tmpl as a distinct template type
Date: Thu, 26 Nov 2026 12:47:41 +0100	[thread overview]
Message-ID: <20261126-lklm-sysctl-ctx-flatarray-v1-1-d7fc9cc9b03e@kernel.org> (raw)
In-Reply-To: <20261126-lklm-sysctl-ctx-flatarray-v1-0-d7fc9cc9b03e@kernel.org>

Introduce a new ctl_table template type identical to ctl_table for when
the table caries several different versions/values of the same path
(think namespaces).

This is a prep commit introducing the struct, no functional change
expected. Sysctl core expects these two to be identical except for the
name; ensure this with a build assert.

Signed-off-by: Joel Granados <joel.granados@kernel.org>
---
 include/linux/sysctl.h | 10 ++++++++++
 1 file changed, 10 insertions(+)

diff --git a/include/linux/sysctl.h b/include/linux/sysctl.h
index e5d7226ab6f5af34a33829883ad5d1b405e19c86..4faa3bc189e7afbc270f4ba14b04b32a3f2d1413 100644
--- a/include/linux/sysctl.h
+++ b/include/linux/sysctl.h
@@ -22,6 +22,7 @@
 #ifndef _LINUX_SYSCTL_H
 #define _LINUX_SYSCTL_H
 
+#include <linux/build_bug.h>
 #include <linux/list.h>
 #include <linux/rcupdate.h>
 #include <linux/wait.h>
@@ -230,6 +231,15 @@ struct ctl_table {
 	void *extra2;
 } __randomize_layout;
 
+/* Template version of struct ctl_table. Used for registering ctl_table templates */
+struct ctl_table_tmpl {
+	struct ctl_table t;
+};
+
+static_assert(sizeof(struct ctl_table_tmpl) == sizeof(struct ctl_table));
+static_assert(__alignof__(struct ctl_table_tmpl) == __alignof__(struct ctl_table));
+static_assert(offsetof(struct ctl_table_tmpl, t) == 0);
+
 struct ctl_node {
 	struct rb_node node;
 	struct ctl_table_header *header;

-- 
2.50.1



  reply	other threads:[~2026-11-26 11:47 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-26 11:47 [PATCH RFC 0/9] sysctl: Replace ARRAY kmemdup with overlay mechanism for NS registration Joel Granados
2026-11-26 11:47 ` Joel Granados [this message]
2026-11-26 11:47 ` [PATCH RFC 2/9] sysctl: Add flags to struct ctl_table Joel Granados
2026-11-26 11:47 ` [PATCH RFC 3/9] sysctl: Add overlay mechanism for flagged ctl_table members Joel Granados
2026-11-26 11:47 ` [PATCH RFC 4/9] sysctl: Add sysctl template registration Joel Granados
2026-11-26 11:47 ` [PATCH RFC 5/9] net: sysctl: Add sysctl registration to networking Joel Granados
2026-11-26 11:47 ` [PATCH RFC 6/9] ipv4: Register ipv4_net_table as a template Joel Granados
2026-11-26 11:47 ` [PATCH RFC 7/9] ipc: Register ipc_sysctls " Joel Granados
2026-11-26 11:47 ` [PATCH RFC 8/9] ipc: Register mq_sysctls " Joel Granados
2026-11-26 11:47 ` [PATCH RFC 9/9] ucount: Register user_table " Joel Granados

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=20261126-lklm-sysctl-ctx-flatarray-v1-1-d7fc9cc9b03e@kernel.org \
    --to=joel.granados@kernel.org \
    --cc=david.laight.linux@gmail.com \
    --cc=edumazet@kernel.org \
    --cc=horms@kernel.org \
    --cc=kees@kernel.org \
    --cc=kuba@kernel.org \
    --cc=legion@kernel.org \
    --cc=linux-fsdevel@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=pabeni@redhat.com \
    --cc=torvalds@linux-foundation.org \
    --cc=wen.yang@linux.dev \
    /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

all inboxes | Powered by JetHome®