Skip to content

Conversation

nicholasbishop
Copy link
Member

The bulk of this change is adding tests for FileInfo, FileSystemInfo, and FileSystemVolumeLabel.

In doing so I noticed that the size field in the header of the first two was calculated incorrectly in their new methods, so fixed that.

And some minor changes to implement Derive and PartialEq on additional types to make the tests easier to write.

(I have some more fixes to make in this area including removing the implicit string conversion, but that will be easier with the tests in place.)

@GabrielMajeri
Copy link
Collaborator

Oops, good catch... it's surprising that no UEFI implementation until now cared to check the header size, or we would've encountered errors 😅

The size field in the header was accidentally being initialized to
16. [`mem::size_of_val`][1] returns the size of the *pointed-to* value,
so by passing in `&info` instead of `info`, we got the size of the DST
fat pointer instead of the dynamically-calculated size of the data
itself.

[1]: https://doc.rust-lang.org/nightly/core/mem/fn.size_of_val.html
@GabrielMajeri GabrielMajeri force-pushed the bishop-add-file-info-tests-2 branch from 2c209bc to 85a2c3f Compare February 23, 2022 07:06
@GabrielMajeri GabrielMajeri merged commit e481eef into rust-osdev:main Feb 23, 2022
@nicholasbishop nicholasbishop deleted the bishop-add-file-info-tests-2 branch February 24, 2022 03:17
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