/* Allocate an (aligned) area in the buffer. This is called under b_lock. Returns ~0 on failure.  */
static unsigned int mon_buff_area_alloc(struct mon_reader_bin *rp, unsigned int size)
/* Allocate an (aligned) area in the buffer. This is called under b_lock. Returns ~0 on failure.  */
static unsigned int mon_buff_area_alloc(struct mon_reader_bin *rp, unsigned int size)
{
	unsigned int offset;
	size = (size + PKT_ALIGN-1) & ~(PKT_ALIGN-1);
	if (rp->b_cnt + size > rp->b_size)
		return ~0;
	offset = rp->b_in;
	rp->b_cnt += size;
	if ((rp->b_in += size) >= rp->b_size)
		rp->b_in -= rp->b_size;
	return offset;
}