Disk Driver Interface Definitions.
All addreses are 64-bit counts of bytes from the logical beginning of the disk unless explicitly stated.
Disk drivers have a flexible directory layout. The root directory can contain subdirectories, with the only conditions being that all nodes must support eTplDrv_IOCtl with DRV_IOCTL_TYPE returning DRV_TYPE_DISK. And all file nodes representing disk devices (or partitions) and implemeting eTplDisk_IOCtl fully
When a read or write occurs on a normal file in the disk driver it will read/write the represented device. The accesses need not be aligned to the block size, however aligned reads/writes should be handled specially to improve speed (this can be aided by using DrvUtil_ReadBlock and DrvUtil_WriteBlock)
Go to the source code of this file.
Data Structures | |
struct | tTplDisk_CacheRegion |
Describes the cache parameters of a region on the disk. More... | |
Defines | |
#define | DRV_DISK_IOCTLNAMES "get_block_size","set_cache_region","set_precache" |
IOCtl name strings. | |
Enumerations | |
enum | eTplDisk_IOCtl { DISK_IOCTL_GETBLOCKSIZE = 4, DISK_IOCTL_SETCACHEREGION, DISK_IOCTL_PRECACHE, DISK_IOCTL_FLUSH } |
Common Disk IOCtl Calls. More... | |
enum | eTplDisk_CacheProtocols { DISK_CACHEPROTO_DONTCACHE, DISK_CACHEPROTO_RECENTLYUSED, DISK_CACHEPROTO_FULLCACHE, DISK_CACHEPROTO_EXPLICIT } |
Cache protocols to use. More... | |
enum | eTplDisk_CacheFlags { DISK_CACHEFLAG_WRITETHROUGH = 0x10 } |
Flags for the cache. More... | |
Disk Driver Utilities | |
| |
typedef Uint(* | tDrvUtil_Callback )(Uint64 Address, Uint Count, void *Buffer, Uint Argument) |
Callback function type used by DrvUtil_ReadBlock and DrvUtil_WriteBlock. | |
Uint64 | DrvUtil_ReadBlock (Uint64 Start, Uint64 Length, void *Buffer, tDrvUtil_Callback ReadBlocks, Uint64 BlockSize, Uint Argument) |
Reads a range from a block device using aligned reads. | |
Uint64 | DrvUtil_WriteBlock (Uint64 Start, Uint64 Length, void *Buffer, tDrvUtil_Callback ReadBlocks, tDrvUtil_Callback WriteBlocks, Uint64 BlockSize, Uint Argument) |
Writes a range to a block device using aligned writes. |
typedef Uint(* tDrvUtil_Callback)(Uint64 Address, Uint Count, void *Buffer, Uint Argument) |
Callback function type used by DrvUtil_ReadBlock and DrvUtil_WriteBlock.
Address | Zero based block number to read | |
Count | Number of blocks to read | |
Buffer | Destination for read blocks | |
Argument | Argument provided in DrvUtil_ReadBlock and DrvUtil_WriteBlock |
enum eTplDisk_CacheFlags |
Cache protocols to use.
DISK_CACHEPROTO_DONTCACHE |
Don't cache the region. |
DISK_CACHEPROTO_RECENTLYUSED |
Most recently used blocks cached.
|
DISK_CACHEPROTO_FULLCACHE |
Cache the entire region in memory. This is a faster version of setting Length to CacheSize*BlockSize |
DISK_CACHEPROTO_EXPLICIT |
Cache only on demand. Only cache when the DISK_IOCTL_PRECACHE IOCtl is used |
enum eTplDisk_IOCtl |
Common Disk IOCtl Calls.
DISK_IOCTL_GETBLOCKSIZE |
Get the block size. ioctl(..., void)
| |||
DISK_IOCTL_SETCACHEREGION |
Sets the cache importantce and protocol for a section of memory. ioctl(..., tTplDisk_CacheRegion *RegionInfo)
| |||
DISK_IOCTL_PRECACHE |
Asks the driver to precache a region of disk. ioctl(..., Uint64 *Info[2])
| |||
DISK_IOCTL_FLUSH |
Asks to driver to flush the region back to disk. ioclt(..., Uint64 *Region[2])
|
Uint64 DrvUtil_ReadBlock | ( | Uint64 | Start, | |
Uint64 | Length, | |||
void * | Buffer, | |||
tDrvUtil_Callback | ReadBlocks, | |||
Uint64 | BlockSize, | |||
Uint | Argument | |||
) |
Reads a range from a block device using aligned reads.
Start | Base byte offset | |
Length | Number of bytes to read | |
Buffer | Destination for read data | |
ReadBlocks | Callback function to read a sequence of blocks | |
BlockSize | Size of an individual block | |
Argument | An argument to pass to ReadBlocks |
Uint64 DrvUtil_WriteBlock | ( | Uint64 | Start, | |
Uint64 | Length, | |||
void * | Buffer, | |||
tDrvUtil_Callback | ReadBlocks, | |||
tDrvUtil_Callback | WriteBlocks, | |||
Uint64 | BlockSize, | |||
Uint | Argument | |||
) |
Writes a range to a block device using aligned writes.
Start | Base byte offset | |
Length | Number of bytes to write | |
Buffer | Destination for read data | |
ReadBlocks | Callback function to read a sequence of blocks | |
WriteBlocks | Callback function to write a sequence of blocks | |
BlockSize | Size of an individual block | |
Argument | An argument to pass to ReadBlocks and WriteBlocks |