VFS: Rename kernel_flock to filesystem_sharemode
[samba.git] / source3 / modules / vfs_not_implemented.c
1 /*
2  * VFS module with "not implemented " helper functions for other modules.
3  *
4  * Copyright (C) Tim Potter, 1999-2000
5  * Copyright (C) Alexander Bokovoy, 2002
6  * Copyright (C) Stefan (metze) Metzmacher, 2003,2018
7  * Copyright (C) Jeremy Allison 2009
8  *
9  * This program is free software; you can redistribute it and/or modify
10  * it under the terms of the GNU General Public License as published by
11  * the Free Software Foundation; either version 3 of the License, or
12  * (at your option) any later version.
13  *
14  * This program is distributed in the hope that it will be useful,
15  * but WITHOUT ANY WARRANTY; without even the implied warranty of
16  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
17  * GNU General Public License for more details.
18  *
19  * You should have received a copy of the GNU General Public License
20  * along with this program; if not, see <http://www.gnu.org/licenses/>.
21  */
22
23 #include "includes.h"
24 #include "lib/util/tevent_unix.h"
25 #include "lib/util/tevent_ntstatus.h"
26
27 int vfs_not_implemented_connect(
28                         vfs_handle_struct *handle,
29                         const char *service,
30                         const char *user)
31 {
32         errno = ENOSYS;
33         return -1;
34 }
35
36 void vfs_not_implemented_disconnect(vfs_handle_struct *handle)
37 {
38         ;
39 }
40
41 uint64_t vfs_not_implemented_disk_free(vfs_handle_struct *handle,
42                                 const struct smb_filename *smb_fname,
43                                 uint64_t *bsize,
44                                 uint64_t *dfree,
45                                 uint64_t *dsize)
46 {
47         *bsize = 0;
48         *dfree = 0;
49         *dsize = 0;
50         return 0;
51 }
52
53 int vfs_not_implemented_get_quota(vfs_handle_struct *handle,
54                                 const struct smb_filename *smb_fname,
55                                 enum SMB_QUOTA_TYPE qtype,
56                                 unid_t id,
57                                 SMB_DISK_QUOTA *dq)
58 {
59         errno = ENOSYS;
60         return -1;
61 }
62
63 int vfs_not_implemented_set_quota(vfs_handle_struct *handle,
64                                   enum SMB_QUOTA_TYPE qtype,
65                                   unid_t id, SMB_DISK_QUOTA *dq)
66 {
67         errno = ENOSYS;
68         return -1;
69 }
70
71 int vfs_not_implemented_get_shadow_copy_data(vfs_handle_struct *handle,
72                                 files_struct *fsp,
73                                 struct shadow_copy_data *shadow_copy_data,
74                                 bool labels)
75 {
76         errno = ENOSYS;
77         return -1;
78 }
79
80 int vfs_not_implemented_statvfs(struct vfs_handle_struct *handle,
81                                 const struct smb_filename *smb_fname,
82                                 struct vfs_statvfs_struct *statbuf)
83 {
84         errno = ENOSYS;
85         return -1;
86 }
87
88 uint32_t vfs_not_implemented_fs_capabilities(struct vfs_handle_struct *handle,
89                                 enum timestamp_set_resolution *p_ts_res)
90 {
91         return 0;
92 }
93
94 NTSTATUS vfs_not_implemented_get_dfs_referrals(struct vfs_handle_struct *handle,
95                                                struct dfs_GetDFSReferral *r)
96 {
97         return NT_STATUS_NOT_IMPLEMENTED;
98 }
99
100 NTSTATUS vfs_not_implemented_create_dfs_pathat(struct vfs_handle_struct *handle,
101                                 struct files_struct *dirfsp,
102                                 const struct smb_filename *smb_fname,
103                                 const struct referral *reflist,
104                                 size_t referral_count)
105 {
106         return NT_STATUS_NOT_IMPLEMENTED;
107 }
108
109 NTSTATUS vfs_not_implemented_read_dfs_pathat(struct vfs_handle_struct *handle,
110                                 TALLOC_CTX *mem_ctx,
111                                 struct files_struct *dirfsp,
112                                 struct smb_filename *smb_fname,
113                                 struct referral **ppreflist,
114                                 size_t *preferral_count)
115 {
116         return NT_STATUS_NOT_IMPLEMENTED;
117 }
118
119 NTSTATUS vfs_not_implemented_snap_check_path(struct vfs_handle_struct *handle,
120                                 TALLOC_CTX *mem_ctx,
121                                 const char *service_path,
122                                 char **base_volume)
123 {
124         return NT_STATUS_NOT_SUPPORTED;
125 }
126
127 NTSTATUS vfs_not_implemented_snap_create(struct vfs_handle_struct *handle,
128                                          TALLOC_CTX *mem_ctx,
129                                          const char *base_volume,
130                                          time_t *tstamp,
131                                          bool rw,
132                                          char **base_path,
133                                          char **snap_path)
134 {
135         return NT_STATUS_NOT_SUPPORTED;
136 }
137
138 NTSTATUS vfs_not_implemented_snap_delete(struct vfs_handle_struct *handle,
139                                          TALLOC_CTX *mem_ctx,
140                                          char *base_path,
141                                          char *snap_path)
142 {
143         return NT_STATUS_NOT_SUPPORTED;
144 }
145
146 DIR *vfs_not_implemented_fdopendir(vfs_handle_struct *handle, files_struct *fsp,
147                                    const char *mask, uint32_t attr)
148 {
149         errno = ENOSYS;
150         return NULL;
151 }
152
153 struct dirent *vfs_not_implemented_readdir(vfs_handle_struct *handle,
154                                            struct files_struct *dirfsp,
155                                            DIR *dirp,
156                                            SMB_STRUCT_STAT *sbuf)
157 {
158         errno = ENOSYS;
159         return NULL;
160 }
161
162 void vfs_not_implemented_seekdir(vfs_handle_struct *handle, DIR *dirp, long offset)
163 {
164         ;
165 }
166
167 long vfs_not_implemented_telldir(vfs_handle_struct *handle, DIR *dirp)
168 {
169         errno = ENOSYS;
170         return (long)-1;
171 }
172
173 void vfs_not_implemented_rewind_dir(vfs_handle_struct *handle, DIR *dirp)
174 {
175         ;
176 }
177
178 int vfs_not_implemented_mkdirat(vfs_handle_struct *handle,
179                 struct files_struct *dirfsp,
180                 const struct smb_filename *smb_fname,
181                 mode_t mode)
182 {
183         errno = ENOSYS;
184         return -1;
185 }
186
187 int vfs_not_implemented_closedir(vfs_handle_struct *handle, DIR *dir)
188 {
189         errno = ENOSYS;
190         return -1;
191 }
192
193 int vfs_not_implemented_openat(vfs_handle_struct *handle,
194                                const struct files_struct *dirfsp,
195                                const struct smb_filename *smb_fname,
196                                struct files_struct *fsp,
197                                int flags,
198                                mode_t mode)
199 {
200         errno = ENOSYS;
201         return -1;
202 }
203
204 NTSTATUS vfs_not_implemented_create_file(struct vfs_handle_struct *handle,
205                                 struct smb_request *req,
206                                 struct smb_filename *smb_fname,
207                                 uint32_t access_mask,
208                                 uint32_t share_access,
209                                 uint32_t create_disposition,
210                                 uint32_t create_options,
211                                 uint32_t file_attributes,
212                                 uint32_t oplock_request,
213                                 const struct smb2_lease *lease,
214                                 uint64_t allocation_size,
215                                 uint32_t private_flags,
216                                 struct security_descriptor *sd,
217                                 struct ea_list *ea_list,
218                                 files_struct **result, int *pinfo,
219                                 const struct smb2_create_blobs *in_context_blobs,
220                                 struct smb2_create_blobs *out_context_blobs)
221 {
222         return NT_STATUS_NOT_IMPLEMENTED;
223 }
224
225 int vfs_not_implemented_close_fn(vfs_handle_struct *handle, files_struct *fsp)
226 {
227         errno = ENOSYS;
228         return -1;
229 }
230
231 ssize_t vfs_not_implemented_pread(vfs_handle_struct *handle, files_struct *fsp,
232                                   void *data, size_t n, off_t offset)
233 {
234         errno = ENOSYS;
235         return -1;
236 }
237
238 struct tevent_req *vfs_not_implemented_pread_send(struct vfs_handle_struct *handle,
239                                                   TALLOC_CTX *mem_ctx,
240                                                   struct tevent_context *ev,
241                                                   struct files_struct *fsp,
242                                                   void *data, size_t n, off_t offset)
243 {
244         return NULL;
245 }
246
247 ssize_t vfs_not_implemented_pread_recv(struct tevent_req *req,
248                                        struct vfs_aio_state *vfs_aio_state)
249 {
250         vfs_aio_state->error = ENOSYS;
251         return -1;
252 }
253
254 ssize_t vfs_not_implemented_pwrite(vfs_handle_struct *handle, files_struct *fsp,
255                                    const void *data, size_t n, off_t offset)
256 {
257         errno = ENOSYS;
258         return -1;
259 }
260
261 struct tevent_req *vfs_not_implemented_pwrite_send(struct vfs_handle_struct *handle,
262                                                    TALLOC_CTX *mem_ctx,
263                                                    struct tevent_context *ev,
264                                                    struct files_struct *fsp,
265                                                    const void *data,
266                                                    size_t n, off_t offset)
267 {
268         return NULL;
269 }
270
271 ssize_t vfs_not_implemented_pwrite_recv(struct tevent_req *req,
272                                 struct vfs_aio_state *vfs_aio_state)
273 {
274         vfs_aio_state->error = ENOSYS;
275         return -1;
276 }
277
278 off_t vfs_not_implemented_lseek(vfs_handle_struct *handle, files_struct *fsp,
279                         off_t offset, int whence)
280 {
281         errno = ENOSYS;
282         return (off_t) - 1;
283 }
284
285 ssize_t vfs_not_implemented_sendfile(vfs_handle_struct *handle, int tofd,
286                                      files_struct *fromfsp, const DATA_BLOB *hdr,
287                                      off_t offset, size_t n)
288 {
289         errno = ENOSYS;
290         return -1;
291 }
292
293 ssize_t vfs_not_implemented_recvfile(vfs_handle_struct *handle, int fromfd,
294                                      files_struct *tofsp, off_t offset, size_t n)
295 {
296         errno = ENOSYS;
297         return -1;
298 }
299
300 int vfs_not_implemented_renameat(vfs_handle_struct *handle,
301                                files_struct *srcfsp,
302                                const struct smb_filename *smb_fname_src,
303                                files_struct *dstfsp,
304                                const struct smb_filename *smb_fname_dst)
305 {
306         errno = ENOSYS;
307         return -1;
308 }
309
310 struct tevent_req *vfs_not_implemented_fsync_send(struct vfs_handle_struct *handle,
311                                                   TALLOC_CTX *mem_ctx,
312                                                   struct tevent_context *ev,
313                                                   struct files_struct *fsp)
314 {
315         return NULL;
316 }
317
318 int vfs_not_implemented_fsync_recv(struct tevent_req *req,
319                                    struct vfs_aio_state *vfs_aio_state)
320 {
321         vfs_aio_state->error = ENOSYS;
322         return -1;
323 }
324
325 int vfs_not_implemented_stat(vfs_handle_struct *handle, struct smb_filename *smb_fname)
326 {
327         errno = ENOSYS;
328         return -1;
329 }
330
331 int vfs_not_implemented_fstat(vfs_handle_struct *handle, files_struct *fsp,
332                         SMB_STRUCT_STAT *sbuf)
333 {
334         errno = ENOSYS;
335         return -1;
336 }
337
338 int vfs_not_implemented_lstat(vfs_handle_struct *handle,
339                               struct smb_filename *smb_fname)
340 {
341         errno = ENOSYS;
342         return -1;
343 }
344
345 uint64_t vfs_not_implemented_get_alloc_size(struct vfs_handle_struct *handle,
346                                             struct files_struct *fsp,
347                                             const SMB_STRUCT_STAT *sbuf)
348 {
349         errno = ENOSYS;
350         return -1;
351 }
352
353 int vfs_not_implemented_unlinkat(vfs_handle_struct *handle,
354                         struct files_struct *dirfsp,
355                         const struct smb_filename *smb_fname,
356                         int flags)
357 {
358         errno = ENOSYS;
359         return -1;
360 }
361
362 int vfs_not_implemented_fchmod(vfs_handle_struct *handle, files_struct *fsp,
363                                mode_t mode)
364 {
365         errno = ENOSYS;
366         return -1;
367 }
368
369 int vfs_not_implemented_fchown(vfs_handle_struct *handle, files_struct *fsp,
370                                uid_t uid, gid_t gid)
371 {
372         errno = ENOSYS;
373         return -1;
374 }
375
376 int vfs_not_implemented_lchown(vfs_handle_struct *handle,
377                                const struct smb_filename *smb_fname,
378                                uid_t uid,
379                                gid_t gid)
380 {
381         errno = ENOSYS;
382         return -1;
383 }
384
385 int vfs_not_implemented_chdir(vfs_handle_struct *handle,
386                               const struct smb_filename *smb_fname)
387 {
388         errno = ENOSYS;
389         return -1;
390 }
391
392 struct smb_filename *vfs_not_implemented_getwd(vfs_handle_struct *handle,
393                                                TALLOC_CTX *ctx)
394 {
395         errno = ENOSYS;
396         return NULL;
397 }
398
399 int vfs_not_implemented_fntimes(vfs_handle_struct *handle,
400                                 files_struct *fsp,
401                                 struct smb_file_time *ft)
402 {
403         errno = ENOSYS;
404         return -1;
405 }
406
407 int vfs_not_implemented_ftruncate(vfs_handle_struct *handle, files_struct *fsp,
408                                   off_t offset)
409 {
410         errno = ENOSYS;
411         return -1;
412 }
413
414 int vfs_not_implemented_fallocate(vfs_handle_struct *handle, files_struct *fsp,
415                                   uint32_t mode, off_t offset, off_t len)
416 {
417         errno = ENOSYS;
418         return -1;
419 }
420
421 bool vfs_not_implemented_lock(vfs_handle_struct *handle, files_struct *fsp, int op,
422                               off_t offset, off_t count, int type)
423 {
424         errno = ENOSYS;
425         return false;
426 }
427
428 int vfs_not_implemented_filesystem_sharemode(struct vfs_handle_struct *handle,
429                                              struct files_struct *fsp,
430                                              uint32_t share_access,
431                                              uint32_t access_mask)
432 {
433         errno = ENOSYS;
434         return -1;
435 }
436
437 int vfs_not_implemented_fcntl(struct vfs_handle_struct *handle,
438                               struct files_struct *fsp, int cmd,
439                               va_list cmd_arg)
440 {
441         errno = ENOSYS;
442         return -1;
443 }
444
445 int vfs_not_implemented_linux_setlease(struct vfs_handle_struct *handle,
446                                        struct files_struct *fsp, int leasetype)
447 {
448         errno = ENOSYS;
449         return -1;
450 }
451
452 bool vfs_not_implemented_getlock(vfs_handle_struct *handle, files_struct *fsp,
453                                  off_t *poffset, off_t *pcount, int *ptype,
454                                  pid_t *ppid)
455 {
456         errno = ENOSYS;
457         return false;
458 }
459
460 int vfs_not_implemented_symlinkat(vfs_handle_struct *handle,
461                                 const struct smb_filename *link_contents,
462                                 struct files_struct *dirfsp,
463                                 const struct smb_filename *new_smb_fname)
464 {
465         errno = ENOSYS;
466         return -1;
467 }
468
469 int vfs_not_implemented_vfs_readlinkat(vfs_handle_struct *handle,
470                         const struct files_struct *dirfsp,
471                         const struct smb_filename *smb_fname,
472                         char *buf,
473                         size_t bufsiz)
474 {
475         errno = ENOSYS;
476         return -1;
477 }
478
479 int vfs_not_implemented_linkat(vfs_handle_struct *handle,
480                         files_struct *srcfsp,
481                         const struct smb_filename *old_smb_fname,
482                         files_struct *dstfsp,
483                         const struct smb_filename *new_smb_fname,
484                         int flags)
485 {
486         errno = ENOSYS;
487         return -1;
488 }
489
490 int vfs_not_implemented_mknodat(vfs_handle_struct *handle,
491                         files_struct *dirfsp,
492                         const struct smb_filename *smb_fname,
493                         mode_t mode,
494                         SMB_DEV_T dev)
495 {
496         errno = ENOSYS;
497         return -1;
498 }
499
500 struct smb_filename *vfs_not_implemented_realpath(vfs_handle_struct *handle,
501                                                   TALLOC_CTX *ctx,
502                                                   const struct smb_filename *smb_fname)
503 {
504         errno = ENOSYS;
505         return NULL;
506 }
507
508 int vfs_not_implemented_fchflags(vfs_handle_struct *handle,
509                                 struct files_struct *fsp,
510                                 uint flags)
511 {
512         errno = ENOSYS;
513         return -1;
514 }
515
516 struct file_id vfs_not_implemented_file_id_create(vfs_handle_struct *handle,
517                                                   const SMB_STRUCT_STAT *sbuf)
518 {
519         struct file_id id;
520         ZERO_STRUCT(id);
521         errno = ENOSYS;
522         return id;
523 }
524
525 uint64_t vfs_not_implemented_fs_file_id(vfs_handle_struct *handle,
526                                         const SMB_STRUCT_STAT *sbuf)
527 {
528         errno = ENOSYS;
529         return 0;
530 }
531
532 struct vfs_not_implemented_offload_read_state {
533         bool dummy;
534 };
535
536 struct tevent_req *vfs_not_implemented_offload_read_send(
537                         TALLOC_CTX *mem_ctx,
538                         struct tevent_context *ev,
539                         struct vfs_handle_struct *handle,
540                         struct files_struct *fsp,
541                         uint32_t fsctl,
542                         uint32_t ttl,
543                         off_t offset,
544                         size_t to_copy)
545 {
546         struct tevent_req *req = NULL;
547         struct vfs_not_implemented_offload_read_state *state = NULL;
548
549         req = tevent_req_create(mem_ctx, &state,
550                                 struct vfs_not_implemented_offload_read_state);
551         if (req == NULL) {
552                 return NULL;
553         }
554
555         tevent_req_nterror(req, NT_STATUS_NOT_IMPLEMENTED);
556         return tevent_req_post(req, ev);
557 }
558
559 NTSTATUS vfs_not_implemented_offload_read_recv(struct tevent_req *req,
560                                        struct vfs_handle_struct *handle,
561                                        TALLOC_CTX *mem_ctx,
562                                        DATA_BLOB *_token_blob)
563 {
564         NTSTATUS status;
565
566         if (tevent_req_is_nterror(req, &status)) {
567                 tevent_req_received(req);
568                 return status;
569         }
570
571         tevent_req_received(req);
572         return NT_STATUS_OK;
573 }
574
575 struct vfs_not_implemented_offload_write_state {
576         uint64_t unused;
577 };
578
579 struct tevent_req *vfs_not_implemented_offload_write_send(
580                         struct vfs_handle_struct *handle,
581                         TALLOC_CTX *mem_ctx,
582                         struct tevent_context *ev,
583                         uint32_t fsctl,
584                         DATA_BLOB *token,
585                         off_t transfer_offset,
586                         struct files_struct *dest_fsp,
587                         off_t dest_off,
588                         off_t num)
589 {
590         struct tevent_req *req;
591         struct vfs_not_implemented_offload_write_state *state;
592
593         req = tevent_req_create(mem_ctx, &state,
594                                 struct vfs_not_implemented_offload_write_state);
595         if (req == NULL) {
596                 return NULL;
597         }
598
599         tevent_req_nterror(req, NT_STATUS_NOT_IMPLEMENTED);
600         return tevent_req_post(req, ev);
601 }
602
603 NTSTATUS vfs_not_implemented_offload_write_recv(struct vfs_handle_struct *handle,
604                                                 struct tevent_req *req,
605                                                 off_t *copied)
606 {
607         NTSTATUS status;
608
609         if (tevent_req_is_nterror(req, &status)) {
610                 tevent_req_received(req);
611                 return status;
612         }
613
614         tevent_req_received(req);
615         return NT_STATUS_OK;
616 }
617
618 NTSTATUS vfs_not_implemented_fget_compression(struct vfs_handle_struct *handle,
619                                              TALLOC_CTX *mem_ctx,
620                                              struct files_struct *fsp,
621                                              uint16_t *_compression_fmt)
622 {
623         return NT_STATUS_INVALID_DEVICE_REQUEST;
624 }
625
626 NTSTATUS vfs_not_implemented_set_compression(struct vfs_handle_struct *handle,
627                                              TALLOC_CTX *mem_ctx,
628                                              struct files_struct *fsp,
629                                              uint16_t compression_fmt)
630 {
631         return NT_STATUS_INVALID_DEVICE_REQUEST;
632 }
633
634 NTSTATUS vfs_not_implemented_fstreaminfo(struct vfs_handle_struct *handle,
635                                         struct files_struct *fsp,
636                                         TALLOC_CTX *mem_ctx,
637                                         unsigned int *num_streams,
638                                         struct stream_struct **streams)
639 {
640         return NT_STATUS_NOT_IMPLEMENTED;
641 }
642
643 int vfs_not_implemented_get_real_filename(struct vfs_handle_struct *handle,
644                                           const struct smb_filename *path,
645                                           const char *name,
646                                           TALLOC_CTX *mem_ctx,
647                                           char **found_name)
648 {
649         errno = ENOSYS;
650         return -1;
651 }
652
653 const char *vfs_not_implemented_connectpath(struct vfs_handle_struct *handle,
654                                             const struct smb_filename *smb_fname)
655 {
656         errno = ENOSYS;
657         return NULL;
658 }
659
660 NTSTATUS vfs_not_implemented_brl_lock_windows(struct vfs_handle_struct *handle,
661                                               struct byte_range_lock *br_lck,
662                                               struct lock_struct *plock)
663 {
664         return NT_STATUS_NOT_IMPLEMENTED;
665 }
666
667 bool vfs_not_implemented_brl_unlock_windows(struct vfs_handle_struct *handle,
668                                             struct byte_range_lock *br_lck,
669                                             const struct lock_struct *plock)
670 {
671         errno = ENOSYS;
672         return false;
673 }
674
675 bool vfs_not_implemented_strict_lock_check(struct vfs_handle_struct *handle,
676                                            struct files_struct *fsp,
677                                            struct lock_struct *plock)
678 {
679         errno = ENOSYS;
680         return false;
681 }
682
683 NTSTATUS vfs_not_implemented_translate_name(struct vfs_handle_struct *handle,
684                                             const char *mapped_name,
685                                             enum vfs_translate_direction direction,
686                                             TALLOC_CTX *mem_ctx, char **pmapped_name)
687 {
688         return NT_STATUS_NOT_IMPLEMENTED;
689 }
690
691 NTSTATUS vfs_not_implemented_parent_pathname(struct vfs_handle_struct *handle,
692                                                     TALLOC_CTX *mem_ctx,
693                                                     const struct smb_filename *smb_fname_in,
694                                                     struct smb_filename **parent_dir_out,
695                                                     struct smb_filename **atname_out)
696 {
697         return NT_STATUS_NOT_IMPLEMENTED;
698 }
699
700 NTSTATUS vfs_not_implemented_fsctl(struct vfs_handle_struct *handle,
701                                    struct files_struct *fsp,
702                                    TALLOC_CTX *ctx,
703                                    uint32_t function,
704                                    uint16_t req_flags,  /* Needed for UNICODE ... */
705                                    const uint8_t *_in_data,
706                                    uint32_t in_len,
707                                    uint8_t **_out_data,
708                                    uint32_t max_out_len, uint32_t *out_len)
709 {
710         return NT_STATUS_NOT_IMPLEMENTED;
711 }
712
713 NTSTATUS vfs_not_implemented_freaddir_attr(struct vfs_handle_struct *handle,
714                                         struct files_struct *fsp,
715                                         TALLOC_CTX *mem_ctx,
716                                         struct readdir_attr_data **pattr_data)
717 {
718         return NT_STATUS_NOT_IMPLEMENTED;
719 }
720
721 struct vfs_not_implemented_get_dos_attributes_state {
722         struct vfs_aio_state aio_state;
723         uint32_t dosmode;
724 };
725
726 struct tevent_req *vfs_not_implemented_get_dos_attributes_send(
727                         TALLOC_CTX *mem_ctx,
728                         struct tevent_context *ev,
729                         struct vfs_handle_struct *handle,
730                         files_struct *dir_fsp,
731                         struct smb_filename *smb_fname)
732 {
733         struct tevent_req *req = NULL;
734         struct vfs_not_implemented_get_dos_attributes_state *state = NULL;
735
736         req = tevent_req_create(mem_ctx, &state,
737                         struct vfs_not_implemented_get_dos_attributes_state);
738         if (req == NULL) {
739                 return NULL;
740         }
741
742         tevent_req_nterror(req, NT_STATUS_NOT_IMPLEMENTED);
743         return tevent_req_post(req, ev);
744 }
745
746 NTSTATUS vfs_not_implemented_get_dos_attributes_recv(
747                         struct tevent_req *req,
748                         struct vfs_aio_state *aio_state,
749                         uint32_t *dosmode)
750 {
751         struct vfs_not_implemented_get_dos_attributes_state *state =
752                 tevent_req_data(req,
753                 struct vfs_not_implemented_get_dos_attributes_state);
754         NTSTATUS status;
755
756         if (tevent_req_is_nterror(req, &status)) {
757                 tevent_req_received(req);
758                 return status;
759         }
760
761         *aio_state = state->aio_state;
762         *dosmode = state->dosmode;
763         tevent_req_received(req);
764         return NT_STATUS_OK;
765 }
766
767 NTSTATUS vfs_not_implemented_fget_dos_attributes(struct vfs_handle_struct *handle,
768                                                  struct files_struct *fsp,
769                                                  uint32_t *dosmode)
770 {
771         return NT_STATUS_NOT_IMPLEMENTED;
772 }
773
774 NTSTATUS vfs_not_implemented_fset_dos_attributes(struct vfs_handle_struct *handle,
775                                                  struct files_struct *fsp,
776                                                  uint32_t dosmode)
777 {
778         return NT_STATUS_NOT_IMPLEMENTED;
779 }
780
781 NTSTATUS vfs_not_implemented_fget_nt_acl(vfs_handle_struct *handle, files_struct *fsp,
782                                          uint32_t security_info,
783                                          TALLOC_CTX *mem_ctx,
784                                          struct security_descriptor **ppdesc)
785 {
786         return NT_STATUS_NOT_IMPLEMENTED;
787 }
788
789 NTSTATUS vfs_not_implemented_fset_nt_acl(vfs_handle_struct *handle, files_struct *fsp,
790                                          uint32_t security_info_sent,
791                                          const struct security_descriptor *psd)
792 {
793         return NT_STATUS_NOT_IMPLEMENTED;
794 }
795
796 SMB_ACL_T vfs_not_implemented_sys_acl_get_fd(vfs_handle_struct *handle,
797                                              files_struct *fsp,
798                                              SMB_ACL_TYPE_T type,
799                                              TALLOC_CTX *mem_ctx)
800 {
801         errno = ENOSYS;
802         return (SMB_ACL_T) NULL;
803 }
804
805 int vfs_not_implemented_sys_acl_blob_get_fd(vfs_handle_struct *handle,
806                                 files_struct *fsp, TALLOC_CTX *mem_ctx,
807                                 char **blob_description, DATA_BLOB *blob)
808 {
809         errno = ENOSYS;
810         return -1;
811 }
812
813 int vfs_not_implemented_sys_acl_set_fd(vfs_handle_struct *handle,
814                                        struct files_struct *fsp,
815                                        SMB_ACL_TYPE_T type,
816                                        SMB_ACL_T theacl)
817 {
818         errno = ENOSYS;
819         return -1;
820 }
821
822 int vfs_not_implemented_sys_acl_delete_def_fd(vfs_handle_struct *handle,
823                                         struct files_struct *fsp)
824 {
825         errno = ENOSYS;
826         return -1;
827 }
828
829 struct vfs_not_implemented_getxattrat_state {
830         struct vfs_aio_state aio_state;
831         ssize_t xattr_size;
832         uint8_t *xattr_value;
833 };
834
835 struct tevent_req *vfs_not_implemented_getxattrat_send(
836                         TALLOC_CTX *mem_ctx,
837                         struct tevent_context *ev,
838                         struct vfs_handle_struct *handle,
839                         files_struct *dir_fsp,
840                         const struct smb_filename *smb_fname,
841                         const char *xattr_name,
842                         size_t alloc_hint)
843 {
844         struct tevent_req *req = NULL;
845         struct vfs_not_implemented_getxattrat_state *state = NULL;
846
847         req = tevent_req_create(mem_ctx, &state,
848                                 struct vfs_not_implemented_getxattrat_state);
849         if (req == NULL) {
850                 return NULL;
851         }
852
853         tevent_req_error(req, ENOSYS);
854         return tevent_req_post(req, ev);
855 }
856
857 ssize_t vfs_not_implemented_getxattrat_recv(struct tevent_req *req,
858                                     struct vfs_aio_state *aio_state,
859                                     TALLOC_CTX *mem_ctx,
860                                     uint8_t **xattr_value)
861 {
862         struct vfs_not_implemented_getxattrat_state *state = tevent_req_data(
863                 req, struct vfs_not_implemented_getxattrat_state);
864         ssize_t xattr_size;
865
866         if (tevent_req_is_unix_error(req, &aio_state->error)) {
867                 tevent_req_received(req);
868                 return -1;
869         }
870
871         *aio_state = state->aio_state;
872         xattr_size = state->xattr_size;
873         if (xattr_value != NULL) {
874                 *xattr_value = talloc_move(mem_ctx, &state->xattr_value);
875         }
876
877         tevent_req_received(req);
878         return xattr_size;
879 }
880
881 ssize_t vfs_not_implemented_fgetxattr(vfs_handle_struct *handle,
882                               struct files_struct *fsp, const char *name,
883                               void *value, size_t size)
884 {
885         errno = ENOSYS;
886         return -1;
887 }
888
889 ssize_t vfs_not_implemented_flistxattr(vfs_handle_struct *handle,
890                                        struct files_struct *fsp, char *list,
891                                        size_t size)
892 {
893         errno = ENOSYS;
894         return -1;
895 }
896
897 int vfs_not_implemented_fremovexattr(vfs_handle_struct *handle,
898                                      struct files_struct *fsp, const char *name)
899 {
900         errno = ENOSYS;
901         return -1;
902 }
903
904 int vfs_not_implemented_fsetxattr(vfs_handle_struct *handle, struct files_struct *fsp,
905                                   const char *name, const void *value, size_t size,
906                                   int flags)
907 {
908         errno = ENOSYS;
909         return -1;
910 }
911
912 bool vfs_not_implemented_aio_force(struct vfs_handle_struct *handle,
913                                    struct files_struct *fsp)
914 {
915         errno = ENOSYS;
916         return false;
917 }
918
919 NTSTATUS vfs_not_implemented_audit_file(struct vfs_handle_struct *handle,
920                                         struct smb_filename *file,
921                                         struct security_acl *sacl,
922                                         uint32_t access_requested,
923                                         uint32_t access_denied)
924 {
925         return NT_STATUS_NOT_IMPLEMENTED;
926 }
927
928 NTSTATUS vfs_not_implemented_durable_cookie(struct vfs_handle_struct *handle,
929                                             struct files_struct *fsp,
930                                             TALLOC_CTX *mem_ctx,
931                                             DATA_BLOB *cookie)
932 {
933         return NT_STATUS_NOT_IMPLEMENTED;
934 }
935
936 NTSTATUS vfs_not_implemented_durable_disconnect(struct vfs_handle_struct *handle,
937                                                 struct files_struct *fsp,
938                                                 const DATA_BLOB old_cookie,
939                                                 TALLOC_CTX *mem_ctx,
940                                                 DATA_BLOB *new_cookie)
941 {
942         return NT_STATUS_NOT_IMPLEMENTED;
943 }
944
945 NTSTATUS vfs_not_implemented_durable_reconnect(struct vfs_handle_struct *handle,
946                                                struct smb_request *smb1req,
947                                                struct smbXsrv_open *op,
948                                                const DATA_BLOB old_cookie,
949                                                TALLOC_CTX *mem_ctx,
950                                                struct files_struct **fsp,
951                                                DATA_BLOB *new_cookie)
952 {
953         return NT_STATUS_NOT_IMPLEMENTED;
954 }
955
956 /* VFS operations structure */
957
958 static struct vfs_fn_pointers vfs_not_implemented_fns = {
959         /* Disk operations */
960
961         .connect_fn = vfs_not_implemented_connect,
962         .disconnect_fn = vfs_not_implemented_disconnect,
963         .disk_free_fn = vfs_not_implemented_disk_free,
964         .get_quota_fn = vfs_not_implemented_get_quota,
965         .set_quota_fn = vfs_not_implemented_set_quota,
966         .get_shadow_copy_data_fn = vfs_not_implemented_get_shadow_copy_data,
967         .statvfs_fn = vfs_not_implemented_statvfs,
968         .fs_capabilities_fn = vfs_not_implemented_fs_capabilities,
969         .get_dfs_referrals_fn = vfs_not_implemented_get_dfs_referrals,
970         .create_dfs_pathat_fn = vfs_not_implemented_create_dfs_pathat,
971         .read_dfs_pathat_fn = vfs_not_implemented_read_dfs_pathat,
972         .snap_check_path_fn = vfs_not_implemented_snap_check_path,
973         .snap_create_fn = vfs_not_implemented_snap_create,
974         .snap_delete_fn = vfs_not_implemented_snap_delete,
975
976         /* Directory operations */
977
978         .fdopendir_fn = vfs_not_implemented_fdopendir,
979         .readdir_fn = vfs_not_implemented_readdir,
980         .seekdir_fn = vfs_not_implemented_seekdir,
981         .telldir_fn = vfs_not_implemented_telldir,
982         .rewind_dir_fn = vfs_not_implemented_rewind_dir,
983         .mkdirat_fn = vfs_not_implemented_mkdirat,
984         .closedir_fn = vfs_not_implemented_closedir,
985
986         /* File operations */
987
988         .openat_fn = vfs_not_implemented_openat,
989         .create_file_fn = vfs_not_implemented_create_file,
990         .close_fn = vfs_not_implemented_close_fn,
991         .pread_fn = vfs_not_implemented_pread,
992         .pread_send_fn = vfs_not_implemented_pread_send,
993         .pread_recv_fn = vfs_not_implemented_pread_recv,
994         .pwrite_fn = vfs_not_implemented_pwrite,
995         .pwrite_send_fn = vfs_not_implemented_pwrite_send,
996         .pwrite_recv_fn = vfs_not_implemented_pwrite_recv,
997         .lseek_fn = vfs_not_implemented_lseek,
998         .sendfile_fn = vfs_not_implemented_sendfile,
999         .recvfile_fn = vfs_not_implemented_recvfile,
1000         .renameat_fn = vfs_not_implemented_renameat,
1001         .fsync_send_fn = vfs_not_implemented_fsync_send,
1002         .fsync_recv_fn = vfs_not_implemented_fsync_recv,
1003         .stat_fn = vfs_not_implemented_stat,
1004         .fstat_fn = vfs_not_implemented_fstat,
1005         .lstat_fn = vfs_not_implemented_lstat,
1006         .get_alloc_size_fn = vfs_not_implemented_get_alloc_size,
1007         .unlinkat_fn = vfs_not_implemented_unlinkat,
1008         .fchmod_fn = vfs_not_implemented_fchmod,
1009         .fchown_fn = vfs_not_implemented_fchown,
1010         .lchown_fn = vfs_not_implemented_lchown,
1011         .chdir_fn = vfs_not_implemented_chdir,
1012         .getwd_fn = vfs_not_implemented_getwd,
1013         .fntimes_fn = vfs_not_implemented_fntimes,
1014         .ftruncate_fn = vfs_not_implemented_ftruncate,
1015         .fallocate_fn = vfs_not_implemented_fallocate,
1016         .lock_fn = vfs_not_implemented_lock,
1017         .filesystem_sharemode_fn = vfs_not_implemented_filesystem_sharemode,
1018         .fcntl_fn = vfs_not_implemented_fcntl,
1019         .linux_setlease_fn = vfs_not_implemented_linux_setlease,
1020         .getlock_fn = vfs_not_implemented_getlock,
1021         .symlinkat_fn = vfs_not_implemented_symlinkat,
1022         .readlinkat_fn = vfs_not_implemented_vfs_readlinkat,
1023         .linkat_fn = vfs_not_implemented_linkat,
1024         .mknodat_fn = vfs_not_implemented_mknodat,
1025         .realpath_fn = vfs_not_implemented_realpath,
1026         .fchflags_fn = vfs_not_implemented_fchflags,
1027         .file_id_create_fn = vfs_not_implemented_file_id_create,
1028         .fs_file_id_fn = vfs_not_implemented_fs_file_id,
1029         .offload_read_send_fn = vfs_not_implemented_offload_read_send,
1030         .offload_read_recv_fn = vfs_not_implemented_offload_read_recv,
1031         .offload_write_send_fn = vfs_not_implemented_offload_write_send,
1032         .offload_write_recv_fn = vfs_not_implemented_offload_write_recv,
1033         .fget_compression_fn = vfs_not_implemented_fget_compression,
1034         .set_compression_fn = vfs_not_implemented_set_compression,
1035
1036         .fstreaminfo_fn = vfs_not_implemented_fstreaminfo,
1037         .get_real_filename_fn = vfs_not_implemented_get_real_filename,
1038         .connectpath_fn = vfs_not_implemented_connectpath,
1039         .brl_lock_windows_fn = vfs_not_implemented_brl_lock_windows,
1040         .brl_unlock_windows_fn = vfs_not_implemented_brl_unlock_windows,
1041         .strict_lock_check_fn = vfs_not_implemented_strict_lock_check,
1042         .translate_name_fn = vfs_not_implemented_translate_name,
1043         .parent_pathname_fn = vfs_not_implemented_parent_pathname,
1044         .fsctl_fn = vfs_not_implemented_fsctl,
1045         .freaddir_attr_fn = vfs_not_implemented_freaddir_attr,
1046         .audit_file_fn = vfs_not_implemented_audit_file,
1047
1048         /* DOS attributes. */
1049         .get_dos_attributes_send_fn = vfs_not_implemented_get_dos_attributes_send,
1050         .get_dos_attributes_recv_fn = vfs_not_implemented_get_dos_attributes_recv,
1051         .fget_dos_attributes_fn = vfs_not_implemented_fget_dos_attributes,
1052         .fset_dos_attributes_fn = vfs_not_implemented_fset_dos_attributes,
1053
1054         /* NT ACL operations. */
1055
1056         .fget_nt_acl_fn = vfs_not_implemented_fget_nt_acl,
1057         .fset_nt_acl_fn = vfs_not_implemented_fset_nt_acl,
1058
1059         /* POSIX ACL operations. */
1060
1061         .sys_acl_get_fd_fn = vfs_not_implemented_sys_acl_get_fd,
1062         .sys_acl_blob_get_fd_fn = vfs_not_implemented_sys_acl_blob_get_fd,
1063         .sys_acl_set_fd_fn = vfs_not_implemented_sys_acl_set_fd,
1064         .sys_acl_delete_def_fd_fn = vfs_not_implemented_sys_acl_delete_def_fd,
1065
1066         /* EA operations. */
1067         .getxattrat_send_fn = vfs_not_implemented_getxattrat_send,
1068         .getxattrat_recv_fn = vfs_not_implemented_getxattrat_recv,
1069         .fgetxattr_fn = vfs_not_implemented_fgetxattr,
1070         .flistxattr_fn = vfs_not_implemented_flistxattr,
1071         .fremovexattr_fn = vfs_not_implemented_fremovexattr,
1072         .fsetxattr_fn = vfs_not_implemented_fsetxattr,
1073
1074         /* aio operations */
1075         .aio_force_fn = vfs_not_implemented_aio_force,
1076
1077         /* durable handle operations */
1078         .durable_cookie_fn = vfs_not_implemented_durable_cookie,
1079         .durable_disconnect_fn = vfs_not_implemented_durable_disconnect,
1080         .durable_reconnect_fn = vfs_not_implemented_durable_reconnect,
1081 };
1082
1083 static_decl_vfs;
1084 NTSTATUS vfs_not_implemented_init(TALLOC_CTX *ctx)
1085 {
1086         /*
1087          * smb_vfs_assert_all_fns() makes sure every
1088          * call is implemented.
1089          */
1090         smb_vfs_assert_all_fns(&vfs_not_implemented_fns, "vfs_not_implemented");
1091         return smb_register_vfs(SMB_VFS_INTERFACE_VERSION, "vfs_not_implemented",
1092                                 &vfs_not_implemented_fns);
1093 }