-
Notifications
You must be signed in to change notification settings - Fork 14
/
libwbfs_os.h
executable file
·49 lines (40 loc) · 983 Bytes
/
libwbfs_os.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
#ifndef LIBWBFS_OS_H
#define LIBWBFS_OS_H
// this file abstract the os integration
// libwbfs_glue.h for segher tools env.
// standard u8, u32 and co types, + fatal
#ifdef WIN32
#include <tools.h>
#else
#include "tools.h"
#endif
#include <stdio.h>
#ifdef WIN32
#define wbfs_fatal fatal
#define wbfs_error fatal
#define wbfs_warning non_fatal
#else
#define wbfs_fatal(x) fatal(x)
#define wbfs_error(x) non_fatal(x)
#endif
#include <stdlib.h>
#define wbfs_malloc(x) malloc(x)
#define wbfs_free(x) free(x)
// alloc memory space suitable for disk io
#define wbfs_ioalloc(x) malloc(x)
#define wbfs_iofree(x) free(x)
#ifdef WIN32
#include <winsock.h>
#else
#include <arpa/inet.h>
#endif
// endianess tools
#define wbfs_ntohl(x) ntohl(x)
#define wbfs_ntohs(x) ntohs(x)
#define wbfs_htonl(x) htonl(x)
#define wbfs_htons(x) htons(x)
#include <string.h>
#define wbfs_memcmp(x,y,z) memcmp(x,y,z)
#define wbfs_memcpy(x,y,z) memcpy(x,y,z)
#define wbfs_memset(x,y,z) memset(x,y,z)
#endif