-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmem.h
79 lines (61 loc) · 1.5 KB
/
mem.h
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
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
/** @file mem.h
Orthogonally persistent memory device.
*/
#ifndef MEM_H
#define MEM_H
#include "mem0.h"
/**
* last commit time
*/
extern time_t mem_lastCommitted;
/** "mem" initialization
@return 1 if very first start, <0 if error, 0 otherwise
*/
int mem_init();
/** opening mem
* mem r/w op must occured between open/close
* @return 0 on success
*/
int mem_open();
/** closing mem
*/
int mem_close();
/** set data into memory cell
@param Cell Address
@param Cell Content Pointer
*/
int mem_set(Address, CellBody*);
/** get data from memory cell
@param Cell Address
@param Cell Content Pointer
@return 0 if OK
*/
int mem_get(Address, CellBody*);
/** get data from memory cell and its lastModifiedPoke
@param Cell Address
@param Cell Stamp Pointer
@return 0 if OK
*/
int mem_get_advanced(Address, CellBody*, uint32_t* stamp_p);
/** close current micro-transaction,
by making all memory changes from last commit persistent
*/
int mem_commit();
/** yield current micro-transaction, allowing disk flush
return !0 if disk flush occurs because MEMn resources are scare
*/
int mem_yield();
/** get a counter of write operation
@return Pokes
*/
uint32_t mem_pokes();
/** setup or reinitialize a geometrically growing RAM area
*/
void zeroalloc(char** pp, uint32_t* maxp, uint32_t* sp);
/** change content size inside a geometrically growing RAM area
*/
void geoalloc(char** pp, uint32_t* maxp, uint32_t* sp, uint32_t us, uint32_t s);
/** "mem" release
*/
int mem_destroy();
#endif /* MEM_H */