Line data Source code
1 : /*
2 : * Skeleton VFS module. Implements passthrough operation of all VFS
3 : * calls to disk functions.
4 : *
5 : * Copyright (C) Tim Potter, 1999-2000
6 : * Copyright (C) Alexander Bokovoy, 2002
7 : * Copyright (C) Stefan (metze) Metzmacher, 2003
8 : * Copyright (C) Jeremy Allison 2009
9 : *
10 : * This program is free software; you can redistribute it and/or modify
11 : * it under the terms of the GNU General Public License as published by
12 : * the Free Software Foundation; either version 3 of the License, or
13 : * (at your option) any later version.
14 : *
15 : * This program is distributed in the hope that it will be useful,
16 : * but WITHOUT ANY WARRANTY; without even the implied warranty of
17 : * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 : * GNU General Public License for more details.
19 : *
20 : * You should have received a copy of the GNU General Public License
21 : * along with this program; if not, see <http://www.gnu.org/licenses/>.
22 : */
23 :
24 : #include "../source3/include/includes.h"
25 : #include "lib/util/tevent_unix.h"
26 : #include "lib/util/tevent_ntstatus.h"
27 :
28 : /* PLEASE,PLEASE READ THE VFS MODULES CHAPTER OF THE
29 : SAMBA DEVELOPERS GUIDE!!!!!!
30 : */
31 :
32 : /* If you take this file as template for your module
33 : * please make sure that you remove all skel_XXX() functions you don't
34 : * want to implement!! The passthrough operations are not
35 : * necessary in a real module.
36 : *
37 : * --metze
38 : */
39 :
40 0 : static int skel_connect(vfs_handle_struct *handle, const char *service,
41 : const char *user)
42 : {
43 0 : return SMB_VFS_NEXT_CONNECT(handle, service, user);
44 : }
45 :
46 0 : static void skel_disconnect(vfs_handle_struct *handle)
47 : {
48 0 : SMB_VFS_NEXT_DISCONNECT(handle);
49 0 : }
50 :
51 0 : static uint64_t skel_disk_free(vfs_handle_struct *handle,
52 : const struct smb_filename *smb_fname,
53 : uint64_t *bsize,
54 : uint64_t *dfree,
55 : uint64_t *dsize)
56 : {
57 0 : return SMB_VFS_NEXT_DISK_FREE(handle, smb_fname, bsize, dfree, dsize);
58 : }
59 :
60 0 : static int skel_get_quota(vfs_handle_struct *handle,
61 : const struct smb_filename *smb_fname,
62 : enum SMB_QUOTA_TYPE qtype,
63 : unid_t id,
64 : SMB_DISK_QUOTA *dq)
65 : {
66 0 : return SMB_VFS_NEXT_GET_QUOTA(handle, smb_fname, qtype, id, dq);
67 : }
68 :
69 0 : static int skel_set_quota(vfs_handle_struct *handle, enum SMB_QUOTA_TYPE qtype,
70 : unid_t id, SMB_DISK_QUOTA *dq)
71 : {
72 0 : return SMB_VFS_NEXT_SET_QUOTA(handle, qtype, id, dq);
73 : }
74 :
75 0 : static int skel_get_shadow_copy_data(vfs_handle_struct *handle,
76 : files_struct *fsp,
77 : struct shadow_copy_data *shadow_copy_data,
78 : bool labels)
79 : {
80 0 : return SMB_VFS_NEXT_GET_SHADOW_COPY_DATA(handle, fsp, shadow_copy_data,
81 : labels);
82 : }
83 :
84 0 : static int skel_statvfs(struct vfs_handle_struct *handle,
85 : const struct smb_filename *smb_fname,
86 : struct vfs_statvfs_struct *statbuf)
87 : {
88 0 : return SMB_VFS_NEXT_STATVFS(handle, smb_fname, statbuf);
89 : }
90 :
91 0 : static uint32_t skel_fs_capabilities(struct vfs_handle_struct *handle,
92 : enum timestamp_set_resolution *p_ts_res)
93 : {
94 0 : return SMB_VFS_NEXT_FS_CAPABILITIES(handle, p_ts_res);
95 : }
96 :
97 0 : static NTSTATUS skel_get_dfs_referrals(struct vfs_handle_struct *handle,
98 : struct dfs_GetDFSReferral *r)
99 : {
100 0 : return SMB_VFS_NEXT_GET_DFS_REFERRALS(handle, r);
101 : }
102 :
103 0 : static NTSTATUS skel_create_dfs_pathat(struct vfs_handle_struct *handle,
104 : struct files_struct *dirfsp,
105 : const struct smb_filename *smb_fname,
106 : const struct referral *reflist,
107 : size_t referral_count)
108 : {
109 0 : return SMB_VFS_NEXT_CREATE_DFS_PATHAT(handle,
110 : dirfsp,
111 : smb_fname,
112 : reflist,
113 : referral_count);
114 : }
115 :
116 0 : static NTSTATUS skel_read_dfs_pathat(struct vfs_handle_struct *handle,
117 : TALLOC_CTX *mem_ctx,
118 : struct files_struct *dirfsp,
119 : struct smb_filename *smb_fname,
120 : struct referral **ppreflist,
121 : size_t *preferral_count)
122 : {
123 0 : return SMB_VFS_NEXT_READ_DFS_PATHAT(handle,
124 : mem_ctx,
125 : dirfsp,
126 : smb_fname,
127 : ppreflist,
128 : preferral_count);
129 : }
130 :
131 0 : static NTSTATUS skel_snap_check_path(struct vfs_handle_struct *handle,
132 : TALLOC_CTX *mem_ctx,
133 : const char *service_path,
134 : char **base_volume)
135 : {
136 0 : return SMB_VFS_NEXT_SNAP_CHECK_PATH(handle, mem_ctx, service_path,
137 : base_volume);
138 : }
139 :
140 0 : static NTSTATUS skel_snap_create(struct vfs_handle_struct *handle,
141 : TALLOC_CTX *mem_ctx,
142 : const char *base_volume,
143 : time_t *tstamp,
144 : bool rw,
145 : char **base_path,
146 : char **snap_path)
147 : {
148 0 : return SMB_VFS_NEXT_SNAP_CREATE(handle, mem_ctx, base_volume, tstamp,
149 : rw, base_path, snap_path);
150 : }
151 :
152 0 : static NTSTATUS skel_snap_delete(struct vfs_handle_struct *handle,
153 : TALLOC_CTX *mem_ctx,
154 : char *base_path,
155 : char *snap_path)
156 : {
157 0 : return SMB_VFS_NEXT_SNAP_DELETE(handle, mem_ctx, base_path, snap_path);
158 : }
159 :
160 0 : static DIR *skel_fdopendir(vfs_handle_struct *handle, files_struct *fsp,
161 : const char *mask, uint32_t attr)
162 : {
163 0 : return SMB_VFS_NEXT_FDOPENDIR(handle, fsp, mask, attr);
164 : }
165 :
166 0 : static struct dirent *skel_readdir(vfs_handle_struct *handle,
167 : struct files_struct *dirfsp,
168 : DIR *dirp,
169 : SMB_STRUCT_STAT *sbuf)
170 : {
171 0 : return SMB_VFS_NEXT_READDIR(handle, dirfsp, dirp, sbuf);
172 : }
173 :
174 0 : static void skel_seekdir(vfs_handle_struct *handle, DIR *dirp, long offset)
175 : {
176 0 : SMB_VFS_NEXT_SEEKDIR(handle, dirp, offset);
177 0 : }
178 :
179 0 : static long skel_telldir(vfs_handle_struct *handle, DIR *dirp)
180 : {
181 0 : return SMB_VFS_NEXT_TELLDIR(handle, dirp);
182 : }
183 :
184 0 : static void skel_rewind_dir(vfs_handle_struct *handle, DIR *dirp)
185 : {
186 0 : SMB_VFS_NEXT_REWINDDIR(handle, dirp);
187 0 : }
188 :
189 0 : static int skel_mkdirat(vfs_handle_struct *handle,
190 : struct files_struct *dirfsp,
191 : const struct smb_filename *smb_fname,
192 : mode_t mode)
193 : {
194 0 : return SMB_VFS_NEXT_MKDIRAT(handle,
195 : dirfsp,
196 : smb_fname,
197 : mode);
198 : }
199 :
200 0 : static int skel_closedir(vfs_handle_struct *handle, DIR *dir)
201 : {
202 0 : return SMB_VFS_NEXT_CLOSEDIR(handle, dir);
203 : }
204 :
205 0 : static int skel_openat(struct vfs_handle_struct *handle,
206 : const struct files_struct *dirfsp,
207 : const struct smb_filename *smb_fname,
208 : struct files_struct *fsp,
209 : const struct vfs_open_how *how)
210 : {
211 0 : return SMB_VFS_NEXT_OPENAT(handle, dirfsp, smb_fname, fsp, how);
212 : }
213 :
214 0 : static NTSTATUS skel_create_file(struct vfs_handle_struct *handle,
215 : struct smb_request *req,
216 : struct files_struct *dirfsp,
217 : struct smb_filename *smb_fname,
218 : uint32_t access_mask,
219 : uint32_t share_access,
220 : uint32_t create_disposition,
221 : uint32_t create_options,
222 : uint32_t file_attributes,
223 : uint32_t oplock_request,
224 : const struct smb2_lease *lease,
225 : uint64_t allocation_size,
226 : uint32_t private_flags,
227 : struct security_descriptor *sd,
228 : struct ea_list *ea_list,
229 : files_struct ** result, int *pinfo,
230 : const struct smb2_create_blobs *in_context_blobs,
231 : struct smb2_create_blobs *out_context_blobs)
232 : {
233 0 : return SMB_VFS_NEXT_CREATE_FILE(handle,
234 : req,
235 : dirfsp,
236 : smb_fname,
237 : access_mask,
238 : share_access,
239 : create_disposition,
240 : create_options,
241 : file_attributes,
242 : oplock_request,
243 : lease,
244 : allocation_size,
245 : private_flags,
246 : sd, ea_list, result, pinfo,
247 : in_context_blobs, out_context_blobs);
248 : }
249 :
250 0 : static int skel_close_fn(vfs_handle_struct *handle, files_struct *fsp)
251 : {
252 0 : return SMB_VFS_NEXT_CLOSE(handle, fsp);
253 : }
254 :
255 0 : static ssize_t skel_pread(vfs_handle_struct *handle, files_struct *fsp,
256 : void *data, size_t n, off_t offset)
257 : {
258 0 : return SMB_VFS_NEXT_PREAD(handle, fsp, data, n, offset);
259 : }
260 :
261 : struct skel_pread_state {
262 : ssize_t ret;
263 : struct vfs_aio_state vfs_aio_state;
264 : };
265 :
266 : static void skel_pread_done(struct tevent_req *subreq);
267 :
268 0 : static struct tevent_req *skel_pread_send(struct vfs_handle_struct *handle,
269 : TALLOC_CTX *mem_ctx,
270 : struct tevent_context *ev,
271 : struct files_struct *fsp,
272 : void *data, size_t n, off_t offset)
273 : {
274 : struct tevent_req *req, *subreq;
275 : struct skel_pread_state *state;
276 :
277 0 : req = tevent_req_create(mem_ctx, &state, struct skel_pread_state);
278 0 : if (req == NULL) {
279 0 : return NULL;
280 : }
281 0 : subreq = SMB_VFS_NEXT_PREAD_SEND(state, ev, handle, fsp, data,
282 : n, offset);
283 0 : if (tevent_req_nomem(subreq, req)) {
284 0 : return tevent_req_post(req, ev);
285 : }
286 0 : tevent_req_set_callback(subreq, skel_pread_done, req);
287 0 : return req;
288 : }
289 :
290 0 : static void skel_pread_done(struct tevent_req *subreq)
291 : {
292 0 : struct tevent_req *req =
293 0 : tevent_req_callback_data(subreq, struct tevent_req);
294 0 : struct skel_pread_state *state =
295 0 : tevent_req_data(req, struct skel_pread_state);
296 :
297 0 : state->ret = SMB_VFS_PREAD_RECV(subreq, &state->vfs_aio_state);
298 0 : TALLOC_FREE(subreq);
299 0 : tevent_req_done(req);
300 0 : }
301 :
302 0 : static ssize_t skel_pread_recv(struct tevent_req *req,
303 : struct vfs_aio_state *vfs_aio_state)
304 : {
305 0 : struct skel_pread_state *state =
306 0 : tevent_req_data(req, struct skel_pread_state);
307 :
308 0 : if (tevent_req_is_unix_error(req, &vfs_aio_state->error)) {
309 0 : return -1;
310 : }
311 0 : *vfs_aio_state = state->vfs_aio_state;
312 0 : return state->ret;
313 : }
314 :
315 0 : static ssize_t skel_pwrite(vfs_handle_struct *handle, files_struct *fsp,
316 : const void *data, size_t n, off_t offset)
317 : {
318 0 : return SMB_VFS_NEXT_PWRITE(handle, fsp, data, n, offset);
319 : }
320 :
321 : struct skel_pwrite_state {
322 : ssize_t ret;
323 : struct vfs_aio_state vfs_aio_state;
324 : };
325 :
326 : static void skel_pwrite_done(struct tevent_req *subreq);
327 :
328 0 : static struct tevent_req *skel_pwrite_send(struct vfs_handle_struct *handle,
329 : TALLOC_CTX *mem_ctx,
330 : struct tevent_context *ev,
331 : struct files_struct *fsp,
332 : const void *data,
333 : size_t n, off_t offset)
334 : {
335 : struct tevent_req *req, *subreq;
336 : struct skel_pwrite_state *state;
337 :
338 0 : req = tevent_req_create(mem_ctx, &state, struct skel_pwrite_state);
339 0 : if (req == NULL) {
340 0 : return NULL;
341 : }
342 0 : subreq = SMB_VFS_NEXT_PWRITE_SEND(state, ev, handle, fsp, data,
343 : n, offset);
344 0 : if (tevent_req_nomem(subreq, req)) {
345 0 : return tevent_req_post(req, ev);
346 : }
347 0 : tevent_req_set_callback(subreq, skel_pwrite_done, req);
348 0 : return req;
349 : }
350 :
351 0 : static void skel_pwrite_done(struct tevent_req *subreq)
352 : {
353 0 : struct tevent_req *req =
354 0 : tevent_req_callback_data(subreq, struct tevent_req);
355 0 : struct skel_pwrite_state *state =
356 0 : tevent_req_data(req, struct skel_pwrite_state);
357 :
358 0 : state->ret = SMB_VFS_PWRITE_RECV(subreq, &state->vfs_aio_state);
359 0 : TALLOC_FREE(subreq);
360 0 : tevent_req_done(req);
361 0 : }
362 :
363 0 : static ssize_t skel_pwrite_recv(struct tevent_req *req,
364 : struct vfs_aio_state *vfs_aio_state)
365 : {
366 0 : struct skel_pwrite_state *state =
367 0 : tevent_req_data(req, struct skel_pwrite_state);
368 :
369 0 : if (tevent_req_is_unix_error(req, &vfs_aio_state->error)) {
370 0 : return -1;
371 : }
372 0 : *vfs_aio_state = state->vfs_aio_state;
373 0 : return state->ret;
374 : }
375 :
376 0 : static off_t skel_lseek(vfs_handle_struct *handle, files_struct *fsp,
377 : off_t offset, int whence)
378 : {
379 0 : return SMB_VFS_NEXT_LSEEK(handle, fsp, offset, whence);
380 : }
381 :
382 0 : static ssize_t skel_sendfile(vfs_handle_struct *handle, int tofd,
383 : files_struct *fromfsp, const DATA_BLOB *hdr,
384 : off_t offset, size_t n)
385 : {
386 0 : return SMB_VFS_NEXT_SENDFILE(handle, tofd, fromfsp, hdr, offset, n);
387 : }
388 :
389 0 : static ssize_t skel_recvfile(vfs_handle_struct *handle, int fromfd,
390 : files_struct *tofsp, off_t offset, size_t n)
391 : {
392 0 : return SMB_VFS_NEXT_RECVFILE(handle, fromfd, tofsp, offset, n);
393 : }
394 :
395 0 : static int skel_renameat(vfs_handle_struct *handle,
396 : files_struct *srcfsp,
397 : const struct smb_filename *smb_fname_src,
398 : files_struct *dstfsp,
399 : const struct smb_filename *smb_fname_dst)
400 : {
401 0 : return SMB_VFS_NEXT_RENAMEAT(handle,
402 : srcfsp,
403 : smb_fname_src,
404 : dstfsp,
405 : smb_fname_dst);
406 : }
407 :
408 : struct skel_fsync_state {
409 : int ret;
410 : struct vfs_aio_state vfs_aio_state;
411 : };
412 :
413 : static void skel_fsync_done(struct tevent_req *subreq);
414 :
415 0 : static struct tevent_req *skel_fsync_send(struct vfs_handle_struct *handle,
416 : TALLOC_CTX *mem_ctx,
417 : struct tevent_context *ev,
418 : struct files_struct *fsp)
419 : {
420 : struct tevent_req *req, *subreq;
421 : struct skel_fsync_state *state;
422 :
423 0 : req = tevent_req_create(mem_ctx, &state, struct skel_fsync_state);
424 0 : if (req == NULL) {
425 0 : return NULL;
426 : }
427 0 : subreq = SMB_VFS_NEXT_FSYNC_SEND(state, ev, handle, fsp);
428 0 : if (tevent_req_nomem(subreq, req)) {
429 0 : return tevent_req_post(req, ev);
430 : }
431 0 : tevent_req_set_callback(subreq, skel_fsync_done, req);
432 0 : return req;
433 : }
434 :
435 0 : static void skel_fsync_done(struct tevent_req *subreq)
436 : {
437 0 : struct tevent_req *req =
438 0 : tevent_req_callback_data(subreq, struct tevent_req);
439 0 : struct skel_fsync_state *state =
440 0 : tevent_req_data(req, struct skel_fsync_state);
441 :
442 0 : state->ret = SMB_VFS_FSYNC_RECV(subreq, &state->vfs_aio_state);
443 0 : TALLOC_FREE(subreq);
444 0 : tevent_req_done(req);
445 0 : }
446 :
447 0 : static int skel_fsync_recv(struct tevent_req *req,
448 : struct vfs_aio_state *vfs_aio_state)
449 : {
450 0 : struct skel_fsync_state *state =
451 0 : tevent_req_data(req, struct skel_fsync_state);
452 :
453 0 : if (tevent_req_is_unix_error(req, &vfs_aio_state->error)) {
454 0 : return -1;
455 : }
456 0 : *vfs_aio_state = state->vfs_aio_state;
457 0 : return state->ret;
458 : }
459 :
460 0 : static int skel_stat(vfs_handle_struct *handle, struct smb_filename *smb_fname)
461 : {
462 0 : return SMB_VFS_NEXT_STAT(handle, smb_fname);
463 : }
464 :
465 0 : static int skel_fstat(vfs_handle_struct *handle, files_struct *fsp,
466 : SMB_STRUCT_STAT *sbuf)
467 : {
468 0 : return SMB_VFS_NEXT_FSTAT(handle, fsp, sbuf);
469 : }
470 :
471 0 : static int skel_lstat(vfs_handle_struct *handle,
472 : struct smb_filename *smb_fname)
473 : {
474 0 : return SMB_VFS_NEXT_LSTAT(handle, smb_fname);
475 : }
476 :
477 0 : static int skel_fstatat(
478 : struct vfs_handle_struct *handle,
479 : const struct files_struct *dirfsp,
480 : const struct smb_filename *smb_fname,
481 : SMB_STRUCT_STAT *sbuf,
482 : int flags)
483 : {
484 0 : return SMB_VFS_NEXT_FSTATAT(handle, dirfsp, smb_fname, sbuf, flags);
485 : }
486 :
487 0 : static uint64_t skel_get_alloc_size(struct vfs_handle_struct *handle,
488 : struct files_struct *fsp,
489 : const SMB_STRUCT_STAT *sbuf)
490 : {
491 0 : return SMB_VFS_NEXT_GET_ALLOC_SIZE(handle, fsp, sbuf);
492 : }
493 :
494 0 : static int skel_unlinkat(vfs_handle_struct *handle,
495 : struct files_struct *dirfsp,
496 : const struct smb_filename *smb_fname,
497 : int flags)
498 : {
499 0 : return SMB_VFS_NEXT_UNLINKAT(handle,
500 : dirfsp,
501 : smb_fname,
502 : flags);
503 : }
504 :
505 0 : static int skel_fchmod(vfs_handle_struct *handle, files_struct *fsp,
506 : mode_t mode)
507 : {
508 0 : return SMB_VFS_NEXT_FCHMOD(handle, fsp, mode);
509 : }
510 :
511 0 : static int skel_fchown(vfs_handle_struct *handle, files_struct *fsp,
512 : uid_t uid, gid_t gid)
513 : {
514 0 : return SMB_VFS_NEXT_FCHOWN(handle, fsp, uid, gid);
515 : }
516 :
517 0 : static int skel_lchown(vfs_handle_struct *handle,
518 : const struct smb_filename *smb_fname,
519 : uid_t uid,
520 : gid_t gid)
521 : {
522 0 : return SMB_VFS_NEXT_LCHOWN(handle, smb_fname, uid, gid);
523 : }
524 :
525 0 : static int skel_chdir(vfs_handle_struct *handle,
526 : const struct smb_filename *smb_fname)
527 : {
528 0 : return SMB_VFS_NEXT_CHDIR(handle, smb_fname);
529 : }
530 :
531 0 : static struct smb_filename *skel_getwd(vfs_handle_struct *handle,
532 : TALLOC_CTX *ctx)
533 : {
534 0 : return SMB_VFS_NEXT_GETWD(handle, ctx);
535 : }
536 :
537 0 : static int skel_fntimes(vfs_handle_struct *handle,
538 : files_struct *fsp,
539 : struct smb_file_time *ft)
540 : {
541 0 : return SMB_VFS_NEXT_FNTIMES(handle, fsp, ft);
542 : }
543 :
544 0 : static int skel_ftruncate(vfs_handle_struct *handle, files_struct *fsp,
545 : off_t offset)
546 : {
547 0 : return SMB_VFS_NEXT_FTRUNCATE(handle, fsp, offset);
548 : }
549 :
550 0 : static int skel_fallocate(vfs_handle_struct *handle, files_struct *fsp,
551 : uint32_t mode, off_t offset, off_t len)
552 : {
553 0 : return SMB_VFS_NEXT_FALLOCATE(handle, fsp, mode, offset, len);
554 : }
555 :
556 0 : static bool skel_lock(vfs_handle_struct *handle, files_struct *fsp, int op,
557 : off_t offset, off_t count, int type)
558 : {
559 0 : return SMB_VFS_NEXT_LOCK(handle, fsp, op, offset, count, type);
560 : }
561 :
562 0 : static int skel_filesystem_sharemode(struct vfs_handle_struct *handle,
563 : struct files_struct *fsp,
564 : uint32_t share_mode,
565 : uint32_t access_mask)
566 : {
567 0 : return SMB_VFS_NEXT_FILESYSTEM_SHAREMODE(handle,
568 : fsp,
569 : share_mode,
570 : access_mask);
571 : }
572 :
573 0 : static int skel_fcntl(struct vfs_handle_struct *handle,
574 : struct files_struct *fsp, int cmd, va_list cmd_arg)
575 : {
576 : void *arg;
577 : va_list dup_cmd_arg;
578 : int result;
579 :
580 0 : va_copy(dup_cmd_arg, cmd_arg);
581 0 : arg = va_arg(dup_cmd_arg, void *);
582 0 : result = SMB_VFS_NEXT_FCNTL(handle, fsp, cmd, arg);
583 0 : va_end(dup_cmd_arg);
584 :
585 0 : return result;
586 : }
587 :
588 0 : static int skel_linux_setlease(struct vfs_handle_struct *handle,
589 : struct files_struct *fsp, int leasetype)
590 : {
591 0 : return SMB_VFS_NEXT_LINUX_SETLEASE(handle, fsp, leasetype);
592 : }
593 :
594 0 : static bool skel_getlock(vfs_handle_struct *handle, files_struct *fsp,
595 : off_t *poffset, off_t *pcount, int *ptype,
596 : pid_t *ppid)
597 : {
598 0 : return SMB_VFS_NEXT_GETLOCK(handle, fsp, poffset, pcount, ptype, ppid);
599 : }
600 :
601 0 : static int skel_symlinkat(vfs_handle_struct *handle,
602 : const struct smb_filename *link_contents,
603 : struct files_struct *dirfsp,
604 : const struct smb_filename *new_smb_fname)
605 : {
606 0 : return SMB_VFS_NEXT_SYMLINKAT(handle,
607 : link_contents,
608 : dirfsp,
609 : new_smb_fname);
610 : }
611 :
612 0 : static int skel_vfs_readlinkat(vfs_handle_struct *handle,
613 : const struct files_struct *dirfsp,
614 : const struct smb_filename *smb_fname,
615 : char *buf,
616 : size_t bufsiz)
617 : {
618 0 : return SMB_VFS_NEXT_READLINKAT(handle,
619 : dirfsp,
620 : smb_fname,
621 : buf,
622 : bufsiz);
623 : }
624 :
625 0 : static int skel_linkat(vfs_handle_struct *handle,
626 : files_struct *srcfsp,
627 : const struct smb_filename *old_smb_fname,
628 : files_struct *dstfsp,
629 : const struct smb_filename *new_smb_fname,
630 : int flags)
631 : {
632 0 : return SMB_VFS_NEXT_LINKAT(handle,
633 : srcfsp,
634 : old_smb_fname,
635 : dstfsp,
636 : new_smb_fname,
637 : flags);
638 : }
639 :
640 0 : static int skel_mknodat(vfs_handle_struct *handle,
641 : files_struct *dirfsp,
642 : const struct smb_filename *smb_fname,
643 : mode_t mode,
644 : SMB_DEV_T dev)
645 : {
646 0 : return SMB_VFS_NEXT_MKNODAT(handle,
647 : dirfsp,
648 : smb_fname,
649 : mode,
650 : dev);
651 : }
652 :
653 0 : static struct smb_filename *skel_realpath(vfs_handle_struct *handle,
654 : TALLOC_CTX *ctx,
655 : const struct smb_filename *smb_fname)
656 : {
657 0 : return SMB_VFS_NEXT_REALPATH(handle, ctx, smb_fname);
658 : }
659 :
660 0 : static int skel_fchflags(vfs_handle_struct *handle,
661 : struct files_struct *fsp,
662 : uint flags)
663 : {
664 0 : return SMB_VFS_NEXT_FCHFLAGS(handle, fsp, flags);
665 : }
666 :
667 0 : static struct file_id skel_file_id_create(vfs_handle_struct *handle,
668 : const SMB_STRUCT_STAT *sbuf)
669 : {
670 0 : return SMB_VFS_NEXT_FILE_ID_CREATE(handle, sbuf);
671 : }
672 :
673 0 : static uint64_t skel_fs_file_id(vfs_handle_struct *handle,
674 : const SMB_STRUCT_STAT *sbuf)
675 : {
676 0 : return SMB_VFS_NEXT_FS_FILE_ID(handle, sbuf);
677 : }
678 :
679 : struct skel_offload_read_state {
680 : struct vfs_handle_struct *handle;
681 : uint32_t flags;
682 : uint64_t xferlen;
683 : DATA_BLOB token;
684 : };
685 :
686 : static void skel_offload_read_done(struct tevent_req *subreq);
687 :
688 0 : static struct tevent_req *skel_offload_read_send(
689 : TALLOC_CTX *mem_ctx,
690 : struct tevent_context *ev,
691 : struct vfs_handle_struct *handle,
692 : struct files_struct *fsp,
693 : uint32_t fsctl,
694 : uint32_t ttl,
695 : off_t offset,
696 : size_t to_copy)
697 : {
698 0 : struct tevent_req *req = NULL;
699 0 : struct skel_offload_read_state *state = NULL;
700 0 : struct tevent_req *subreq = NULL;
701 :
702 0 : req = tevent_req_create(mem_ctx, &state, struct skel_offload_read_state);
703 0 : if (req == NULL) {
704 0 : return NULL;
705 : }
706 0 : *state = (struct skel_offload_read_state) {
707 : .handle = handle,
708 : };
709 :
710 0 : subreq = SMB_VFS_NEXT_OFFLOAD_READ_SEND(mem_ctx, ev, handle, fsp,
711 : fsctl, ttl, offset, to_copy);
712 0 : if (tevent_req_nomem(subreq, req)) {
713 0 : return tevent_req_post(req, ev);
714 : }
715 0 : tevent_req_set_callback(subreq, skel_offload_read_done, req);
716 0 : return req;
717 : }
718 :
719 0 : static void skel_offload_read_done(struct tevent_req *subreq)
720 : {
721 0 : struct tevent_req *req = tevent_req_callback_data(
722 : subreq, struct tevent_req);
723 0 : struct skel_offload_read_state *state = tevent_req_data(
724 : req, struct skel_offload_read_state);
725 : NTSTATUS status;
726 :
727 0 : status = SMB_VFS_NEXT_OFFLOAD_READ_RECV(subreq,
728 : state->handle,
729 : state,
730 : &state->flags,
731 : &state->xferlen,
732 : &state->token);
733 0 : TALLOC_FREE(subreq);
734 0 : if (tevent_req_nterror(req, status)) {
735 0 : return;
736 : }
737 :
738 0 : tevent_req_done(req);
739 0 : return;
740 : }
741 :
742 0 : static NTSTATUS skel_offload_read_recv(struct tevent_req *req,
743 : struct vfs_handle_struct *handle,
744 : TALLOC_CTX *mem_ctx,
745 : uint32_t *flags,
746 : uint64_t *xferlen,
747 : DATA_BLOB *_token)
748 : {
749 0 : struct skel_offload_read_state *state = tevent_req_data(
750 : req, struct skel_offload_read_state);
751 : DATA_BLOB token;
752 : NTSTATUS status;
753 :
754 0 : if (tevent_req_is_nterror(req, &status)) {
755 0 : tevent_req_received(req);
756 0 : return status;
757 : }
758 :
759 0 : token = data_blob_talloc(mem_ctx,
760 : state->token.data,
761 : state->token.length);
762 :
763 0 : tevent_req_received(req);
764 :
765 0 : if (token.data == NULL) {
766 0 : return NT_STATUS_NO_MEMORY;
767 : }
768 :
769 0 : *flags = state->flags;
770 0 : *xferlen = state->xferlen;
771 0 : *_token = token;
772 0 : return NT_STATUS_OK;
773 : }
774 :
775 : struct skel_offload_write_state {
776 : struct vfs_handle_struct *handle;
777 : off_t copied;
778 : };
779 : static void skel_offload_write_done(struct tevent_req *subreq);
780 :
781 0 : static struct tevent_req *skel_offload_write_send(struct vfs_handle_struct *handle,
782 : TALLOC_CTX *mem_ctx,
783 : struct tevent_context *ev,
784 : uint32_t fsctl,
785 : DATA_BLOB *token,
786 : off_t transfer_offset,
787 : struct files_struct *dest_fsp,
788 : off_t dest_off,
789 : off_t num)
790 : {
791 : struct tevent_req *req;
792 : struct tevent_req *subreq;
793 : struct skel_offload_write_state *state;
794 :
795 0 : req = tevent_req_create(mem_ctx, &state, struct skel_offload_write_state);
796 0 : if (req == NULL) {
797 0 : return NULL;
798 : }
799 :
800 0 : state->handle = handle;
801 0 : subreq = SMB_VFS_NEXT_OFFLOAD_WRITE_SEND(handle, state, ev,
802 : fsctl, token, transfer_offset,
803 : dest_fsp, dest_off, num);
804 0 : if (tevent_req_nomem(subreq, req)) {
805 0 : return tevent_req_post(req, ev);
806 : }
807 :
808 0 : tevent_req_set_callback(subreq, skel_offload_write_done, req);
809 0 : return req;
810 : }
811 :
812 0 : static void skel_offload_write_done(struct tevent_req *subreq)
813 : {
814 0 : struct tevent_req *req = tevent_req_callback_data(
815 : subreq, struct tevent_req);
816 0 : struct skel_offload_write_state *state
817 0 : = tevent_req_data(req, struct skel_offload_write_state);
818 : NTSTATUS status;
819 :
820 0 : status = SMB_VFS_NEXT_OFFLOAD_WRITE_RECV(state->handle,
821 : subreq,
822 : &state->copied);
823 0 : TALLOC_FREE(subreq);
824 0 : if (tevent_req_nterror(req, status)) {
825 0 : return;
826 : }
827 0 : tevent_req_done(req);
828 : }
829 :
830 0 : static NTSTATUS skel_offload_write_recv(struct vfs_handle_struct *handle,
831 : struct tevent_req *req,
832 : off_t *copied)
833 : {
834 0 : struct skel_offload_write_state *state
835 0 : = tevent_req_data(req, struct skel_offload_write_state);
836 : NTSTATUS status;
837 :
838 0 : *copied = state->copied;
839 0 : if (tevent_req_is_nterror(req, &status)) {
840 0 : tevent_req_received(req);
841 0 : return status;
842 : }
843 :
844 0 : tevent_req_received(req);
845 0 : return NT_STATUS_OK;
846 : }
847 :
848 0 : static NTSTATUS skel_fget_compression(struct vfs_handle_struct *handle,
849 : TALLOC_CTX *mem_ctx,
850 : struct files_struct *fsp,
851 : uint16_t *_compression_fmt)
852 : {
853 0 : return SMB_VFS_NEXT_FGET_COMPRESSION(handle, mem_ctx, fsp,
854 : _compression_fmt);
855 : }
856 :
857 0 : static NTSTATUS skel_set_compression(struct vfs_handle_struct *handle,
858 : TALLOC_CTX *mem_ctx,
859 : struct files_struct *fsp,
860 : uint16_t compression_fmt)
861 : {
862 0 : return SMB_VFS_NEXT_SET_COMPRESSION(handle, mem_ctx, fsp,
863 : compression_fmt);
864 : }
865 :
866 0 : static NTSTATUS skel_fstreaminfo(struct vfs_handle_struct *handle,
867 : struct files_struct *fsp,
868 : TALLOC_CTX *mem_ctx,
869 : unsigned int *num_streams,
870 : struct stream_struct **streams)
871 : {
872 0 : return SMB_VFS_NEXT_FSTREAMINFO(handle,
873 : fsp,
874 : mem_ctx,
875 : num_streams,
876 : streams);
877 : }
878 :
879 0 : static NTSTATUS skel_get_real_filename_at(struct vfs_handle_struct *handle,
880 : struct files_struct *dirfsp,
881 : const char *name,
882 : TALLOC_CTX *mem_ctx,
883 : char **found_name)
884 : {
885 0 : return SMB_VFS_NEXT_GET_REAL_FILENAME_AT(
886 : handle, dirfsp, name, mem_ctx, found_name);
887 : }
888 :
889 0 : static const char *skel_connectpath(struct vfs_handle_struct *handle,
890 : const struct smb_filename *smb_fname)
891 : {
892 0 : return SMB_VFS_NEXT_CONNECTPATH(handle, smb_fname);
893 : }
894 :
895 0 : static NTSTATUS skel_brl_lock_windows(struct vfs_handle_struct *handle,
896 : struct byte_range_lock *br_lck,
897 : struct lock_struct *plock)
898 : {
899 0 : return SMB_VFS_NEXT_BRL_LOCK_WINDOWS(handle, br_lck, plock);
900 : }
901 :
902 0 : static bool skel_brl_unlock_windows(struct vfs_handle_struct *handle,
903 : struct byte_range_lock *br_lck,
904 : const struct lock_struct *plock)
905 : {
906 0 : return SMB_VFS_NEXT_BRL_UNLOCK_WINDOWS(handle, br_lck, plock);
907 : }
908 :
909 0 : static bool skel_strict_lock_check(struct vfs_handle_struct *handle,
910 : struct files_struct *fsp,
911 : struct lock_struct *plock)
912 : {
913 0 : return SMB_VFS_NEXT_STRICT_LOCK_CHECK(handle, fsp, plock);
914 : }
915 :
916 0 : static NTSTATUS skel_translate_name(struct vfs_handle_struct *handle,
917 : const char *mapped_name,
918 : enum vfs_translate_direction direction,
919 : TALLOC_CTX *mem_ctx, char **pmapped_name)
920 : {
921 0 : return SMB_VFS_NEXT_TRANSLATE_NAME(handle, mapped_name, direction,
922 : mem_ctx, pmapped_name);
923 : }
924 :
925 0 : static NTSTATUS skel_parent_pathname(struct vfs_handle_struct *handle,
926 : TALLOC_CTX *mem_ctx,
927 : const struct smb_filename *smb_fname_in,
928 : struct smb_filename **parent_dir_out,
929 : struct smb_filename **atname_out)
930 : {
931 0 : return SMB_VFS_NEXT_PARENT_PATHNAME(handle,
932 : mem_ctx,
933 : smb_fname_in,
934 : parent_dir_out,
935 : atname_out);
936 : }
937 :
938 0 : static NTSTATUS skel_fsctl(struct vfs_handle_struct *handle,
939 : struct files_struct *fsp,
940 : TALLOC_CTX *ctx,
941 : uint32_t function,
942 : uint16_t req_flags, /* Needed for UNICODE ... */
943 : const uint8_t *_in_data,
944 : uint32_t in_len,
945 : uint8_t ** _out_data,
946 : uint32_t max_out_len, uint32_t *out_len)
947 : {
948 0 : return SMB_VFS_NEXT_FSCTL(handle,
949 : fsp,
950 : ctx,
951 : function,
952 : req_flags,
953 : _in_data,
954 : in_len, _out_data, max_out_len, out_len);
955 : }
956 :
957 0 : static NTSTATUS skel_freaddir_attr(struct vfs_handle_struct *handle,
958 : struct files_struct *fsp,
959 : TALLOC_CTX *mem_ctx,
960 : struct readdir_attr_data **pattr_data)
961 : {
962 0 : return SMB_VFS_NEXT_FREADDIR_ATTR(handle, fsp, mem_ctx, pattr_data);
963 : }
964 :
965 : struct skel_get_dos_attributes_state {
966 : struct vfs_aio_state aio_state;
967 : uint32_t dosmode;
968 : };
969 :
970 : static void skel_get_dos_attributes_done(struct tevent_req *subreq);
971 :
972 0 : static struct tevent_req *skel_get_dos_attributes_send(
973 : TALLOC_CTX *mem_ctx,
974 : struct tevent_context *ev,
975 : struct vfs_handle_struct *handle,
976 : files_struct *dir_fsp,
977 : struct smb_filename *smb_fname)
978 : {
979 0 : struct tevent_req *req = NULL;
980 0 : struct skel_get_dos_attributes_state *state = NULL;
981 0 : struct tevent_req *subreq = NULL;
982 :
983 0 : req = tevent_req_create(mem_ctx, &state,
984 : struct skel_get_dos_attributes_state);
985 0 : if (req == NULL) {
986 0 : return NULL;
987 : }
988 :
989 0 : subreq = SMB_VFS_NEXT_GET_DOS_ATTRIBUTES_SEND(mem_ctx,
990 : ev,
991 : handle,
992 : dir_fsp,
993 : smb_fname);
994 0 : if (tevent_req_nomem(subreq, req)) {
995 0 : return tevent_req_post(req, ev);
996 : }
997 0 : tevent_req_set_callback(subreq, skel_get_dos_attributes_done, req);
998 :
999 0 : return req;
1000 : }
1001 :
1002 0 : static void skel_get_dos_attributes_done(struct tevent_req *subreq)
1003 : {
1004 0 : struct tevent_req *req =
1005 0 : tevent_req_callback_data(subreq,
1006 : struct tevent_req);
1007 0 : struct skel_get_dos_attributes_state *state =
1008 0 : tevent_req_data(req,
1009 : struct skel_get_dos_attributes_state);
1010 : NTSTATUS status;
1011 :
1012 0 : status = SMB_VFS_NEXT_GET_DOS_ATTRIBUTES_RECV(subreq,
1013 : &state->aio_state,
1014 : &state->dosmode);
1015 0 : TALLOC_FREE(subreq);
1016 0 : if (tevent_req_nterror(req, status)) {
1017 0 : return;
1018 : }
1019 :
1020 0 : tevent_req_done(req);
1021 0 : return;
1022 : }
1023 :
1024 0 : static NTSTATUS skel_get_dos_attributes_recv(struct tevent_req *req,
1025 : struct vfs_aio_state *aio_state,
1026 : uint32_t *dosmode)
1027 : {
1028 0 : struct skel_get_dos_attributes_state *state =
1029 0 : tevent_req_data(req,
1030 : struct skel_get_dos_attributes_state);
1031 : NTSTATUS status;
1032 :
1033 0 : if (tevent_req_is_nterror(req, &status)) {
1034 0 : tevent_req_received(req);
1035 0 : return status;
1036 : }
1037 :
1038 0 : *aio_state = state->aio_state;
1039 0 : *dosmode = state->dosmode;
1040 0 : tevent_req_received(req);
1041 0 : return NT_STATUS_OK;
1042 : }
1043 :
1044 0 : static NTSTATUS skel_fget_dos_attributes(struct vfs_handle_struct *handle,
1045 : struct files_struct *fsp,
1046 : uint32_t *dosmode)
1047 : {
1048 0 : return SMB_VFS_NEXT_FGET_DOS_ATTRIBUTES(handle,
1049 : fsp,
1050 : dosmode);
1051 : }
1052 :
1053 0 : static NTSTATUS skel_fset_dos_attributes(struct vfs_handle_struct *handle,
1054 : struct files_struct *fsp,
1055 : uint32_t dosmode)
1056 : {
1057 0 : return SMB_VFS_NEXT_FSET_DOS_ATTRIBUTES(handle,
1058 : fsp,
1059 : dosmode);
1060 : }
1061 :
1062 0 : static NTSTATUS skel_fget_nt_acl(vfs_handle_struct *handle, files_struct *fsp,
1063 : uint32_t security_info,
1064 : TALLOC_CTX *mem_ctx,
1065 : struct security_descriptor **ppdesc)
1066 : {
1067 0 : return SMB_VFS_NEXT_FGET_NT_ACL(handle, fsp, security_info, mem_ctx,
1068 : ppdesc);
1069 : }
1070 :
1071 0 : static NTSTATUS skel_fset_nt_acl(vfs_handle_struct *handle, files_struct *fsp,
1072 : uint32_t security_info_sent,
1073 : const struct security_descriptor *psd)
1074 : {
1075 0 : return SMB_VFS_NEXT_FSET_NT_ACL(handle, fsp, security_info_sent, psd);
1076 : }
1077 :
1078 0 : static SMB_ACL_T skel_sys_acl_get_fd(vfs_handle_struct *handle,
1079 : files_struct *fsp,
1080 : SMB_ACL_TYPE_T type,
1081 : TALLOC_CTX *mem_ctx)
1082 : {
1083 0 : return SMB_VFS_NEXT_SYS_ACL_GET_FD(handle, fsp, type, mem_ctx);
1084 : }
1085 :
1086 0 : static int skel_sys_acl_blob_get_fd(vfs_handle_struct *handle,
1087 : files_struct *fsp, TALLOC_CTX *mem_ctx,
1088 : char **blob_description, DATA_BLOB *blob)
1089 : {
1090 0 : return SMB_VFS_NEXT_SYS_ACL_BLOB_GET_FD(handle, fsp, mem_ctx,
1091 : blob_description, blob);
1092 : }
1093 :
1094 0 : static int skel_sys_acl_set_fd(vfs_handle_struct *handle,
1095 : struct files_struct *fsp,
1096 : SMB_ACL_TYPE_T type,
1097 : SMB_ACL_T theacl)
1098 : {
1099 0 : return SMB_VFS_NEXT_SYS_ACL_SET_FD(handle, fsp, type, theacl);
1100 : }
1101 :
1102 0 : static int skel_sys_acl_delete_def_fd(vfs_handle_struct *handle,
1103 : struct files_struct *fsp)
1104 : {
1105 0 : return SMB_VFS_NEXT_SYS_ACL_DELETE_DEF_FD(handle, fsp);
1106 : }
1107 :
1108 : struct skel_getxattrat_state {
1109 : struct vfs_aio_state aio_state;
1110 : ssize_t xattr_size;
1111 : uint8_t *xattr_value;
1112 : };
1113 :
1114 : static void skel_getxattrat_done(struct tevent_req *subreq);
1115 :
1116 0 : static struct tevent_req *skel_getxattrat_send(
1117 : TALLOC_CTX *mem_ctx,
1118 : struct tevent_context *ev,
1119 : struct vfs_handle_struct *handle,
1120 : files_struct *dir_fsp,
1121 : const struct smb_filename *smb_fname,
1122 : const char *xattr_name,
1123 : size_t alloc_hint)
1124 : {
1125 0 : struct tevent_req *req = NULL;
1126 0 : struct skel_getxattrat_state *state = NULL;
1127 0 : struct tevent_req *subreq = NULL;
1128 :
1129 0 : req = tevent_req_create(mem_ctx, &state,
1130 : struct skel_getxattrat_state);
1131 0 : if (req == NULL) {
1132 0 : return NULL;
1133 : }
1134 :
1135 0 : subreq = SMB_VFS_NEXT_GETXATTRAT_SEND(state,
1136 : ev,
1137 : handle,
1138 : dir_fsp,
1139 : smb_fname,
1140 : xattr_name,
1141 : alloc_hint);
1142 0 : if (tevent_req_nomem(subreq, req)) {
1143 0 : return tevent_req_post(req, ev);
1144 : }
1145 0 : tevent_req_set_callback(subreq, skel_getxattrat_done, req);
1146 :
1147 0 : return req;
1148 : }
1149 :
1150 0 : static void skel_getxattrat_done(struct tevent_req *subreq)
1151 : {
1152 0 : struct tevent_req *req = tevent_req_callback_data(
1153 : subreq, struct tevent_req);
1154 0 : struct skel_getxattrat_state *state = tevent_req_data(
1155 : req, struct skel_getxattrat_state);
1156 :
1157 0 : state->xattr_size = SMB_VFS_NEXT_GETXATTRAT_RECV(subreq,
1158 : &state->aio_state,
1159 : state,
1160 : &state->xattr_value);
1161 0 : TALLOC_FREE(subreq);
1162 0 : if (state->xattr_size == -1) {
1163 0 : tevent_req_error(req, state->aio_state.error);
1164 0 : return;
1165 : }
1166 :
1167 0 : tevent_req_done(req);
1168 : }
1169 :
1170 0 : static ssize_t skel_getxattrat_recv(struct tevent_req *req,
1171 : struct vfs_aio_state *aio_state,
1172 : TALLOC_CTX *mem_ctx,
1173 : uint8_t **xattr_value)
1174 : {
1175 0 : struct skel_getxattrat_state *state = tevent_req_data(
1176 : req, struct skel_getxattrat_state);
1177 : ssize_t xattr_size;
1178 :
1179 0 : if (tevent_req_is_unix_error(req, &aio_state->error)) {
1180 0 : tevent_req_received(req);
1181 0 : return -1;
1182 : }
1183 :
1184 0 : *aio_state = state->aio_state;
1185 0 : xattr_size = state->xattr_size;
1186 0 : if (xattr_value != NULL) {
1187 0 : *xattr_value = talloc_move(mem_ctx, &state->xattr_value);
1188 : }
1189 :
1190 0 : tevent_req_received(req);
1191 0 : return xattr_size;
1192 : }
1193 :
1194 0 : static ssize_t skel_fgetxattr(vfs_handle_struct *handle,
1195 : struct files_struct *fsp, const char *name,
1196 : void *value, size_t size)
1197 : {
1198 0 : return SMB_VFS_NEXT_FGETXATTR(handle, fsp, name, value, size);
1199 : }
1200 :
1201 0 : static ssize_t skel_flistxattr(vfs_handle_struct *handle,
1202 : struct files_struct *fsp, char *list,
1203 : size_t size)
1204 : {
1205 0 : return SMB_VFS_NEXT_FLISTXATTR(handle, fsp, list, size);
1206 : }
1207 :
1208 0 : static int skel_fremovexattr(vfs_handle_struct *handle,
1209 : struct files_struct *fsp, const char *name)
1210 : {
1211 0 : return SMB_VFS_NEXT_FREMOVEXATTR(handle, fsp, name);
1212 : }
1213 :
1214 0 : static int skel_fsetxattr(vfs_handle_struct *handle, struct files_struct *fsp,
1215 : const char *name, const void *value, size_t size,
1216 : int flags)
1217 : {
1218 0 : return SMB_VFS_NEXT_FSETXATTR(handle, fsp, name, value, size, flags);
1219 : }
1220 :
1221 0 : static bool skel_aio_force(struct vfs_handle_struct *handle,
1222 : struct files_struct *fsp)
1223 : {
1224 0 : return SMB_VFS_NEXT_AIO_FORCE(handle, fsp);
1225 : }
1226 :
1227 0 : static NTSTATUS skel_audit_file(struct vfs_handle_struct *handle,
1228 : struct smb_filename *file,
1229 : struct security_acl *sacl,
1230 : uint32_t access_requested,
1231 : uint32_t access_denied)
1232 : {
1233 0 : return SMB_VFS_NEXT_AUDIT_FILE(handle,
1234 : file,
1235 : sacl,
1236 : access_requested,
1237 : access_denied);
1238 : }
1239 :
1240 0 : static NTSTATUS skel_durable_cookie(struct vfs_handle_struct *handle,
1241 : struct files_struct *fsp,
1242 : TALLOC_CTX *mem_ctx,
1243 : DATA_BLOB *cookie)
1244 : {
1245 0 : return SMB_VFS_NEXT_DURABLE_COOKIE(handle,
1246 : fsp,
1247 : mem_ctx,
1248 : cookie);
1249 : }
1250 :
1251 0 : static NTSTATUS skel_durable_disconnect(struct vfs_handle_struct *handle,
1252 : struct files_struct *fsp,
1253 : const DATA_BLOB old_cookie,
1254 : TALLOC_CTX *mem_ctx,
1255 : DATA_BLOB *new_cookie)
1256 : {
1257 0 : return SMB_VFS_NEXT_DURABLE_DISCONNECT(handle,
1258 : fsp,
1259 : old_cookie,
1260 : mem_ctx,
1261 : new_cookie);
1262 : }
1263 :
1264 0 : static NTSTATUS skel_durable_reconnect(struct vfs_handle_struct *handle,
1265 : struct smb_request *smb1req,
1266 : struct smbXsrv_open *op,
1267 : const DATA_BLOB old_cookie,
1268 : TALLOC_CTX *mem_ctx,
1269 : struct files_struct **fsp,
1270 : DATA_BLOB *new_cookie)
1271 : {
1272 0 : return SMB_VFS_NEXT_DURABLE_RECONNECT(handle,
1273 : smb1req,
1274 : op,
1275 : old_cookie,
1276 : mem_ctx,
1277 : fsp,
1278 : new_cookie);
1279 : }
1280 :
1281 : /* VFS operations structure */
1282 :
1283 : static struct vfs_fn_pointers skel_transparent_fns = {
1284 : /* Disk operations */
1285 :
1286 : .connect_fn = skel_connect,
1287 : .disconnect_fn = skel_disconnect,
1288 : .disk_free_fn = skel_disk_free,
1289 : .get_quota_fn = skel_get_quota,
1290 : .set_quota_fn = skel_set_quota,
1291 : .get_shadow_copy_data_fn = skel_get_shadow_copy_data,
1292 : .statvfs_fn = skel_statvfs,
1293 : .fs_capabilities_fn = skel_fs_capabilities,
1294 : .get_dfs_referrals_fn = skel_get_dfs_referrals,
1295 : .create_dfs_pathat_fn = skel_create_dfs_pathat,
1296 : .read_dfs_pathat_fn = skel_read_dfs_pathat,
1297 : .snap_check_path_fn = skel_snap_check_path,
1298 : .snap_create_fn = skel_snap_create,
1299 : .snap_delete_fn = skel_snap_delete,
1300 :
1301 : /* Directory operations */
1302 :
1303 : .fdopendir_fn = skel_fdopendir,
1304 : .readdir_fn = skel_readdir,
1305 : .seekdir_fn = skel_seekdir,
1306 : .telldir_fn = skel_telldir,
1307 : .rewind_dir_fn = skel_rewind_dir,
1308 : .mkdirat_fn = skel_mkdirat,
1309 : .closedir_fn = skel_closedir,
1310 :
1311 : /* File operations */
1312 :
1313 : .openat_fn = skel_openat,
1314 : .create_file_fn = skel_create_file,
1315 : .close_fn = skel_close_fn,
1316 : .pread_fn = skel_pread,
1317 : .pread_send_fn = skel_pread_send,
1318 : .pread_recv_fn = skel_pread_recv,
1319 : .pwrite_fn = skel_pwrite,
1320 : .pwrite_send_fn = skel_pwrite_send,
1321 : .pwrite_recv_fn = skel_pwrite_recv,
1322 : .lseek_fn = skel_lseek,
1323 : .sendfile_fn = skel_sendfile,
1324 : .recvfile_fn = skel_recvfile,
1325 : .renameat_fn = skel_renameat,
1326 : .fsync_send_fn = skel_fsync_send,
1327 : .fsync_recv_fn = skel_fsync_recv,
1328 : .stat_fn = skel_stat,
1329 : .fstat_fn = skel_fstat,
1330 : .lstat_fn = skel_lstat,
1331 : .fstatat_fn = skel_fstatat,
1332 : .get_alloc_size_fn = skel_get_alloc_size,
1333 : .unlinkat_fn = skel_unlinkat,
1334 : .fchmod_fn = skel_fchmod,
1335 : .fchown_fn = skel_fchown,
1336 : .lchown_fn = skel_lchown,
1337 : .chdir_fn = skel_chdir,
1338 : .getwd_fn = skel_getwd,
1339 : .fntimes_fn = skel_fntimes,
1340 : .ftruncate_fn = skel_ftruncate,
1341 : .fallocate_fn = skel_fallocate,
1342 : .lock_fn = skel_lock,
1343 : .filesystem_sharemode_fn = skel_filesystem_sharemode,
1344 : .fcntl_fn = skel_fcntl,
1345 : .linux_setlease_fn = skel_linux_setlease,
1346 : .getlock_fn = skel_getlock,
1347 : .symlinkat_fn = skel_symlinkat,
1348 : .readlinkat_fn = skel_vfs_readlinkat,
1349 : .linkat_fn = skel_linkat,
1350 : .mknodat_fn = skel_mknodat,
1351 : .realpath_fn = skel_realpath,
1352 : .fchflags_fn = skel_fchflags,
1353 : .file_id_create_fn = skel_file_id_create,
1354 : .fs_file_id_fn = skel_fs_file_id,
1355 : .offload_read_send_fn = skel_offload_read_send,
1356 : .offload_read_recv_fn = skel_offload_read_recv,
1357 : .offload_write_send_fn = skel_offload_write_send,
1358 : .offload_write_recv_fn = skel_offload_write_recv,
1359 : .fget_compression_fn = skel_fget_compression,
1360 : .set_compression_fn = skel_set_compression,
1361 :
1362 : .fstreaminfo_fn = skel_fstreaminfo,
1363 : .get_real_filename_at_fn = skel_get_real_filename_at,
1364 : .connectpath_fn = skel_connectpath,
1365 : .brl_lock_windows_fn = skel_brl_lock_windows,
1366 : .brl_unlock_windows_fn = skel_brl_unlock_windows,
1367 : .strict_lock_check_fn = skel_strict_lock_check,
1368 : .translate_name_fn = skel_translate_name,
1369 : .parent_pathname_fn = skel_parent_pathname,
1370 : .fsctl_fn = skel_fsctl,
1371 : .freaddir_attr_fn = skel_freaddir_attr,
1372 : .audit_file_fn = skel_audit_file,
1373 :
1374 : /* DOS attributes. */
1375 : .get_dos_attributes_send_fn = skel_get_dos_attributes_send,
1376 : .get_dos_attributes_recv_fn = skel_get_dos_attributes_recv,
1377 : .fget_dos_attributes_fn = skel_fget_dos_attributes,
1378 : .fset_dos_attributes_fn = skel_fset_dos_attributes,
1379 :
1380 : /* NT ACL operations. */
1381 :
1382 : .fget_nt_acl_fn = skel_fget_nt_acl,
1383 : .fset_nt_acl_fn = skel_fset_nt_acl,
1384 :
1385 : /* POSIX ACL operations. */
1386 :
1387 : .sys_acl_get_fd_fn = skel_sys_acl_get_fd,
1388 : .sys_acl_blob_get_fd_fn = skel_sys_acl_blob_get_fd,
1389 : .sys_acl_set_fd_fn = skel_sys_acl_set_fd,
1390 : .sys_acl_delete_def_fd_fn = skel_sys_acl_delete_def_fd,
1391 :
1392 : /* EA operations. */
1393 : .getxattrat_send_fn = skel_getxattrat_send,
1394 : .getxattrat_recv_fn = skel_getxattrat_recv,
1395 : .fgetxattr_fn = skel_fgetxattr,
1396 : .flistxattr_fn = skel_flistxattr,
1397 : .fremovexattr_fn = skel_fremovexattr,
1398 : .fsetxattr_fn = skel_fsetxattr,
1399 :
1400 : /* aio operations */
1401 : .aio_force_fn = skel_aio_force,
1402 :
1403 : /* durable handle operations */
1404 : .durable_cookie_fn = skel_durable_cookie,
1405 : .durable_disconnect_fn = skel_durable_disconnect,
1406 : .durable_reconnect_fn = skel_durable_reconnect,
1407 : };
1408 :
1409 : static_decl_vfs;
1410 26 : NTSTATUS vfs_skel_transparent_init(TALLOC_CTX *ctx)
1411 : {
1412 : /*
1413 : * smb_vfs_assert_all_fns() is only needed in
1414 : * order to have a complete example.
1415 : *
1416 : * A transparent vfs module typically don't
1417 : * need to implement every calls.
1418 : */
1419 26 : smb_vfs_assert_all_fns(&skel_transparent_fns, "skel_transparent");
1420 26 : return smb_register_vfs(SMB_VFS_INTERFACE_VERSION, "skel_transparent",
1421 : &skel_transparent_fns);
1422 : }
|