Line data Source code
1 : /*
2 : * Skeleton VFS module. Implements dummy versions of all VFS
3 : * 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 : * you must re-implement every function.
34 : */
35 :
36 0 : static int skel_connect(vfs_handle_struct *handle, const char *service,
37 : const char *user)
38 : {
39 0 : errno = ENOSYS;
40 0 : return -1;
41 : }
42 :
43 0 : static void skel_disconnect(vfs_handle_struct *handle)
44 : {
45 : ;
46 0 : }
47 :
48 0 : static uint64_t skel_disk_free(vfs_handle_struct *handle,
49 : const struct smb_filename *smb_fname,
50 : uint64_t *bsize,
51 : uint64_t *dfree,
52 : uint64_t *dsize)
53 : {
54 0 : *bsize = 0;
55 0 : *dfree = 0;
56 0 : *dsize = 0;
57 0 : return 0;
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 : errno = ENOSYS;
67 0 : return -1;
68 : }
69 :
70 0 : static int skel_set_quota(vfs_handle_struct *handle, enum SMB_QUOTA_TYPE qtype,
71 : unid_t id, SMB_DISK_QUOTA *dq)
72 : {
73 0 : errno = ENOSYS;
74 0 : return -1;
75 : }
76 :
77 0 : static int skel_get_shadow_copy_data(vfs_handle_struct *handle,
78 : files_struct *fsp,
79 : struct shadow_copy_data *shadow_copy_data,
80 : bool labels)
81 : {
82 0 : errno = ENOSYS;
83 0 : return -1;
84 : }
85 :
86 0 : static int skel_statvfs(struct vfs_handle_struct *handle,
87 : const struct smb_filename *smb_fname,
88 : struct vfs_statvfs_struct *statbuf)
89 : {
90 0 : errno = ENOSYS;
91 0 : return -1;
92 : }
93 :
94 0 : static uint32_t skel_fs_capabilities(struct vfs_handle_struct *handle,
95 : enum timestamp_set_resolution *p_ts_res)
96 : {
97 0 : return 0;
98 : }
99 :
100 0 : static NTSTATUS skel_get_dfs_referrals(struct vfs_handle_struct *handle,
101 : struct dfs_GetDFSReferral *r)
102 : {
103 0 : return NT_STATUS_NOT_IMPLEMENTED;
104 : }
105 :
106 0 : static NTSTATUS skel_create_dfs_pathat(struct vfs_handle_struct *handle,
107 : struct files_struct *dirfsp,
108 : const struct smb_filename *smb_fname,
109 : const struct referral *reflist,
110 : size_t referral_count)
111 : {
112 0 : return NT_STATUS_NOT_IMPLEMENTED;
113 : }
114 :
115 0 : static NTSTATUS skel_read_dfs_pathat(struct vfs_handle_struct *handle,
116 : TALLOC_CTX *mem_ctx,
117 : struct files_struct *dirfsp,
118 : struct smb_filename *smb_fname,
119 : struct referral **ppreflist,
120 : size_t *preferral_count)
121 : {
122 0 : return NT_STATUS_NOT_IMPLEMENTED;
123 : }
124 :
125 0 : static NTSTATUS skel_snap_check_path(struct vfs_handle_struct *handle,
126 : TALLOC_CTX *mem_ctx,
127 : const char *service_path,
128 : char **base_volume)
129 : {
130 0 : return NT_STATUS_NOT_SUPPORTED;
131 : }
132 :
133 0 : static NTSTATUS skel_snap_create(struct vfs_handle_struct *handle,
134 : TALLOC_CTX *mem_ctx,
135 : const char *base_volume,
136 : time_t *tstamp,
137 : bool rw,
138 : char **base_path,
139 : char **snap_path)
140 : {
141 0 : return NT_STATUS_NOT_SUPPORTED;
142 : }
143 :
144 0 : static NTSTATUS skel_snap_delete(struct vfs_handle_struct *handle,
145 : TALLOC_CTX *mem_ctx,
146 : char *base_path,
147 : char *snap_path)
148 : {
149 0 : return NT_STATUS_NOT_SUPPORTED;
150 : }
151 :
152 0 : static DIR *skel_fdopendir(vfs_handle_struct *handle, files_struct *fsp,
153 : const char *mask, uint32_t attr)
154 : {
155 0 : return NULL;
156 : }
157 :
158 0 : static struct dirent *skel_readdir(vfs_handle_struct *handle,
159 : struct files_struct *dirfsp,
160 : DIR *dirp,
161 : SMB_STRUCT_STAT *sbuf)
162 : {
163 0 : return NULL;
164 : }
165 :
166 0 : static void skel_seekdir(vfs_handle_struct *handle, DIR *dirp, long offset)
167 : {
168 : ;
169 0 : }
170 :
171 0 : static long skel_telldir(vfs_handle_struct *handle, DIR *dirp)
172 : {
173 0 : return (long)-1;
174 : }
175 :
176 0 : static void skel_rewind_dir(vfs_handle_struct *handle, DIR *dirp)
177 : {
178 : ;
179 0 : }
180 :
181 0 : static int skel_mkdirat(vfs_handle_struct *handle,
182 : struct files_struct *dirfsp,
183 : const struct smb_filename *smb_fname,
184 : mode_t mode)
185 : {
186 0 : errno = ENOSYS;
187 0 : return -1;
188 : }
189 :
190 0 : static int skel_closedir(vfs_handle_struct *handle, DIR *dir)
191 : {
192 0 : errno = ENOSYS;
193 0 : return -1;
194 : }
195 :
196 0 : static int skel_openat(struct vfs_handle_struct *handle,
197 : const struct files_struct *dirfsp,
198 : const struct smb_filename *smb_fname,
199 : struct files_struct *fsp,
200 : const struct vfs_open_how *how)
201 : {
202 0 : if (how->resolve != 0) {
203 0 : errno = ENOSYS;
204 0 : return -1;
205 : }
206 :
207 0 : errno = ENOSYS;
208 0 : return -1;
209 : }
210 :
211 0 : static NTSTATUS skel_create_file(struct vfs_handle_struct *handle,
212 : struct smb_request *req,
213 : struct files_struct *dirfsp,
214 : struct smb_filename *smb_fname,
215 : uint32_t access_mask,
216 : uint32_t share_access,
217 : uint32_t create_disposition,
218 : uint32_t create_options,
219 : uint32_t file_attributes,
220 : uint32_t oplock_request,
221 : const struct smb2_lease *lease,
222 : uint64_t allocation_size,
223 : uint32_t private_flags,
224 : struct security_descriptor *sd,
225 : struct ea_list *ea_list,
226 : files_struct **result, int *pinfo,
227 : const struct smb2_create_blobs *in_context_blobs,
228 : struct smb2_create_blobs *out_context_blobs)
229 : {
230 0 : return NT_STATUS_NOT_IMPLEMENTED;
231 : }
232 :
233 0 : static int skel_close_fn(vfs_handle_struct *handle, files_struct *fsp)
234 : {
235 0 : errno = ENOSYS;
236 0 : return -1;
237 : }
238 :
239 0 : static ssize_t skel_pread(vfs_handle_struct *handle, files_struct *fsp,
240 : void *data, size_t n, off_t offset)
241 : {
242 0 : errno = ENOSYS;
243 0 : return -1;
244 : }
245 :
246 0 : static struct tevent_req *skel_pread_send(struct vfs_handle_struct *handle,
247 : TALLOC_CTX *mem_ctx,
248 : struct tevent_context *ev,
249 : struct files_struct *fsp,
250 : void *data, size_t n, off_t offset)
251 : {
252 0 : return NULL;
253 : }
254 :
255 0 : static ssize_t skel_pread_recv(struct tevent_req *req,
256 : struct vfs_aio_state *vfs_aio_state)
257 : {
258 0 : vfs_aio_state->error = ENOSYS;
259 0 : return -1;
260 : }
261 :
262 0 : static ssize_t skel_pwrite(vfs_handle_struct *handle, files_struct *fsp,
263 : const void *data, size_t n, off_t offset)
264 : {
265 0 : errno = ENOSYS;
266 0 : return -1;
267 : }
268 :
269 0 : static struct tevent_req *skel_pwrite_send(struct vfs_handle_struct *handle,
270 : TALLOC_CTX *mem_ctx,
271 : struct tevent_context *ev,
272 : struct files_struct *fsp,
273 : const void *data,
274 : size_t n, off_t offset)
275 : {
276 0 : return NULL;
277 : }
278 :
279 0 : static ssize_t skel_pwrite_recv(struct tevent_req *req,
280 : struct vfs_aio_state *vfs_aio_state)
281 : {
282 0 : vfs_aio_state->error = ENOSYS;
283 0 : return -1;
284 : }
285 :
286 0 : static off_t skel_lseek(vfs_handle_struct *handle, files_struct *fsp,
287 : off_t offset, int whence)
288 : {
289 0 : errno = ENOSYS;
290 0 : return (off_t) - 1;
291 : }
292 :
293 0 : static ssize_t skel_sendfile(vfs_handle_struct *handle, int tofd,
294 : files_struct *fromfsp, const DATA_BLOB *hdr,
295 : off_t offset, size_t n)
296 : {
297 0 : errno = ENOSYS;
298 0 : return -1;
299 : }
300 :
301 0 : static ssize_t skel_recvfile(vfs_handle_struct *handle, int fromfd,
302 : files_struct *tofsp, off_t offset, size_t n)
303 : {
304 0 : errno = ENOSYS;
305 0 : return -1;
306 : }
307 :
308 0 : static int skel_renameat(vfs_handle_struct *handle,
309 : files_struct *srcfsp,
310 : const struct smb_filename *smb_fname_src,
311 : files_struct *dstfsp,
312 : const struct smb_filename *smb_fname_dst)
313 : {
314 0 : errno = ENOSYS;
315 0 : return -1;
316 : }
317 :
318 0 : static struct tevent_req *skel_fsync_send(struct vfs_handle_struct *handle,
319 : TALLOC_CTX *mem_ctx,
320 : struct tevent_context *ev,
321 : struct files_struct *fsp)
322 : {
323 0 : return NULL;
324 : }
325 :
326 0 : static int skel_fsync_recv(struct tevent_req *req,
327 : struct vfs_aio_state *vfs_aio_state)
328 : {
329 0 : vfs_aio_state->error = ENOSYS;
330 0 : return -1;
331 : }
332 :
333 0 : static int skel_stat(vfs_handle_struct *handle, struct smb_filename *smb_fname)
334 : {
335 0 : errno = ENOSYS;
336 0 : return -1;
337 : }
338 :
339 0 : static int skel_fstat(vfs_handle_struct *handle, files_struct *fsp,
340 : SMB_STRUCT_STAT *sbuf)
341 : {
342 0 : errno = ENOSYS;
343 0 : return -1;
344 : }
345 :
346 0 : static int skel_lstat(vfs_handle_struct *handle,
347 : struct smb_filename *smb_fname)
348 : {
349 0 : errno = ENOSYS;
350 0 : return -1;
351 : }
352 :
353 0 : static int skel_fstatat(
354 : struct vfs_handle_struct *handle,
355 : const struct files_struct *dirfsp,
356 : const struct smb_filename *smb_fname,
357 : SMB_STRUCT_STAT *sbuf,
358 : int flags)
359 : {
360 0 : errno = ENOSYS;
361 0 : return -1;
362 : }
363 :
364 0 : static uint64_t skel_get_alloc_size(struct vfs_handle_struct *handle,
365 : struct files_struct *fsp,
366 : const SMB_STRUCT_STAT *sbuf)
367 : {
368 0 : errno = ENOSYS;
369 0 : return -1;
370 : }
371 :
372 0 : static int skel_unlinkat(vfs_handle_struct *handle,
373 : struct files_struct *dirfsp,
374 : const struct smb_filename *smb_fname,
375 : int flags)
376 : {
377 0 : errno = ENOSYS;
378 0 : return -1;
379 : }
380 :
381 0 : static int skel_fchmod(vfs_handle_struct *handle, files_struct *fsp,
382 : mode_t mode)
383 : {
384 0 : errno = ENOSYS;
385 0 : return -1;
386 : }
387 :
388 0 : static int skel_fchown(vfs_handle_struct *handle, files_struct *fsp,
389 : uid_t uid, gid_t gid)
390 : {
391 0 : errno = ENOSYS;
392 0 : return -1;
393 : }
394 :
395 0 : static int skel_lchown(vfs_handle_struct *handle,
396 : const struct smb_filename *smb_fname,
397 : uid_t uid,
398 : gid_t gid)
399 : {
400 0 : errno = ENOSYS;
401 0 : return -1;
402 : }
403 :
404 0 : static int skel_chdir(vfs_handle_struct *handle,
405 : const struct smb_filename *smb_fname)
406 : {
407 0 : errno = ENOSYS;
408 0 : return -1;
409 : }
410 :
411 0 : static struct smb_filename *skel_getwd(vfs_handle_struct *handle,
412 : TALLOC_CTX *ctx)
413 : {
414 0 : errno = ENOSYS;
415 0 : return NULL;
416 : }
417 :
418 0 : static int skel_fntimes(vfs_handle_struct *handle,
419 : files_struct *fsp,
420 : struct smb_file_time *ft)
421 : {
422 0 : errno = ENOSYS;
423 0 : return -1;
424 : }
425 :
426 0 : static int skel_ftruncate(vfs_handle_struct *handle, files_struct *fsp,
427 : off_t offset)
428 : {
429 0 : errno = ENOSYS;
430 0 : return -1;
431 : }
432 :
433 0 : static int skel_fallocate(vfs_handle_struct *handle, files_struct *fsp,
434 : uint32_t mode, off_t offset, off_t len)
435 : {
436 0 : errno = ENOSYS;
437 0 : return -1;
438 : }
439 :
440 0 : static bool skel_lock(vfs_handle_struct *handle, files_struct *fsp, int op,
441 : off_t offset, off_t count, int type)
442 : {
443 0 : errno = ENOSYS;
444 0 : return false;
445 : }
446 :
447 0 : static int skel_filesystem_sharemode(struct vfs_handle_struct *handle,
448 : struct files_struct *fsp,
449 : uint32_t share_mode,
450 : uint32_t access_mask)
451 : {
452 0 : errno = ENOSYS;
453 0 : return -1;
454 : }
455 :
456 0 : static int skel_fcntl(struct vfs_handle_struct *handle,
457 : struct files_struct *fsp, int cmd, va_list cmd_arg)
458 : {
459 0 : errno = ENOSYS;
460 0 : return -1;
461 : }
462 :
463 0 : static int skel_linux_setlease(struct vfs_handle_struct *handle,
464 : struct files_struct *fsp, int leasetype)
465 : {
466 0 : errno = ENOSYS;
467 0 : return -1;
468 : }
469 :
470 0 : static bool skel_getlock(vfs_handle_struct *handle, files_struct *fsp,
471 : off_t *poffset, off_t *pcount, int *ptype,
472 : pid_t *ppid)
473 : {
474 0 : errno = ENOSYS;
475 0 : return false;
476 : }
477 :
478 0 : static int skel_symlinkat(vfs_handle_struct *handle,
479 : const struct smb_filename *link_contents,
480 : struct files_struct *dirfsp,
481 : const struct smb_filename *new_smb_fname)
482 : {
483 0 : errno = ENOSYS;
484 0 : return -1;
485 : }
486 :
487 0 : static int skel_vfs_readlinkat(vfs_handle_struct *handle,
488 : const struct files_struct *dirfsp,
489 : const struct smb_filename *smb_fname,
490 : char *buf,
491 : size_t bufsiz)
492 : {
493 0 : errno = ENOSYS;
494 0 : return -1;
495 : }
496 :
497 0 : static int skel_linkat(vfs_handle_struct *handle,
498 : files_struct *srcfsp,
499 : const struct smb_filename *old_smb_fname,
500 : files_struct *dstfsp,
501 : const struct smb_filename *new_smb_fname,
502 : int flags)
503 : {
504 0 : errno = ENOSYS;
505 0 : return -1;
506 : }
507 :
508 0 : static int skel_mknodat(vfs_handle_struct *handle,
509 : files_struct *dirfsp,
510 : const struct smb_filename *smb_fname,
511 : mode_t mode,
512 : SMB_DEV_T dev)
513 : {
514 0 : errno = ENOSYS;
515 0 : return -1;
516 : }
517 :
518 0 : static struct smb_filename *skel_realpath(vfs_handle_struct *handle,
519 : TALLOC_CTX *ctx,
520 : const struct smb_filename *smb_fname)
521 : {
522 0 : errno = ENOSYS;
523 0 : return NULL;
524 : }
525 :
526 0 : static int skel_fchflags(vfs_handle_struct *handle,
527 : struct files_struct *fsp,
528 : uint flags)
529 : {
530 0 : errno = ENOSYS;
531 0 : return -1;
532 : }
533 :
534 0 : static struct file_id skel_file_id_create(vfs_handle_struct *handle,
535 : const SMB_STRUCT_STAT *sbuf)
536 : {
537 : struct file_id id;
538 0 : ZERO_STRUCT(id);
539 0 : errno = ENOSYS;
540 0 : return id;
541 : }
542 :
543 0 : static uint64_t skel_fs_file_id(vfs_handle_struct *handle,
544 : const SMB_STRUCT_STAT *sbuf)
545 : {
546 0 : errno = ENOSYS;
547 0 : return 0;
548 : }
549 :
550 : struct skel_offload_read_state {
551 : bool dummy;
552 : };
553 :
554 0 : static struct tevent_req *skel_offload_read_send(
555 : TALLOC_CTX *mem_ctx,
556 : struct tevent_context *ev,
557 : struct vfs_handle_struct *handle,
558 : struct files_struct *fsp,
559 : uint32_t fsctl,
560 : uint32_t ttl,
561 : off_t offset,
562 : size_t to_copy)
563 : {
564 0 : struct tevent_req *req = NULL;
565 0 : struct skel_offload_read_state *state = NULL;
566 :
567 0 : req = tevent_req_create(mem_ctx, &state, struct skel_offload_read_state);
568 0 : if (req == NULL) {
569 0 : return NULL;
570 : }
571 :
572 0 : tevent_req_nterror(req, NT_STATUS_NOT_IMPLEMENTED);
573 0 : return tevent_req_post(req, ev);
574 : }
575 :
576 0 : static NTSTATUS skel_offload_read_recv(struct tevent_req *req,
577 : struct vfs_handle_struct *handle,
578 : TALLOC_CTX *mem_ctx,
579 : uint32_t *flags,
580 : uint64_t *xferlen,
581 : DATA_BLOB *_token_blob)
582 : {
583 : NTSTATUS status;
584 :
585 0 : if (tevent_req_is_nterror(req, &status)) {
586 0 : tevent_req_received(req);
587 0 : return status;
588 : }
589 0 : tevent_req_received(req);
590 :
591 0 : return NT_STATUS_OK;
592 : }
593 :
594 : struct skel_cc_state {
595 : uint64_t unused;
596 : };
597 0 : static struct tevent_req *skel_offload_write_send(struct vfs_handle_struct *handle,
598 : TALLOC_CTX *mem_ctx,
599 : struct tevent_context *ev,
600 : uint32_t fsctl,
601 : DATA_BLOB *token,
602 : off_t transfer_offset,
603 : struct files_struct *dest_fsp,
604 : off_t dest_off,
605 : off_t num)
606 : {
607 : struct tevent_req *req;
608 : struct skel_cc_state *cc_state;
609 :
610 0 : req = tevent_req_create(mem_ctx, &cc_state, struct skel_cc_state);
611 0 : if (req == NULL) {
612 0 : return NULL;
613 : }
614 :
615 0 : tevent_req_nterror(req, NT_STATUS_NOT_IMPLEMENTED);
616 0 : return tevent_req_post(req, ev);
617 : }
618 :
619 0 : static NTSTATUS skel_offload_write_recv(struct vfs_handle_struct *handle,
620 : struct tevent_req *req,
621 : off_t *copied)
622 : {
623 : NTSTATUS status;
624 :
625 0 : if (tevent_req_is_nterror(req, &status)) {
626 0 : tevent_req_received(req);
627 0 : return status;
628 : }
629 0 : tevent_req_received(req);
630 :
631 0 : return NT_STATUS_OK;
632 : }
633 :
634 0 : static NTSTATUS skel_fget_compression(struct vfs_handle_struct *handle,
635 : TALLOC_CTX *mem_ctx,
636 : struct files_struct *fsp,
637 : uint16_t *_compression_fmt)
638 : {
639 0 : return NT_STATUS_INVALID_DEVICE_REQUEST;
640 : }
641 :
642 0 : static NTSTATUS skel_set_compression(struct vfs_handle_struct *handle,
643 : TALLOC_CTX *mem_ctx,
644 : struct files_struct *fsp,
645 : uint16_t compression_fmt)
646 : {
647 0 : return NT_STATUS_INVALID_DEVICE_REQUEST;
648 : }
649 :
650 0 : static NTSTATUS skel_fstreaminfo(struct vfs_handle_struct *handle,
651 : struct files_struct *fsp,
652 : TALLOC_CTX *mem_ctx,
653 : unsigned int *num_streams,
654 : struct stream_struct **streams)
655 : {
656 0 : return NT_STATUS_NOT_IMPLEMENTED;
657 : }
658 :
659 0 : static NTSTATUS skel_get_real_filename_at(struct vfs_handle_struct *handle,
660 : struct files_struct *dirfsp,
661 : const char *name,
662 : TALLOC_CTX *mem_ctx,
663 : char **found_name)
664 : {
665 0 : return NT_STATUS_NOT_IMPLEMENTED;
666 : }
667 :
668 0 : static const char *skel_connectpath(struct vfs_handle_struct *handle,
669 : const struct smb_filename *smb_fname)
670 : {
671 0 : errno = ENOSYS;
672 0 : return NULL;
673 : }
674 :
675 0 : static NTSTATUS skel_brl_lock_windows(struct vfs_handle_struct *handle,
676 : struct byte_range_lock *br_lck,
677 : struct lock_struct *plock)
678 : {
679 0 : return NT_STATUS_NOT_IMPLEMENTED;
680 : }
681 :
682 0 : static bool skel_brl_unlock_windows(struct vfs_handle_struct *handle,
683 : struct byte_range_lock *br_lck,
684 : const struct lock_struct *plock)
685 : {
686 0 : errno = ENOSYS;
687 0 : return false;
688 : }
689 :
690 0 : static bool skel_strict_lock_check(struct vfs_handle_struct *handle,
691 : struct files_struct *fsp,
692 : struct lock_struct *plock)
693 : {
694 0 : errno = ENOSYS;
695 0 : return false;
696 : }
697 :
698 0 : static NTSTATUS skel_translate_name(struct vfs_handle_struct *handle,
699 : const char *mapped_name,
700 : enum vfs_translate_direction direction,
701 : TALLOC_CTX *mem_ctx, char **pmapped_name)
702 : {
703 0 : return NT_STATUS_NOT_IMPLEMENTED;
704 : }
705 :
706 0 : static NTSTATUS skel_parent_pathname(struct vfs_handle_struct *handle,
707 : TALLOC_CTX *mem_ctx,
708 : const struct smb_filename *smb_fname_in,
709 : struct smb_filename **parent_dir_out,
710 : struct smb_filename **atname_out)
711 : {
712 0 : return NT_STATUS_NOT_IMPLEMENTED;
713 : }
714 :
715 0 : static NTSTATUS skel_fsctl(struct vfs_handle_struct *handle,
716 : struct files_struct *fsp,
717 : TALLOC_CTX *ctx,
718 : uint32_t function,
719 : uint16_t req_flags, /* Needed for UNICODE ... */
720 : const uint8_t *_in_data,
721 : uint32_t in_len,
722 : uint8_t **_out_data,
723 : uint32_t max_out_len, uint32_t *out_len)
724 : {
725 0 : return NT_STATUS_NOT_IMPLEMENTED;
726 : }
727 :
728 0 : static NTSTATUS skel_freaddir_attr(struct vfs_handle_struct *handle,
729 : struct files_struct *fsp,
730 : TALLOC_CTX *mem_ctx,
731 : struct readdir_attr_data **pattr_data)
732 : {
733 0 : return NT_STATUS_NOT_IMPLEMENTED;
734 : }
735 :
736 : struct skel_get_dos_attributes_state {
737 : struct vfs_aio_state aio_state;
738 : uint32_t dosmode;
739 : };
740 :
741 0 : static struct tevent_req *skel_get_dos_attributes_send(
742 : TALLOC_CTX *mem_ctx,
743 : struct tevent_context *ev,
744 : struct vfs_handle_struct *handle,
745 : files_struct *dir_fsp,
746 : struct smb_filename *smb_fname)
747 : {
748 0 : struct tevent_req *req = NULL;
749 0 : struct skel_get_dos_attributes_state *state = NULL;
750 :
751 0 : req = tevent_req_create(mem_ctx, &state,
752 : struct skel_get_dos_attributes_state);
753 0 : if (req == NULL) {
754 0 : return NULL;
755 : }
756 :
757 0 : tevent_req_nterror(req, NT_STATUS_NOT_IMPLEMENTED);
758 0 : return tevent_req_post(req, ev);
759 : }
760 :
761 0 : static NTSTATUS skel_get_dos_attributes_recv(struct tevent_req *req,
762 : struct vfs_aio_state *aio_state,
763 : uint32_t *dosmode)
764 : {
765 0 : struct skel_get_dos_attributes_state *state =
766 0 : tevent_req_data(req,
767 : struct skel_get_dos_attributes_state);
768 : NTSTATUS status;
769 :
770 0 : if (tevent_req_is_nterror(req, &status)) {
771 0 : tevent_req_received(req);
772 0 : return status;
773 : }
774 :
775 0 : *aio_state = state->aio_state;
776 0 : *dosmode = state->dosmode;
777 0 : tevent_req_received(req);
778 0 : return NT_STATUS_OK;
779 : }
780 :
781 0 : static NTSTATUS skel_fget_dos_attributes(struct vfs_handle_struct *handle,
782 : struct files_struct *fsp,
783 : uint32_t *dosmode)
784 : {
785 0 : return NT_STATUS_NOT_IMPLEMENTED;
786 : }
787 :
788 0 : static NTSTATUS skel_fset_dos_attributes(struct vfs_handle_struct *handle,
789 : struct files_struct *fsp,
790 : uint32_t dosmode)
791 : {
792 0 : return NT_STATUS_NOT_IMPLEMENTED;
793 : }
794 :
795 0 : static NTSTATUS skel_fget_nt_acl(vfs_handle_struct *handle, files_struct *fsp,
796 : uint32_t security_info,
797 : TALLOC_CTX *mem_ctx,
798 : struct security_descriptor **ppdesc)
799 : {
800 0 : return NT_STATUS_NOT_IMPLEMENTED;
801 : }
802 :
803 0 : static NTSTATUS skel_fset_nt_acl(vfs_handle_struct *handle, files_struct *fsp,
804 : uint32_t security_info_sent,
805 : const struct security_descriptor *psd)
806 : {
807 0 : return NT_STATUS_NOT_IMPLEMENTED;
808 : }
809 :
810 0 : static SMB_ACL_T skel_sys_acl_get_fd(vfs_handle_struct *handle,
811 : files_struct *fsp,
812 : SMB_ACL_TYPE_T type,
813 : TALLOC_CTX *mem_ctx)
814 : {
815 0 : errno = ENOSYS;
816 0 : return (SMB_ACL_T) NULL;
817 : }
818 :
819 0 : static int skel_sys_acl_blob_get_fd(vfs_handle_struct *handle,
820 : files_struct *fsp, TALLOC_CTX *mem_ctx,
821 : char **blob_description, DATA_BLOB *blob)
822 : {
823 0 : errno = ENOSYS;
824 0 : return -1;
825 : }
826 :
827 0 : static int skel_sys_acl_set_fd(vfs_handle_struct *handle,
828 : struct files_struct *fsp,
829 : SMB_ACL_TYPE_T type,
830 : SMB_ACL_T theacl)
831 : {
832 0 : errno = ENOSYS;
833 0 : return -1;
834 : }
835 :
836 0 : static int skel_sys_acl_delete_def_fd(vfs_handle_struct *handle,
837 : struct files_struct *fsp)
838 : {
839 0 : errno = ENOSYS;
840 0 : return -1;
841 : }
842 :
843 : struct skel_getxattrat_state {
844 : struct vfs_aio_state aio_state;
845 : ssize_t xattr_size;
846 : uint8_t *xattr_value;
847 : };
848 :
849 0 : static struct tevent_req *skel_getxattrat_send(
850 : TALLOC_CTX *mem_ctx,
851 : struct tevent_context *ev,
852 : struct vfs_handle_struct *handle,
853 : files_struct *dir_fsp,
854 : const struct smb_filename *smb_fname,
855 : const char *xattr_name,
856 : size_t alloc_hint)
857 : {
858 0 : struct tevent_req *req = NULL;
859 0 : struct skel_getxattrat_state *state = NULL;
860 :
861 0 : req = tevent_req_create(mem_ctx, &state,
862 : struct skel_getxattrat_state);
863 0 : if (req == NULL) {
864 0 : return NULL;
865 : }
866 :
867 0 : tevent_req_error(req, ENOSYS);
868 0 : return tevent_req_post(req, ev);
869 : }
870 :
871 0 : static ssize_t skel_getxattrat_recv(struct tevent_req *req,
872 : struct vfs_aio_state *aio_state,
873 : TALLOC_CTX *mem_ctx,
874 : uint8_t **xattr_value)
875 : {
876 0 : struct skel_getxattrat_state *state = tevent_req_data(
877 : req, struct skel_getxattrat_state);
878 : ssize_t xattr_size;
879 :
880 0 : if (tevent_req_is_unix_error(req, &aio_state->error)) {
881 0 : tevent_req_received(req);
882 0 : return -1;
883 : }
884 :
885 0 : *aio_state = state->aio_state;
886 0 : xattr_size = state->xattr_size;
887 0 : if (xattr_value != NULL) {
888 0 : *xattr_value = talloc_move(mem_ctx, &state->xattr_value);
889 : }
890 :
891 0 : tevent_req_received(req);
892 0 : return xattr_size;
893 : }
894 :
895 0 : static ssize_t skel_fgetxattr(vfs_handle_struct *handle,
896 : struct files_struct *fsp, const char *name,
897 : void *value, size_t size)
898 : {
899 0 : errno = ENOSYS;
900 0 : return -1;
901 : }
902 :
903 0 : static ssize_t skel_flistxattr(vfs_handle_struct *handle,
904 : struct files_struct *fsp, char *list,
905 : size_t size)
906 : {
907 0 : errno = ENOSYS;
908 0 : return -1;
909 : }
910 :
911 0 : static int skel_fremovexattr(vfs_handle_struct *handle,
912 : struct files_struct *fsp, const char *name)
913 : {
914 0 : errno = ENOSYS;
915 0 : return -1;
916 : }
917 :
918 0 : static int skel_fsetxattr(vfs_handle_struct *handle, struct files_struct *fsp,
919 : const char *name, const void *value, size_t size,
920 : int flags)
921 : {
922 0 : errno = ENOSYS;
923 0 : return -1;
924 : }
925 :
926 0 : static bool skel_aio_force(struct vfs_handle_struct *handle,
927 : struct files_struct *fsp)
928 : {
929 0 : errno = ENOSYS;
930 0 : return false;
931 : }
932 :
933 0 : static NTSTATUS skel_audit_file(struct vfs_handle_struct *handle,
934 : struct smb_filename *file,
935 : struct security_acl *sacl,
936 : uint32_t access_requested,
937 : uint32_t access_denied)
938 : {
939 0 : return NT_STATUS_NOT_IMPLEMENTED;
940 : }
941 :
942 0 : static NTSTATUS skel_durable_cookie(struct vfs_handle_struct *handle,
943 : struct files_struct *fsp,
944 : TALLOC_CTX *mem_ctx,
945 : DATA_BLOB *cookie)
946 : {
947 0 : return NT_STATUS_NOT_IMPLEMENTED;
948 : }
949 :
950 0 : static NTSTATUS skel_durable_disconnect(struct vfs_handle_struct *handle,
951 : struct files_struct *fsp,
952 : const DATA_BLOB old_cookie,
953 : TALLOC_CTX *mem_ctx,
954 : DATA_BLOB *new_cookie)
955 : {
956 0 : return NT_STATUS_NOT_IMPLEMENTED;
957 : }
958 :
959 0 : static NTSTATUS skel_durable_reconnect(struct vfs_handle_struct *handle,
960 : struct smb_request *smb1req,
961 : struct smbXsrv_open *op,
962 : const DATA_BLOB old_cookie,
963 : TALLOC_CTX *mem_ctx,
964 : struct files_struct **fsp,
965 : DATA_BLOB *new_cookie)
966 : {
967 0 : return NT_STATUS_NOT_IMPLEMENTED;
968 : }
969 :
970 : /* VFS operations structure */
971 :
972 : static struct vfs_fn_pointers skel_opaque_fns = {
973 : /* Disk operations */
974 :
975 : .connect_fn = skel_connect,
976 : .disconnect_fn = skel_disconnect,
977 : .disk_free_fn = skel_disk_free,
978 : .get_quota_fn = skel_get_quota,
979 : .set_quota_fn = skel_set_quota,
980 : .get_shadow_copy_data_fn = skel_get_shadow_copy_data,
981 : .statvfs_fn = skel_statvfs,
982 : .fs_capabilities_fn = skel_fs_capabilities,
983 : .get_dfs_referrals_fn = skel_get_dfs_referrals,
984 : .create_dfs_pathat_fn = skel_create_dfs_pathat,
985 : .read_dfs_pathat_fn = skel_read_dfs_pathat,
986 : .snap_check_path_fn = skel_snap_check_path,
987 : .snap_create_fn = skel_snap_create,
988 : .snap_delete_fn = skel_snap_delete,
989 :
990 : /* Directory operations */
991 :
992 : .fdopendir_fn = skel_fdopendir,
993 : .readdir_fn = skel_readdir,
994 : .seekdir_fn = skel_seekdir,
995 : .telldir_fn = skel_telldir,
996 : .rewind_dir_fn = skel_rewind_dir,
997 : .mkdirat_fn = skel_mkdirat,
998 : .closedir_fn = skel_closedir,
999 :
1000 : /* File operations */
1001 :
1002 : .openat_fn = skel_openat,
1003 : .create_file_fn = skel_create_file,
1004 : .close_fn = skel_close_fn,
1005 : .pread_fn = skel_pread,
1006 : .pread_send_fn = skel_pread_send,
1007 : .pread_recv_fn = skel_pread_recv,
1008 : .pwrite_fn = skel_pwrite,
1009 : .pwrite_send_fn = skel_pwrite_send,
1010 : .pwrite_recv_fn = skel_pwrite_recv,
1011 : .lseek_fn = skel_lseek,
1012 : .sendfile_fn = skel_sendfile,
1013 : .recvfile_fn = skel_recvfile,
1014 : .renameat_fn = skel_renameat,
1015 : .fsync_send_fn = skel_fsync_send,
1016 : .fsync_recv_fn = skel_fsync_recv,
1017 : .stat_fn = skel_stat,
1018 : .fstat_fn = skel_fstat,
1019 : .lstat_fn = skel_lstat,
1020 : .fstatat_fn = skel_fstatat,
1021 : .get_alloc_size_fn = skel_get_alloc_size,
1022 : .unlinkat_fn = skel_unlinkat,
1023 : .fchmod_fn = skel_fchmod,
1024 : .fchown_fn = skel_fchown,
1025 : .lchown_fn = skel_lchown,
1026 : .chdir_fn = skel_chdir,
1027 : .getwd_fn = skel_getwd,
1028 : .fntimes_fn = skel_fntimes,
1029 : .ftruncate_fn = skel_ftruncate,
1030 : .fallocate_fn = skel_fallocate,
1031 : .lock_fn = skel_lock,
1032 : .filesystem_sharemode_fn = skel_filesystem_sharemode,
1033 : .fcntl_fn = skel_fcntl,
1034 : .linux_setlease_fn = skel_linux_setlease,
1035 : .getlock_fn = skel_getlock,
1036 : .symlinkat_fn = skel_symlinkat,
1037 : .readlinkat_fn = skel_vfs_readlinkat,
1038 : .linkat_fn = skel_linkat,
1039 : .mknodat_fn = skel_mknodat,
1040 : .realpath_fn = skel_realpath,
1041 : .fchflags_fn = skel_fchflags,
1042 : .file_id_create_fn = skel_file_id_create,
1043 : .fs_file_id_fn = skel_fs_file_id,
1044 : .offload_read_send_fn = skel_offload_read_send,
1045 : .offload_read_recv_fn = skel_offload_read_recv,
1046 : .offload_write_send_fn = skel_offload_write_send,
1047 : .offload_write_recv_fn = skel_offload_write_recv,
1048 : .fget_compression_fn = skel_fget_compression,
1049 : .set_compression_fn = skel_set_compression,
1050 :
1051 : .fstreaminfo_fn = skel_fstreaminfo,
1052 : .get_real_filename_at_fn = skel_get_real_filename_at,
1053 : .connectpath_fn = skel_connectpath,
1054 : .brl_lock_windows_fn = skel_brl_lock_windows,
1055 : .brl_unlock_windows_fn = skel_brl_unlock_windows,
1056 : .strict_lock_check_fn = skel_strict_lock_check,
1057 : .translate_name_fn = skel_translate_name,
1058 : .parent_pathname_fn = skel_parent_pathname,
1059 : .fsctl_fn = skel_fsctl,
1060 : .freaddir_attr_fn = skel_freaddir_attr,
1061 : .audit_file_fn = skel_audit_file,
1062 :
1063 : /* DOS attributes. */
1064 : .get_dos_attributes_send_fn = skel_get_dos_attributes_send,
1065 : .get_dos_attributes_recv_fn = skel_get_dos_attributes_recv,
1066 : .fget_dos_attributes_fn = skel_fget_dos_attributes,
1067 : .fset_dos_attributes_fn = skel_fset_dos_attributes,
1068 :
1069 : /* NT ACL operations. */
1070 :
1071 : .fget_nt_acl_fn = skel_fget_nt_acl,
1072 : .fset_nt_acl_fn = skel_fset_nt_acl,
1073 :
1074 : /* POSIX ACL operations. */
1075 :
1076 : .sys_acl_get_fd_fn = skel_sys_acl_get_fd,
1077 : .sys_acl_blob_get_fd_fn = skel_sys_acl_blob_get_fd,
1078 : .sys_acl_set_fd_fn = skel_sys_acl_set_fd,
1079 : .sys_acl_delete_def_fd_fn = skel_sys_acl_delete_def_fd,
1080 :
1081 : /* EA operations. */
1082 : .getxattrat_send_fn = skel_getxattrat_send,
1083 : .getxattrat_recv_fn = skel_getxattrat_recv,
1084 : .fgetxattr_fn = skel_fgetxattr,
1085 : .flistxattr_fn = skel_flistxattr,
1086 : .fremovexattr_fn = skel_fremovexattr,
1087 : .fsetxattr_fn = skel_fsetxattr,
1088 :
1089 : /* aio operations */
1090 : .aio_force_fn = skel_aio_force,
1091 :
1092 : /* durable handle operations */
1093 : .durable_cookie_fn = skel_durable_cookie,
1094 : .durable_disconnect_fn = skel_durable_disconnect,
1095 : .durable_reconnect_fn = skel_durable_reconnect,
1096 : };
1097 :
1098 : static_decl_vfs;
1099 26 : NTSTATUS vfs_skel_opaque_init(TALLOC_CTX *ctx)
1100 : {
1101 : /*
1102 : * smb_vfs_assert_all_fns() makes sure every
1103 : * call is implemented.
1104 : *
1105 : * An opaque module requires this!
1106 : */
1107 26 : smb_vfs_assert_all_fns(&skel_opaque_fns, "skel_opaque");
1108 26 : return smb_register_vfs(SMB_VFS_INTERFACE_VERSION, "skel_opaque",
1109 : &skel_opaque_fns);
1110 : }
|