#include <libpmemset.h> int pmemset_source_from_temporary(struct pmemset_source **src, const char const char *dir);
pmemset_source_from_temporary() function instantiates a new struct pmemset_source* object describing the data source and creates a unnamed temporary file in the provided directory dir. The temporary file is always created with mode 0600, and the dir must specify an existing directory name. The created file has size 0 and is extended dynamically based on required part size during pmemset_part_map(3).
In case of source from temporary file the pmemset_source_delete(3) function frees *src and sets *src to NULL and closes the temporary file as a result the file is immediately deleted.
The pmemset_source_from_temporary() function return 0 on success or negative error code on failure.
The pmemset_source_from_temporary() can fail with the following errors:
PMEMSET_E_INVALID_SOURCE_PATH - the provided directory path string is NULL or provided path does not exists.
PMEMSET_E_CANNOT_CREATE_TEMP_FILE - cannot create a unique temporary filename.
-ENOMEM - in case of insufficient memory to allocate an instance of struct pmemset_source.
pmemset_part_map(3), pmemset_source_delete(3), libpmemset(7) and http://pmem.io
The contents of this web site and the associated GitHub repositories are BSD-licensed open source.