Steve Kondik | 2111ad7 | 2013-07-07 12:07:44 -0700 | [diff] [blame] | 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_FAKE_RW, |
| 55 | OPT_FSNAME, |
| 56 | OPT_NO_DEF_OPTS, |
| 57 | OPT_DEFAULT_PERMISSIONS, |
| 58 | OPT_PERMISSIONS, |
| 59 | OPT_ACL, |
| 60 | OPT_UMASK, |
| 61 | OPT_FMASK, |
| 62 | OPT_DMASK, |
| 63 | OPT_UID, |
| 64 | OPT_GID, |
| 65 | OPT_SHOW_SYS_FILES, |
| 66 | OPT_HIDE_HID_FILES, |
| 67 | OPT_HIDE_DOT_FILES, |
| 68 | OPT_IGNORE_CASE, |
| 69 | OPT_WINDOWS_NAMES, |
| 70 | OPT_COMPRESSION, |
| 71 | OPT_NOCOMPRESSION, |
| 72 | OPT_SILENT, |
| 73 | OPT_RECOVER, |
| 74 | OPT_NORECOVER, |
| 75 | OPT_REMOVE_HIBERFILE, |
| 76 | OPT_SYNC, |
| 77 | OPT_BIG_WRITES, |
| 78 | OPT_LOCALE, |
| 79 | OPT_NFCONV, |
| 80 | OPT_NONFCONV, |
| 81 | OPT_STREAMS_INTERFACE, |
| 82 | OPT_USER_XATTR, |
| 83 | OPT_NOAUTO, |
| 84 | OPT_DEBUG, |
| 85 | OPT_NO_DETACH, |
| 86 | OPT_REMOUNT, |
| 87 | OPT_BLKSIZE, |
| 88 | OPT_INHERIT, |
| 89 | OPT_ADDSECURIDS, |
| 90 | OPT_STATICGRPS, |
| 91 | OPT_USERMAPPING, |
| 92 | OPT_XATTRMAPPING, |
| 93 | OPT_EFS_RAW, |
| 94 | } ; |
| 95 | |
| 96 | /* Option flags */ |
| 97 | enum { |
| 98 | FLGOPT_BOGUS = 1, |
| 99 | FLGOPT_STRING = 2, |
| 100 | FLGOPT_OCTAL = 4, |
| 101 | FLGOPT_DECIMAL = 8, |
| 102 | FLGOPT_APPEND = 16, |
| 103 | FLGOPT_NOSUPPORT = 32, |
| 104 | FLGOPT_OPTIONAL = 64 |
| 105 | } ; |
| 106 | |
| 107 | typedef enum { |
| 108 | ATIME_ENABLED, |
| 109 | ATIME_DISABLED, |
| 110 | ATIME_RELATIVE |
| 111 | } ntfs_atime_t; |
| 112 | |
| 113 | typedef struct { |
| 114 | ntfs_volume *vol; |
| 115 | unsigned int uid; |
| 116 | unsigned int gid; |
| 117 | unsigned int fmask; |
| 118 | unsigned int dmask; |
| 119 | ntfs_fuse_streams_interface streams; |
| 120 | ntfs_atime_t atime; |
Steve Kondik | e68cb60 | 2016-08-28 00:45:36 -0700 | [diff] [blame] | 121 | s64 dmtime; |
Steve Kondik | 2111ad7 | 2013-07-07 12:07:44 -0700 | [diff] [blame] | 122 | BOOL ro; |
| 123 | BOOL show_sys_files; |
| 124 | BOOL hide_hid_files; |
| 125 | BOOL hide_dot_files; |
| 126 | BOOL windows_names; |
| 127 | BOOL ignore_case; |
| 128 | BOOL compression; |
| 129 | BOOL acl; |
| 130 | BOOL silent; |
| 131 | BOOL recover; |
| 132 | BOOL hiberfile; |
| 133 | BOOL sync; |
| 134 | BOOL big_writes; |
| 135 | BOOL debug; |
| 136 | BOOL no_detach; |
| 137 | BOOL blkdev; |
| 138 | BOOL mounted; |
| 139 | #ifdef HAVE_SETXATTR /* extended attributes interface required */ |
| 140 | BOOL efs_raw; |
| 141 | #ifdef XATTR_MAPPINGS |
| 142 | char *xattrmap_path; |
| 143 | #endif /* XATTR_MAPPINGS */ |
| 144 | #endif /* HAVE_SETXATTR */ |
| 145 | struct fuse_chan *fc; |
| 146 | BOOL inherit; |
| 147 | unsigned int secure_flags; |
| 148 | char *usermap_path; |
| 149 | char *abs_mnt_point; |
| 150 | struct PERMISSIONS_CACHE *seccache; |
| 151 | struct SECURITY_CONTEXT security; |
| 152 | struct open_file *open_files; /* only defined in lowntfs-3g */ |
| 153 | u64 latest_ghost; |
| 154 | } ntfs_fuse_context_t; |
| 155 | |
| 156 | extern const char *EXEC_NAME; |
| 157 | |
| 158 | #ifdef FUSE_INTERNAL |
| 159 | #define FUSE_TYPE "integrated FUSE" |
| 160 | #else |
| 161 | #define FUSE_TYPE "external FUSE" |
| 162 | #endif |
| 163 | |
| 164 | extern const char xattr_ntfs_3g[]; |
| 165 | |
| 166 | extern const char nf_ns_user_prefix[]; |
| 167 | extern const int nf_ns_user_prefix_len; |
| 168 | extern const char nf_ns_system_prefix[]; |
| 169 | extern const int nf_ns_system_prefix_len; |
| 170 | extern const char nf_ns_security_prefix[]; |
| 171 | extern const int nf_ns_security_prefix_len; |
| 172 | extern const char nf_ns_trusted_prefix[]; |
| 173 | extern const int nf_ns_trusted_prefix_len; |
| 174 | |
| 175 | int ntfs_strappend(char **dest, const char *append); |
| 176 | int ntfs_strinsert(char **dest, const char *append); |
| 177 | char *parse_mount_options(ntfs_fuse_context_t *ctx, |
| 178 | const struct ntfs_options *popts, BOOL low_fuse); |
| 179 | int ntfs_parse_options(struct ntfs_options *popts, void (*usage)(void), |
| 180 | int argc, char *argv[]); |
| 181 | |
| 182 | int ntfs_fuse_listxattr_common(ntfs_inode *ni, ntfs_attr_search_ctx *actx, |
| 183 | char *list, size_t size, BOOL prefixing); |
| 184 | |
| 185 | #endif /* _NTFS_3G_COMMON_H */ |