]> git.proxmox.com Git - ceph.git/blob - ceph/src/pmdk/src/libpmem2/pmem2_arch.h
import ceph 16.2.7
[ceph.git] / ceph / src / pmdk / src / libpmem2 / pmem2_arch.h
1 /* SPDX-License-Identifier: BSD-3-Clause */
2 /* Copyright 2014-2020, Intel Corporation */
3
4 /*
5 * pmem2_arch.h -- core-arch interface
6 */
7 #ifndef PMEM2_ARCH_H
8 #define PMEM2_ARCH_H
9
10 #include <stddef.h>
11 #include "libpmem2.h"
12 #include "util.h"
13 #include "valgrind_internal.h"
14
15 #ifdef __cplusplus
16 extern "C" {
17 #endif
18
19 struct pmem2_arch_info;
20
21 typedef void (*fence_func)(void);
22 typedef void (*flush_func)(const void *, size_t);
23 typedef void *(*memmove_nodrain_func)(void *pmemdest, const void *src,
24 size_t len, unsigned flags, flush_func flush);
25 typedef void *(*memset_nodrain_func)(void *pmemdest, int c, size_t len,
26 unsigned flags, flush_func flush);
27
28 struct pmem2_arch_info {
29 memmove_nodrain_func memmove_nodrain;
30 memmove_nodrain_func memmove_nodrain_eadr;
31 memset_nodrain_func memset_nodrain;
32 memset_nodrain_func memset_nodrain_eadr;
33 flush_func flush;
34 fence_func fence;
35 int flush_has_builtin_fence;
36 };
37
38 void pmem2_arch_init(struct pmem2_arch_info *info);
39
40 /*
41 * flush_empty_nolog -- (internal) do not flush the CPU cache
42 */
43 static force_inline void
44 flush_empty_nolog(const void *addr, size_t len)
45 {
46 /* NOP, but tell pmemcheck about it */
47 VALGRIND_DO_FLUSH(addr, len);
48 }
49
50 void *memmove_nodrain_generic(void *pmemdest, const void *src, size_t len,
51 unsigned flags, flush_func flush);
52 void *memset_nodrain_generic(void *pmemdest, int c, size_t len, unsigned flags,
53 flush_func flush);
54
55 #ifdef __cplusplus
56 }
57 #endif
58
59 #endif