Skip to content

Commit b119d61

Browse files
committed
lib-types: provide base types when missing
Windows doesn't provide these types, thus define then in this case. Signed-off-by: Daniel Wagner <[email protected]>
1 parent 716cb2e commit b119d61

1 file changed

Lines changed: 30 additions & 0 deletions

File tree

libnvme/src/nvme/lib-types.h

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,37 @@
88
*/
99
#pragma once
1010

11+
#ifdef __linux__
1112
#include <linux/types.h>
13+
#else
14+
#include <stdint.h>
15+
16+
/* Standard type definitions for linux/types.h compatibility */
17+
typedef uint8_t __u8;
18+
typedef uint16_t __u16;
19+
typedef uint32_t __u32;
20+
typedef uint64_t __u64;
21+
typedef int8_t __s8;
22+
typedef int16_t __s16;
23+
typedef int32_t __s32;
24+
typedef int64_t __s64;
25+
26+
/* Little-endian types (Windows is little-endian) */
27+
typedef __u16 __le16;
28+
typedef __u32 __le32;
29+
typedef __u64 __le64;
30+
typedef __s16 __le16s;
31+
typedef __s32 __le32s;
32+
typedef __s64 __le64s;
33+
34+
/* Big-endian types for completeness */
35+
typedef __u16 __be16;
36+
typedef __u32 __be32;
37+
typedef __u64 __be64;
38+
typedef __s16 __be16s;
39+
typedef __s32 __be32s;
40+
typedef __s64 __be64s;
41+
#endif
1242

1343
struct libnvme_global_ctx;
1444
struct libnvme_transport_handle;

0 commit comments

Comments
 (0)