pmemobj_sys/
lib.rs

1//! # FFI bindings to **libpmemobj**
2//!
3//! The **libpmemobj** library provides a transactional object store, providing memory allocation,
4//! transactions, and general facilities for persistent memory programming.
5//!
6//! Developers new to persistent memory probably want to start with this library.
7//!
8//! > This is **not** an official port of the NVM Library.
9//! >
10//! > The official **libpmemobj** documentation can be found at: [http://pmem.io/nvml/libpmemobj/](http://pmem.io/nvml/libpmemobj/)
11
12extern crate libc;
13
14use ::libc::{size_t, mode_t};
15use ::libc::{c_void, c_char, c_int};
16
17
18pub enum PMEMobjpool {}
19
20
21#[allow(dead_code)]
22#[link(name = "pmemobj")]
23extern "C" {
24    pub fn pmemobj_open(path: *const c_char, layout: *const c_char) -> *mut PMEMobjpool;
25    pub fn pmemobj_create(path: *const c_char,
26                          layout: *const c_char,
27                          poolsize: size_t,
28                          mode: mode_t)
29                          -> *mut PMEMobjpool;
30    pub fn pmemobj_close(pop: *mut PMEMobjpool);
31    pub fn pmemobj_memcpy_persist(pop: *mut PMEMobjpool,
32                                  dest: *mut c_void,
33                                  src: *const c_void,
34                                  len: size_t);
35    pub fn pmemobj_memset_persist(pop: *mut PMEMobjpool, dest: *mut c_void, c: c_int, len: size_t);
36    pub fn pmemobj_persist(pop: *mut PMEMobjpool, addr: *const c_void, len: size_t);
37    pub fn pmemobj_flush(pop: *mut PMEMobjpool, addr: *const c_void, len: size_t);
38    pub fn pmemobj_drain(pop: *mut PMEMobjpool);
39}