2019-02-01 13:54:59 -05:00
|
|
|
#include <stdlib.h>
|
|
|
|
#include <stdio.h>
|
|
|
|
#include <memkind.h>
|
|
|
|
#include <sys/ioctl.h>
|
|
|
|
#include <linux/fs.h>
|
|
|
|
#include <unistd.h>
|
|
|
|
#include <inttypes.h>
|
|
|
|
#include "storage.h"
|
|
|
|
#include <assert.h>
|
2019-02-04 16:56:13 -05:00
|
|
|
#include <malloc.h>
|
2019-02-01 13:54:59 -05:00
|
|
|
|
|
|
|
// initialize the memory subsystem.
|
|
|
|
// NOTE: This may be called twice, first with NULL specifying we should use ram
|
|
|
|
// later, after the configuration file is loaded with a path to where we should
|
|
|
|
// place our temporary file.
|
2019-02-04 16:56:13 -05:00
|
|
|
void storage_init(const char *tmpfilePath, size_t cbReserve)
|
2019-02-01 13:54:59 -05:00
|
|
|
{
|
|
|
|
assert(tmpfilePath == NULL);
|
|
|
|
(void)tmpfilePath;
|
2019-02-04 16:56:13 -05:00
|
|
|
(void)cbReserve;
|
2019-02-01 13:54:59 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
void *salloc(size_t cb, enum MALLOC_CLASS class)
|
|
|
|
{
|
|
|
|
(void)class;
|
|
|
|
return malloc(cb);
|
|
|
|
}
|
|
|
|
|
|
|
|
void *scalloc(size_t cb, size_t c, enum MALLOC_CLASS class)
|
|
|
|
{
|
|
|
|
(void)class;
|
|
|
|
return calloc(cb, c);
|
|
|
|
}
|
|
|
|
|
|
|
|
void sfree(void *pv)
|
|
|
|
{
|
|
|
|
free(pv);
|
|
|
|
}
|
|
|
|
|
2019-02-04 16:56:13 -05:00
|
|
|
void *srealloc(void *pv, size_t cb, enum MALLOC_CLASS class)
|
2019-02-01 13:54:59 -05:00
|
|
|
{
|
2019-02-04 16:56:13 -05:00
|
|
|
(void)class;
|
2019-02-01 13:54:59 -05:00
|
|
|
return realloc(pv, cb);
|
|
|
|
}
|
2019-02-04 16:56:13 -05:00
|
|
|
|
|
|
|
size_t salloc_usable_size(void *ptr)
|
|
|
|
{
|
|
|
|
return malloc_usable_size(ptr);
|
|
|
|
}
|