• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /* SPDX-License-Identifier: MIT */
2 /*
3  * WIN32 compat definitions for libfsverity and the 'fsverity' program
4  *
5  * Copyright 2020 Microsoft
6  *
7  * Use of this source code is governed by an MIT-style
8  * license that can be found in the LICENSE file or at
9  * https://opensource.org/licenses/MIT.
10  */
11 #ifndef COMMON_WIN32_DEFS_H
12 #define COMMON_WIN32_DEFS_H
13 
14 /* Some minimal definitions to allow the digest/sign commands to run under Windows */
15 
16 /* All file reads we do need this flag on _WIN32 */
17 #ifndef O_BINARY
18 #  define O_BINARY 0
19 #endif
20 
21 #ifdef _WIN32
22 
23 #include <stdint.h>
24 #include <inttypes.h>
25 
26 #ifndef ENOPKG
27 #   define ENOPKG 65
28 #endif
29 
30 #ifndef __cold
31 #  define __cold
32 #endif
33 
34 /* For %zu in printf() */
35 #ifndef __printf
36 #  define __printf(fmt_idx, vargs_idx) \
37        __attribute__((format(gnu_printf, fmt_idx, vargs_idx)))
38 #endif
39 
40 typedef __signed__ char __s8;
41 typedef unsigned char __u8;
42 typedef __signed__ short __s16;
43 typedef unsigned short __u16;
44 typedef __signed__ int __s32;
45 typedef unsigned int __u32;
46 typedef __signed__ long long  __s64;
47 typedef unsigned long long  __u64;
48 typedef __u16 __le16;
49 typedef __u16 __be16;
50 typedef __u32 __le32;
51 typedef __u32 __be32;
52 typedef __u64 __le64;
53 typedef __u64 __be64;
54 
55 #endif /* _WIN32 */
56 
57 #endif /* COMMON_WIN32_DEFS_H */
58