Closed Fanael closed 9 years ago
This seems like a worthy thing to add. However, even so, there's a few style issues I'd like to see resolved before I'll merge this:
AC_DEFINE
something if it's there, and #ifdef
on that rather than on __CYGWIN__
.punch_hole
function unconditionally, having it do nothing if we have no API, rather than to #ifdef
twice (that, or keep the code where it is now with no extra function).Other than that, looks good.
In keeping with the autoconf philosophy of testing for features, not operating systems, I'd prefer if you could add a configure test for this API call.
Done.
I'm thinking it would be easier to follow the code if we call this
punch_hole
function unconditionally, having it do nothing if we have no API
Sure.
It's done by using Win32's FSCTL_SET_ZERO_DATA ioctl.
Despite the name, FSCTL_SET_ZERO_DATA is the right API to punch holes on Windows, even on non-sparse files: I can easily punch a 10 GB hole in milliseconds, which wouldn't be achievable if this ioctl were just writing zeros in a loop.
This ioctl is supported since (I think) Windows 2000, so basically available everywhere.