drbd: switch from genl_magic to YNL#738
Open
blktests-ci[bot] wants to merge 4 commits intolinus-master_basefrom
Open
drbd: switch from genl_magic to YNL#738blktests-ci[bot] wants to merge 4 commits intolinus-master_basefrom
blktests-ci[bot] wants to merge 4 commits intolinus-master_basefrom
Conversation
Author
|
Upstream branch: d60bc14 |
6b4d829 to
ceec5ed
Compare
Author
|
Upstream branch: b4e0758 |
a00ac41 to
4474ccd
Compare
ceec5ed to
3b54e52
Compare
Author
|
Upstream branch: 6596a02 |
4474ccd to
87a2e2c
Compare
3b54e52 to
6a0b974
Compare
Author
|
Upstream branch: 507bd4b |
87a2e2c to
607161c
Compare
6a0b974 to
59ca59b
Compare
Author
|
Upstream branch: dd6c438 |
607161c to
f264b33
Compare
94f0438 to
857ada9
Compare
Author
|
Upstream branch: dd6c438 |
drbd.h and drbd_limits.h contain only type definitions, enums, and constants shared between kernel and userspace. These should be part of UAPI. Split the genl_api header into two: the genlmsghdr and the enums are UAPI, the rest stays there for now (it will be removed by one of the next commits in this series). drbd_config.h is clearly DRBD-internal, so move it there. Signed-off-by: Christoph Böhmwalder <christoph.boehmwalder@linbit.com>
Add a "emit-structs" option to the genetlink-legacy spec. Enabling "emit-structs" adds struct declarations for nested attribute sets to the generated kernel headers. It also adds some useful serialization helpers: - from_attrs() with 'required' attribute enforcement - to_skb() for struct-to-netlink serialization - set_defaults() driven by the 'default' YAML key The motivation is to replace the existing deprecated genl_magic system. Some genl_magic features are dropped entirely because they had no significant users, some are carried over to YNL (the genetlink-legacy spec). The new flags in the genetlink-legacy spec that are required for existing consumers to keep working are: "default": a literal value or C define that sets the default value for an attribute, consumed by set_defaults(). "required": if true, from_attrs() returns an error when this attribute is missing from the request message. "nla-policy-type": can be used to override the NLA type used in policy arrays. This is needed when the semantic type differs from the wire type for backward compatibility: genl_magic maps s32 fields to NLA_U32/nla_get_u32, and existing userspace might depend on this encoding. The immediate motivation is DRBD, whose genl spec definition predates the addition of signed types in genl. However, this is a generic issue that potentially affects multiple families: for example, nftables has NFTA_HOOK_PRIORITY as s32 in the spec but NLA_U32 in the actual kernel policy. All new properties are backward-compatible; existing specs that do not use them are unaffected. Signed-off-by: Christoph Böhmwalder <christoph.boehmwalder@linbit.com>
Add a YNL-conformant YAML spec for the DRBD genetlink interface. This uses the genetlink-legacy schema since DRBD has a fixed protocol header (drbd_genlmsghdr) and pre-existing conventions that userspace depends on. s32 fields (meta-dev-idx, resync-after) use nla-policy-type: u32 to preserve wire compatibility with existing userspace; the original spec predates kernel NLA_S32 support. Signed-off-by: Christoph Böhmwalder <christoph.boehmwalder@linbit.com>
Replace the genl_magic multi-include macro system with proper YNL generation. The bulk of the changes are mechanical renames to fit the generator 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 to generate, so make this 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. Define the genl_family struct manually in drbd_nl.c; this is not emitted by the generator for genetlink-legacy families. Also replace a couple of drbd-specific wrappers (nla_put_u64_0pad, drbd_nla_find_nested) and replace by 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>
f264b33 to
e1f00dc
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Pull request for series with
subject: drbd: switch from genl_magic to YNL
version: 1
url: https://patchwork.kernel.org/project/linux-block/list/?series=1078298