]> git.proxmox.com Git - ceph.git/blob - ceph/src/pmdk/src/core/fault_injection.h
import ceph 16.2.7
[ceph.git] / ceph / src / pmdk / src / core / fault_injection.h
1 /* SPDX-License-Identifier: BSD-3-Clause */
2 /* Copyright 2019-2020, Intel Corporation */
3
4 #ifndef CORE_FAULT_INJECTION
5 #define CORE_FAULT_INJECTION
6
7 #include <stdlib.h>
8
9 #ifdef __cplusplus
10 extern "C" {
11 #endif
12
13 enum pmem_allocation_type { PMEM_MALLOC, PMEM_REALLOC };
14
15 #if FAULT_INJECTION
16 void core_inject_fault_at(enum pmem_allocation_type type,
17 int nth, const char *at);
18
19 int core_fault_injection_enabled(void);
20
21 #else
22 static inline void
23 core_inject_fault_at(enum pmem_allocation_type type, int nth, const char *at)
24 {
25 abort();
26 }
27
28 static inline int
29 core_fault_injection_enabled(void)
30 {
31 return 0;
32 }
33 #endif
34
35 #ifdef __cplusplus
36 }
37 #endif
38
39 #endif