-
Notifications
You must be signed in to change notification settings - Fork 55
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
Move static header functionality into a separate module #1568
Closed
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
mulkieran
changed the title
Master static header
Move static header functionality into a separate module
Jun 19, 2019
The final goal is to use the same tricks used in mda.rs with types to ensure that our sizes are correct. |
Blocked by #1571. |
Also, fix the header documentation. Signed-off-by: mulhern <[email protected]>
Also, fix the header documentation. Signed-off-by: mulhern <[email protected]>
This is a rough split, the next step is to induce better encapsulation. Signed-off-by: mulhern <[email protected]>
Set the value in the StaticHeader constructor. This is a value that the StaticHeader stores but the BDA decides. Signed-off-by: mulhern <[email protected]>
This way, it becomes unnecessary to export StaticHeader at all. Signed-off-by: mulhern <[email protected]>
It wipes the static header and nothing else. It improves encapsulation. Signed-off-by: mulhern <[email protected]>
This is really where the property belongs. Note that this means that the test module must import _BDA_STATIC_HDR_SIZE. This is a strong hint that some of the tests now in the bda test module really belong in a static header module. Signed-off-by: mulhern <[email protected]>
For more precision and better encapsulation. Rename or improve the test documentation as appropriate. Signed-off-by: mulhern <[email protected]>
For better encapsulation and more sharing. Signed-off-by: mulhern <[email protected]>
These functions are slightly better at the module level, now that a module exists. The read function just reads some bytes according to the static header geometry. The wipe function just wipes some bytes according to the static header geometry. The setup function does is not an instance method and may or may not actually yield a StaticHeader.
This ensures that it is not possible to use StaticHeader::write to write arbitrary data to the static header location, i.e., our code ensures that the data written represents a valid static header. Signed-off-by: mulhern <[email protected]>
Signed-off-by: mulhern <[email protected]>
mulkieran
force-pushed
the
master-static-header
branch
from
June 20, 2019 15:55
2f63fbb
to
ebd9c39
Compare
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This accomplishes the following:
Better encapsulation:
Better documentation: It is now explicitly stated that all methods that read or write the static header seek to the 0 location before beginning. This was not at all obvious before.
StaticHeader::write is made an instance method, insuring, at the level of the StaticHeader impl, that only a valid signature block can be written to the device by our code. Previously it was necessary to rely on all code that invoked the write method, since the method could take an arbitrary buffer.