Skip to content

Conversation

@ShadowCurse
Copy link
Contributor

Changes

  • Clarify the reason for main function wrapping. This is mainly because I have this question each time I look at this code and each time need to discover the reason again.
  • Use Rust feature to create CStr constants for paths avoiding runtime conversion.

Reason

Since Rust 1.77 CStr can be created with c prefix to string. Use this to simplify the code and remove runtime conversions.

License Acceptance

By submitting this pull request, I confirm that my contribution is made under
the terms of the Apache 2.0 license. For more information on following Developer
Certificate of Origin and signing off your commits, please check
CONTRIBUTING.md.

PR Checklist

  • I have read and understand CONTRIBUTING.md.
  • I have run tools/devtool checkstyle to verify that the PR passes the
    automated style checks.
  • I have described what is done in these changes, why they are needed, and
    how they are solving the problem in a clear and encompassing way.
  • I have updated any relevant documentation (both in code and in the docs)
    in the PR.
  • I have mentioned all user-facing changes in CHANGELOG.md.
  • If a specific issue led to this PR, this PR closes the issue.
  • When making API changes, I have followed the
    Runbook for Firecracker API changes.
  • I have tested all new and changed functionalities in unit tests and/or
    integration tests.
  • I have linked an issue to every new TODO.

  • This functionality cannot be added in rust-vmm.

@ShadowCurse ShadowCurse force-pushed the jailer_tweaks branch 3 times, most recently from e808757 to 54d3655 Compare March 6, 2025 11:18
@codecov
Copy link

codecov bot commented Mar 6, 2025

Codecov Report

Attention: Patch coverage is 18.75000% with 13 lines in your changes missing coverage. Please review.

Project coverage is 83.19%. Comparing base (74a5161) to head (5544bd1).
Report is 3 commits behind head on main.

Files with missing lines Patch % Lines
src/jailer/src/chroot.rs 0.00% 10 Missing ⚠️
src/jailer/src/env.rs 50.00% 3 Missing ⚠️
Additional details and impacted files
@@           Coverage Diff           @@
##             main    #5068   +/-   ##
=======================================
  Coverage   83.19%   83.19%           
=======================================
  Files         247      247           
  Lines       26641    26638    -3     
=======================================
- Hits        22163    22162    -1     
+ Misses       4478     4476    -2     
Flag Coverage Δ
5.10-c5n.metal 83.67% <18.75%> (+<0.01%) ⬆️
5.10-m5n.metal 83.66% <18.75%> (+<0.01%) ⬆️
5.10-m6a.metal 82.87% <18.75%> (+0.01%) ⬆️
5.10-m6g.metal 79.67% <18.75%> (+<0.01%) ⬆️
5.10-m6i.metal 83.65% <18.75%> (+<0.01%) ⬆️
5.10-m7g.metal 79.67% <18.75%> (+<0.01%) ⬆️
6.1-c5n.metal 83.67% <18.75%> (+<0.01%) ⬆️
6.1-m5n.metal 83.66% <18.75%> (+<0.01%) ⬆️
6.1-m6a.metal 82.87% <18.75%> (+<0.01%) ⬆️
6.1-m6g.metal 79.67% <18.75%> (+<0.01%) ⬆️
6.1-m6i.metal 83.65% <18.75%> (+<0.01%) ⬆️
6.1-m7g.metal 79.67% <18.75%> (+<0.01%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@ShadowCurse ShadowCurse marked this pull request as ready for review March 6, 2025 12:02
@ShadowCurse ShadowCurse self-assigned this Mar 6, 2025
@ShadowCurse ShadowCurse added Status: Awaiting review Indicates that a pull request is ready to be reviewed Type: Enhancement Indicates new feature requests labels Mar 6, 2025
Copy link
Contributor

@roypat roypat left a comment

Choose a reason for hiding this comment

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

Nice!

Add a comment why we wrap the actual main inplementation.

Signed-off-by: Egor Lazarchuk <[email protected]>
Since Rust 1.77 we can create constants with C strings without
runtime conversion.

Signed-off-by: Egor Lazarchuk <[email protected]>
As a follow up of the previous commit, replace string which should be C
string with CStr.

Signed-off-by: Egor Lazarchuk <[email protected]>
@ShadowCurse ShadowCurse merged commit 8411b07 into firecracker-microvm:main Mar 6, 2025
5 of 7 checks passed
@ShadowCurse ShadowCurse deleted the jailer_tweaks branch March 6, 2025 14:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Status: Awaiting review Indicates that a pull request is ready to be reviewed Type: Enhancement Indicates new feature requests

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants