1/* 2 * Copyright 2004-2005, Axel D��rfler, axeld@pinc-software.de. All rights reserved. 3 * Distributed under the terms of the MIT License. 4 */ 5#ifndef BLOCK_MAP_H 6#define BLOCK_MAP_H 7 8 9#include <OS.h> 10#include <util/khash.h> 11 12 13class BlockMap { 14 public: 15 BlockMap(off_t size); 16 ~BlockMap(); 17 18 status_t InitCheck() const; 19 20 void SetSize(off_t size); 21 off_t Size() const { return fSize; } 22 23 status_t Remove(off_t offset, off_t count = 1); 24 status_t Set(off_t offset, addr_t address); 25 status_t Get(off_t offset, addr_t &address); 26 27 private: 28 struct block_entry; 29 status_t GetBlockEntry(off_t offset, block_entry **_entry); 30 31 hash_table *fHashTable; 32 off_t fSize; 33}; 34 35#endif /* BLOCK_MAP_H */ 36