filters/truncate/truncate.c
/* Get the size.  As a side effect, calculate the size to serve. */
Get the size.  As a side effect, calculate the size to serve.
Get the size . As a side effect calculate the size to serve .
static int64_t
truncate_get_size (struct nbdkit_next_ops *next_ops, void *nxdata,
                   void *handle)
{
  int64_t r, ret;
  r = next_ops->get_size (nxdata);
  if (r == -1)
    return -1;
  pthread_mutex_lock (&lock);
  real_size = size = r;
  if (truncate_size >= 0)
    size = truncate_size;
  if (round_up > 0)
    size = ROUND_UP (size, round_up);
  if (round_down > 0)
    size = ROUND_DOWN (size, round_down);
  ret = size;
  pthread_mutex_unlock (&lock);
  return ret;
}
static int64_t truncate_get_size ( struct nbdkit_next_ops * next_ops , void * nxdata , void * handle ) { int64_t r , ret ; r = next_ops -> get_size ( nxdata ) ; if ( r == -1 ) return -1 ; pthread_mutex_lock ( & lock ) ; real_size = size = r ; if ( truncate_size >= 0 ) size = truncate_size ; if ( round_up > 0 ) size = ROUND_UP ( size , round_up ) ; if ( round_down > 0 ) size = ROUND_DOWN ( size , round_down ) ; ret = size ; pthread_mutex_unlock ( & lock ) ; return ret ; }
Get the size.
Get the size .
/* The truncate, round-up and round-down parameters are treated as
   * separate operations.  It's possible to specify more than one,
   * although perhaps not very useful.
   */