int SectorSize;
tMutex Lock;
int Mode;
- Uint32 ID;
+ void *ID;
tIOCache_WriteCallback Write;
int CacheSize;
int CacheUsed;
* \fn tIOCache *IOCache_Create( tIOCache_WriteCallback Write, Uint32 ID, int SectorSize, int CacheSize )
* \brief Creates a new IO Cache
*/
-tIOCache *IOCache_Create( tIOCache_WriteCallback Write, Uint32 ID, int SectorSize, int CacheSize )
+tIOCache *IOCache_Create( tIOCache_WriteCallback Write, void *ID, int SectorSize, int CacheSize )
{
tIOCache *ret = calloc( 1, sizeof(tIOCache) );
* \fn int IOCache_Add( tIOCache *Cache, Uint64 Sector, void *Buffer )
* \brief Cache a sector
*/
-int IOCache_Add( tIOCache *Cache, Uint64 Sector, void *Buffer )
+int IOCache_Add( tIOCache *Cache, Uint64 Sector, const void *Buffer )
{
tIOCache_Ent *ent, *prev;
tIOCache_Ent *new;
* \fn int IOCache_Write( tIOCache *Cache, Uint64 Sector, void *Buffer )
* \brief Read from a cached sector
*/
-int IOCache_Write( tIOCache *Cache, Uint64 Sector, void *Buffer )
+int IOCache_Write( tIOCache *Cache, Uint64 Sector, const void *Buffer )
{
tIOCache_Ent *ent;
*
* Called to write a sector back to the device
*/
-typedef int (*tIOCache_WriteCallback)(Uint32 ID, Uint64 Sector, void *Buffer);
+typedef int (*tIOCache_WriteCallback)(void *ID, Uint64 Sector, const void *Buffer);
// === CONSTANTS ===
/**
* \param SectorSize Size of a cached sector
* \param CacheSize Maximum number of objects that can be in the cache at one time
*/
-tIOCache *IOCache_Create( tIOCache_WriteCallback Write, Uint32 ID, int SectorSize, int CacheSize );
+extern tIOCache *IOCache_Create( tIOCache_WriteCallback Write, void *ID, int SectorSize, int CacheSize );
/**
* \brief Reads from a cached sector
* \param Buffer Destination for the data read
* \return 1 if the data was read, 0 if the sector is not cached, -1 on error
*/
- int IOCache_Read( tIOCache *Cache, Uint64 Sector, void *Buffer );
+extern int IOCache_Read( tIOCache *Cache, Uint64 Sector, void *Buffer );
/**
* \brief Adds a sector to the cache
* \param Buffer Data to cache
* \return 1 on success, 0 if the sector is already cached, -1 on error
*/
- int IOCache_Add( tIOCache *Cache, Uint64 Sector, void *Buffer );
+extern int IOCache_Add( tIOCache *Cache, Uint64 Sector, const void *Buffer );
/**
* \brief Writes to a cached sector
* Wether the Write callback is called depends on the selected caching
* behaviour.
*/
- int IOCache_Write( tIOCache *Cache, Uint64 Sector, void *Buffer );
+extern int IOCache_Write( tIOCache *Cache, Uint64 Sector, const void *Buffer );
/**
* \brief Flush altered sectors out to the device
* This will call the cache's write callback on each altered sector
* to flush the write cache.
*/
-void IOCache_Flush( tIOCache *Cache );
+extern void IOCache_Flush( tIOCache *Cache );
/**
* \brief Flushes the cache and then removes it
* IOCache_Destroy writes all changed sectors to the device and then
* deallocates the cache for other systems to use.
*/
-void IOCache_Destroy( tIOCache *Cache );
+extern void IOCache_Destroy( tIOCache *Cache );
#endif