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 40typedef __signed__ char __s8; 41typedef unsigned char __u8; 42typedef __signed__ short __s16; 43typedef unsigned short __u16; 44typedef __signed__ int __s32; 45typedef unsigned int __u32; 46typedef __signed__ long long __s64; 47typedef unsigned long long __u64; 48typedef __u16 __le16; 49typedef __u16 __be16; 50typedef __u32 __le32; 51typedef __u32 __be32; 52typedef __u64 __le64; 53typedef __u64 __be64; 54 55#endif /* _WIN32 */ 56 57#endif /* COMMON_WIN32_DEFS_H */ 58