FreeBSD/sys/netpfil/ipfw/ip_fw_sockopt.c
/*
 * Ensures that @sd buffer has contiguous @neeeded number of
 * bytes.
 *
 * Returns pointer to requested space or NULL.
 */
Ensures that @sd buffer has contiguous @neeeded number of
bytes.

Returns pointer to requested space or NULL.
Ensures that @sd buffer has contiguous @neeeded number of bytes . Returns pointer to requested space or NULL .
caddr_t
ipfw_get_sopt_space(struct sockopt_data *sd, size_t needed)
{
	int error;
	caddr_t addr;
	if (sd->kavail < needed) {
		error = ipfw_flush_sopt_data(sd);
		if (sd->kavail < needed || error != 0)
			return (NULL);
	}
	addr = sd->kbuf + sd->koff;
	sd->koff += needed;
	sd->kavail -= needed;
	return (addr);
}
caddr_t ipfw_get_sopt_space ( struct sockopt_data * sd , size_t needed ) { int error ; caddr_t addr ; if ( sd -> kavail < needed ) { error = ipfw_flush_sopt_data ( sd ) ; if ( sd -> kavail < needed || error != 0 ) return ( NULL ) ; } addr = sd -> kbuf + sd -> koff ; sd -> koff += needed ; sd -> kavail -= needed ; return ( addr ) ; }
Ensures that @sd buffer has contiguous @neeeded number of
 bytes.
Ensures that @sd buffer has contiguous @neeeded number of bytes .
/*
		 * Flush data and try another time.
		 */