Commit fa7a1a57 authored by Vladislav Vaintroub's avatar Vladislav Vaintroub

Windows : small optimization in os_is_sparse_file_supported()

Use GetFileInformationByHandleEx with FileAttributeTagInfo to query whether
the file is sparse. This saves 1 syscall, as GetFileInformationByHandle()
would additionally query volume info.
parent ff2d9e12
...@@ -5639,10 +5639,11 @@ os_is_sparse_file_supported(os_file_t fh) ...@@ -5639,10 +5639,11 @@ os_is_sparse_file_supported(os_file_t fh)
); );
#ifdef _WIN32 #ifdef _WIN32
BY_HANDLE_FILE_INFORMATION info; FILE_ATTRIBUTE_TAG_INFO info;
if (GetFileInformationByHandle(fh,&info)) { if (GetFileInformationByHandleEx(fh, FileAttributeTagInfo,
if (info.dwFileAttributes != INVALID_FILE_ATTRIBUTES) { &info, (DWORD)sizeof(info))) {
return (info.dwFileAttributes & FILE_ATTRIBUTE_SPARSE_FILE) != 0; if (info.FileAttributes != INVALID_FILE_ATTRIBUTES) {
return (info.FileAttributes & FILE_ATTRIBUTE_SPARSE_FILE) != 0;
} }
} }
return false; return false;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment