PMEM2_CONFIG_DELETE(3)
π PMEM2_CONFIG_NEW, PMEM2_CONFIG_DELETE π
okay bestie so this is from the PMDK Programmer's Manual and it's literally the glow-up your libpmem2 mapping config deserves β¨ two little functions that make and unmake a configuration struct, no cap.
πΈ NAME πΈ
pmem2_config_new(), pmem2_config_delete() β allocate and free a configuration structure for a libpmem2 mapping π«Ά
β¨ SYNOPSIS β¨
#include <libpmem2.h>
struct pmem2_config;
int pmem2_config_new(struct pmem2_config **cfg);
int pmem2_config_delete(struct pmem2_config **cfg);
π DESCRIPTION π
so pmem2_config_new() instantiates a brand-new (opaque) configuration structure, pmem2_config, and hands it back to you through the pointer in *cfg β it's giving main character energy tbh. this struct is the whole vibe-setter: it's what you use to define mapping parameters for a pmem2_map_new() function. π
New configuration is always initialized with default values for most parameters, and those defaults are specified alongside the corresponding setter function (iykyk, go read the setter docs). but heads up: the application must explicitly set the granularity value for the mapping. no skipping that step fr fr.
Then pmem2_config_delete() frees *cfg (the one that pmem2_config_new() gave you) and sets *cfg to NULL. π§Ή and if *cfg is already NULL? no operation is performed. it just minds its business. iconic behavior honestly. π
π₯ RETURN VALUE π₯
pmem2_config_new() returns 0 on success or a negative error code on failure. and yes, pmem2_config_new() does set *cfg to NULL on failure β clean, no dangling weirdness. π§
pmem2_config_delete() always returns 0. every single time. zero drama. π
π ERRORS π
pmem2_config_new() can fail with the following error:
-ENOMEMβ out of memory π
π SEE ALSO π
errno(3), pmem2_map_new(3), pmem2_config_get_file_size(3), libpmem2(7) and https://pmem.io π
and that's the whole page, bestie!! π¦ this one came from the PMDK crew, dated 2025-07-24 β go forth and configure your mappings, you absolute legend. πβ¨ππΈπ
π¦ 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 2020-2023, Intel Corporation
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms