Luna/kernel/src/fs/StorageCache.h
apio 4af337e92d
Some checks are pending
continuous-integration/drone/push Build is running
kernel: Improve the mutex system
2023-09-20 07:05:33 +02:00

38 lines
594 B
C++

#pragma once
#include "lib/Mutex.h"
#include <luna/Buffer.h>
#include <luna/HashMap.h>
#include <luna/LinkedList.h>
class StorageCache : public LinkedListNode<StorageCache>
{
public:
struct CacheEntry
{
Buffer buffer {};
};
void lock()
{
return m_mutex.lock();
}
void unlock()
{
return m_mutex.unlock();
}
Result<CacheEntry*> fetch_entry(u64 block);
void clear();
static void clear_caches();
StorageCache();
~StorageCache();
private:
HashMap<u64, CacheEntry> m_cache_entries;
Mutex m_mutex;
};