1PMEM2_MAP_FROM_EXISTING(3) PMDK Programmer's Manual PMEM2_MAP_FROM_EXISTING(3)
2
3
4
6 pmem2_map_from_existing() - creates a pmem2_map object from an existing
7 mapping
8
10 #include <libpmem2.h>
11
12 int pmem2_map_from_existing(struct pmem2_map **map, const struct pmem2_source *src,
13 void *addr, size_t len, enum pmem2_granularity gran);
14
16 The pmem2_map_from_existing() returns a new *struct pmem2_map for map‐
17 ping provided by the user. This function allows usage of libpmem2[1m(7)
18 API without pmem2_map_new[1m(3) for mapping file. Mapping is defined by
19 addr and len. You have to specify underlying file as a src, and define
20 granularity of this mapping. See pmem2_config_set_required_store_granu‐
21 larity(3) and libpmem2**(7) for more details.
22
23 For the pmem2_map object created by the pmem2_map_from_existing(3)
24 function, the pmem2_map_delete(3) will only destroy the object, but it
25 won't unmap the mapping this object describes.
26
28 The pmem2_map_from_existing() function returns 0 when it succeeds or a
29 negative error code on failure.
30
32 The pmem2_map_from_existing() can fail with the following errors:
33
34 PMEM2_E_MAPPING_EXISTS - when contiguous region (addr, addr + len) is
35 already registered by libpmem2
36
37 It can also return -ENOMEM from the underlying malloc(2) function.
38
40 malloc(2), pmem2_map_delete(3), pmem2_map_new(3),
41 pmem2_source_from_fd(3), libpmem2(7) and <https://pmem.io>
42
43
44
45PMDK - pmem2 API version 1.0 2022-05-24 PMEM2_MAP_FROM_EXISTING(3)