-
Notifications
You must be signed in to change notification settings - Fork 296
libs: add Stat module in Unixext to handle special device IDs #6812
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
base: master
Are you sure you want to change the base?
Conversation
1139dfa to
52ba24a
Compare
| Some {major; minor} | ||
|
|
||
| let encode_st_dev {major; minor} = | ||
| 0 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
the 0 |^ is added to make ocamlformat behave and keep the first major term parenthesised and aligned. The same has been done in in decode
52ba24a to
7753e0f
Compare
last-genius
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Probably worth explaining the motivation for this - the fact that we saw real-world minors > 256 failing to be handled by xapi properly, as it is unable to figure out the format of the backing file, and has to handle the VDI as raw instead.
7753e0f to
afa33ff
Compare
These device IDs are handled in an ad-hoc way, and none of the implementations follow the actual linux behaviour. The glibc-provided macros are used for the implementation, with a pure-ocaml implementation that was useful to compare against while implementing, which has been kept in the tests, to detect any behavioural changes. Because Unix.stat returns an `int` instead of an int64, the code does not support all possible values for major supported by glibc. This shouldn't be an issue in Linux since the device value is 32-bit wide. Signed-off-by: Pau Ruiz Safont <[email protected]>
There were 5 ad-hoc implementations, they were all getting wrong results for the minor because only the lower 8 bits were accounted for. Use the unixext one which handles up to 32-bit-wide minors correctly. Signed-off-by: Pau Ruiz Safont <[email protected]>
Previously, when a failure happened while getting a base vhd, a non-descriptive error was printed. Because there can be many reasons that can cause this code to fail, model the possible errors and print them when needed. Signed-off-by: Pau Ruiz Safont <[email protected]>
afa33ff to
d037795
Compare
These device IDs are handled in an ad-hoc way, and none of the implementations follow the actual linux behaviour, replace all of them with an in imeplementation that uses the glibc macros to handle these.
Also change vhd_wrapper_tool to print better error messages when there's an error when getting the base VHD.
I'm still testing the changes that are not unit-tested, so drafting this for the time being