-
Notifications
You must be signed in to change notification settings - Fork 57
/
Copy pathplatform.h
82 lines (67 loc) · 1.99 KB
/
platform.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
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
/**
* Ext2read
* File: platform.h
**/
/**
* Copyright (C) 2005 by Manish Regmi (regmi dot manish at gmail.com)
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the
* Free Software Foundation, Inc.,
* 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
**/
#ifndef __PLATFORM_H
#define __PLATFORM_H
#ifdef WIN32
#include <windows.h>
#include <stdint.h>
typedef HANDLE FileHandle;
#ifdef _MSC_VER
typedef unsigned char uint8_t;
typedef unsigned short uint16_t;
typedef unsigned int uint32_t;
#endif
#define FILE_DELIM "\\"
#else
typedef int FileHandle;
#define FILE_DELIM "/"
#endif
typedef uint64_t lloff_t;
typedef unsigned int uint;
typedef unsigned long ulong;
#define SECTOR_SIZE 512
#if defined(__GNUC__)
#define PACKED __attribute__((packed))
#else
#define PACKED
#endif
#ifndef INLINE
#if defined(_MSC_VER)
#define INLINE __inline
#elif defined(__GNUC__)
#define INLINE __inline__
#endif /* Compiler */
#endif /* INLINE */
#ifdef __cplusplus
extern "C"{
#endif
FileHandle open_disk(const char *, int *);
int get_ndisks();
void close_disk();
int read_disk(FileHandle hnd, void *ptr, lloff_t sector, int nsects, int sectorsize);
int write_disk(FileHandle hnd, void *ptr, lloff_t sector, int nsects, int sectorsize);
int get_nthdevice(char *path, int ndisks);
#ifdef __cplusplus
}
#endif
#endif // __PLATFORM_H