.\" Automatically generated by Pandoc 2.9.2.1 .\" .TH "" "" "2023-05-26" "PMDK - " "PMDK Programmer's Manual" .hy .\" SPDX-License-Identifier: BSD-3-Clause .\" Copyright 2020, Intel Corporation .SH NAME .PP \f[B]pmem2_config_new\f[R](), \f[B]pmem2_config_delete\f[R]() - allocate and free a configuration structure for a libpmem2 mapping .SH SYNOPSIS .IP .nf \f[C] #include struct pmem2_config; int pmem2_config_new(struct pmem2_config **cfg); int pmem2_config_delete(struct pmem2_config **cfg); \f[R] .fi .SH DESCRIPTION .PP The \f[B]pmem2_config_new\f[R]() function instantiates a new (opaque) configuration structure, \f[I]pmem2_config\f[R], which is used to define mapping parameters for a \f[B]pmem2_map_new\f[R]() function, and returns it through the pointer in \f[I]*cfg\f[R]. .PP New configuration is always initialized with default values for most parameters, which are specified alongside the corresponding setter function. The application must explicitly set the granularity value for the mapping. .PP The \f[B]pmem2_config_delete\f[R]() function frees \f[I]*cfg\f[R] returned by \f[B]pmem2_config_new\f[R]() and sets \f[I]*cfg\f[R] to NULL. If \f[I]*cfg\f[R] is NULL, no operation is performed. .SH RETURN VALUE .PP The \f[B]pmem2_config_new\f[R]() function returns 0 on success or a negative error code on failure. \f[B]pmem2_config_new\f[R]() does set \f[I]*cfg\f[R] to NULL on failure. .PP The \f[B]pmem2_config_delete\f[R]() function always returns 0. .SH ERRORS .PP \f[B]pmem2_config_new\f[R]() can fail with the following error: - \f[B]-ENOMEM\f[R] - out of memory .SH SEE ALSO .PP \f[B]errno\f[R](3), \f[B]pmem2_map_new\f[R](3), \f[B]pmem2_config_set_handle\f[R](3), \f[B]pmem2_config_set_fd\f[R](3), \f[B]pmem2_config_get_file_size\f[R](3), \f[B]libpmem2\f[R](7) and \f[B]\f[R]