• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * ntfs-3g_common.h - Common declarations for ntfs-3g and lowntfs-3g.
3  *
4  * Copyright (c) 2010-2011 Jean-Pierre Andre
5  * Copyright (c) 2010      Erik Larsson
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_3G_COMMON_H
24 #define _NTFS_3G_COMMON_H
25 
26 #include "inode.h"
27 
28 struct ntfs_options {
29         char    *mnt_point;     /* Mount point */
30         char    *options;       /* Mount options */
31         char    *device;        /* Device to mount */
32 	char	*arg_device;	/* Device requested in argv */
33 } ;
34 
35 typedef enum {
36 	NF_STREAMS_INTERFACE_NONE,	/* No access to named data streams. */
37 	NF_STREAMS_INTERFACE_XATTR,	/* Map named data streams to xattrs. */
38 	NF_STREAMS_INTERFACE_OPENXATTR,	/* Same, not limited to "user." */
39 	NF_STREAMS_INTERFACE_WINDOWS,	/* "file:stream" interface. */
40 } ntfs_fuse_streams_interface;
41 
42 struct DEFOPTION {
43 	const char *name;
44 	int type;
45 	int flags;
46 } ;
47 			/* Options, order not significant */
48 enum {
49 	OPT_RO,
50 	OPT_NOATIME,
51 	OPT_ATIME,
52 	OPT_RELATIME,
53 	OPT_DMTIME,
54 	OPT_RW,
55 	OPT_FAKE_RW,
56 	OPT_FSNAME,
57 	OPT_NO_DEF_OPTS,
58 	OPT_DEFAULT_PERMISSIONS,
59 	OPT_PERMISSIONS,
60 	OPT_ACL,
61 	OPT_UMASK,
62 	OPT_FMASK,
63 	OPT_DMASK,
64 	OPT_UID,
65 	OPT_GID,
66 	OPT_SHOW_SYS_FILES,
67 	OPT_HIDE_HID_FILES,
68 	OPT_HIDE_DOT_FILES,
69 	OPT_IGNORE_CASE,
70 	OPT_WINDOWS_NAMES,
71 	OPT_COMPRESSION,
72 	OPT_NOCOMPRESSION,
73 	OPT_SILENT,
74 	OPT_RECOVER,
75 	OPT_NORECOVER,
76 	OPT_REMOVE_HIBERFILE,
77 	OPT_SYNC,
78 	OPT_BIG_WRITES,
79 	OPT_LOCALE,
80 	OPT_NFCONV,
81 	OPT_NONFCONV,
82 	OPT_STREAMS_INTERFACE,
83 	OPT_USER_XATTR,
84 	OPT_NOAUTO,
85 	OPT_DEBUG,
86 	OPT_NO_DETACH,
87 	OPT_REMOUNT,
88 	OPT_BLKSIZE,
89 	OPT_INHERIT,
90 	OPT_ADDSECURIDS,
91 	OPT_STATICGRPS,
92 	OPT_USERMAPPING,
93 	OPT_XATTRMAPPING,
94 	OPT_EFS_RAW,
95 	OPT_POSIX_NLINK,
96 	OPT_SPECIAL_FILES,
97 	OPT_HELP,
98 	OPT_VERSION,
99 } ;
100 
101 			/* Option flags */
102 enum {
103 	FLGOPT_BOGUS = 1,
104 	FLGOPT_STRING = 2,
105 	FLGOPT_OCTAL = 4,
106 	FLGOPT_DECIMAL = 8,
107 	FLGOPT_APPEND = 16,
108 	FLGOPT_NOSUPPORT = 32,
109 	FLGOPT_OPTIONAL = 64
110 } ;
111 
112 typedef enum {
113 	ATIME_ENABLED,
114 	ATIME_DISABLED,
115 	ATIME_RELATIVE
116 } ntfs_atime_t;
117 
118 typedef enum {
119 	ERR_PLUGIN = 1
120 } single_log_t;
121 
122 #ifndef DISABLE_PLUGINS
123 
124 typedef struct plugin_list {
125 	struct plugin_list *next;
126 	void *handle;
127 	const plugin_operations_t *ops;
128 	le32 tag;
129 } plugin_list_t;
130 
131 #endif /* DISABLE_PLUGINS */
132 
133 typedef struct {
134 	ntfs_volume *vol;
135 	unsigned int uid;
136 	unsigned int gid;
137 	unsigned int fmask;
138 	unsigned int dmask;
139 	ntfs_fuse_streams_interface streams;
140 	ntfs_atime_t atime;
141 	s64 dmtime;
142 	BOOL ro;
143 	BOOL rw;
144 	BOOL show_sys_files;
145 	BOOL hide_hid_files;
146 	BOOL hide_dot_files;
147 	BOOL windows_names;
148 	BOOL ignore_case;
149 	BOOL compression;
150 	BOOL acl;
151 	BOOL silent;
152 	BOOL recover;
153 	BOOL hiberfile;
154 	BOOL sync;
155 	BOOL big_writes;
156 	BOOL debug;
157 	BOOL no_detach;
158 	BOOL blkdev;
159 	BOOL mounted;
160 	BOOL posix_nlink;
161 	ntfs_volume_special_files special_files;
162 #ifdef HAVE_SETXATTR	/* extended attributes interface required */
163 	BOOL efs_raw;
164 #ifdef XATTR_MAPPINGS
165 	char *xattrmap_path;
166 #endif /* XATTR_MAPPINGS */
167 #endif /* HAVE_SETXATTR */
168 	struct fuse_chan *fc;
169 	BOOL inherit;
170 	unsigned int secure_flags;
171 	single_log_t errors_logged;
172 	char *usermap_path;
173 	char *abs_mnt_point;
174 #ifndef DISABLE_PLUGINS
175 	plugin_list_t *plugins;
176 #endif /* DISABLE_PLUGINS */
177 	struct PERMISSIONS_CACHE *seccache;
178 	struct SECURITY_CONTEXT security;
179 	struct open_file *open_files; /* only defined in lowntfs-3g */
180 	u64 latest_ghost;
181 } ntfs_fuse_context_t;
182 
183 extern const char *EXEC_NAME;
184 
185 #ifdef FUSE_INTERNAL
186 #define FUSE_TYPE	"integrated FUSE"
187 #else
188 #define FUSE_TYPE	"external FUSE"
189 #endif
190 
191 extern const char xattr_ntfs_3g[];
192 
193 extern const char nf_ns_user_prefix[];
194 extern const int nf_ns_user_prefix_len;
195 extern const char nf_ns_system_prefix[];
196 extern const int nf_ns_system_prefix_len;
197 extern const char nf_ns_security_prefix[];
198 extern const int nf_ns_security_prefix_len;
199 extern const char nf_ns_trusted_prefix[];
200 extern const int nf_ns_trusted_prefix_len;
201 
202 int ntfs_strappend(char **dest, const char *append);
203 int ntfs_strinsert(char **dest, const char *append);
204 char *parse_mount_options(ntfs_fuse_context_t *ctx,
205 			const struct ntfs_options *popts, BOOL low_fuse);
206 int ntfs_parse_options(struct ntfs_options *popts, void (*usage)(void),
207 			int argc, char *argv[]);
208 
209 int ntfs_fuse_listxattr_common(ntfs_inode *ni, ntfs_attr_search_ctx *actx,
210  			char *list, size_t size, BOOL prefixing);
211 BOOL user_xattrs_allowed(ntfs_fuse_context_t *ctx, ntfs_inode *ni);
212 
213 #ifndef DISABLE_PLUGINS
214 
215 void close_reparse_plugins(ntfs_fuse_context_t *ctx);
216 const struct plugin_operations *select_reparse_plugin(ntfs_fuse_context_t *ctx,
217 				ntfs_inode *ni, REPARSE_POINT **reparse);
218 int register_reparse_plugin(ntfs_fuse_context_t *ctx, le32 tag,
219                                 const plugin_operations_t *ops, void *handle);
220 
221 #endif /* DISABLE_PLUGINS */
222 
223 #endif /* _NTFS_3G_COMMON_H */
224