1 /*
2    Unix SMB/CIFS implementation.
3    VFS wrapper macros
4    Copyright (C) Stefan (metze) Metzmacher	2003
5    Copyright (C) Volker Lendecke		2009
6 
7    This program is free software; you can redistribute it and/or modify
8    it under the terms of the GNU General Public License as published by
9    the Free Software Foundation; either version 3 of the License, or
10    (at your option) any later version.
11 
12    This program is distributed in the hope that it will be useful,
13    but WITHOUT ANY WARRANTY; without even the implied warranty of
14    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.  If not, see <http://www.gnu.org/licenses/>.
19 */
20 
21 #ifndef _VFS_MACROS_H
22 #define _VFS_MACROS_H
23 
24 /*
25  * These macros SMB_VFS_<FOO> (and SMB_VFS_NEXT_<FOO>) are our
26  * interface for the VFS.
27  *
28  * Don't access conn->vfs_handles[->next]->fns->* directly!
29  */
30 
31 /* Disk operations */
32 #define SMB_VFS_CONNECT(conn, service, user) \
33 	smb_vfs_call_connect((conn)->vfs_handles, (service), (user))
34 #define SMB_VFS_NEXT_CONNECT(handle, service, user) \
35 	smb_vfs_call_connect((handle)->next, (service), (user))
36 
37 #define SMB_VFS_DISCONNECT(conn) \
38 	smb_vfs_call_disconnect((conn)->vfs_handles)
39 #define SMB_VFS_NEXT_DISCONNECT(handle) \
40 	smb_vfs_call_disconnect((handle)->next)
41 
42 #define SMB_VFS_DISK_FREE(conn, smb_fname, bsize, dfree ,dsize) \
43 	smb_vfs_call_disk_free((conn)->vfs_handles, (smb_fname), (bsize), (dfree), (dsize))
44 #define SMB_VFS_NEXT_DISK_FREE(handle, smb_fname, bsize, dfree ,dsize)\
45 	smb_vfs_call_disk_free((handle)->next, (smb_fname), (bsize), (dfree), (dsize))
46 
47 #define SMB_VFS_GET_QUOTA(conn, smb_fname, qtype, id, qt)                           \
48 	smb_vfs_call_get_quota((conn)->vfs_handles, (smb_fname), (qtype), (id), (qt))
49 #define SMB_VFS_NEXT_GET_QUOTA(handle, smb_fname, qtype, id, qt)                    \
50 	smb_vfs_call_get_quota((handle)->next, (smb_fname), (qtype), (id), (qt))
51 
52 #define SMB_VFS_SET_QUOTA(conn, qtype, id, qt) \
53 	smb_vfs_call_set_quota((conn)->vfs_handles, (qtype), (id), (qt))
54 #define SMB_VFS_NEXT_SET_QUOTA(handle, qtype, id, qt) \
55 	smb_vfs_call_set_quota((handle)->next, (qtype), (id), (qt))
56 
57 #define SMB_VFS_GET_SHADOW_COPY_DATA(fsp,shadow_copy_data,labels) \
58 	smb_vfs_call_get_shadow_copy_data((fsp)->conn->vfs_handles, (fsp), (shadow_copy_data), (labels))
59 #define SMB_VFS_NEXT_GET_SHADOW_COPY_DATA(handle, fsp, shadow_copy_data ,labels) \
60 	smb_vfs_call_get_shadow_copy_data((handle)->next, (fsp), (shadow_copy_data), (labels))
61 
62 #define SMB_VFS_STATVFS(conn, smb_fname, statbuf) \
63 	smb_vfs_call_statvfs((conn)->vfs_handles, (smb_fname), (statbuf))
64 #define SMB_VFS_NEXT_STATVFS(handle, smb_fname, statbuf) \
65 	smb_vfs_call_statvfs((handle)->next, (smb_fname), (statbuf))
66 
67 #define SMB_VFS_FS_CAPABILITIES(conn, p_ts_res) \
68 	smb_vfs_call_fs_capabilities((conn)->vfs_handles, (p_ts_res))
69 #define SMB_VFS_NEXT_FS_CAPABILITIES(handle, p_ts_res) \
70 	smb_vfs_call_fs_capabilities((handle)->next, (p_ts_res))
71 
72 /*
73  * Note: that "struct dfs_GetDFSReferral *r"
74  * needs to be a valid TALLOC_CTX
75  */
76 #define SMB_VFS_GET_DFS_REFERRALS(conn, r) \
77 	smb_vfs_call_get_dfs_referrals((conn)->vfs_handles, (r))
78 #define SMB_VFS_NEXT_GET_DFS_REFERRALS(handle, r) \
79 	smb_vfs_call_get_dfs_referrals((handle)->next, (r))
80 
81 #define SMB_VFS_CREATE_DFS_PATHAT(conn, dirfsp, smb_fname, reflist, count) \
82 	smb_vfs_call_create_dfs_pathat((conn)->vfs_handles, \
83 		(dirfsp), \
84 		(smb_fname), \
85 		(reflist), \
86 		(count))
87 #define SMB_VFS_NEXT_CREATE_DFS_PATHAT(handle, dirfsp, smb_fname, reflist, count) \
88 	smb_vfs_call_create_dfs_pathat((handle)->next, \
89 		(dirfsp), \
90 		(smb_fname), \
91 		(reflist), \
92 		(count))
93 #define SMB_VFS_READ_DFS_PATHAT(conn, mem_ctx, dirfsp, smb_fname, ppreflist, pcount) \
94 	smb_vfs_call_read_dfs_pathat((conn)->vfs_handles, \
95 		(mem_ctx), \
96 		(dirfsp), \
97 		(smb_fname), \
98 		(ppreflist), \
99 		(pcount))
100 #define SMB_VFS_NEXT_READ_DFS_PATHAT(handle, mem_ctx, dirfsp, smb_fname, ppreflist, pcount) \
101         smb_vfs_call_read_dfs_pathat((handle)->next, \
102 		(mem_ctx), \
103                 (dirfsp), \
104                 (smb_fname), \
105                 (ppreflist), \
106                 (pcount))
107 
108 /* Directory operations */
109 #define SMB_VFS_OPENDIR(conn, smb_fname, mask, attr) \
110 	smb_vfs_call_opendir((conn)->vfs_handles, (smb_fname), (mask), (attr))
111 #define SMB_VFS_NEXT_OPENDIR(handle, smb_fname, mask, attr) \
112 	smb_vfs_call_opendir((handle)->next, (smb_fname), (mask), (attr))
113 
114 #define SMB_VFS_FDOPENDIR(fsp, mask, attr) \
115 	smb_vfs_call_fdopendir((fsp)->conn->vfs_handles, (fsp), (mask), (attr))
116 #define SMB_VFS_NEXT_FDOPENDIR(handle, fsp, mask, attr) \
117 	smb_vfs_call_fdopendir((handle)->next, (fsp), (mask), (attr))
118 
119 #define SMB_VFS_READDIR(conn, dirp, sbuf) \
120 	smb_vfs_call_readdir((conn)->vfs_handles, (dirp), (sbuf))
121 #define SMB_VFS_NEXT_READDIR(handle, dirp, sbuf) \
122 	smb_vfs_call_readdir((handle)->next, (dirp), (sbuf))
123 
124 #define SMB_VFS_SEEKDIR(conn, dirp, offset) \
125 	smb_vfs_call_seekdir((conn)->vfs_handles, (dirp), (offset))
126 #define SMB_VFS_NEXT_SEEKDIR(handle, dirp, offset) \
127 	smb_vfs_call_seekdir((handle)->next, (dirp), (offset))
128 
129 #define SMB_VFS_TELLDIR(conn, dirp) \
130 	smb_vfs_call_telldir((conn)->vfs_handles, (dirp))
131 #define SMB_VFS_NEXT_TELLDIR(handle, dirp) \
132 	smb_vfs_call_telldir((handle)->next, (dirp))
133 
134 #define SMB_VFS_REWINDDIR(conn, dirp) \
135 	smb_vfs_call_rewind_dir((conn)->vfs_handles, (dirp))
136 #define SMB_VFS_NEXT_REWINDDIR(handle, dirp) \
137 	smb_vfs_call_rewind_dir((handle)->next, (dirp))
138 
139 #define SMB_VFS_MKDIRAT(conn, dirfsp, smb_fname, mode) \
140 	smb_vfs_call_mkdirat((conn)->vfs_handles,(dirfsp), (smb_fname), (mode))
141 #define SMB_VFS_NEXT_MKDIRAT(handle, dirfsp, smb_fname, mode) \
142 	smb_vfs_call_mkdirat((handle)->next,(dirfsp), (smb_fname), (mode))
143 
144 #define SMB_VFS_CLOSEDIR(conn, dir) \
145 	smb_vfs_call_closedir((conn)->vfs_handles, dir)
146 #define SMB_VFS_NEXT_CLOSEDIR(handle, dir) \
147 	smb_vfs_call_closedir((handle)->next, (dir))
148 
149 /* File operations */
150 #define SMB_VFS_OPEN(conn, fname, fsp, flags, mode) \
151 	smb_vfs_call_open((conn)->vfs_handles, (fname), (fsp), (flags), (mode))
152 #define SMB_VFS_NEXT_OPEN(handle, fname, fsp, flags, mode) \
153 	smb_vfs_call_open((handle)->next, (fname), (fsp), (flags), (mode))
154 
155 #define SMB_VFS_CREATE_FILE(conn, req, root_dir_fid, smb_fname, access_mask, share_access, create_disposition, \
156         create_options, file_attributes, oplock_request, lease, allocation_size, private_flags, sd, ea_list, result, pinfo, in_context_blobs, out_context_blobs) \
157         smb_vfs_call_create_file((conn)->vfs_handles, (req), (root_dir_fid), (smb_fname), (access_mask), (share_access), (create_disposition), \
158         (create_options), (file_attributes), (oplock_request), (lease), (allocation_size), (private_flags), (sd), (ea_list), (result), (pinfo), \
159 	(in_context_blobs), (out_context_blobs))
160 #define SMB_VFS_NEXT_CREATE_FILE(handle, req, root_dir_fid, smb_fname, access_mask, share_access, create_disposition, \
161 	create_options, file_attributes, oplock_request, lease, allocation_size, private_flags, sd, ea_list, result, pinfo, in_context_blobs, out_context_blobs) \
162 	smb_vfs_call_create_file((handle)->next, (req), (root_dir_fid), (smb_fname), (access_mask), (share_access), (create_disposition), \
163         (create_options), (file_attributes), (oplock_request), (lease), (allocation_size), (private_flags), (sd), (ea_list), (result), (pinfo), \
164 	(in_context_blobs), (out_context_blobs))
165 
166 #define SMB_VFS_CLOSE(fsp) \
167 	smb_vfs_call_close((fsp)->conn->vfs_handles, (fsp))
168 #define SMB_VFS_NEXT_CLOSE(handle, fsp) \
169 	smb_vfs_call_close((handle)->next, (fsp))
170 
171 #define SMB_VFS_PREAD(fsp, data, n, off) \
172 	smb_vfs_call_pread((fsp)->conn->vfs_handles, (fsp), (data), (n), (off))
173 #define SMB_VFS_NEXT_PREAD(handle, fsp, data, n, off) \
174 	smb_vfs_call_pread((handle)->next, (fsp), (data), (n), (off))
175 
176 #define SMB_VFS_PREAD_SEND(mem_ctx, ev, fsp, data, n, off) \
177 	smb_vfs_call_pread_send((fsp)->conn->vfs_handles, (mem_ctx), (ev), \
178 				(fsp), (data), (n), (off))
179 #define SMB_VFS_NEXT_PREAD_SEND(mem_ctx, ev, handle, fsp, data, n, off)	\
180 	smb_vfs_call_pread_send((handle)->next, (mem_ctx), (ev), (fsp), \
181 				(data), (n), (off))
182 
183 #define SMB_VFS_PWRITE(fsp, data, n, off) \
184 	smb_vfs_call_pwrite((fsp)->conn->vfs_handles, (fsp), (data), (n), (off))
185 #define SMB_VFS_NEXT_PWRITE(handle, fsp, data, n, off) \
186 	smb_vfs_call_pwrite((handle)->next, (fsp), (data), (n), (off))
187 
188 #define SMB_VFS_PWRITE_SEND(mem_ctx, ev, fsp, data, n, off) \
189 	smb_vfs_call_pwrite_send((fsp)->conn->vfs_handles, (mem_ctx), (ev), \
190 				(fsp), (data), (n), (off))
191 #define SMB_VFS_NEXT_PWRITE_SEND(mem_ctx, ev, handle, fsp, data, n, off) \
192 	smb_vfs_call_pwrite_send((handle)->next, (mem_ctx), (ev), (fsp), \
193 				(data), (n), (off))
194 
195 #define SMB_VFS_LSEEK(fsp, offset, whence) \
196 	smb_vfs_call_lseek((fsp)->conn->vfs_handles, (fsp), (offset), (whence))
197 #define SMB_VFS_NEXT_LSEEK(handle, fsp, offset, whence) \
198 	smb_vfs_call_lseek((handle)->next, (fsp), (offset), (whence))
199 
200 #define SMB_VFS_SENDFILE(tofd, fromfsp, header, offset, count) \
201 	smb_vfs_call_sendfile((fromfsp)->conn->vfs_handles, (tofd), (fromfsp), (header), (offset), (count))
202 #define SMB_VFS_NEXT_SENDFILE(handle, tofd, fromfsp, header, offset, count) \
203 	smb_vfs_call_sendfile((handle)->next, (tofd), (fromfsp), (header), (offset), (count))
204 
205 #define SMB_VFS_RECVFILE(fromfd, tofsp, offset, count) \
206 	smb_vfs_call_recvfile((tofsp)->conn->vfs_handles, (fromfd), (tofsp), (offset), (count))
207 #define SMB_VFS_NEXT_RECVFILE(handle, fromfd, tofsp, offset, count) \
208 	smb_vfs_call_recvfile((handle)->next, (fromfd), (tofsp), (offset), (count))
209 
210 #define SMB_VFS_RENAMEAT(conn, oldfsp, old, newfsp, new) \
211 	smb_vfs_call_renameat((conn)->vfs_handles, (oldfsp), (old), (newfsp), (new))
212 #define SMB_VFS_NEXT_RENAMEAT(handle, oldfsp, old, newfsp, new) \
213 	smb_vfs_call_renameat((handle)->next, (oldfsp), (old), (newfsp), (new))
214 
215 #define SMB_VFS_FSYNC(fsp) \
216 	smb_vfs_call_fsync((fsp)->conn->vfs_handles, (fsp))
217 #define SMB_VFS_NEXT_FSYNC(handle, fsp) \
218 	smb_vfs_call_fsync((handle)->next, (fsp))
219 
220 #define SMB_VFS_FSYNC_SEND(mem_ctx, ev, fsp) \
221 	smb_vfs_call_fsync_send((fsp)->conn->vfs_handles, (mem_ctx), (ev), \
222 				(fsp))
223 #define SMB_VFS_NEXT_FSYNC_SEND(mem_ctx, ev, handle, fsp)		\
224 	smb_vfs_call_fsync_send((handle)->next, (mem_ctx), (ev), (fsp))
225 
226 #define SMB_VFS_STAT(conn, smb_fname) \
227 	smb_vfs_call_stat((conn)->vfs_handles, (smb_fname))
228 #define SMB_VFS_NEXT_STAT(handle, smb_fname) \
229 	smb_vfs_call_stat((handle)->next, (smb_fname))
230 
231 #define SMB_VFS_FSTAT(fsp, sbuf) \
232 	smb_vfs_call_fstat((fsp)->conn->vfs_handles, (fsp), (sbuf))
233 #define SMB_VFS_NEXT_FSTAT(handle, fsp, sbuf) \
234 	smb_vfs_call_fstat((handle)->next, (fsp), (sbuf))
235 
236 #define SMB_VFS_LSTAT(conn, smb_fname) \
237 	smb_vfs_call_lstat((conn)->vfs_handles, (smb_fname))
238 #define SMB_VFS_NEXT_LSTAT(handle, smb_fname) \
239 	smb_vfs_call_lstat((handle)->next, (smb_fname))
240 
241 #define SMB_VFS_GET_ALLOC_SIZE(conn, fsp, sbuf) \
242 	smb_vfs_call_get_alloc_size((conn)->vfs_handles, (fsp), (sbuf))
243 #define SMB_VFS_NEXT_GET_ALLOC_SIZE(conn, fsp, sbuf) \
244 	smb_vfs_call_get_alloc_size((conn)->next, (fsp), (sbuf))
245 
246 #define SMB_VFS_UNLINKAT(conn, dirfsp, path, flags) \
247 	smb_vfs_call_unlinkat((conn)->vfs_handles, (dirfsp), (path), (flags))
248 #define SMB_VFS_NEXT_UNLINKAT(handle, dirfsp, path, flags) \
249 	smb_vfs_call_unlinkat((handle)->next, (dirfsp), (path), (flags))
250 
251 #define SMB_VFS_CHMOD(conn, smb_fname, mode) \
252 	smb_vfs_call_chmod((conn)->vfs_handles, (smb_fname), (mode))
253 #define SMB_VFS_NEXT_CHMOD(handle, smb_fname, mode) \
254 	smb_vfs_call_chmod((handle)->next, (smb_fname), (mode))
255 
256 #define SMB_VFS_FCHMOD(fsp, mode) \
257 	smb_vfs_call_fchmod((fsp)->conn->vfs_handles, (fsp), (mode))
258 #define SMB_VFS_NEXT_FCHMOD(handle, fsp, mode) \
259 	smb_vfs_call_fchmod((handle)->next, (fsp), (mode))
260 
261 #define SMB_VFS_FCHOWN(fsp, uid, gid) \
262 	smb_vfs_call_fchown((fsp)->conn->vfs_handles, (fsp), (uid), (gid))
263 #define SMB_VFS_NEXT_FCHOWN(handle, fsp, uid, gid) \
264 	smb_vfs_call_fchown((handle)->next, (fsp), (uid), (gid))
265 
266 #define SMB_VFS_LCHOWN(conn, smb_fname, uid, gid) \
267 	smb_vfs_call_lchown((conn)->vfs_handles, (smb_fname), (uid), (gid))
268 #define SMB_VFS_NEXT_LCHOWN(handle, smb_fname, uid, gid) \
269 	smb_vfs_call_lchown((handle)->next, (smb_fname), (uid), (gid))
270 
271 #define SMB_VFS_CHDIR(conn, smb_fname) \
272 	smb_vfs_call_chdir((conn)->vfs_handles, (smb_fname))
273 #define SMB_VFS_NEXT_CHDIR(handle, smb_fname) \
274 	smb_vfs_call_chdir((handle)->next, (smb_fname))
275 
276 #define SMB_VFS_GETWD(conn, ctx) \
277 	smb_vfs_call_getwd((conn)->vfs_handles, (ctx))
278 #define SMB_VFS_NEXT_GETWD(handle, ctx) \
279 	smb_vfs_call_getwd((handle)->next, (ctx))
280 
281 #define SMB_VFS_NTIMES(conn, path, ts) \
282 	smb_vfs_call_ntimes((conn)->vfs_handles, (path), (ts))
283 #define SMB_VFS_NEXT_NTIMES(handle, path, ts) \
284 	smb_vfs_call_ntimes((handle)->next, (path), (ts))
285 
286 #define SMB_VFS_FTRUNCATE(fsp, offset) \
287 	smb_vfs_call_ftruncate((fsp)->conn->vfs_handles, (fsp), (offset))
288 #define SMB_VFS_NEXT_FTRUNCATE(handle, fsp, offset) \
289 	smb_vfs_call_ftruncate((handle)->next, (fsp), (offset))
290 
291 #define SMB_VFS_FALLOCATE(fsp, mode, offset, len) \
292 	smb_vfs_call_fallocate((fsp)->conn->vfs_handles, (fsp), (mode), (offset), (len))
293 #define SMB_VFS_NEXT_FALLOCATE(handle, fsp, mode, offset, len) \
294 	smb_vfs_call_fallocate((handle)->next, (fsp), (mode), (offset), (len))
295 
296 #define SMB_VFS_LOCK(fsp, op, offset, count, type) \
297 	smb_vfs_call_lock((fsp)->conn->vfs_handles, (fsp), (op), (offset), (count), (type))
298 #define SMB_VFS_NEXT_LOCK(handle, fsp, op, offset, count, type) \
299 	smb_vfs_call_lock((handle)->next, (fsp), (op), (offset), (count), (type))
300 
301 #define SMB_VFS_KERNEL_FLOCK(fsp, share_access, access_mask) \
302 	smb_vfs_call_kernel_flock((fsp)->conn->vfs_handles, (fsp), (share_access), (access_mask))
303 #define SMB_VFS_NEXT_KERNEL_FLOCK(handle, fsp, share_access, access_mask)	\
304 	smb_vfs_call_kernel_flock((handle)->next, (fsp), (share_access), (access_mask))
305 
306 #define SMB_VFS_FCNTL(fsp, cmd, ...) \
307 	smb_vfs_call_fcntl((fsp)->conn->vfs_handles, (fsp), (cmd), (__VA_ARGS__))
308 #define SMB_VFS_NEXT_FCNTL(handle, fsp, cmd, ...) \
309 	smb_vfs_call_fcntl((handle)->next, (fsp), (cmd), (__VA_ARGS__))
310 
311 #define SMB_VFS_LINUX_SETLEASE(fsp, leasetype) \
312 	smb_vfs_call_linux_setlease((fsp)->conn->vfs_handles, (fsp), (leasetype))
313 #define SMB_VFS_NEXT_LINUX_SETLEASE(handle, fsp, leasetype) \
314 	smb_vfs_call_linux_setlease((handle)->next, (fsp), (leasetype))
315 
316 #define SMB_VFS_GETLOCK(fsp, poffset, pcount, ptype, ppid) \
317 	smb_vfs_call_getlock((fsp)->conn->vfs_handles, (fsp), (poffset), (pcount), (ptype), (ppid))
318 #define SMB_VFS_NEXT_GETLOCK(handle, fsp, poffset, pcount, ptype, ppid) \
319 	smb_vfs_call_getlock((handle)->next, (fsp), (poffset), (pcount), (ptype), (ppid))
320 
321 #define SMB_VFS_SYMLINKAT(conn, oldpath, dirfsp, newpath) \
322 	smb_vfs_call_symlinkat((conn)->vfs_handles, (oldpath), (dirfsp), (newpath))
323 #define SMB_VFS_NEXT_SYMLINKAT(handle, oldpath, dirfsp, newpath) \
324 	smb_vfs_call_symlinkat((handle)->next, (oldpath), (dirfsp), (newpath))
325 
326 #define SMB_VFS_READLINKAT(conn, dirfsp, smb_fname, buf, bufsiz) \
327 	smb_vfs_call_readlinkat((conn)->vfs_handles, (dirfsp), (smb_fname), (buf), (bufsiz))
328 #define SMB_VFS_NEXT_READLINKAT(handle, dirfsp, smb_fname, buf, bufsiz) \
329 	smb_vfs_call_readlinkat((handle)->next, (dirfsp), (smb_fname), (buf), (bufsiz))
330 
331 #define SMB_VFS_LINKAT(conn, srcfsp, oldpath, dstfsp, newpath, flags) \
332 	smb_vfs_call_linkat((conn)->vfs_handles, (srcfsp), (oldpath), (dstfsp), (newpath), (flags))
333 #define SMB_VFS_NEXT_LINKAT(handle, srcfsp, oldpath, dstfsp, newpath, flags) \
334 	smb_vfs_call_linkat((handle)->next, (srcfsp), (oldpath), (dstfsp), (newpath), (flags))
335 
336 #define SMB_VFS_MKNODAT(conn, dirfsp, smb_fname, mode, dev) \
337 	smb_vfs_call_mknodat((conn)->vfs_handles, (dirfsp), (smb_fname), (mode), (dev))
338 #define SMB_VFS_NEXT_MKNODAT(handle, dirfsp, smb_fname, mode, dev) \
339 	smb_vfs_call_mknodat((handle)->next, (dirfsp), (smb_fname), (mode), (dev))
340 
341 #define SMB_VFS_REALPATH(conn, ctx, smb_fname) \
342 	smb_vfs_call_realpath((conn)->vfs_handles, (ctx), (smb_fname))
343 #define SMB_VFS_NEXT_REALPATH(handle, ctx, smb_fname) \
344 	smb_vfs_call_realpath((handle)->next, (ctx), (smb_fname))
345 
346 #define SMB_VFS_CHFLAGS(conn, smb_fname, flags) \
347 	smb_vfs_call_chflags((conn)->vfs_handles, (smb_fname), (flags))
348 #define SMB_VFS_NEXT_CHFLAGS(handle, smb_fname, flags) \
349 	smb_vfs_call_chflags((handle)->next, (smb_fname), (flags))
350 
351 #define SMB_VFS_FILE_ID_CREATE(conn, sbuf) \
352 	smb_vfs_call_file_id_create((conn)->vfs_handles, (sbuf))
353 #define SMB_VFS_NEXT_FILE_ID_CREATE(handle, sbuf) \
354 	smb_vfs_call_file_id_create((handle)->next, (sbuf))
355 
356 #define SMB_VFS_FS_FILE_ID(conn, sbuf) \
357 	smb_vfs_call_fs_file_id((conn)->vfs_handles, (sbuf))
358 #define SMB_VFS_NEXT_FS_FILE_ID(handle, sbuf) \
359 	smb_vfs_call_fs_file_id((handle)->next, (sbuf))
360 
361 #define SMB_VFS_STREAMINFO(conn, fsp, smb_fname, mem_ctx, num_streams, streams) \
362 	smb_vfs_call_streaminfo((conn)->vfs_handles, (fsp), (smb_fname), (mem_ctx), (num_streams), (streams))
363 #define SMB_VFS_NEXT_STREAMINFO(handle, fsp, smb_fname, mem_ctx, num_streams, streams) \
364 	smb_vfs_call_streaminfo((handle)->next, (fsp), (smb_fname), (mem_ctx), (num_streams), (streams))
365 
366 #define SMB_VFS_GET_REAL_FILENAME(conn, path, name, mem_ctx, found_name) \
367 	smb_vfs_call_get_real_filename((conn)->vfs_handles, (path), (name), (mem_ctx), (found_name))
368 #define SMB_VFS_NEXT_GET_REAL_FILENAME(handle, path, name, mem_ctx, found_name) \
369 	smb_vfs_call_get_real_filename((handle)->next, (path), (name), (mem_ctx), (found_name))
370 
371 #define SMB_VFS_CONNECTPATH(conn, smb_fname) \
372 	smb_vfs_call_connectpath((conn)->vfs_handles, (smb_fname))
373 #define SMB_VFS_NEXT_CONNECTPATH(conn, smb_fname) \
374 	smb_vfs_call_connectpath((conn)->next, (smb_fname))
375 
376 #define SMB_VFS_BRL_LOCK_WINDOWS(conn, br_lck, plock) \
377 	smb_vfs_call_brl_lock_windows((conn)->vfs_handles, (br_lck), (plock))
378 #define SMB_VFS_NEXT_BRL_LOCK_WINDOWS(handle, br_lck, plock) \
379 	smb_vfs_call_brl_lock_windows((handle)->next, (br_lck), (plock))
380 
381 #define SMB_VFS_BRL_UNLOCK_WINDOWS(conn, br_lck, plock) \
382 	smb_vfs_call_brl_unlock_windows((conn)->vfs_handles, (br_lck), (plock))
383 #define SMB_VFS_NEXT_BRL_UNLOCK_WINDOWS(handle, br_lck, plock) \
384 	smb_vfs_call_brl_unlock_windows((handle)->next, (br_lck), (plock))
385 
386 #define SMB_VFS_STRICT_LOCK_CHECK(conn, fsp, plock) \
387 	smb_vfs_call_strict_lock_check((conn)->vfs_handles, (fsp), (plock))
388 #define SMB_VFS_NEXT_STRICT_LOCK_CHECK(handle, fsp, plock) \
389 	smb_vfs_call_strict_lock_check((handle)->next, (fsp), (plock))
390 
391 #define SMB_VFS_TRANSLATE_NAME(conn, name, direction, mem_ctx, mapped_name) \
392 	smb_vfs_call_translate_name((conn)->vfs_handles, (name), (direction), (mem_ctx), (mapped_name))
393 #define SMB_VFS_NEXT_TRANSLATE_NAME(handle, name, direction, mem_ctx, mapped_name) \
394 	smb_vfs_call_translate_name((handle)->next, (name), (direction), (mem_ctx), (mapped_name))
395 
396 #define SMB_VFS_FSCTL(fsp, ctx, function, req_flags, in_data, in_len, out_data, max_out_len, out_len) \
397 	smb_vfs_call_fsctl((fsp)->conn->vfs_handles, (fsp), (ctx), (function), (req_flags), (in_data), (in_len), (out_data), (max_out_len), (out_len))
398 
399 #define SMB_VFS_NEXT_FSCTL(handle, fsp, ctx, function, req_flags, in_data, in_len, out_data, max_out_len, out_len) \
400 	smb_vfs_call_fsctl((handle)->next, (fsp), (ctx), (function), (req_flags), (in_data), (in_len), (out_data), (max_out_len), (out_len))
401 
402 #define SMB_VFS_GET_DOS_ATTRIBUTES(conn, smb_fname, attributes) \
403 	smb_vfs_call_get_dos_attributes((conn)->vfs_handles, (smb_fname), (attributes))
404 #define SMB_VFS_NEXT_GET_DOS_ATTRIBUTES(handle, smb_fname, attributes) \
405 	smb_vfs_call_get_dos_attributes((handle)->next, (smb_fname), (attributes))
406 #define SMB_VFS_FGET_DOS_ATTRIBUTES(conn, fsp, attributes) \
407 	smb_vfs_call_fget_dos_attributes((conn)->vfs_handles, (fsp), (attributes))
408 #define SMB_VFS_NEXT_FGET_DOS_ATTRIBUTES(handle, fsp, attributes) \
409 	smb_vfs_call_fget_dos_attributes((handle)->next, (fsp), (attributes))
410 
411 #define SMB_VFS_GET_DOS_ATTRIBUTES_SEND(mem_ctx, evg, dir_fsp, smb_fname) \
412 	smb_vfs_call_get_dos_attributes_send((mem_ctx), (evg), \
413 					     (dir_fsp)->conn->vfs_handles, \
414 					     (dir_fsp), (smb_fname))
415 #define SMB_VFS_GET_DOS_ATTRIBUTES_RECV(req, aio_state, dosmode) \
416 	smb_vfs_call_get_dos_attributes_recv((req), (aio_state), (dosmode))
417 
418 #define SMB_VFS_NEXT_GET_DOS_ATTRIBUTES_SEND(mem_ctx, evg, handle, dir_fsp, \
419 					     smb_fname) \
420 	smb_vfs_call_get_dos_attributes_send((mem_ctx), (evg), \
421 					     (handle)->next, \
422 					     (dir_fsp), (smb_fname))
423 #define SMB_VFS_NEXT_GET_DOS_ATTRIBUTES_RECV(req, aio_state, dosmode) \
424 	smb_vfs_call_get_dos_attributes_recv((req), (aio_state), (dosmode))
425 
426 #define SMB_VFS_SET_DOS_ATTRIBUTES(conn, smb_fname, attributes) \
427 	smb_vfs_call_set_dos_attributes((conn)->vfs_handles, (smb_fname), (attributes))
428 #define SMB_VFS_NEXT_SET_DOS_ATTRIBUTES(handle, smb_fname, attributes) \
429 	smb_vfs_call_set_dos_attributes((handle)->next, (smb_fname), (attributes))
430 #define SMB_VFS_FSET_DOS_ATTRIBUTES(conn, fsp, attributes) \
431 	smb_vfs_call_fset_dos_attributes((conn)->vfs_handles, (fsp), (attributes))
432 #define SMB_VFS_NEXT_FSET_DOS_ATTRIBUTES(handle, fsp, attributes) \
433 	smb_vfs_call_fset_dos_attributes((handle)->next, (fsp), (attributes))
434 
435 #define SMB_VFS_OFFLOAD_READ_SEND(mem_ctx, ev, fsp, fsctl, ttl, offset, to_copy) \
436 	smb_vfs_call_offload_read_send((mem_ctx), (ev), (fsp)->conn->vfs_handles, fsp, (fsctl), (ttl), (offset), (to_copy))
437 #define SMB_VFS_NEXT_OFFLOAD_READ_SEND(mem_ctx, ev, handle, fsp, fsctl, ttl, offset, to_copy) \
438 	smb_vfs_call_offload_read_send((mem_ctx), (ev), (handle)->next, (fsp), (fsctl), (ttl), (offset), (to_copy))
439 
440 #define SMB_VFS_OFFLOAD_READ_RECV(req, conn, mem_ctx, token_blob) \
441 	smb_vfs_call_offload_read_recv((req), (conn)->vfs_handles, (mem_ctx), (token_blob))
442 #define SMB_VFS_NEXT_OFFLOAD_READ_RECV(req, handle, mem_ctx, token_blob) \
443 	smb_vfs_call_offload_read_recv((req), (handle)->next, (mem_ctx), (token_blob))
444 
445 #define SMB_VFS_OFFLOAD_WRITE_SEND(conn, mem_ctx, ev, fsctl, token, transfer_offset, dest_fsp, dest_off, num) \
446 	smb_vfs_call_offload_write_send((conn)->vfs_handles, (mem_ctx), (ev), (fsctl), (token), (transfer_offset), (dest_fsp), (dest_off), (num))
447 #define SMB_VFS_NEXT_OFFLOAD_WRITE_SEND(handle, mem_ctx, ev, fsctl, token, transfer_offset, dest_fsp, dest_off, num) \
448 	smb_vfs_call_offload_write_send((handle)->next, (mem_ctx), (ev), (fsctl), (token), (transfer_offset), (dest_fsp), (dest_off), (num))
449 
450 #define SMB_VFS_OFFLOAD_WRITE_RECV(conn, req, copied) \
451 	smb_vfs_call_offload_write_recv((conn)->vfs_handles, (req), (copied))
452 #define SMB_VFS_NEXT_OFFLOAD_WRITE_RECV(handle, req, copied) \
453 	smb_vfs_call_offload_write_recv((handle)->next, (req), (copied))
454 
455 #define SMB_VFS_GET_COMPRESSION(conn, mem_ctx, fsp, smb_fname, _compression_fmt)		\
456 	smb_vfs_call_get_compression((conn)->vfs_handles, (mem_ctx), (fsp), (smb_fname), (_compression_fmt))
457 #define SMB_VFS_NEXT_GET_COMPRESSION(handle, mem_ctx, fsp, smb_fname, _compression_fmt)		\
458 	smb_vfs_call_get_compression((handle)->next, (mem_ctx), (fsp), (smb_fname), (_compression_fmt))
459 
460 #define SMB_VFS_SET_COMPRESSION(conn, mem_ctx, fsp, compression_fmt)		\
461 	smb_vfs_call_set_compression((conn)->vfs_handles, (mem_ctx), (fsp), (compression_fmt))
462 #define SMB_VFS_NEXT_SET_COMPRESSION(handle, mem_ctx, fsp, compression_fmt)		\
463 	smb_vfs_call_set_compression((handle)->next, (mem_ctx), (fsp), (compression_fmt))
464 
465 #define SMB_VFS_SNAP_CHECK_PATH(conn, mem_ctx, service_path, base_volume) \
466 	smb_vfs_call_snap_check_path((conn)->vfs_handles, (mem_ctx), (service_path), (base_volume))
467 #define SMB_VFS_NEXT_SNAP_CHECK_PATH(handle, mem_ctx, service_path, base_volume) \
468 	smb_vfs_call_snap_check_path((handle)->next, (mem_ctx), (service_path), (base_volume))
469 
470 #define SMB_VFS_SNAP_CREATE(conn, mem_ctx, base_volume, tstamp, rw, base_path, snap_path) \
471 	smb_vfs_call_snap_create((conn)->vfs_handles, (mem_ctx), (base_volume), (tstamp), (rw), (base_path), (snap_path))
472 #define SMB_VFS_NEXT_SNAP_CREATE(handle, mem_ctx, base_volume, tstamp, rw, base_path, snap_path) \
473 	smb_vfs_call_snap_create((handle)->next, (mem_ctx), (base_volume), (tstamp), (rw), (base_path), (snap_path))
474 
475 #define SMB_VFS_SNAP_DELETE(conn, mem_ctx, base_path, snap_path) \
476 	smb_vfs_call_snap_delete((conn)->vfs_handles, (mem_ctx), (base_path), (snap_path))
477 #define SMB_VFS_NEXT_SNAP_DELETE(handle, mem_ctx, base_path, snap_path) \
478 	smb_vfs_call_snap_delete((handle)->next, (mem_ctx), (base_path), (snap_path))
479 
480 #define SMB_VFS_FGET_NT_ACL(fsp, security_info, mem_ctx, ppdesc)		\
481 	smb_vfs_call_fget_nt_acl((fsp)->conn->vfs_handles, (fsp), (security_info), (mem_ctx), (ppdesc))
482 #define SMB_VFS_NEXT_FGET_NT_ACL(handle, fsp, security_info, mem_ctx, ppdesc) \
483 	smb_vfs_call_fget_nt_acl((handle)->next, (fsp), (security_info), (mem_ctx), (ppdesc))
484 
485 #define SMB_VFS_GET_NT_ACL(conn, smb_fname, security_info, mem_ctx, ppdesc)	\
486 	smb_vfs_call_get_nt_acl((conn)->vfs_handles, (smb_fname), (security_info), (mem_ctx), (ppdesc))
487 #define SMB_VFS_NEXT_GET_NT_ACL(handle, smb_fname, security_info, mem_ctx, ppdesc) \
488 	smb_vfs_call_get_nt_acl((handle)->next, (smb_fname), (security_info), (mem_ctx), (ppdesc))
489 
490 #define SMB_VFS_AUDIT_FILE(conn, name, sacl, access_requested, access_denied) \
491 	smb_vfs_call_audit_file((conn)->vfs_handles, (name), (sacl), (access_requested), (access_denied))
492 #define SMB_VFS_NEXT_AUDIT_FILE(handle, name, sacl, access_requested, access_denied) \
493 	smb_vfs_call_audit_file((handle)->next, (name), (sacl), (access_requested), (access_denied))
494 
495 #define SMB_VFS_FSET_NT_ACL(fsp, security_info_sent, psd) \
496 	smb_vfs_call_fset_nt_acl((fsp)->conn->vfs_handles, (fsp), (security_info_sent), (psd))
497 #define SMB_VFS_NEXT_FSET_NT_ACL(handle, fsp, security_info_sent, psd) \
498 	smb_vfs_call_fset_nt_acl((handle)->next, (fsp), (security_info_sent), (psd))
499 
500 #define SMB_VFS_SYS_ACL_GET_FILE(conn, smb_fname, type, mem_ctx)		\
501 	smb_vfs_call_sys_acl_get_file((conn)->vfs_handles, (smb_fname), (type), (mem_ctx))
502 #define SMB_VFS_NEXT_SYS_ACL_GET_FILE(handle, smb_fname, type, mem_ctx)		\
503 	smb_vfs_call_sys_acl_get_file((handle)->next, (smb_fname), (type), (mem_ctx))
504 
505 #define SMB_VFS_SYS_ACL_GET_FD(fsp, mem_ctx) \
506 	smb_vfs_call_sys_acl_get_fd((fsp)->conn->vfs_handles, (fsp), (mem_ctx))
507 #define SMB_VFS_NEXT_SYS_ACL_GET_FD(handle, fsp, mem_ctx) \
508 	smb_vfs_call_sys_acl_get_fd((handle)->next, (fsp), (mem_ctx))
509 
510 #define SMB_VFS_SYS_ACL_BLOB_GET_FILE(conn, smb_fname, mem_ctx, blob_description, blob)	\
511 	smb_vfs_call_sys_acl_blob_get_file((conn)->vfs_handles, (smb_fname), (mem_ctx), (blob_description), (blob))
512 #define SMB_VFS_NEXT_SYS_ACL_BLOB_GET_FILE(handle, smb_fname, mem_ctx, blob_description, blob) \
513 	smb_vfs_call_sys_acl_blob_get_file((handle)->next, (smb_fname), (mem_ctx), (blob_description), (blob))
514 
515 #define SMB_VFS_SYS_ACL_BLOB_GET_FD(fsp, mem_ctx, blob_description, blob)			\
516 	smb_vfs_call_sys_acl_blob_get_fd((fsp)->conn->vfs_handles, (fsp), (mem_ctx), (blob_description), (blob))
517 #define SMB_VFS_NEXT_SYS_ACL_BLOB_GET_FD(handle, fsp, mem_ctx, blob_description, blob)	\
518 	smb_vfs_call_sys_acl_blob_get_fd((handle)->next, (fsp), mem_ctx, (blob_description), (blob))
519 
520 #define SMB_VFS_SYS_ACL_SET_FILE(conn, smb_fname, acltype, theacl) \
521 	smb_vfs_call_sys_acl_set_file((conn)->vfs_handles, (smb_fname), (acltype), (theacl))
522 #define SMB_VFS_NEXT_SYS_ACL_SET_FILE(handle, smb_fname, acltype, theacl) \
523 	smb_vfs_call_sys_acl_set_file((handle)->next, (smb_fname), (acltype), (theacl))
524 
525 #define SMB_VFS_SYS_ACL_SET_FD(fsp, theacl) \
526 	smb_vfs_call_sys_acl_set_fd((fsp)->conn->vfs_handles, (fsp), (theacl))
527 #define SMB_VFS_NEXT_SYS_ACL_SET_FD(handle, fsp, theacl) \
528 	smb_vfs_call_sys_acl_set_fd((handle)->next, (fsp), (theacl))
529 
530 #define SMB_VFS_SYS_ACL_DELETE_DEF_FILE(conn, smb_fname) \
531 	smb_vfs_call_sys_acl_delete_def_file((conn)->vfs_handles, (smb_fname))
532 #define SMB_VFS_NEXT_SYS_ACL_DELETE_DEF_FILE(handle, smb_fname) \
533 	smb_vfs_call_sys_acl_delete_def_file((handle)->next, (smb_fname))
534 
535 #define SMB_VFS_GETXATTR(conn,smb_fname,name,value,size) \
536 	smb_vfs_call_getxattr((conn)->vfs_handles,(smb_fname),(name),(value),(size))
537 #define SMB_VFS_NEXT_GETXATTR(handle,smb_fname,name,value,size) \
538 	smb_vfs_call_getxattr((handle)->next,(smb_fname),(name),(value),(size))
539 
540 #define SMB_VFS_GETXATTRAT_SEND(mem_ctx,ev,dir_fsp,smb_fname, \
541 				xattr_name, alloc_hint) \
542 	smb_vfs_call_getxattrat_send((mem_ctx),(ev), \
543 				     (dir_fsp)->conn->vfs_handles, \
544 				     (dir_fsp),(smb_fname),(xattr_name), \
545 				     (alloc_hint))
546 #define SMB_VFS_GETXATTRAT_RECV(req, aio_state, mem_ctx, xattr_value) \
547 	smb_vfs_call_getxattrat_recv((req),(aio_state),(mem_ctx),(xattr_value))
548 
549 #define SMB_VFS_NEXT_GETXATTRAT_SEND(mem_ctx,ev,handle,dir_fsp,smb_fname, \
550 				     xattr_name,alloc_hint) \
551 	smb_vfs_call_getxattrat_send((mem_ctx),(ev), \
552 				     (handle)->next, \
553 				     (dir_fsp), (smb_fname),(xattr_name), \
554 				     (alloc_hint))
555 #define SMB_VFS_NEXT_GETXATTRAT_RECV(req, aio_state, mem_ctx, xattr_value) \
556 	smb_vfs_call_getxattrat_recv((req),(aio_state),(mem_ctx),(xattr_value))
557 
558 #define SMB_VFS_FGETXATTR(fsp,name,value,size) \
559 	smb_vfs_call_fgetxattr((fsp)->conn->vfs_handles, (fsp), (name),(value),(size))
560 #define SMB_VFS_NEXT_FGETXATTR(handle,fsp,name,value,size) \
561 	smb_vfs_call_fgetxattr((handle)->next,(fsp),(name),(value),(size))
562 
563 #define SMB_VFS_LISTXATTR(conn,smb_fname,list,size) \
564 	smb_vfs_call_listxattr((conn)->vfs_handles,(smb_fname),(list),(size))
565 #define SMB_VFS_NEXT_LISTXATTR(handle,smb_fname,list,size) \
566 	smb_vfs_call_listxattr((handle)->next,(smb_fname),(list),(size))
567 
568 #define SMB_VFS_FLISTXATTR(fsp,list,size) \
569 	smb_vfs_call_flistxattr((fsp)->conn->vfs_handles, (fsp), (list),(size))
570 #define SMB_VFS_NEXT_FLISTXATTR(handle,fsp,list,size) \
571 	smb_vfs_call_flistxattr((handle)->next,(fsp),(list),(size))
572 
573 #define SMB_VFS_REMOVEXATTR(conn,smb_fname,name) \
574 	smb_vfs_call_removexattr((conn)->vfs_handles,(smb_fname),(name))
575 #define SMB_VFS_NEXT_REMOVEXATTR(handle,smb_fname,name) \
576 	smb_vfs_call_removexattr((handle)->next,(smb_fname),(name))
577 
578 #define SMB_VFS_FREMOVEXATTR(fsp,name) \
579 	smb_vfs_call_fremovexattr((fsp)->conn->vfs_handles, (fsp), (name))
580 #define SMB_VFS_NEXT_FREMOVEXATTR(handle,fsp,name) \
581 	smb_vfs_call_fremovexattr((handle)->next,(fsp),(name))
582 
583 #define SMB_VFS_SETXATTR(conn,smb_fname,name,value,size,flags) \
584 	smb_vfs_call_setxattr((conn)->vfs_handles,(smb_fname),(name),(value),(size),(flags))
585 #define SMB_VFS_NEXT_SETXATTR(handle,smb_fname,name,value,size,flags) \
586 	smb_vfs_call_setxattr((handle)->next,(smb_fname),(name),(value),(size),(flags))
587 
588 #define SMB_VFS_FSETXATTR(fsp,name,value,size,flags) \
589 	smb_vfs_call_fsetxattr((fsp)->conn->vfs_handles, (fsp), (name),(value),(size),(flags))
590 #define SMB_VFS_NEXT_FSETXATTR(handle,fsp,name,value,size,flags) \
591 	smb_vfs_call_fsetxattr((handle)->next,(fsp),(name),(value),(size),(flags))
592 
593 #define SMB_VFS_AIO_FORCE(fsp) \
594 	smb_vfs_call_aio_force((fsp)->conn->vfs_handles, (fsp))
595 #define SMB_VFS_NEXT_AIO_FORCE(handle,fsp) \
596 	smb_vfs_call_aio_force((handle)->next,(fsp))
597 
598 /* durable handle operations */
599 
600 #define SMB_VFS_DURABLE_COOKIE(fsp, mem_ctx, cookie) \
601 	smb_vfs_call_durable_cookie((fsp)->conn->vfs_handles, \
602 				    (fsp), (mem_ctx), (cookie))
603 #define SMB_VFS_NEXT_DURABLE_COOKIE(handle, fsp, mem_ctx, cookie) \
604 	smb_vfs_call_durable_cookie((handle)->next, \
605 				    (fsp), (mem_ctx), (cookie))
606 
607 #define SMB_VFS_DURABLE_DISCONNECT(fsp, old_cookie, mem_ctx, new_cookie) \
608 	smb_vfs_call_durable_disconnect((fsp)->conn->vfs_handles, \
609 					(fsp), (old_cookie), (mem_ctx), (new_cookie))
610 #define SMB_VFS_NEXT_DURABLE_DISCONNECT(handle, fsp, old_cookie, mem_ctx, new_cookie) \
611 	smb_vfs_call_durable_disconnect((handle)->next, \
612 					(fsp), (old_cookie), (mem_ctx), (new_cookie))
613 
614 #define SMB_VFS_DURABLE_RECONNECT(conn, smb1req, op, old_cookie, mem_ctx, fsp, new_cookie) \
615 	smb_vfs_call_durable_reconnect((conn)->vfs_handles, \
616 				       (smb1req), (op), (old_cookie), \
617 				       (mem_ctx), (fsp), (new_cookie))
618 #define SMB_VFS_NEXT_DURABLE_RECONNECT(handle, smb1req, op, old_cookie, mem_ctx, fsp, new_cookie) \
619 	smb_vfs_call_durable_reconnect((handle)->next, \
620 					(smb1req), (op), (old_cookie), \
621 					(mem_ctx), (fsp), (new_cookie))
622 
623 #define SMB_VFS_READDIR_ATTR(conn, fname, mem_ctx, attr_data) \
624 	smb_vfs_call_readdir_attr((conn)->vfs_handles, (fname), (mem_ctx), (attr_data))
625 #define SMB_VFS_NEXT_READDIR_ATTR(conn, fname, mem_ctx, attr_data) \
626 	smb_vfs_call_readdir_attr((handle)->next, (fname), (mem_ctx), (attr_data))
627 
628 #endif /* _VFS_MACROS_H */
629