.\" Automatically generated by Pandoc 2.0.6 .\" .TH "PMEM2_CONFIG_NEW" "3" "2022-08-25" "PMDK - pmem2 API version 1.0" "PMDK Programmer's Manual" .hy .\" SPDX-License-Identifier: BSD-3-Clause .\" Copyright 2020, Intel Corporation .SH NAME .PP \f[B]pmem2_config_new\f[](), \f[B]pmem2_config_delete\f[]() \- 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[] .fi .SH DESCRIPTION .PP The \f[B]pmem2_config_new\f[]() function instantiates a new (opaque) configuration structure, \f[I]pmem2_config\f[], which is used to define mapping parameters for a \f[B]pmem2_map_new\f[]() function, and returns it through the pointer in \f[I]*cfg\f[]. .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[]() function frees \f[I]*cfg\f[] returned by \f[B]pmem2_config_new\f[]() and sets \f[I]*cfg\f[] to NULL. If \f[I]*cfg\f[] is NULL, no operation is performed. .SH RETURN VALUE .PP The \f[B]pmem2_config_new\f[]() function returns 0 on success or a negative error code on failure. \f[B]pmem2_config_new\f[]() does set \f[I]*cfg\f[] to NULL on failure. .PP The \f[B]pmem2_config_delete\f[]() function always returns 0. .SH ERRORS .PP \f[B]pmem2_config_new\f[]() can fail with the following error: \- \f[B]\-ENOMEM\f[] \- out of memory .SH SEE ALSO .PP \f[B]errno\f[](3), \f[B]pmem2_map_new\f[](3), \f[B]pmem2_config_set_handle\f[](3), \f[B]pmem2_config_set_fd\f[](3), \f[B]pmem2_config_get_file_size\f[](3), \f[B]libpmem2\f[](7) and \f[B]\f[]