1 /* 2 * Copyright (c) 2006-2007 Troeglazov Gerasim (3dEyes**) 3 * 4 * This program/include file is free software; you can redistribute it and/or 5 * modify it under the terms of the GNU General Public License as published 6 * by the Free Software Foundation; either version 2 of the License, or 7 * (at your option) any later version. 8 * 9 * This program/include file is distributed in the hope that it will be 10 * useful, but WITHOUT ANY WARRANTY; without even the implied warranty 11 * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 * GNU General Public License for more details. 13 * 14 * You should have received a copy of the GNU General Public License 15 * along with this program (in the main directory of the Linux-NTFS 16 * distribution in the file COPYING); if not, write to the Free Software 17 * Foundation,Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 18 */ 19 #ifndef _NTFS_H 20 #define _NTFS_H 21 22 23 #ifdef __cplusplus 24 extern "C" { 25 #endif 26 27 28 #include <fs_attr.h> 29 #include <fs_cache.h> 30 #include <fs_info.h> 31 #include <fs_interface.h> 32 #include <fs_info.h> 33 #include <fs_index.h> 34 #include <fs_query.h> 35 #include <fs_volume.h> 36 #include <lock.h> 37 #include <NodeMonitor.h> 38 #include <util/kernel_cpp.h> 39 40 #include "config.h" 41 #include "attrib.h" 42 #include "inode.h" 43 #include "volume.h" 44 #include "dir.h" 45 #include "unistr.h" 46 #include "layout.h" 47 #include "index.h" 48 #include "utils.h" 49 #include "ntfstime.h" 50 #include "misc.h" 51 #include "utils.h" 52 #include "bootsect.h" 53 54 #include "lock.h" 55 #include "ntfsdir.h" 56 57 #define TRACE(...) ; 58 //#define TRACE dprintf 59 #define ERROR dprintf 60 61 #define DEV_FD(dev) (*(int *)dev->d_private) 62 #define TEMP_BUFFER_SIZE (B_PAGE_SIZE * 32) 63 64 #define LOCK_VOL(vol) \ 65 { \ 66 if (vol == NULL) { \ 67 return EINVAL; \ 68 } \ 69 \ 70 LOCK((vol)->vlock); \ 71 } 72 73 #define UNLOCK_VOL(vol) \ 74 { \ 75 UNLOCK((vol)->vlock); \ 76 } 77 78 typedef enum { 79 // Information about amount of free clusters is outdated. 80 NF_FreeClustersOutdate = (1 << 0), 81 // Information about amount of free MFT records is outdated. 82 NF_FreeMFTOutdate = (1 << 1), 83 } ntfs_state_bits; 84 85 86 typedef struct vnode { 87 u64 vnid; 88 u64 parent_vnid; 89 char *mime; 90 } vnode; 91 92 typedef struct filecookie { 93 int omode; 94 off_t last_size; 95 } filecookie; 96 97 typedef struct attrcookie { 98 int omode; 99 ino_t vnid; 100 ntfschar* uname; 101 int uname_len; 102 uint32 type; 103 } attrcookie; 104 105 typedef struct attrdircookie { 106 ntfs_inode* inode; 107 ntfs_attr_search_ctx *ctx; 108 } attrdircookie; 109 110 #define ntfs_mark_free_space_outdated(ns) \ 111 (ns->state |= (NF_FreeClustersOutdate | NF_FreeMFTOutdate)); 112 113 114 typedef struct nspace { 115 ntfs_volume *ntvol; 116 char devicePath[MAX_PATH]; 117 dev_t id; 118 int free_cluster_count; 119 char volumeLabel[MAX_PATH]; 120 ulong flags; 121 int state; 122 s64 free_clusters; 123 long free_mft; 124 BOOL ro; 125 BOOL show_sys_files; 126 BOOL fake_attrib; 127 BOOL silent; 128 BOOL force; 129 BOOL debug; 130 BOOL noatime; 131 BOOL no_detach; 132 lock vlock; 133 } nspace; 134 135 136 #ifdef __cplusplus 137 } 138 #endif 139 140 141 #endif 142 143