2 Unix SMB/CIFS implementation.
4 POSIX NTVFS backend - structure definitions
6 Copyright (C) Andrew Tridgell 2004
8 This program is free software; you can redistribute it and/or modify
9 it under the terms of the GNU General Public License as published by
10 the Free Software Foundation; either version 2 of the License, or
11 (at your option) any later version.
13 This program is distributed in the hope that it will be useful,
14 but WITHOUT ANY WARRANTY; without even the implied warranty of
15 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 GNU General Public License for more details.
18 You should have received a copy of the GNU General Public License
19 along with this program; if not, write to the Free Software
20 Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
26 #include "librpc/gen_ndr/xattr.h"
27 #include "system/filesys.h"
28 #include "smb_server/smb_server.h"
29 #include "ntvfs/ntvfs.h"
31 /* this is the private structure for the posix vfs backend. It is used
32 to hold per-connection (per tree connect) state information */
34 struct ntvfs_module_context *ntvfs;
35 const char *base_directory;
36 struct GUID *base_fs_uuid;
38 const char *share_name;
41 struct pvfs_mangle_context *mangle_ctx;
43 struct brl_context *brl_context;
44 struct odb_context *odb_context;
45 struct sidmap_context *sidmap;
47 /* a list of pending async requests. Needed to support
49 struct pvfs_wait *wait_list;
51 /* the sharing violation timeout */
52 uint_t sharing_violation_delay;
54 /* filesystem attributes (see FS_ATTR_*) */
57 /* if posix:eadb is set, then this gets setup */
58 struct tdb_wrap *ea_db;
60 /* the allocation size rounding */
61 uint32_t alloc_size_rounding;
64 /* an id tree mapping open file handle -> struct pvfs_file */
65 struct idr_context *idtree;
67 /* the open files as DLINKLIST */
68 struct pvfs_file *list;
72 /* an id tree mapping open search ID to a pvfs_search_state structure */
73 struct idr_context *idtree;
75 /* the open searches as DLINKLIST */
76 struct pvfs_search_state *list;
78 /* how long to keep inactive searches around for */
79 uint_t inactivity_time;
82 /* used to accelerate acl mapping */
84 const struct dom_sid *creator_owner;
85 const struct dom_sid *creator_group;
89 /* this is the basic information needed about a file from the filesystem */
90 struct pvfs_dos_fileinfo {
104 this is the structure returned by pvfs_resolve_name(). It holds the posix details of
105 a filename passed by the client to any function
107 struct pvfs_filename {
108 const char *original_name;
110 const char *stream_name; /* does not include :$DATA suffix */
111 uint32_t stream_id; /* this uses a hash, so is probabilistic */
113 BOOL exists; /* true if the base filename exists */
114 BOOL stream_exists; /* true if the stream exists */
116 struct pvfs_dos_fileinfo dos;
120 /* open file handle state - encapsulates the posix fd
122 Note that this is separated from the pvfs_file structure in order
123 to cope with the openx DENY_DOS semantics where a 2nd DENY_DOS open
124 on the same connection gets the same low level filesystem handle,
125 rather than a new handle
127 struct pvfs_file_handle {
130 struct pvfs_filename *name;
132 /* a unique file key to be used for open file locking */
133 DATA_BLOB odb_locking_key;
135 /* a unique file key to be used for byte range locking */
136 DATA_BLOB brl_locking_key;
138 uint32_t create_options;
140 /* this is set by the mode_information level. What does it do? */
143 /* yes, we need 2 independent positions ... */
144 uint64_t seek_offset;
147 BOOL have_opendb_entry;
149 /* we need this hook back to our parent for lock destruction */
150 struct pvfs_state *pvfs;
152 /* have we set a sticky write time that we should remove on close */
153 BOOL sticky_write_time;
156 /* open file state */
158 struct pvfs_file *next, *prev;
159 struct pvfs_file_handle *handle;
162 struct pvfs_state *pvfs;
164 uint32_t impersonation;
165 uint32_t share_access;
166 uint32_t access_mask;
168 /* we need to remember the session it was opened on,
169 as it is illegal to operate on someone elses fnum */
170 struct auth_session_info *session_info;
172 /* we need to remember the client pid that
173 opened the file so SMBexit works */
176 /* a list of pending locks - used for locking cancel operations */
177 struct pvfs_pending_lock *pending_list;
179 /* a count of active locks - used to avoid calling brl_close on
184 /* the state of a search started with pvfs_search_first() */
185 struct pvfs_search_state {
186 struct pvfs_search_state *prev, *next;
187 struct pvfs_state *pvfs;
189 uint_t current_index;
190 uint16_t search_attrib;
191 uint16_t must_attrib;
192 struct pvfs_dir *dir;
195 struct ea_name *ea_names;
196 struct timed_event *te;
199 /* flags to pvfs_resolve_name() */
200 #define PVFS_RESOLVE_WILDCARD (1<<0)
201 #define PVFS_RESOLVE_STREAMS (1<<1)
203 /* flags in pvfs->flags */
204 #define PVFS_FLAG_CI_FILESYSTEM (1<<0) /* the filesystem is case insensitive */
205 #define PVFS_FLAG_MAP_ARCHIVE (1<<1)
206 #define PVFS_FLAG_MAP_SYSTEM (1<<2)
207 #define PVFS_FLAG_MAP_HIDDEN (1<<3)
208 #define PVFS_FLAG_READONLY (1<<4)
209 #define PVFS_FLAG_STRICT_SYNC (1<<5)
210 #define PVFS_FLAG_STRICT_LOCKING (1<<6)
211 #define PVFS_FLAG_XATTR_ENABLE (1<<7)
212 #define PVFS_FLAG_FAKE_OPLOCKS (1<<8)
214 /* forward declare some anonymous structures */
217 /* types of notification for pvfs wait events */
218 enum pvfs_wait_notice {PVFS_WAIT_EVENT, PVFS_WAIT_TIMEOUT, PVFS_WAIT_CANCEL};
220 #include "ntvfs/posix/vfs_posix_proto.h"
222 #endif /* _VFS_POSIX_H_ */