Virtio: Difference between revisions

[unchecked revision][unchecked revision]
Content deleted Content added
Added Block VirtIO device details
Line 158:
 
Note: The only way that I could get the VirtIO Network device to work was to separate this header and the network packet data into two separate buffers, and to link them together using the Next field. I can't find anything about having to split these buffers in the Virtio documentation, so I'm not sure if it is entirely necessary or not.
 
=== Block Device Packets ===
 
Each block device request placed in a buffer must be filled with a VirtIO Block Request record.
 
<source lang="c">
 
struct BlockRequest
{
int Type; // 0:Read 1:Write
int Priority; // 0:Low
long Sector;
byte[255] Data;
byte Status; // 0:OK 1:Error 2:Unsupported
}
 
</source>
 
Note: Since the BlockRequest structure contains both read-only and write-only fields, it may be necessary to split this structure up into multiple buffers. The Type, Priority and Sector fields should be placed in a Read-Only buffer, and the Data and Status fields should be placed in a Write-Only buffer. The buffers will need to be linked together using the Next field.
 
 
[[Category:Virtual]]