]> git.ipfire.org Git - thirdparty/kernel/linux.git/commit
drbd: replace genl_magic with explicit netlink serialization
authorChristoph Böhmwalder <christoph.boehmwalder@linbit.com>
Wed, 6 May 2026 12:45:41 +0000 (14:45 +0200)
committerJens Axboe <axboe@kernel.dk>
Sat, 9 May 2026 01:23:23 +0000 (19:23 -0600)
commit8098eeb693c4cc4e774c62fbd4875197cb5578ce
tree9357b663ae4972d3a95d2b1dd4fb6ffb7b2f460e
parenta54f499838292c1768f6575ed1ec7cf35f1b6489
drbd: replace genl_magic with explicit netlink serialization

Replace the genl_magic multi-include macro system with explicit
serialization and parsing.

The *_gen files were initially produced from a YNL spec via a
customized ynl-gen-c, but the DRBD netlink family is effectively
frozen, so the generator is kept unmodified.
All new functionality will land in a separate, properly-designed
family.
Carry the resulting code as ordinary in-tree source rather than
landing the spec and generator changes that produced it.

The bulk of the changes are mechanical renames to fit the YNL naming
conventions:
  - Handler functions: drbd_adm_* -> drbd_nl_*_doit/dumpit
  - GENL_MAGIC_VERSION -> DRBD_FAMILY_VERSION
  - GENL_MAGIC_FAMILY_HDRSZ -> sizeof(struct drbd_genlmsghdr)
  - drbd_genl_family -> drbd_nl_family
  - Attribute IDs: T_* -> DRBD_A_*

Remove the nested_attr_tb static global buffer and move to a per-call
allocation approach: each deserialization manages its own nested
attribute table. This will be needed anyway when we eventually move
to parallel_ops, and it's actually simpler this way, so make the
move now.

Replace the functionality of the "sensitive" flag: this was only used
by a single field (shared_secret); open-code redaction logic for that
locally.

Also replace the "invariant" flag: this only had a couple of users,
and those basically never change. Hard code the check directly inline.

The genl_family struct itself is defined manually in drbd_nl.c.

Also replace a couple of drbd-specific wrappers (nla_put_u64_0pad,
drbd_nla_find_nested) with standard kernel functions while we're at
it.

Finally, completely remove the genl_magic system; DRBD was its only
user.

Signed-off-by: Christoph Böhmwalder <christoph.boehmwalder@linbit.com>
Acked-by: Jakub Kicinski <kuba@kernel.org>
Link: https://patch.msgid.link/20260506124541.1951772-3-christoph.boehmwalder@linbit.com
Signed-off-by: Jens Axboe <axboe@kernel.dk>
14 files changed:
drivers/block/drbd/Makefile
drivers/block/drbd/drbd_debugfs.c
drivers/block/drbd/drbd_int.h
drivers/block/drbd/drbd_main.c
drivers/block/drbd/drbd_nl.c
drivers/block/drbd/drbd_nl_gen.c [new file with mode: 0644]
drivers/block/drbd/drbd_nl_gen.h [new file with mode: 0644]
drivers/block/drbd/drbd_proc.c
include/linux/drbd_genl.h [deleted file]
include/linux/drbd_genl_api.h [deleted file]
include/linux/genl_magic_func.h [deleted file]
include/linux/genl_magic_struct.h [deleted file]
include/uapi/linux/drbd.h
include/uapi/linux/drbd_genl.h [new file with mode: 0644]