-
Notifications
You must be signed in to change notification settings - Fork 794
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
Fixes to use lfs_filebd on windows platforms #643
Fixes to use lfs_filebd on windows platforms #643
Conversation
There are two issues, when using the file-based block device emulation on Windows Platforms: 1. There is no fsync implementation available. This needs to be mapped to a Windows-specific FlushFileBuffers system call. 2. The block device file needs to be opened as binary file (O_BINARY) The corresponding flag is not required for Linux.
Hi @m8ddin, thanks for the PR. A request, could these be changed to explicit ifdef statements?
This would just help future work to know what exact idiosyncrasies are required for each platform. I also want to highlight that we can't easily test these platform specific changes in CI, so future regressions are possible. This unfortunately may break in the future without warning. |
Hi @geky ! |
51b5cb4
to
4ac607a
Compare
Hi @m8ddin, thanks for the update. Sorry, I meant that each platform specific function should be an ifdef, both the #ifdef _WIN32
int err = FlushFileBuffers((HANDLE)_get_osfhandle(bd->fd)) ? 0 : -1;
#else
int err = fsync(bd->fd);
#endif |
Makes sense 👍 |
Thanks for this! I will bring this in next minor release, which shouldn't be too far away. |
Fixes to use lfs_filebd on windows platforms
There are two issues, when using the file-based block device emulation
on Windows Platforms:
to a Windows-specific FlushFileBuffers system call.
The corresponding flag is not required for Linux.