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)
);
#ifdef _WIN32
BY_HANDLE_FILE_INFORMATION info;
if (GetFileInformationByHandle(fh,&info)) {
if (info.dwFileAttributes != INVALID_FILE_ATTRIBUTES) {
return (info.dwFileAttributes & FILE_ATTRIBUTE_SPARSE_FILE) != 0;
FILE_ATTRIBUTE_TAG_INFO info;
if (GetFileInformationByHandleEx(fh, FileAttributeTagInfo,
&info, (DWORD)sizeof(info))) {
if (info.FileAttributes != INVALID_FILE_ATTRIBUTES) {
return (info.FileAttributes & FILE_ATTRIBUTE_SPARSE_FILE) != 0;
}
}
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