Closed TheEndHunter closed 3 months ago
Great work! I have a few things though that I want you to consider before we move forward with this.
LeaveBlocksAllocated
flag to Fixed
. The issue I have we it though, is that it makes it more difficult to follow how the implementation corresponds to official VHDX format specification, where the flag is called LeaveBlockAllocated
. So I suggest that we do not rename this flag.Great work! I have a few things though that I want you to consider before we move forward with this.
- I do not want to require preview versions of SDK to build the code in this repository. We could add .NET 9.0 to the builds, but then we should do that in a separate branch so that it does not get built automatically when building nuget packages etc. So, I would suggest that you put .NET 9.0 related changes in a separate pull request.
No problem, I do understand that, will pull that change into its own branch.
- I understand that it might make the code easier to read if we rename
LeaveBlocksAllocated
flag toFixed
. The issue I have we it though, is that it makes it more difficult to follow how the implementation corresponds to official VHDX format specification, where the flag is calledLeaveBlockAllocated
. So I suggest that we do not rename this flag.
I will make this change back and probably just add some comments to each enum for clarity instead.
As for tests, are there any additional test you can think of that may need to be added for this?
The only ones I can think of are to make sure it doesn't try to shrink or grow the vhdx file when it is initialized fixed, but I'm not familiar with the code base as a whole yet, so I may already be covered by another check.
Thanks! I will check out the code tomorrow and take a look at the test cases as well!
I have pushed the changes over. Let me know if you need any more changes.
There seems to be something wrong with the implementation. When I run VHDXCreate -t fixed -sz 2GB test.vhdx
, I get a vhdx file that is just 4 MB in physical size. The virtual size is okay though, and the file seems correct in other aspects and it does not shrink when filled with data and then trimmed afterwards. So, it actually creates a dynamically allocated vhdx that can only grow and never shrink, not a vhdx with entire size allocated from start.
If you create a 2 GB fixed size vhdx file in Disk Management in Windows, you get a 2 GB fixed allocated vhdx file.
There seems to be something wrong with the implementation. When I run
VHDXCreate -t fixed -sz 2GB test.vhdx
, I get a vhdx file that is just 4 MB in physical size. The virtual size is okay though, and the file seems correct in other aspects and it does not shrink when filled with data and then trimmed afterwards. So, it actually creates a dynamically allocated vhdx that can only grow and never shrink, not a vhdx with entire size allocated from start.If you create a 2 GB fixed size vhdx file in Disk Management in Windows, you get a 2 GB fixed allocated vhdx file.
I am working on a fix now, turns out i missed setting the fileEnd from OneMiB to capacity, also had to make a few other changes for the tests as they tried to allocate 16GB of memory to a fixed disk once i fixed the issue.
checked the VHDXCreate -t fixed -sz 2GB test.vhdx (and 4GB) both worked
I'll be pushing the changes up soon
Thanks a lot for your contribution! Much appreciated! 👍
Thanks a lot for your contribution! Much appreciated! 👍
Thanks, always happy to contribute where I can, especially when I use this project for a hobby project of my own.
Implemented VHDX Fixed Disk Initialization code (May need to add additional Tests for more coverage as needed, let me know) Made some changes to allow newer packages versions in the Library Tests Project.
All Tests are passing across all framework versions supported as it currently stands,.
I would like another pair of eyes(or two) to double check, just to make sure i didn't do anything bad,