FreeBSD/sys/dev/hyperv/vmbus/hv_ring_buffer.c
/**
 * @brief Initialize the ring buffer.
 */
@brief Initialize the ring buffer.
@brief Initialize the ring buffer .
int
hv_vmbus_ring_buffer_init(
	hv_vmbus_ring_buffer_info*	ring_info,
	void*				buffer,
	uint32_t			buffer_len)
{
	memset(ring_info, 0, sizeof(hv_vmbus_ring_buffer_info));
	ring_info->ring_buffer = (hv_vmbus_ring_buffer*) buffer;
	ring_info->ring_buffer->read_index =
	    ring_info->ring_buffer->write_index = 0;
	ring_info->ring_size = buffer_len;
	ring_info->ring_data_size = buffer_len - sizeof(hv_vmbus_ring_buffer);
	mtx_init(&ring_info->ring_lock, "vmbus ring buffer", NULL, MTX_SPIN);
	return (0);
}
int hv_vmbus_ring_buffer_init ( hv_vmbus_ring_buffer_info * ring_info , void * buffer , uint32_t buffer_len ) { memset ( ring_info , 0 , sizeof ( hv_vmbus_ring_buffer_info ) ) ; ring_info -> ring_buffer = ( hv_vmbus_ring_buffer * ) buffer ; ring_info -> ring_buffer -> read_index = ring_info -> ring_buffer -> write_index = 0 ; ring_info -> ring_size = buffer_len ; ring_info -> ring_data_size = buffer_len - sizeof ( hv_vmbus_ring_buffer ) ; mtx_init ( & ring_info -> ring_lock , " " , NULL , MTX_SPIN ) ; return ( 0 ) ; }
@brief Initialize the ring buffer.
@brief Initialize the ring buffer .