blob: 7080240a8418551c42d82589c9e26c3324d8f915 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
|
/* ISC license. */
#include <skalibs/uint64.h>
#include <skalibs/posixplz.h>
#include <skalibs/strerr.h>
#include <shibari/dcache.h>
#include "shibari-cache-internal.h"
static dcache_t cache = DCACHE_ZERO ;
void cache_init (uint64_t cachesize)
{
dcache_init(&cache, cachesize) ;
}
void cache_dump (void)
{
if (g->dumpfile)
{
if (!dcache_save(&cache, g->dumpfile))
{
strerr_warnwu2sys("save cache contents to ", g->dumpfile) ;
unlink_void(g->dumpfile) ;
}
}
}
void cache_load (void)
{
if (g->dumpfile)
{
if (!dcache_load(&cache, g->dumpfile))
strerr_warnwu2sys("load cache contents from ", g->dumpfile) ;
}
}
|