include/llfio/v2.0/file_handle.hpp
/*! \brief Efficiently zero, and possibly deallocate, data on storage.

On most major operating systems and with recent filing systems which are "extents based", one can
deallocate the physical storage of a file, causing the space deallocated to appear all bits zero.
This call attempts to deallocate whole pages (usually 4Kb) entirely, and memset's any excess to all
bits zero. This call works on most Linux filing systems with a recent kernel, Microsoft Windows
with NTFS, and FreeBSD with ZFS. On other systems it simply writes zeros.

\return The bytes zeroed.
\param self The object whose member function to call.
\param offset The offset to start zeroing from.
\param bytes The number of bytes to zero.
\param d An optional deadline by which the i/o must complete, else it is cancelled.
Note function may return significantly after this deadline if the i/o takes long to cancel.
\errors Any of the values POSIX write() can return, `errc::timed_out`, `errc::operation_canceled`. `errc::not_supported` may be
returned if deadline i/o is not possible with this particular handle configuration (e.g.
writing to regular files on POSIX or writing to a non-overlapped HANDLE on Windows).
\mallocs The default synchronous implementation in file_handle performs no memory allocation.
*/
\brief Efficiently zero, and possibly deallocate, data on storage.
On most major operating systems and with recent filing systems which are "extents based", one can
deallocate the physical storage of a file, causing the space deallocated to appear all bits zero.
This call attempts to deallocate whole pages (usually 4Kb) entirely, and memset's any excess to all
bits zero. This call works on most Linux filing systems with a recent kernel, Microsoft Windows
with NTFS, and FreeBSD with ZFS. On other systems it simply writes zeros.

\return The bytes zeroed.
\param self The object whose member function to call.
\param offset The offset to start zeroing from.
\param bytes The number of bytes to zero.
\param d An optional deadline by which the i/o must complete, else it is cancelled.
Note function may return significantly after this deadline if the i/o takes long to cancel.
\errors Any of the values POSIX write() can return, `errc::timed_out`, `errc::operation_canceled`. `errc::not_supported` may be
returned if deadline i/o is not possible with this particular handle configuration .
\mallocs The default synchronous implementation in file_handle performs no memory allocation.
\ brief Efficiently zero and possibly deallocate data on storage . On most major operating systems and with recent filing systems which are " extents based " one can deallocate the physical storage of a file causing the space deallocated to appear all bits zero . This call attempts to deallocate whole pages ( usually 4Kb ) entirely and memset ' s any excess to all bits zero . This call works on most Linux filing systems with a recent kernel Microsoft Windows with NTFS and FreeBSD with ZFS . On other systems it simply writes zeros . \ return The bytes zeroed . \ param self The object whose member function to call . \ param offset The offset to start zeroing from . \ param bytes The number of bytes to zero . \ param d An optional deadline by which the i / o must complete else it is cancelled . Note function may return significantly after this deadline if the i / o takes long to cancel . \ errors Any of the values POSIX write () can return ` errc :: timed_out ` ` errc :: operation_canceled ` . ` errc :: not_supported ` may be returned if deadline i / o is not possible with this particular handle configuration . \ mallocs The default synchronous implementation in file_handle performs no memory allocation .
inline result<file_handle::extent_type> zero(file_handle &self, file_handle::extent_type offset, file_handle::extent_type bytes,
                                             deadline d = deadline()) noexcept
{
  return self.zero(std::forward<decltype(offset)>(offset), std::forward<decltype(bytes)>(bytes), std::forward<decltype(d)>(d));
}
inline result < file_handle :: extent_type > zero ( file_handle & self , file_handle :: extent_type offset , file_handle :: extent_type bytes , deadline d = deadline ( ) ) noexcept { return self . zero ( std :: forward < decltype ( offset ) > ( offset ) , std :: forward < decltype ( bytes ) > ( bytes ) , std :: forward < decltype ( d ) > ( d ) ) ; }
\brief Efficiently zero, and possibly deallocate, data on storage.
\ brief Efficiently zero and possibly deallocate data on storage .