FreeBSD/sys/dev/hyperv/vmbus/hv_channel.c
/**
 * @brief Retrieve the raw packet on the specified channel
 */
@brief Retrieve the raw packet on the specified channel
@brief Retrieve the raw packet on the specified channel
int
hv_vmbus_channel_recv_packet_raw(
	hv_vmbus_channel*	channel,
	void*			buffer,
	uint32_t		buffer_len,
	uint32_t*		buffer_actual_len,
	uint64_t*		request_id)
{
	int		ret;
	uint32_t	packetLen;
	hv_vm_packet_descriptor	desc;
	*buffer_actual_len = 0;
	*request_id = 0;
	ret = hv_ring_buffer_peek(
		&channel->inbound, &desc,
		sizeof(hv_vm_packet_descriptor));
	if (ret != 0)
	    return (0);
	packetLen = desc.length8 << 3;
	*buffer_actual_len = packetLen;
	if (packetLen > buffer_len)
	    return (ENOBUFS);
	*request_id = desc.transaction_id;
	ret = hv_ring_buffer_read(&channel->inbound, buffer, packetLen, 0);
	return (0);
}
int hv_vmbus_channel_recv_packet_raw ( hv_vmbus_channel * channel , void * buffer , uint32_t buffer_len , uint32_t * buffer_actual_len , uint64_t * request_id ) { int ret ; uint32_t packetLen ; hv_vm_packet_descriptor desc ; * buffer_actual_len = 0 ; * request_id = 0 ; ret = hv_ring_buffer_peek ( & channel -> inbound , & desc , sizeof ( hv_vm_packet_descriptor ) ) ; if ( ret != 0 ) return ( 0 ) ; packetLen = desc . length8 << 3 ; * buffer_actual_len = packetLen ; if ( packetLen > buffer_len ) return ( ENOBUFS ) ; * request_id = desc . transaction_id ; ret = hv_ring_buffer_read ( & channel -> inbound , buffer , packetLen , 0 ) ; return ( 0 ) ; }
@brief Retrieve the raw packet on the specified channel
@brief Retrieve the raw packet on the specified channel
/* Copy over the entire packet to the user buffer */