Skip to content

Conversation

@cgwalters
Copy link
Collaborator

Many cases want to find the value of an argument, no need to return the key back to them.

Also IMO value_lossy() is a HUGE trap because aside from logging it's almost never the right thing to do. I plan to remove it in a followup.

So this also adds a utf8 helper that returns an error, and changes one case to use it.

Copy link
Contributor

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request introduces value_of and value_of_utf8 helper methods to the Cmdline struct, simplifying the process of retrieving kernel argument values. The value_of_utf8 method correctly handles potential UTF-8 errors, which is an improvement over the value_lossy method it replaces in one instance. The changes are well-tested. My main feedback is a small refactoring suggestion to improve code reuse.

Many cases want to find the value of an argument, no need
to return the key back to them.

Also IMO `value_lossy()` is a HUGE trap because aside from
logging it's almost never the right thing to do. I plan
to remove it in a followup.

So this also adds a `utf8` helper that returns an error,
and changes one case to use it.

Signed-off-by: Colin Walters <[email protected]>
@cgwalters cgwalters changed the title kernel: Add value helper kernel: Add value helpers Aug 4, 2025
Copy link
Collaborator

@jeckersb jeckersb left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍 very nice improvement!

@cgwalters cgwalters enabled auto-merge August 4, 2025 19:04
@cgwalters cgwalters merged commit 735a0b0 into bootc-dev:main Aug 4, 2025
26 of 27 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants