Write to FD. Write data consisting of N_BYTES' worth of '\0's. Use the buffer *ABUF of size BUF_SIZE for temporary storage, allocating the buffer lazily if *ABUF is null. Return true if successful, false (setting errno) otherwise. */
| 280 | allocating the buffer lazily if *ABUF is null. |
| 281 | Return true if successful, false (setting errno) otherwise. */ |
| 282 | static bool |
| 283 | write_zeros (int fd, off_t n_bytes, char **abuf, idx_t buf_size) |
| 284 | { |
| 285 | char *zeros = NULL; |
| 286 | while (n_bytes) |
| 287 | { |
| 288 | idx_t n = MIN (buf_size, n_bytes); |
| 289 | if (!zeros) |
| 290 | { |
| 291 | if (!*abuf) |
| 292 | *abuf = xalignalloc (getpagesize (), buf_size); |
| 293 | zeros = memset (*abuf, 0, n); |
| 294 | } |
| 295 | if (full_write (fd, zeros, n) != n) |
| 296 | return false; |
| 297 | n_bytes -= n; |
| 298 | } |
| 299 | |
| 300 | return true; |
| 301 | } |
| 302 | |
| 303 | #ifdef SEEK_HOLE |
| 304 | /* Perform an efficient extent copy, if possible. This avoids |
no outgoing calls
no test coverage detected