Closed yadutaf closed 1 year ago
Currently, diskfs attempts to detect the size of a block device using a "seek" based approach. Unfortunately, while this looks generic, it does not work on Mac, at least not in a VM.
Based on the previous commit, this commit adds a Mac and Linux implementation for getting the size of a Block device through IOCTL inspired by https://github.com/tytso/e2fsprogs/blob/master/lib/ext2fs/getsize.c
This was manually tested using a Linux loopback device and in a Mac virtual machine.
Let me know if you'd rather see 2 distinct PRs (one for the refactoring and 1 for the IOCTL)
I like this, no need to split it. I have some questions, going to comment inline.
Thank you!
Currently, diskfs attempts to detect the size of a block device using a "seek" based approach. Unfortunately, while this looks generic, it does not work on Mac, at least not in a VM.
Based on the previous commit, this commit adds a Mac and Linux implementation for getting the size of a Block device through IOCTL inspired by https://github.com/tytso/e2fsprogs/blob/master/lib/ext2fs/getsize.c
This was manually tested using a Linux loopback device and in a Mac virtual machine.