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 /* this is the private structure for the posix vfs backend. It is used
27 to hold per-connection (per tree connect) state information */
29 struct smbsrv_tcon *tcon;
30 const char *base_directory;
32 const char *share_name;
35 struct pvfs_file *open_files;
37 struct pvfs_mangle_context *mangle_ctx;
39 struct brl_context *brl_context;
40 struct odb_context *odb_context;
42 /* an id tree mapping open search ID to a pvfs_search_state structure */
43 struct idr_context *idtree_search;
45 /* an id tree mapping open file handle -> struct pvfs_file */
46 struct idr_context *idtree_fnum;
50 /* this is the basic information needed about a file from the filesystem */
51 struct pvfs_dos_fileinfo {
64 this is the structure returned by pvfs_resolve_name(). It holds the posix details of
65 a filename passed by the client to any function
67 struct pvfs_filename {
68 const char *original_name;
70 const char *stream_name;
74 struct pvfs_dos_fileinfo dos;
78 /* the state of a search started with pvfs_search_first() */
79 struct pvfs_search_state {
80 struct pvfs_state *pvfs;
83 uint16_t search_attrib;
90 struct pvfs_file *next, *prev;
93 struct pvfs_filename *name;
95 /* we need to remember the session it was opened on,
96 as it is illegal to operate on someone elses fnum */
97 struct smbsrv_session *session;
99 /* we need to remember the client pid that
100 opened the file so SMBexit works */
103 /* a unique file key to be used for file locking */
104 DATA_BLOB locking_key;
106 /* we need this hook back to our parent for lock destruction */
107 struct pvfs_state *pvfs;
109 /* a list of pending locks - used for locking cancel operations */
110 struct pvfs_pending_lock *pending_list;
112 /* a count of active locks - used to avoid calling brl_close on
116 uint32_t create_options;
117 uint32_t share_access;
118 uint32_t access_mask;
120 /* yes, we need 2 independent positions ... */
121 uint64_t seek_offset;
126 struct pvfs_mangle_context {
127 uint8_t char_flags[256];
129 this determines how many characters are used from the original
130 filename in the 8.3 mangled name. A larger value leads to a weaker
131 hash and more collisions. The largest possible value is 6.
134 uint32_t mangle_modulus;
136 /* we will use a very simple direct mapped prefix cache. The big
137 advantage of this cache structure is speed and low memory usage
139 The cache is indexed by the low-order bits of the hash, and confirmed by
140 hashing the resulting cache entry to match the known hash
143 uint32_t *prefix_cache_hashes;
145 /* this is used to reverse the base 36 mapping */
146 unsigned char base_reverse[256];
151 /* flags to pvfs_resolve_name() */
152 #define PVFS_RESOLVE_NO_WILDCARD (1<<0)
153 #define PVFS_RESOLVE_STREAMS (1<<1)
155 /* flags in pvfs->flags */
156 #define PVFS_FLAG_CI_FILESYSTEM (1<<0) /* the filesystem is case insensitive */
157 #define PVFS_FLAG_MAP_ARCHIVE (1<<1)
158 #define PVFS_FLAG_MAP_SYSTEM (1<<2)
159 #define PVFS_FLAG_MAP_HIDDEN (1<<3)
160 #define PVFS_FLAG_READONLY (1<<4)
161 #define PVFS_FLAG_STRICT_SYNC (1<<5)
162 #define PVFS_FLAG_STRICT_LOCKING (1<<6)
164 #endif /* _VFS_POSIX_H_ */