113546Sjulian/* 235509Sjb * types.h - Misc type definitions not related to on-disk structure. 313546Sjulian * Originated from the Linux-NTFS project. 413546Sjulian * 513546Sjulian * Copyright (c) 2000-2004 Anton Altaparmakov 613546Sjulian * 713546Sjulian * This program/include file is free software; you can redistribute it and/or 813546Sjulian * modify it under the terms of the GNU General Public License as published 913546Sjulian * by the Free Software Foundation; either version 2 of the License, or 1013546Sjulian * (at your option) any later version. 1113546Sjulian * 1213546Sjulian * This program/include file is distributed in the hope that it will be 1313546Sjulian * useful, but WITHOUT ANY WARRANTY; without even the implied warranty 1413546Sjulian * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 1513546Sjulian * GNU General Public License for more details. 1613546Sjulian * 1713546Sjulian * You should have received a copy of the GNU General Public License 1813546Sjulian * along with this program (in the main directory of the NTFS-3G 1913546Sjulian * distribution in the file COPYING); if not, write to the Free Software 2013546Sjulian * Foundation,Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 2113546Sjulian */ 2213546Sjulian 2349439Sdeischen#ifndef _NTFS_TYPES_H 2413546Sjulian#define _NTFS_TYPES_H 2513546Sjulian 2613546Sjulian#ifdef HAVE_CONFIG_H 2713546Sjulian#include "config.h" 2813546Sjulian#endif 2913546Sjulian 3013546Sjulian#if HAVE_STDINT_H || !HAVE_CONFIG_H 3113546Sjulian#include <stdint.h> 3250476Speter#endif 3324518Sjb#ifdef HAVE_SYS_TYPES_H 3413546Sjulian#include <sys/types.h> 3513546Sjulian#endif 3613546Sjulian 3713546Sjuliantypedef uint8_t u8; /* Unsigned types of an exact size */ 3813546Sjuliantypedef uint16_t u16; 3913546Sjuliantypedef uint32_t u32; 4013546Sjuliantypedef uint64_t u64; 41103388Smini 4213546Sjuliantypedef int8_t s8; /* Signed types of an exact size */ 4375369Sdeischentypedef int16_t s16; 4471581Sdeischentypedef int32_t s32; 4513546Sjuliantypedef int64_t s64; 4671581Sdeischen 4756698Sjasonetypedef u16 le16; 4856698Sjasonetypedef u32 le32; 4956698Sjasonetypedef u64 le64; 5056698Sjasone 51103419Smini/* 5256698Sjasone * Declare sle{16,32,64} to be unsigned because we do not want sign extension 5356698Sjasone * on BE architectures. 5456698Sjasone */ 5556698Sjasonetypedef u16 sle16; 56typedef u32 sle32; 57typedef u64 sle64; 58 59typedef u16 ntfschar; /* 2-byte Unicode character type. */ 60#define UCHAR_T_SIZE_BITS 1 61 62/* 63 * Clusters are signed 64-bit values on NTFS volumes. We define two types, LCN 64 * and VCN, to allow for type checking and better code readability. 65 */ 66typedef s64 VCN; 67typedef sle64 leVCN; 68typedef s64 LCN; 69typedef sle64 leLCN; 70 71/* 72 * The NTFS journal $LogFile uses log sequence numbers which are signed 64-bit 73 * values. We define our own type LSN, to allow for type checking and better 74 * code readability. 75 */ 76typedef s64 LSN; 77typedef sle64 leLSN; 78 79/* 80 * Cygwin has a collision between our BOOL and <windef.h>'s 81 * As long as this file will be included after <windows.h> were fine. 82 */ 83#ifndef _WINDEF_H 84/** 85 * enum BOOL - These are just to make the code more readable... 86 */ 87typedef enum { 88#ifndef FALSE 89 FALSE = 0, 90#endif 91#ifndef NO 92 NO = 0, 93#endif 94#ifndef ZERO 95 ZERO = 0, 96#endif 97#ifndef TRUE 98 TRUE = 1, 99#endif 100#ifndef YES 101 YES = 1, 102#endif 103#ifndef ONE 104 ONE = 1, 105#endif 106} BOOL; 107#endif /* defined _WINDEF_H */ 108 109/** 110 * enum IGNORE_CASE_BOOL - 111 */ 112typedef enum { 113 CASE_SENSITIVE = 0, 114 IGNORE_CASE = 1, 115} IGNORE_CASE_BOOL; 116 117#define STATUS_OK (0) 118#define STATUS_ERROR (-1) 119#define STATUS_RESIDENT_ATTRIBUTE_FILLED_MFT (-2) 120#define STATUS_KEEP_SEARCHING (-3) 121#define STATUS_NOT_FOUND (-4) 122 123/* 124 * Force alignment in a struct if required by processor 125 */ 126union ALIGNMENT { 127 u64 u64align; 128 void *ptralign; 129} ; 130 131#endif /* defined _NTFS_TYPES_H */ 132 133