85
38 #include
39 #include
40 #include
41
42 #define LAYOUT_NAME "rweg"
43 #define MAX_BUF_LEN 31
44
45 struct my_root {
46
size_t len;
47
char buf[MAX_BUF_LEN];
48 };
49
50 int
51 main(int argc, char *argv[])
52 {
53
if (argc != 2) {
54
printf("usage: %s file-name\n", argv[0]);
55
return 1;
56
}
57
58
PMEMobjpool *pop = pmemobj_create(argv[1],
59
LAYOUT_NAME, PMEMOBJ_MIN_POOL, 0666);
60
61
if (pop == NULL) {
62
perror("pmemobj_create");
63
return 1;
64
}
65
66
PMEMoid root = pmemobj_root(pop,
67
sizeof(struct my_root));
68
69
struct my_root *rootp = pmemobj_direct(root);
70
71
char buf[MAX_BUF_LEN] = "Hello PMEM World";
72
Chapter 7 libpmemobj: a Native traNsaCtioNal objeCt store
Précédent

- 112/457

Suivant