FreeBSD/sys/kern/kern_sendfile.c
/*
 * Helper function used when allocation of a page or sf_buf failed.
 * Pretend as if we don't have enough space, subtract xfsize() of
 * all pages that failed.
 */
Helper function used when allocation of a page or sf_buf failed.
Pretend as if we don't have enough space, subtract xfsize() of
all pages that failed.
Helper function used when allocation of a page or sf_buf failed . Pretend as if we don ' t have enough space subtract xfsize () of all pages that failed .
static inline void
fixspace(int old, int new, off_t off, int *space)
{
	KASSERT(old > new, ("%s: old %d new %d", __func__, old, new));
	*space -= xfsize(old - 1, old, off, *space);
	old--;
	if (new == old)
		return;
	if (new == 0) {
		*space -= xfsize(0, old, off, *space);
		new++;
	}
	*space -= (old - new) * PAGE_SIZE;
	KASSERT(*space >= 0, ("%s: space went backwards", __func__));
}
static inline void fixspace ( int old , int new , off_t off , int * space ) { KASSERT ( old > new , ( " " , __func__ , old , new ) ) ; * space -= xfsize ( old - 1 , old , off , * space ) ; old -- ; if ( new == old ) return ; if ( new == 0 ) { * space -= xfsize ( 0 , old , off , * space ) ; new ++ ; } * space -= ( old - new ) * PAGE_SIZE ; KASSERT ( * space >= 0 , ( " " , __func__ ) ) ; }
Helper function used when allocation of a page or sf_buf failed.
Helper function used when allocation of a page or sf_buf failed .
/* Subtract last one. */ /* There was only one page. */ /* Subtract first one. */ /* Rest of pages are full sized. */