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