Storage: Windows compatibility layer for the file port (WIP)

POSIX shims over the Windows CRT for the storage file port: statvfs ->
GetDiskFreeSpaceExW, flock -> LockFileEx, pread/pwrite -> serialized
seek+read/write, rename -> MoveFileExW replace, link -> CreateHardLinkW,
fsync -> FlushFileBuffers, directory opens via handle-backed descriptors,
and O_NOFOLLOW enforced through reparse-point checks.

Void_Storage and its tests build for Windows; the remaining failures are
being worked through before Storage is allowlisted. Refs #65.
This commit is contained in:
faumaray committed 2026-12-06 02:14:11 +03:00
1 parent de1fdcda72
commit 9fd07127fb
2 files changed
+272 -2

No files matched your search

+8
View File
@@ -911,7 +911,15 @@ Void::Testing::Test storage_file_port_space_link_noreplace_and_no_follow()
Void::Testing::require((*file)->close().has_value());
}
const auto symlink_path = dir.path / "symlink";
#ifdef _WIN32
std::error_code symlink_ec;
std::filesystem::create_symlink(target, symlink_path, symlink_ec);
if (symlink_ec) {
Void::Testing::skip("symlink creation is not permitted");
}
#else
Void::Testing::require(::symlink(target.c_str(), symlink_path.c_str()) == 0);
#endif
Void::Testing::expect(
!port->open_file(symlink_path, FileOpenMode::ReadOnly).has_value());
}