Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ptfs: use BorrowedFd instead of RawFd when possible #173

Merged
merged 1 commit into from
Nov 14, 2023

Conversation

jiangliu
Copy link
Contributor

@jiangliu jiangliu commented Nov 6, 2023

Use BorrowedFd instead of RawFd when possible.

@@ -272,8 +282,8 @@ impl HandleData {
// object is within scope. Otherwise it may cause race window to access wrong target fd.
// By introducing this method, we could explicitly audit all callers making use of the
// underlying RawFd.
Copy link
Contributor

Choose a reason for hiding this comment

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

The comments above are still referencing RawFd, these should be updated as well?

Also, it'd be better to describe why we're replacing RawFd with BorrowedFd in commit log, what are the benefits.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

fixed

Use BorrowedFd instead of RawFd when possible. By using BorrowedFd
we can explicitly manage the lifetime of the underlying RawFd,
to avoid misusing after file close.

Signed-off-by: Jiang Liu <[email protected]>
@eryugey eryugey merged commit cc0a191 into cloud-hypervisor:master Nov 14, 2023
9 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