]> git.proxmox.com Git - ceph.git/blame - ceph/src/pmdk/src/include/pmemcompat.h
import ceph 16.2.7
[ceph.git] / ceph / src / pmdk / src / include / pmemcompat.h
CommitLineData
a4b75251
TL
1/* SPDX-License-Identifier: BSD-3-Clause */
2/* Copyright 2016-2020, Intel Corporation */
3
4/*
5 * pmemcompat.h -- compatibility layer for libpmem* libraries
6 */
7
8#ifndef PMEMCOMPAT_H
9#define PMEMCOMPAT_H
10#include <windows.h>
11
12/* for backward compatibility */
13#ifdef NVML_UTF8_API
14#pragma message( "NVML_UTF8_API macro is obsolete, please use PMDK_UTF8_API instead." )
15#ifndef PMDK_UTF8_API
16#define PMDK_UTF8_API
17#endif
18#endif
19
20struct iovec {
21 void *iov_base;
22 size_t iov_len;
23};
24
25typedef int mode_t;
26/*
27 * XXX: this code will not work on windows if our library is included in
28 * an extern block.
29 */
30#if defined(__cplusplus) && defined(_MSC_VER) && !defined(__typeof__)
31#include <type_traits>
32/*
33 * These templates are used to remove a type reference(T&) which, in some
34 * cases, is returned by decltype
35 */
36namespace pmem {
37
38namespace detail {
39
40template<typename T>
41struct get_type {
42 using type = T;
43};
44
45template<typename T>
46struct get_type<T*> {
47 using type = T*;
48};
49
50template<typename T>
51struct get_type<T&> {
52 using type = T;
53};
54
55} /* namespace detail */
56
57} /* namespace pmem */
58
59#define __typeof__(p) pmem::detail::get_type<decltype(p)>::type
60
61#endif
62
63#endif