metal-cos/sys/include/diskcache.h

24 lines
616 B
C

#ifndef __SYS_DISKCACHE_H__
#define __SYS_DISKCACHE_H__
#include <sys/queue.h>
typedef struct DiskCacheEntry {
Disk *disk;
uint64_t diskOffset;
uint64_t refCount;
void *buffer;
TAILQ_ENTRY(DiskCacheEntry) htEntry;
TAILQ_ENTRY(DiskCacheEntry) lruEntry;
} DiskCacheEntry;
void DiskCache_Init();
int DiskCache_Alloc(Disk *disk, uint64_t diskOffset, DiskCacheEntry **entry);
void DiskCache_Release(DiskCacheEntry *entry);
int DiskCache_Read(Disk *disk, uint64_t diskOffset, DiskCacheEntry **entry);
int DiskCache_Write(DiskCacheEntry *entry);
#endif /* __SYS_DISKCACHE_H__ */