diff options
author | Corinna Vinschen <corinna@vinschen.de> | 2023-11-28 12:42:52 +0300 |
---|---|---|
committer | Corinna Vinschen <corinna@vinschen.de> | 2023-11-28 12:55:38 +0300 |
commit | 65831f88d6c4cd943969b5ee531bc6162c7b0f60 (patch) | |
tree | 11b0b37fb95d53171d0f10df0d6a6d9812ad6b67 /winsup/cygwin/local_includes/ntdll.h | |
parent | f64f3eced8e0f51753bc199f3ba96fab06a54848 (diff) |
Cygwin: fallocate(2): handle FALLOC_FL_PUNCH_HOLE and FALLOC_FL_ZERO_RANGE
Split fhandler_disk_file::fallocate into multiple methods, each
implementing a different aspect of fallocate(2), thus adding
FALLOC_FL_PUNCH_HOLE and FALLOC_FL_ZERO_RANGE handling.
For more correctly implementing posix_fallocate(3) semantics, make
sure to re-allocate holes in the given range if the file is sparse.
While at it, change the way checking when to make a file sparse.
The rule is now, make file sparse if the hole created by the action
spans at least one sparse block, taking the allocation granularity
of sparse files into account.
Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
Diffstat (limited to 'winsup/cygwin/local_includes/ntdll.h')
-rw-r--r-- | winsup/cygwin/local_includes/ntdll.h | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/winsup/cygwin/local_includes/ntdll.h b/winsup/cygwin/local_includes/ntdll.h index a1a9f7f8d..a9ccd16a9 100644 --- a/winsup/cygwin/local_includes/ntdll.h +++ b/winsup/cygwin/local_includes/ntdll.h @@ -45,6 +45,9 @@ extern GUID __cygwin_socket_guid; #define FILE_WRITE_TO_END_OF_FILE (-1LL) #define FILE_USE_FILE_POINTER_POSITION (-2LL) +/* Sparsification granularity on NTFS. */ +#define FILE_SPARSE_GRANULARITY (64 * 1024) + /* Device Characteristics. */ #define FILE_REMOVABLE_MEDIA 0x00000001 #define FILE_READ_ONLY_DEVICE 0x00000002 @@ -390,6 +393,11 @@ typedef struct _FILE_ALL_INFORMATION { // 18 FILE_NAME_INFORMATION NameInformation; } FILE_ALL_INFORMATION, *PFILE_ALL_INFORMATION; +typedef struct _FILE_ALLOCATION_INFORMATION // 19 +{ + LARGE_INTEGER AllocationSize; +} FILE_ALLOCATION_INFORMATION, *PFILE_ALLOCATION_INFORMATION; + typedef struct _FILE_END_OF_FILE_INFORMATION // 20 { LARGE_INTEGER EndOfFile; |