|
|
ColdStore Mmap manager
Mmap maintains the store, providing
const size_t max |
maximum size of store (page aligned)
const size_t page_size |
underlying page size of store (power of 2)
bool initialized |
flag: is Mmap initialized?
size_t open ( int fd) |
Mmap the file as a store.
Parameters:
fd | file descriptor of open store |
Returns: current size of store
int open (char *file) |
Open and Mmap the named file as a store.
Parameters:
file | file name |
Returns: file descriptor of open store
void close ( int fd) |
close the Mmap
Parameters:
fd | file descriptor of open store |
void* alloc ( size_t size) |
Allocate a range of pages in the store
Parameters:
size | size of allocation |
Returns: allocated region
int check ( void* ptr) |
check the validity of a pointer
Parameters:
ptr | pointer to be checked |
Returns: true if the pointer is in the Mmap
size_t align ( size_t size) |
align a value to a page boundary
Parameters:
size | value to align |
Returns: page-aligned value
void* pageof ( void* ptr) |
return the page which contains a pointer
Parameters:
ptr | pointer to align |
Returns: page-aligned pointer