Files
systemd/docs
Christian Brauner 3707468837 rust: pass the command line tables around as sections
dispatch_verb!(), command_print_help_name!(), command_print_verb_help!()
and introspect_cli!() each declare the bounds the linker defines for
the SYSTEMD_VERBS and SYSTEMD_OPTIONS sections and hand them to an
unsafe backend as four raw pointers. foreach_option!() does the same
and needs OptionParser::__parser() only so that it can evaluate its
argument outside of the unsafe block.

Instead, wrap the bounds in a Section<T> that only __verbs_section!()
and __options_section!() create. Creating it is the unsafe part, so the
backends become safe functions and each table macro is a single call.
foreach_option!() calls a safe OptionParser::__next() now and
__parser() is gone.

The verbs get the userdata as it is though. So __dispatch_verb() stays
unsafe and dispatch_verb!() expands to the call directly. IOW, the
caller vouches for the userdata in an unsafe block of its own instead
of the macro hiding that in its unsafe block. clippy's
not_unsafe_ptr_arg_deref caught this once the bounds were gone.

The new code takes the address of the bounds with &raw const,
addr_of!() is soft-deprecated.

Signed-off-by: Christian Brauner (Amutable) <brauner@kernel.org>
2026-10-27 12:25:05 +01:00
..
2026-01-31 01:11:11 +09:00
2026-04-14 17:32:37 +01:00
2019-12-11 17:04:20 +01:00
2025-11-12 23:01:35 +00:00
2026-01-31 01:11:11 +09:00
2026-03-24 17:55:26 +01:00
2026-10-03 16:12:54 +02:00
2026-01-31 01:11:11 +09:00
2026-01-31 01:11:11 +09:00
2026-01-31 01:11:11 +09:00
2026-10-05 09:35:58 +02:00
2026-01-31 01:11:11 +09:00
2019-12-11 17:04:20 +01:00
2025-05-14 18:06:04 +02:00
2026-01-31 01:11:11 +09:00
2026-10-05 09:35:58 +02:00
2026-01-31 01:11:11 +09:00
2026-01-31 01:11:11 +09:00
2026-01-31 01:11:11 +09:00
2024-03-15 04:04:01 +09:00
2026-09-22 18:46:41 +02:00