Page MenuHomeFreeBSD

kboot: For hostfs, return better errors from read, where possible.
ClosedPublic

Authored by imp on Jan 29 2023, 3:16 PM.
Tags
None
Referenced Files
Unknown Object (File)
Tue, Nov 5, 12:11 PM
Unknown Object (File)
Sep 30 2024, 4:16 PM
Unknown Object (File)
Sep 25 2024, 2:41 AM
Unknown Object (File)
Sep 25 2024, 2:26 AM
Unknown Object (File)
Sep 23 2024, 3:05 PM
Unknown Object (File)
Sep 22 2024, 12:46 PM
Unknown Object (File)
Sep 20 2024, 9:43 AM
Unknown Object (File)
Sep 19 2024, 9:23 AM
Subscribers

Details

Summary

Translate the Linux error return from read to a FreeBSD errno. We use a
simplified translation: 1-34 are the same between the systems, so any of
those will be returned directly. All other errno map to EINVAL. This
will suffice for some code that reads /dev/mem in producing the right
diagnostic.

A fully generalized version is much harder. Linux has a number of errno
that don't translate well and has architecture dependent
encodings. Avoid this mess with a simple macro for now. Add comment
explaining why we use the simple method we do.

Sponsored by: Netflix

Diff Detail

Repository
rG FreeBSD src repository
Lint
Lint Skipped
Unit
Tests Skipped
Build Status
Buildable 49475
Build 46365: arc lint + arc unit

Event Timeline

imp requested review of this revision.Jan 29 2023, 3:16 PM

rebase / refactor / redo

kevans added inline comments.
stand/kboot/host_syscall.h
211
This revision is now accepted and ready to land.Feb 2 2023, 3:58 AM
This revision now requires review to proceed.Feb 2 2023, 4:21 AM
This revision is now accepted and ready to land.Feb 2 2023, 2:55 PM

I did find myself wondering if host_to_stand_errno should assert that e <= 0 since it's a relatively common error to accidentally use positive errors when modifying linux code.

I did find myself wondering if host_to_stand_errno should assert that e <= 0 since it's a relatively common error to accidentally use positive errors when modifying linux code.

I had similar thoughts early on, but this wound up being a #define... I'll post a followup review.