plugins/nbd/nbd.c
/* Write zeroes to the file. */
Write zeroes to the file.
Write zeroes to the file .
static int
nbd_zero (void *handle, uint32_t count, uint64_t offset, uint32_t flags)
{
  struct handle *h = handle;
  int c;
  int f = 0;
  assert (!(flags & ~(NBDKIT_FLAG_FUA | NBDKIT_FLAG_MAY_TRIM)));
  assert (h->flags & NBD_FLAG_SEND_WRITE_ZEROES);
  if (!(flags & NBDKIT_FLAG_MAY_TRIM))
    f |= NBD_CMD_FLAG_NO_HOLE;
  if (flags & NBDKIT_FLAG_FUA)
    f |= NBD_CMD_FLAG_FUA;
  c = nbd_request (h, f, NBD_CMD_WRITE_ZEROES, offset, count);
  return c < 0 ? c : nbd_reply (h, c);
}
static int nbd_zero ( void * handle , uint32_t count , uint64_t offset , uint32_t flags ) { struct handle * h = handle ; int c ; int f = 0 ; assert ( ! ( flags & ~ ( NBDKIT_FLAG_FUA | NBDKIT_FLAG_MAY_TRIM ) ) ) ; assert ( h -> flags & NBD_FLAG_SEND_WRITE_ZEROES ) ; if ( ! ( flags & NBDKIT_FLAG_MAY_TRIM ) ) f |= NBD_CMD_FLAG_NO_HOLE ; if ( flags & NBDKIT_FLAG_FUA ) f |= NBD_CMD_FLAG_FUA ; c = nbd_request ( h , f , NBD_CMD_WRITE_ZEROES , offset , count ) ; return c < 0 ? c : nbd_reply ( h , c ) ; }
Write zeroes to the file.
Write zeroes to the file .