Implement common traits for public types#108
Merged
l0kod merged 1 commit intolandlock-lsm:mainfrom Sep 14, 2025
Merged
Conversation
Implement Debug for ABI, Ruleset, RulesetCreated, PathBeneath, PathFd, and NetPort (and other non-public dependencies). Derived Debug formats are not stable: https://doc.rust-lang.org/stable/std/fmt/trait.Debug.html#stability Implement PartialEq, Eq, PartialOrd, and Ord for ABI. This might be needed when these types are wrapped (see LandlockConfig). Closes: landlock-lsm#82 Signed-off-by: Mickaël Salaün <mic@digikod.net>
l0kod
added a commit
to l0kod/landlockconfig
that referenced
this pull request
Sep 11, 2025
TODO: Remove patch.cartes-io once this PR land: landlock-lsm/rust-landlock#108 In preparation to replace the "vN." prefixes with a global max ABI version. This new approach is flexible enough and simpler. This is now possible thanks to the composition feature (each file can have a dedicated max ABI) and its similar to the use of a local variable. The variable `abi = 4` is the highest version of the Landlock ABI, which should replace the hardcoded v4 uses. This is convenient to update configurations to newest Landlock features by only updating one line instead of all use of vN. Example: abi = 4 [[ruleset]] handled_access_fs = ["abi.all"] [[path_beneath]] allowed_access = ["abi.read_execute"] parent = ["/usr"] Signed-off-by: Mickaël Salaün <mic@digikod.net>
l0kod
added a commit
to l0kod/landlockconfig
that referenced
this pull request
Sep 11, 2025
TODO: Remove patch.cartes-io once this PR land: landlock-lsm/rust-landlock#108 TODO: Factor out code In preparation to replace the "vN." prefixes with a global max ABI version. This new approach is flexible enough and simpler. This is now possible thanks to the composition feature (each file can have a dedicated max ABI) and its similar to the use of a local variable. The variable `abi = 4` is the highest version of the Landlock ABI, which should replace the hardcoded v4 uses. This is convenient to update configurations to newest Landlock features by only updating one line instead of all use of vN. Example: abi = 4 [[ruleset]] handled_access_fs = ["abi.all"] [[path_beneath]] allowed_access = ["abi.read_execute"] parent = ["/usr"] Signed-off-by: Mickaël Salaün <mic@digikod.net>
l0kod
added a commit
to l0kod/landlockconfig
that referenced
this pull request
Sep 14, 2025
TODO: Remove patch.cartes-io once this PR land: landlock-lsm/rust-landlock#108 TODO: Factor out code In preparation to replace the "vN." prefixes with a global max ABI version. This new approach is flexible enough and simpler. This is now possible thanks to the composition feature (each file can have a dedicated max ABI) and its similar to the use of a local variable. For instance, the variable `abi = 4` represents the highest version of the Landlock ABI in a configuration file, which should replace the hardcoded v4 uses. This is convenient to update configurations to newest Landlock features by only updating one line instead of all use of vN. Example: abi = 4 [[ruleset]] handled_access_fs = ["abi.all"] [[path_beneath]] allowed_access = ["abi.read_execute"] parent = ["/usr"] Add new ValueAccess enums and AbiGroup trait to factor out common code. Replace get_fs_read_execute() and get_fs_read_write() with AbiGroupFs::ReadExecute and AbiGroupFs::ReadWrite. Signed-off-by: Mickaël Salaün <mic@digikod.net>
l0kod
added a commit
to l0kod/landlockconfig
that referenced
this pull request
Sep 14, 2025
TODO: Remove patch.cartes-io once this PR land: landlock-lsm/rust-landlock#108 TODO: Factor out code In preparation to replace the "vN." prefixes with a global max ABI version. This new approach is flexible enough and simpler. This is now possible thanks to the composition feature (each file can have a dedicated max ABI) and its similar to the use of a local variable. For instance, the variable `abi = 4` represents the highest version of the Landlock ABI in a configuration file, which should replace the hardcoded v4 uses. This is convenient to update configurations to newest Landlock features by only updating one line instead of all use of vN. Example: abi = 4 [[ruleset]] handled_access_fs = ["abi.all"] [[path_beneath]] allowed_access = ["abi.read_execute"] parent = ["/usr"] Add new ValueAccess enums and AbiGroup trait to factor out common code. Replace get_fs_read_execute() and get_fs_read_write() with AbiGroupFs::ReadExecute and AbiGroupFs::ReadWrite. Signed-off-by: Mickaël Salaün <mic@digikod.net>
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.
Implement Debug for ABI, Ruleset, RulesetCreated, PathBeneath, PathFd, and NetPort (and other non-public dependencies). Derived Debug formats are not stable:
https://doc.rust-lang.org/stable/std/fmt/trait.Debug.html#stability
Implement PartialEq, Eq, PartialOrd, and Ord for ABI.
This might be needed when these types are wrapped (see LandlockConfig).
See #82