xref: /haiku/src/add-ons/kernel/file_systems/ntfs/ntfs.h (revision 80d75f15dfa48ebea421c6b2c19a5296cc63d7eb)
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 
20 #ifndef _NTFS_H
21 #define _NTFS_H
22 
23 #ifdef __cplusplus
24 extern "C" {
25 #endif
26 
27 #ifdef __HAIKU__
28 
29 #include <fs_interface.h>
30 #include <kernel/lock.h>
31 #include <fs_info.h>
32 #include <fs_cache.h>
33 #include <fs_attr.h>
34 #include <fs_info.h>
35 #include <fs_index.h>
36 #include <fs_query.h>
37 #include <fs_volume.h>
38 #include <NodeMonitor.h>
39 #include <util/kernel_cpp.h>
40 
41 #else
42 
43 #include "fsproto.h"
44 #include "lock.h"
45 
46 #define publish_vnode new_vnode
47 
48 #endif
49 
50 #include "config.h"
51 #include "attrib.h"
52 #include "inode.h"
53 #include "volume.h"
54 #include "dir.h"
55 #include "unistr.h"
56 #include "layout.h"
57 #include "index.h"
58 #include "utils.h"
59 #include "version.h"
60 #include "ntfstime.h"
61 #include "misc.h"
62 #include "utils.h"
63 #include "bootsect.h"
64 
65 #include "lock.h"
66 #include "ntfsdir.h"
67 
68 #define  	ERRPRINT(...) ;
69 //#define 	ERRPRINT dprintf
70 
71 #define 	DEV_FD(dev)	(*(int *)dev->d_private)
72 
73 #define 	LOCK_VOL(vol) \
74 { \
75 if (vol == NULL) { \
76 	return EINVAL; \
77 } \
78 \
79 LOCK((vol)->vlock); \
80 }
81 
82 #define 	UNLOCK_VOL(vol) \
83 { \
84 UNLOCK((vol)->vlock); \
85 }
86 
87 typedef enum {
88 	NF_FreeClustersOutdate	= (1 << 0),  		// Information about amount of free clusters is outdated.
89 	NF_FreeMFTOutdate	= (1 << 1),  			//	Information about amount of	free MFT records is outdated.
90 } ntfs_state_bits;
91 
92 
93 typedef struct vnode
94 {
95 	u64			vnid;
96 	u64			parent_vnid;
97 	char 		*mime;
98 } vnode;
99 
100 typedef struct filecookie
101 {
102 	int	omode;
103 	off_t	last_size;
104 } filecookie;
105 
106 #define ntfs_mark_free_space_outdated(ns) (ns->state |= (NF_FreeClustersOutdate | NF_FreeMFTOutdate));
107 
108 
109 
110 typedef struct nspace
111 {
112 	ntfs_volume	*ntvol;
113 	char		devicePath[MAX_PATH];
114 #ifdef __HAIKU__
115 	dev_t		id;
116 #else
117 	nspace_id	id;
118 #endif
119 	int			free_cluster_count;
120 	char		volumeLabel[MAX_PATH];
121 
122 	ulong 		flags;
123 
124 	int 		state;
125 	s64 		free_clusters;
126 	long 		free_mft;
127 	BOOL 		ro;
128 	BOOL 		show_sys_files;
129 	BOOL 		silent;
130 	BOOL 		force;
131 	BOOL 		debug;
132 	BOOL 		noatime;
133 	BOOL 		no_detach;
134 
135 
136 	lock		vlock;
137 
138 } nspace;
139 
140 
141 #ifdef __cplusplus
142 }
143 #endif
144 
145 
146 #endif
147