r2561: completely redid the ntvfs module chaining code, You can now do something...
[jra/samba/.git] / source4 / ntvfs / posix / vfs_posix.h
1 /* 
2    Unix SMB/CIFS implementation.
3
4    POSIX NTVFS backend - structure definitions
5
6    Copyright (C) Andrew Tridgell 2004
7
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.
12    
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.
17    
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.
21 */
22
23 #ifndef _VFS_POSIX_H_
24 #define _VFS_POSIX_H_
25
26 /* this is the private structure for the posix vfs backend. It is used
27    to hold per-connection (per tree connect) state information */
28 struct pvfs_state {
29         struct smbsrv_tcon *tcon;
30         const char *base_directory;
31
32         const char *share_name;
33         uint_t flags;
34
35         struct {
36                 /* a linked list of open searches */
37                 struct pvfs_search_state *open_searches;
38
39                 /* search handles are returned to the clients so they
40                    can continue searches */
41                 uint16_t next_search_handle;
42
43                 /* count of active searches */
44                 uint_t num_active_searches;
45
46                 /* during trans2 search continuations we need to use
47                    the initial search attributes */
48                 uint16_t search_attrib;
49         } search;
50
51         struct pvfs_file *open_files;
52
53         const struct ntvfs_ops *ops;
54 };
55
56
57 /* this is the basic information needed about a file from the filesystem */
58 struct pvfs_dos_fileinfo {
59         NTTIME create_time;
60         NTTIME access_time;
61         NTTIME write_time;
62         NTTIME change_time;
63         uint32_t attrib;
64         uint64_t alloc_size;
65         uint32_t nlink;
66         uint32_t ea_size;
67         uint64_t file_id;
68 };
69
70 /*
71   this is the structure returned by pvfs_resolve_name(). It holds the posix details of
72   a filename passed by the client to any function
73 */
74 struct pvfs_filename {
75         const char *original_name;
76         char *full_name;
77         const char *stream_name;
78         BOOL has_wildcard;
79         BOOL exists;
80         struct stat st;
81         struct pvfs_dos_fileinfo dos;
82 };
83
84
85 /* this holds a list of file names for a search. We deliberately do
86    not hold the file stat information here to minimise the memory
87    overhead of idle searches */
88 struct pvfs_dir {
89         uint_t count;
90         const char *unix_path;
91         const char **names;
92 };
93
94 /* the state of a search started with pvfs_search_first() */
95 struct pvfs_search_state {
96         struct pvfs_search_state *next, *prev;
97         uint16_t handle;
98         uint_t current_index;
99         uint16_t search_attrib;
100         struct pvfs_dir *dir;
101 };
102
103 /* open file state - this is a temporary implementation
104    to allow some tests to work */
105 struct pvfs_file {
106         struct pvfs_file *next, *prev;
107         int fd;
108         uint16_t fnum;
109         struct pvfs_filename *name;
110 };
111
112
113 /* flags to pvfs_resolve_name() */
114 #define PVFS_RESOLVE_NO_WILDCARD (1<<0)
115 #define PVFS_RESOLVE_STREAMS     (1<<1)
116
117 /* flags in pvfs->flags */
118 #define PVFS_FLAG_CI_FILESYSTEM (1<<0) /* the filesystem is case insensitive */
119 #define PVFS_FLAG_MAP_ARCHIVE   (1<<1)
120 #define PVFS_FLAG_MAP_SYSTEM    (1<<2)
121 #define PVFS_FLAG_MAP_HIDDEN    (1<<3)
122 #define PVFS_FLAG_READONLY      (1<<4)
123
124 #endif /* _VFS_POSIX_H_ */