.\" 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_get_flush_fn\f[R]() - get a flush function .SH SYNOPSIS .IP .nf \f[C] #include typedef void (*pmem2_flush_fn)(const void *ptr, size_t size); struct pmem2_map; pmem2_flush_fn pmem2_get_flush_fn(struct pmem2_map *map); \f[R] .fi .SH DESCRIPTION .PP The \f[B]pmem2_get_flush_fn\f[R]() function returns a pointer to a function responsible for efficiently flushing data in the range owned by the \f[I]map\f[R]. .PP Flushing data using \f[I]pmem2_flush_fn\f[R] \f[B]does not\f[R] guarantee that the data is stored durably by the time it returns. To get this guarantee, application should either use the persist operation (see \f[B]pmem2_get_persist_fn\f[R](3)) or follow \f[I]pmem2_flush_fn\f[R] by a drain operation (see \f[B]pmem2_get_drain_fn\f[R](3)). .PP There are no alignment restrictions on the range described by \f[I]ptr\f[R] and \f[I]size\f[R], but \f[I]pmem2_flush_fn\f[R] may expand the range as necessary to meet platform alignment requirements. .PP There is nothing atomic or transactional about \f[I]pmem2_flush_fn\f[R]. Any unwritten stores in the given range will be written, but some stores may have already been written by virtue of normal cache eviction/replacement policies. Correctly written code must not depend on stores waiting until \f[I]pmem2_flush_fn\f[R] is called to be flushed \[en] they can be flushed at any time before \f[I]pmem2_flush_fn\f[R] is called. .PP If two (or more) mappings share the same \f[I]pmem2_flush_fn\f[R] and they are adjacent to each other, it is safe to call this function for a range spanning those mappings. .SH RETURN VALUE .PP The \f[B]pmem2_get_flush_fn\f[R]() function never returns NULL. .PP The \f[B]pmem2_get_flush_fn\f[R]() for the same \f[I]map\f[R] always returns the same function. This means that it\[cq]s safe to cache its return value. However, this function is very cheap (because it returns a precomputed value), so caching may not be necessary. .SH SEE ALSO .PP \f[B]pmem2_get_drain_fn\f[R](3), \f[B]pmem2_get_persist_fn\f[R](3), \f[B]pmem2_map_new\f[R](3), \f[B]libpmem2\f[R](7) and \f[B]\f[R]