1 /*
2  * ntfstypes.h - This file defines four things:
3  * - Generic platform independent fixed-size types (e.g. ntfs_u32).
4  * - Specific fixed-size types (e.g. ntfs_offset_t).
5  * - Macros that read and write those types from and to byte arrays.
6  * - Types derived from OS specific ones.
7  *
8  * Copyright (C) 1996, 1998, 1999 Martin von L�wis
9  * Copyright (C) 2001 Anton Altaparmakov (AIA)
10  */
11 #include <linux/fs.h>
12 #include "ntfsendian.h"
13 #include <asm/types.h>
14 
15 /* Integral types */
16 #ifndef NTFS_INTEGRAL_TYPES
17 #define NTFS_INTEGRAL_TYPES
18 typedef u8  ntfs_u8;
19 typedef u16 ntfs_u16;
20 typedef u32 ntfs_u32;
21 typedef u64 ntfs_u64;
22 typedef s8  ntfs_s8;
23 typedef s16 ntfs_s16;
24 typedef s32 ntfs_s32;
25 typedef s64 ntfs_s64;
26 #endif
27 
28 /* Unicode character type */
29 #ifndef NTFS_WCHAR_T
30 #define NTFS_WCHAR_T
31 typedef u16 ntfs_wchar_t;
32 #endif
33 /* File offset */
34 #ifndef NTFS_OFFSET_T
35 #define NTFS_OFFSET_T
36 typedef s64 ntfs_offset_t;
37 #endif
38 /* UTC */
39 #ifndef NTFS_TIME64_T
40 #define NTFS_TIME64_T
41 typedef u64 ntfs_time64_t;
42 #endif
43 /*
44  * This is really signed long long. So we support only volumes up to 2Tb. This
45  * is ok as Win2k also only uses 32-bits to store clusters.
46  * Whatever you do keep this a SIGNED value or a lot of NTFS users with
47  * corrupted filesystems will lynch you! It causes massive fs corruption when
48  * unsigned due to the nature of many checks relying on being performed on
49  * signed quantities. (AIA)
50  */
51 #ifndef NTFS_CLUSTER_T
52 #define NTFS_CLUSTER_T
53 typedef s32 ntfs_cluster_t;
54 #endif
55 
56 /* Architecture independent macros. */
57 
58 /* PUTU32 would not clear all bytes. */
59 #define NTFS_PUTINUM(p,i)    NTFS_PUTU64(p, i->i_number); \
60                              NTFS_PUTU16(((char*)p) + 6, i->sequence_number)
61 
62 /* System dependent types. */
63 #include <asm/posix_types.h>
64 #ifndef NTMODE_T
65 #define NTMODE_T
66 typedef __kernel_mode_t ntmode_t;
67 #endif
68 #ifndef NTFS_UID_T
69 #define NTFS_UID_T
70 typedef uid_t ntfs_uid_t;
71 #endif
72 #ifndef NTFS_GID_T
73 #define NTFS_GID_T
74 typedef gid_t ntfs_gid_t;
75 #endif
76 #ifndef NTFS_SIZE_T
77 #define NTFS_SIZE_T
78 typedef __kernel_size_t ntfs_size_t;
79 #endif
80 #ifndef NTFS_TIME_T
81 #define NTFS_TIME_T
82 typedef __kernel_time_t ntfs_time_t;
83 #endif
84 
85