1 /*
2 * types.h - Misc type definitions not related to on-disk structure. Part of
3 * the Linux-NTFS project.
4 *
5 * Copyright (c) 2000-2004 Anton Altaparmakov
6 * Copyright (c) 2006 Szabolcs Szakacsits
7 * Copyright (c) 2007 Yura Pakhuchiy
8 *
9 * This program/include file is free software; you can redistribute it and/or
10 * modify it under the terms of the GNU General Public License as published
11 * by the Free Software Foundation; either version 2 of the License, or
12 * (at your option) any later version.
13 *
14 * This program/include file is distributed in the hope that it will be
15 * useful, but WITHOUT ANY WARRANTY; without even the implied warranty
16 * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 * GNU General Public License for more details.
18 *
19 * You should have received a copy of the GNU General Public License
20 * along with this program (in the main directory of the Linux-NTFS
21 * distribution in the file COPYING); if not, write to the Free Software
22 * Foundation,Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
23 */
24
25 #ifndef _NTFS_TYPES_H
26 #define _NTFS_TYPES_H
27
28 #ifdef HAVE_CONFIG_H
29 #include "config.h"
30 #endif
31
32 #if HAVE_STDINT_H || !HAVE_CONFIG_H
33 #include <stdint.h>
34 #endif
35 #ifdef HAVE_SYS_TYPES_H
36 #include <sys/types.h>
37 #endif
38
39 typedef uint8_t u8; /* Unsigned types of an exact size */
40 typedef uint16_t u16;
41 typedef uint32_t u32;
42 typedef uint64_t u64;
43
44 typedef int8_t s8; /* Signed types of an exact size */
45 typedef int16_t s16;
46 typedef int32_t s32;
47 typedef int64_t s64;
48
49 #if defined(__CHECKER__) && !defined(NTFS_DO_NOT_CHECK_ENDIANS)
50 #undef __bitwise
51 #undef __force
52 #define __bitwise __attribute__((bitwise))
53 #define __force __attribute__((force))
54 #else
55 #undef __bitwise
56 #undef __force
57 #define __bitwise
58 #define __force
59 #endif
60
61 typedef u16 __bitwise le16;
62 typedef u32 __bitwise le32;
63 typedef u64 __bitwise le64;
64
65 /*
66 * Declare sle{16,32,64} to be unsigned because we do not want sign extension
67 * on BE architectures.
68 */
69 typedef u16 __bitwise sle16;
70 typedef u32 __bitwise sle32;
71 typedef u64 __bitwise sle64;
72
73 typedef u16 __bitwise be16;
74 typedef u32 __bitwise be32;
75 typedef u64 __bitwise be64;
76
77 typedef le16 ntfschar; /* 2-byte Unicode character type. */
78 #define UCHAR_T_SIZE_BITS 1
79
80 /*
81 * Clusters are signed 64-bit values on NTFS volumes. We define two types, LCN
82 * and VCN, to allow for type checking and better code readability.
83 */
84 typedef s64 VCN;
85 typedef sle64 leVCN;
86 typedef s64 LCN;
87 typedef sle64 leLCN;
88
89 /*
90 * The NTFS journal $LogFile uses log sequence numbers which are signed 64-bit
91 * values. We define our own type LSN, to allow for type checking and better
92 * code readability.
93 */
94 typedef s64 LSN;
95 typedef sle64 leLSN;
96
97 /*
98 * Cygwin has a collision between our BOOL and <windef.h>'s
99 * As long as this file will be included after <windows.h> we're fine.
100 */
101 #ifndef _WINDEF_H
102 /**
103 * enum BOOL - These are just to make the code more readable...
104 */
105 typedef enum {
106 #ifndef FALSE
107 FALSE = 0,
108 #endif
109 #ifndef NO
110 NO = 0,
111 #endif
112 #ifndef ZERO
113 ZERO = 0,
114 #endif
115 #ifndef TRUE
116 TRUE = 1,
117 #endif
118 #ifndef YES
119 YES = 1,
120 #endif
121 #ifndef ONE
122 ONE = 1,
123 #endif
124 } BOOL;
125 #endif /* defined _WINDEF_H */
126
127 /**
128 * enum IGNORE_CASE_BOOL -
129 */
130 typedef enum {
131 CASE_SENSITIVE = 0,
132 IGNORE_CASE = 1,
133 } IGNORE_CASE_BOOL;
134
135 #define STATUS_OK (0)
136 #define STATUS_ERROR (-1)
137 #define STATUS_RESIDENT_ATTRIBUTE_FILLED_MFT (-2)
138 #define STATUS_KEEP_SEARCHING (-3)
139 #define STATUS_NOT_FOUND (-4)
140
141 #endif /* defined _NTFS_TYPES_H */
142