pmemset API version 1.0

The PMDK repository on GitHub is the ultimate source of information on PMDK from release 2.0! For all questions and to submit eventual issues please follow to that repository. The PMDK documentation collected here should be valid up to the 1.13.1 release but is maintained only on a best-effort basis and may not reflect the latest state of the art.

NAME
SYNOPSIS
DESCRIPTION
RETURN VALUE
ERRORS
SEE ALSO

NAME

pmemset_source_from_file()

  • creates an instance of persistent memory data source

SYNOPSIS

#include <libpmemset.h>

int pmemset_source_from_file(struct pmemset_source **src, const char *file);
int pmemset_xsource_from_file(struct pmemset_source **src, const char *file, unsigned flags);
int pmemset_source_delete(struct pmemset_source **src);

DESCRIPTION

pmemset_source_from_file() function instantiates a new struct pmemset_source* object describing the data source and sets a path to the file in it. pmemset_xsource_from_file() is equivalent to pmemset_source_from_file(), but with additional flags argument that is a bitmask of the following values:

  • PMEMSET_SOURCE_FILE_CREATE_IF_NEEDED - a new file will be created only if the specified file does not already exist,

  • PMEMSET_SOURCE_FILE_CREATE_ALWAYS - always a new file will be created. If the specified file exists, the file will be overwritten,

  • PMEMSET_SOURCE_FILE_TRUNCATE_IF_NEEDED - the specified file will be truncated during pmemset_part_map(3) to designated part size and offset.

Obtained source is ready to be passed on to the pmemset_part_new() function. See pmemset_part_new(3) for details.

The pmemset_source_delete() function frees *src and sets *src to NULL. If *src is NULL, no operation is performed.

RETURN VALUE

The pmemset_source_from_file() and pmemset_xsource_from_file() functions return 0 on success or negative error code on failure.

The pmemset_source_delete() function always returns 0.

ERRORS

The pmemset_source_from_file() and pmemset_xsource_from_file() can fail with the following errors:

  • PMEMSET_E_INVALID_SOURCE_PATH - when the provided file path string is NULL.

  • -ENOMEM - in case of insufficient memory to allocate an instance of struct pmemset_source.

The pmemset_xsource_from_file() can also fail with the error:

  • PMEMSET_E_INVALID_SOURCE_FILE_CREATE_FLAGS - in case of invalid flags parameter.

SEE ALSO

pmemset_part_map(3), pmemset_part_new(3), libpmemset(7) and http://pmem.io

The contents of this web site and the associated GitHub repositories are BSD-licensed open source.