ntfstypes.h 2.1 KB
Newer Older
Linus Torvalds's avatar
Linus Torvalds committed
1 2 3 4 5 6
/*
 * ntfstypes.h - This file defines four things:
 * - Generic platform independent fixed-size types (e.g. ntfs_u32).
 * - Specific fixed-size types (e.g. ntfs_offset_t).
 * - Macros that read and write those types from and to byte arrays.
 * - Types derived from OS specific ones.
Linus Torvalds's avatar
Linus Torvalds committed
7
 *
Linus Torvalds's avatar
Linus Torvalds committed
8 9
 * Copyright (C) 1996, 1998, 1999 Martin von Lwis
 * Copyright (C) 2001 Anton Altaparmakov (AIA)
Linus Torvalds's avatar
Linus Torvalds committed
10 11 12 13 14
 */
#include <linux/fs.h>
#include "ntfsendian.h"
#include <asm/types.h>

Linus Torvalds's avatar
Linus Torvalds committed
15
/* Integral types */
Linus Torvalds's avatar
Linus Torvalds committed
16 17 18 19 20 21 22 23 24 25 26 27
#ifndef NTFS_INTEGRAL_TYPES
#define NTFS_INTEGRAL_TYPES
typedef u8  ntfs_u8;
typedef u16 ntfs_u16;
typedef u32 ntfs_u32;
typedef u64 ntfs_u64;
typedef s8  ntfs_s8;
typedef s16 ntfs_s16;
typedef s32 ntfs_s32;
typedef s64 ntfs_s64;
#endif

Linus Torvalds's avatar
Linus Torvalds committed
28
/* Unicode character type */
Linus Torvalds's avatar
Linus Torvalds committed
29 30 31 32
#ifndef NTFS_WCHAR_T
#define NTFS_WCHAR_T
typedef u16 ntfs_wchar_t;
#endif
Linus Torvalds's avatar
Linus Torvalds committed
33
/* File offset */
Linus Torvalds's avatar
Linus Torvalds committed
34 35
#ifndef NTFS_OFFSET_T
#define NTFS_OFFSET_T
Linus Torvalds's avatar
Linus Torvalds committed
36
typedef s64 ntfs_offset_t;
Linus Torvalds's avatar
Linus Torvalds committed
37 38 39 40 41 42
#endif
/* UTC */
#ifndef NTFS_TIME64_T
#define NTFS_TIME64_T
typedef u64 ntfs_time64_t;
#endif
Linus Torvalds's avatar
Linus Torvalds committed
43 44 45 46 47 48 49 50
/*
 * This is really signed long long. So we support only volumes up to 2Tb. This
 * is ok as Win2k also only uses 32-bits to store clusters.
 * Whatever you do keep this a SIGNED value or a lot of NTFS users with
 * corrupted filesystems will lynch you! It causes massive fs corruption when
 * unsigned due to the nature of many checks relying on being performed on
 * signed quantities. (AIA)
 */
Linus Torvalds's avatar
Linus Torvalds committed
51 52
#ifndef NTFS_CLUSTER_T
#define NTFS_CLUSTER_T
Linus Torvalds's avatar
Linus Torvalds committed
53
typedef s32 ntfs_cluster_t;
Linus Torvalds's avatar
Linus Torvalds committed
54 55
#endif

Linus Torvalds's avatar
Linus Torvalds committed
56
/* Architecture independent macros. */
Linus Torvalds's avatar
Linus Torvalds committed
57

Linus Torvalds's avatar
Linus Torvalds committed
58 59 60
/* PUTU32 would not clear all bytes. */
#define NTFS_PUTINUM(p,i)    NTFS_PUTU64(p, i->i_number); \
                             NTFS_PUTU16(((char*)p) + 6, i->sequence_number)
Linus Torvalds's avatar
Linus Torvalds committed
61

Linus Torvalds's avatar
Linus Torvalds committed
62
/* System dependent types. */
Linus Torvalds's avatar
Linus Torvalds committed
63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84
#include <asm/posix_types.h>
#ifndef NTMODE_T
#define NTMODE_T
typedef __kernel_mode_t ntmode_t;
#endif
#ifndef NTFS_UID_T
#define NTFS_UID_T
typedef uid_t ntfs_uid_t;
#endif
#ifndef NTFS_GID_T
#define NTFS_GID_T
typedef gid_t ntfs_gid_t;
#endif
#ifndef NTFS_SIZE_T
#define NTFS_SIZE_T
typedef __kernel_size_t ntfs_size_t;
#endif
#ifndef NTFS_TIME_T
#define NTFS_TIME_T
typedef __kernel_time_t ntfs_time_t;
#endif