PMEM2_VM_RESERVATION_MAP_FIND_PREV(3)
π PMEM2_VM_RESERVATION_MAP_FIND(3) π
okay bestie, sit down, hydrate, and let me tell you about the cutest lil squad of functions in the PMDK Programmer's Manual, section 3. their whole job? finding mappings in a virtual memory reservation. searching for the mapping located at the desirable location, if you will. and honestly? they ate. π«Ά
β¨ NAME β¨
pmem2_vm_reservation_map_find(), pmem2_vm_reservation_map_find_prev(), pmem2_vm_reservation_map_find_next(), pmem2_vm_reservation_map_find_first() and pmem2_vm_reservation_map_find_last() β search for the mapping located at the desirable location π
πΈ SYNOPSIS πΈ
#include <libpmem2.h>
struct pmem2_map;
struct pmem2_vm_reservation;
int pmem2_vm_reservation_map_find(struct pmem2_vm_reservation *rsv,
size_t reserv_offset, size_t len, struct pmem2_map **map_ptr);
int pmem2_vm_reservation_map_find_prev(struct pmem2_vm_reservation *rsv,
struct pmem2_map *map, struct pmem2_map **prev_map);
int pmem2_vm_reservation_map_find_next(struct pmem2_vm_reservation *rsv,
struct pmem2_map *map, struct pmem2_map **next_map);
int pmem2_vm_reservation_map_find_first(struct pmem2_vm_reservation *rsv,
struct pmem2_map **first_map);
int pmem2_vm_reservation_map_find_last(struct pmem2_vm_reservation *rsv,
struct pmem2_map **last_map);
like, five whole functions. a whole friend group. no cap. π
π¦ DESCRIPTION π¦
so here's the lore, bestie. mappings get inserted into the virtual memory reservation in the order of their virtual address space location. the first mapping is the earliest mapping in the virtual address space contained in a reservation, and the last mapping is, well, the last one. main character energy for the earliest one, honestly. β¨
pmem2_vm_reservation_map_find()β searches for the earliest mapping stored in the virtual memory reservation that intersects with the interval defined by thereserv_offsetandlenvariables, and hands it back to you through themap_ptrvariable. πpmem2_vm_reservation_map_find_prev()β searches for the map previous to the providedmap, and returns it via the providedprev_mapvariable. β¬ οΈpmem2_vm_reservation_map_find_next()β searches for the map next after the providedmap, and returns it via thenext_mapvariable. β‘οΈpmem2_vm_reservation_map_find_first()β searches for the first map in the reservation, and returns it via the providedfirst_mapvariable. πpmem2_vm_reservation_map_find_last()β searches for the last map in the reservation, and returns it via the providedlast_mapvariable. π
π RETURN VALUE π
pmem2_vm_reservation_map_find(), pmem2_vm_reservation_map_find_prev(), pmem2_vm_reservation_map_find_next(), pmem2_vm_reservation_map_find_first() and pmem2_vm_reservation_map_find_last() return 0 on success, or a negative error on failure.
on success it passes an address to the found mapping via the user provided map pointer variable. otherwise, when no mapping was found, it passes a NULL value. it's giving "found nothing, bestie" π
π ERRORS π
the whole squad β pmem2_vm_reservation_map_find(), pmem2_vm_reservation_map_find_prev(), pmem2_vm_reservation_map_find_next(), pmem2_vm_reservation_map_find_first() and pmem2_vm_reservation_map_find_last() β can fail with the following errors:
PMEM2_E_MAPPING_NOT_FOUNDβ no mapping found at the desirable location of the reservation π
π SEE ALSO π
reminder bestie: mappings live in address-space order inside the reservation, so "first" = earliest and "last" = latest. don't come for me, that's literally what the page says. π§
and that's the tea, fr fr. this iconic little page came to you from the PMDK crew, dated 2025-07-24, and it is now officially over. go find your mappings, bestie. slay. πβ¨ππ¦πΈπ π«Άπ₯πβ
π¦ where this page comes from
- fedora 43: libpmem2-devel 2.1.0-4.fc43 Β· BSD-3-Clause
- π the page's license: BSD-3-Clause
- Copyright 2021-2022, Intel Corporation
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms