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 51/* 52 * Declare sle{16,32,64} to be unsigned because we do not want sign extension 53 * on BE architectures. 54 */ 55typedef 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#endif /* defined _NTFS_TYPES_H */ 124 125