vfs: Remove "blocking_lock" from SMB_VFS_BRL_LOCK_WINDOWS
[amitay/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 DIR *vfs_not_implemented_opendir(vfs_handle_struct *handle,
101                         const struct smb_filename *smb_fname,
102                         const char *mask,
103                         uint32_t attr)
104 {
105         return NULL;
106 }
107
108 NTSTATUS vfs_not_implemented_snap_check_path(struct vfs_handle_struct *handle,
109                                 TALLOC_CTX *mem_ctx,
110                                 const char *service_path,
111                                 char **base_volume)
112 {
113         return NT_STATUS_NOT_SUPPORTED;
114 }
115
116 NTSTATUS vfs_not_implemented_snap_create(struct vfs_handle_struct *handle,
117                                          TALLOC_CTX *mem_ctx,
118                                          const char *base_volume,
119                                          time_t *tstamp,
120                                          bool rw,
121                                          char **base_path,
122                                          char **snap_path)
123 {
124         return NT_STATUS_NOT_SUPPORTED;
125 }
126
127 NTSTATUS vfs_not_implemented_snap_delete(struct vfs_handle_struct *handle,
128                                          TALLOC_CTX *mem_ctx,
129                                          char *base_path,
130                                          char *snap_path)
131 {
132         return NT_STATUS_NOT_SUPPORTED;
133 }
134
135 DIR *vfs_not_implemented_fdopendir(vfs_handle_struct *handle, files_struct *fsp,
136                                    const char *mask, uint32_t attr)
137 {
138         errno = ENOSYS;
139         return NULL;
140 }
141
142 struct dirent *vfs_not_implemented_readdir(vfs_handle_struct *handle,
143                                            DIR *dirp, SMB_STRUCT_STAT *sbuf)
144 {
145         errno = ENOSYS;
146         return NULL;
147 }
148
149 void vfs_not_implemented_seekdir(vfs_handle_struct *handle, DIR *dirp, long offset)
150 {
151         ;
152 }
153
154 long vfs_not_implemented_telldir(vfs_handle_struct *handle, DIR *dirp)
155 {
156         errno = ENOSYS;
157         return (long)-1;
158 }
159
160 void vfs_not_implemented_rewind_dir(vfs_handle_struct *handle, DIR *dirp)
161 {
162         ;
163 }
164
165 int vfs_not_implemented_mkdir(vfs_handle_struct *handle,
166                 const struct smb_filename *smb_fname,
167                 mode_t mode)
168 {
169         errno = ENOSYS;
170         return -1;
171 }
172
173 int vfs_not_implemented_rmdir(vfs_handle_struct *handle,
174                 const struct smb_filename *smb_fname)
175 {
176         errno = ENOSYS;
177         return -1;
178 }
179
180 int vfs_not_implemented_closedir(vfs_handle_struct *handle, DIR *dir)
181 {
182         errno = ENOSYS;
183         return -1;
184 }
185
186 int vfs_not_implemented_open(vfs_handle_struct *handle,
187                              struct smb_filename *smb_fname,
188                              files_struct *fsp, int flags, mode_t mode)
189 {
190         errno = ENOSYS;
191         return -1;
192 }
193
194 NTSTATUS vfs_not_implemented_create_file(struct vfs_handle_struct *handle,
195                                 struct smb_request *req,
196                                 uint16_t root_dir_fid,
197                                 struct smb_filename *smb_fname,
198                                 uint32_t access_mask,
199                                 uint32_t share_access,
200                                 uint32_t create_disposition,
201                                 uint32_t create_options,
202                                 uint32_t file_attributes,
203                                 uint32_t oplock_request,
204                                 struct smb2_lease *lease,
205                                 uint64_t allocation_size,
206                                 uint32_t private_flags,
207                                 struct security_descriptor *sd,
208                                 struct ea_list *ea_list,
209                                 files_struct **result, int *pinfo,
210                                 const struct smb2_create_blobs *in_context_blobs,
211                                 struct smb2_create_blobs *out_context_blobs)
212 {
213         return NT_STATUS_NOT_IMPLEMENTED;
214 }
215
216 int vfs_not_implemented_close_fn(vfs_handle_struct *handle, files_struct *fsp)
217 {
218         errno = ENOSYS;
219         return -1;
220 }
221
222 ssize_t vfs_not_implemented_pread(vfs_handle_struct *handle, files_struct *fsp,
223                                   void *data, size_t n, off_t offset)
224 {
225         errno = ENOSYS;
226         return -1;
227 }
228
229 struct tevent_req *vfs_not_implemented_pread_send(struct vfs_handle_struct *handle,
230                                                   TALLOC_CTX *mem_ctx,
231                                                   struct tevent_context *ev,
232                                                   struct files_struct *fsp,
233                                                   void *data, size_t n, off_t offset)
234 {
235         return NULL;
236 }
237
238 ssize_t vfs_not_implemented_pread_recv(struct tevent_req *req,
239                                        struct vfs_aio_state *vfs_aio_state)
240 {
241         vfs_aio_state->error = ENOSYS;
242         return -1;
243 }
244
245 ssize_t vfs_not_implemented_pwrite(vfs_handle_struct *handle, files_struct *fsp,
246                                    const void *data, size_t n, off_t offset)
247 {
248         errno = ENOSYS;
249         return -1;
250 }
251
252 struct tevent_req *vfs_not_implemented_pwrite_send(struct vfs_handle_struct *handle,
253                                                    TALLOC_CTX *mem_ctx,
254                                                    struct tevent_context *ev,
255                                                    struct files_struct *fsp,
256                                                    const void *data,
257                                                    size_t n, off_t offset)
258 {
259         return NULL;
260 }
261
262 ssize_t vfs_not_implemented_pwrite_recv(struct tevent_req *req,
263                                 struct vfs_aio_state *vfs_aio_state)
264 {
265         vfs_aio_state->error = ENOSYS;
266         return -1;
267 }
268
269 off_t vfs_not_implemented_lseek(vfs_handle_struct *handle, files_struct *fsp,
270                         off_t offset, int whence)
271 {
272         errno = ENOSYS;
273         return (off_t) - 1;
274 }
275
276 ssize_t vfs_not_implemented_sendfile(vfs_handle_struct *handle, int tofd,
277                                      files_struct *fromfsp, const DATA_BLOB *hdr,
278                                      off_t offset, size_t n)
279 {
280         errno = ENOSYS;
281         return -1;
282 }
283
284 ssize_t vfs_not_implemented_recvfile(vfs_handle_struct *handle, int fromfd,
285                                      files_struct *tofsp, off_t offset, size_t n)
286 {
287         errno = ENOSYS;
288         return -1;
289 }
290
291 int vfs_not_implemented_rename(vfs_handle_struct *handle,
292                                const struct smb_filename *smb_fname_src,
293                                const struct smb_filename *smb_fname_dst)
294 {
295         errno = ENOSYS;
296         return -1;
297 }
298
299 struct tevent_req *vfs_not_implemented_fsync_send(struct vfs_handle_struct *handle,
300                                                   TALLOC_CTX *mem_ctx,
301                                                   struct tevent_context *ev,
302                                                   struct files_struct *fsp)
303 {
304         return NULL;
305 }
306
307 int vfs_not_implemented_fsync_recv(struct tevent_req *req,
308                                    struct vfs_aio_state *vfs_aio_state)
309 {
310         vfs_aio_state->error = ENOSYS;
311         return -1;
312 }
313
314 int vfs_not_implemented_stat(vfs_handle_struct *handle, struct smb_filename *smb_fname)
315 {
316         errno = ENOSYS;
317         return -1;
318 }
319
320 int vfs_not_implemented_fstat(vfs_handle_struct *handle, files_struct *fsp,
321                         SMB_STRUCT_STAT *sbuf)
322 {
323         errno = ENOSYS;
324         return -1;
325 }
326
327 int vfs_not_implemented_lstat(vfs_handle_struct *handle,
328                               struct smb_filename *smb_fname)
329 {
330         errno = ENOSYS;
331         return -1;
332 }
333
334 uint64_t vfs_not_implemented_get_alloc_size(struct vfs_handle_struct *handle,
335                                             struct files_struct *fsp,
336                                             const SMB_STRUCT_STAT *sbuf)
337 {
338         errno = ENOSYS;
339         return -1;
340 }
341
342 int vfs_not_implemented_unlink(vfs_handle_struct *handle,
343                                const struct smb_filename *smb_fname)
344 {
345         errno = ENOSYS;
346         return -1;
347 }
348
349 int vfs_not_implemented_chmod(vfs_handle_struct *handle,
350                               const struct smb_filename *smb_fname,
351                               mode_t mode)
352 {
353         errno = ENOSYS;
354         return -1;
355 }
356
357 int vfs_not_implemented_fchmod(vfs_handle_struct *handle, files_struct *fsp,
358                                mode_t mode)
359 {
360         errno = ENOSYS;
361         return -1;
362 }
363
364 int vfs_not_implemented_chown(vfs_handle_struct *handle,
365                               const struct smb_filename *smb_fname,
366                               uid_t uid,
367                               gid_t gid)
368 {
369         errno = ENOSYS;
370         return -1;
371 }
372
373 int vfs_not_implemented_fchown(vfs_handle_struct *handle, files_struct *fsp,
374                                uid_t uid, gid_t gid)
375 {
376         errno = ENOSYS;
377         return -1;
378 }
379
380 int vfs_not_implemented_lchown(vfs_handle_struct *handle,
381                                const struct smb_filename *smb_fname,
382                                uid_t uid,
383                                gid_t gid)
384 {
385         errno = ENOSYS;
386         return -1;
387 }
388
389 int vfs_not_implemented_chdir(vfs_handle_struct *handle,
390                               const struct smb_filename *smb_fname)
391 {
392         errno = ENOSYS;
393         return -1;
394 }
395
396 struct smb_filename *vfs_not_implemented_getwd(vfs_handle_struct *handle,
397                                                TALLOC_CTX *ctx)
398 {
399         errno = ENOSYS;
400         return NULL;
401 }
402
403 int vfs_not_implemented_ntimes(vfs_handle_struct *handle,
404                                const struct smb_filename *smb_fname,
405                                struct smb_file_time *ft)
406 {
407         errno = ENOSYS;
408         return -1;
409 }
410
411 int vfs_not_implemented_ftruncate(vfs_handle_struct *handle, files_struct *fsp,
412                                   off_t offset)
413 {
414         errno = ENOSYS;
415         return -1;
416 }
417
418 int vfs_not_implemented_fallocate(vfs_handle_struct *handle, files_struct *fsp,
419                                   uint32_t mode, off_t offset, off_t len)
420 {
421         errno = ENOSYS;
422         return -1;
423 }
424
425 bool vfs_not_implemented_lock(vfs_handle_struct *handle, files_struct *fsp, int op,
426                               off_t offset, off_t count, int type)
427 {
428         errno = ENOSYS;
429         return false;
430 }
431
432 int vfs_not_implemented_kernel_flock(struct vfs_handle_struct *handle,
433                                      struct files_struct *fsp,
434                                      uint32_t share_mode, uint32_t access_mask)
435 {
436         errno = ENOSYS;
437         return -1;
438 }
439
440 int vfs_not_implemented_linux_setlease(struct vfs_handle_struct *handle,
441                                        struct files_struct *fsp, int leasetype)
442 {
443         errno = ENOSYS;
444         return -1;
445 }
446
447 bool vfs_not_implemented_getlock(vfs_handle_struct *handle, files_struct *fsp,
448                                  off_t *poffset, off_t *pcount, int *ptype,
449                                  pid_t *ppid)
450 {
451         errno = ENOSYS;
452         return false;
453 }
454
455 int vfs_not_implemented_symlink(vfs_handle_struct *handle,
456                                 const char *link_contents,
457                                 const struct smb_filename *new_smb_fname)
458 {
459         errno = ENOSYS;
460         return -1;
461 }
462
463 int vfs_not_implemented_vfs_readlink(vfs_handle_struct *handle,
464                                      const struct smb_filename *smb_fname,
465                                      char *buf,
466                                      size_t bufsiz)
467 {
468         errno = ENOSYS;
469         return -1;
470 }
471
472 int vfs_not_implemented_link(vfs_handle_struct *handle,
473                              const struct smb_filename *old_smb_fname,
474                              const struct smb_filename *new_smb_fname)
475 {
476         errno = ENOSYS;
477         return -1;
478 }
479
480 int vfs_not_implemented_mknod(vfs_handle_struct *handle,
481                               const struct smb_filename *smb_fname,
482                               mode_t mode,
483                               SMB_DEV_T dev)
484 {
485         errno = ENOSYS;
486         return -1;
487 }
488
489 struct smb_filename *vfs_not_implemented_realpath(vfs_handle_struct *handle,
490                                                   TALLOC_CTX *ctx,
491                                                   const struct smb_filename *smb_fname)
492 {
493         errno = ENOSYS;
494         return NULL;
495 }
496
497 int vfs_not_implemented_chflags(vfs_handle_struct *handle,
498                                 const struct smb_filename *smb_fname,
499                                 uint flags)
500 {
501         errno = ENOSYS;
502         return -1;
503 }
504
505 struct file_id vfs_not_implemented_file_id_create(vfs_handle_struct *handle,
506                                                   const SMB_STRUCT_STAT *sbuf)
507 {
508         struct file_id id;
509         ZERO_STRUCT(id);
510         errno = ENOSYS;
511         return id;
512 }
513
514 uint64_t vfs_not_implemented_fs_file_id(vfs_handle_struct *handle,
515                                         const SMB_STRUCT_STAT *sbuf)
516 {
517         errno = ENOSYS;
518         return 0;
519 }
520
521 struct vfs_not_implemented_offload_read_state {
522         bool dummy;
523 };
524
525 struct tevent_req *vfs_not_implemented_offload_read_send(
526                         TALLOC_CTX *mem_ctx,
527                         struct tevent_context *ev,
528                         struct vfs_handle_struct *handle,
529                         struct files_struct *fsp,
530                         uint32_t fsctl,
531                         uint32_t ttl,
532                         off_t offset,
533                         size_t to_copy)
534 {
535         struct tevent_req *req = NULL;
536         struct vfs_not_implemented_offload_read_state *state = NULL;
537
538         req = tevent_req_create(mem_ctx, &state,
539                                 struct vfs_not_implemented_offload_read_state);
540         if (req == NULL) {
541                 return NULL;
542         }
543
544         tevent_req_nterror(req, NT_STATUS_NOT_IMPLEMENTED);
545         return tevent_req_post(req, ev);
546 }
547
548 NTSTATUS vfs_not_implemented_offload_read_recv(struct tevent_req *req,
549                                        struct vfs_handle_struct *handle,
550                                        TALLOC_CTX *mem_ctx,
551                                        DATA_BLOB *_token_blob)
552 {
553         NTSTATUS status;
554
555         if (tevent_req_is_nterror(req, &status)) {
556                 tevent_req_received(req);
557                 return status;
558         }
559
560         tevent_req_received(req);
561         return NT_STATUS_OK;
562 }
563
564 struct vfs_not_implemented_offload_write_state {
565         uint64_t unused;
566 };
567
568 struct tevent_req *vfs_not_implemented_offload_write_send(
569                         struct vfs_handle_struct *handle,
570                         TALLOC_CTX *mem_ctx,
571                         struct tevent_context *ev,
572                         uint32_t fsctl,
573                         DATA_BLOB *token,
574                         off_t transfer_offset,
575                         struct files_struct *dest_fsp,
576                         off_t dest_off,
577                         off_t num)
578 {
579         struct tevent_req *req;
580         struct vfs_not_implemented_offload_write_state *state;
581
582         req = tevent_req_create(mem_ctx, &state,
583                                 struct vfs_not_implemented_offload_write_state);
584         if (req == NULL) {
585                 return NULL;
586         }
587
588         tevent_req_nterror(req, NT_STATUS_NOT_IMPLEMENTED);
589         return tevent_req_post(req, ev);
590 }
591
592 NTSTATUS vfs_not_implemented_offload_write_recv(struct vfs_handle_struct *handle,
593                                                 struct tevent_req *req,
594                                                 off_t *copied)
595 {
596         NTSTATUS status;
597
598         if (tevent_req_is_nterror(req, &status)) {
599                 tevent_req_received(req);
600                 return status;
601         }
602
603         tevent_req_received(req);
604         return NT_STATUS_OK;
605 }
606
607 NTSTATUS vfs_not_implemented_get_compression(struct vfs_handle_struct *handle,
608                                              TALLOC_CTX *mem_ctx,
609                                              struct files_struct *fsp,
610                                              struct smb_filename *smb_fname,
611                                              uint16_t *_compression_fmt)
612 {
613         return NT_STATUS_INVALID_DEVICE_REQUEST;
614 }
615
616 NTSTATUS vfs_not_implemented_set_compression(struct vfs_handle_struct *handle,
617                                              TALLOC_CTX *mem_ctx,
618                                              struct files_struct *fsp,
619                                              uint16_t compression_fmt)
620 {
621         return NT_STATUS_INVALID_DEVICE_REQUEST;
622 }
623
624 NTSTATUS vfs_not_implemented_streaminfo(struct vfs_handle_struct *handle,
625                                         struct files_struct *fsp,
626                                         const struct smb_filename *smb_fname,
627                                         TALLOC_CTX *mem_ctx,
628                                         unsigned int *num_streams,
629                                         struct stream_struct **streams)
630 {
631         return NT_STATUS_NOT_IMPLEMENTED;
632 }
633
634 int vfs_not_implemented_get_real_filename(struct vfs_handle_struct *handle,
635                                           const char *path,
636                                           const char *name,
637                                           TALLOC_CTX *mem_ctx,
638                                           char **found_name)
639 {
640         errno = ENOSYS;
641         return -1;
642 }
643
644 const char *vfs_not_implemented_connectpath(struct vfs_handle_struct *handle,
645                                             const struct smb_filename *smb_fname)
646 {
647         errno = ENOSYS;
648         return NULL;
649 }
650
651 NTSTATUS vfs_not_implemented_brl_lock_windows(struct vfs_handle_struct *handle,
652                                               struct byte_range_lock *br_lck,
653                                               struct lock_struct *plock)
654 {
655         return NT_STATUS_NOT_IMPLEMENTED;
656 }
657
658 bool vfs_not_implemented_brl_unlock_windows(struct vfs_handle_struct *handle,
659                                             struct messaging_context *msg_ctx,
660                                             struct byte_range_lock *br_lck,
661                                             const struct lock_struct *plock)
662 {
663         errno = ENOSYS;
664         return false;
665 }
666
667 bool vfs_not_implemented_strict_lock_check(struct vfs_handle_struct *handle,
668                                            struct files_struct *fsp,
669                                            struct lock_struct *plock)
670 {
671         errno = ENOSYS;
672         return false;
673 }
674
675 NTSTATUS vfs_not_implemented_translate_name(struct vfs_handle_struct *handle,
676                                             const char *mapped_name,
677                                             enum vfs_translate_direction direction,
678                                             TALLOC_CTX *mem_ctx, char **pmapped_name)
679 {
680         return NT_STATUS_NOT_IMPLEMENTED;
681 }
682
683 NTSTATUS vfs_not_implemented_fsctl(struct vfs_handle_struct *handle,
684                                    struct files_struct *fsp,
685                                    TALLOC_CTX *ctx,
686                                    uint32_t function,
687                                    uint16_t req_flags,  /* Needed for UNICODE ... */
688                                    const uint8_t *_in_data,
689                                    uint32_t in_len,
690                                    uint8_t **_out_data,
691                                    uint32_t max_out_len, uint32_t *out_len)
692 {
693         return NT_STATUS_NOT_IMPLEMENTED;
694 }
695
696 NTSTATUS vfs_not_implemented_readdir_attr(struct vfs_handle_struct *handle,
697                                           const struct smb_filename *fname,
698                                           TALLOC_CTX *mem_ctx,
699                                           struct readdir_attr_data **pattr_data)
700 {
701         return NT_STATUS_NOT_IMPLEMENTED;
702 }
703
704 NTSTATUS vfs_not_implemented_get_dos_attributes(struct vfs_handle_struct *handle,
705                                                 struct smb_filename *smb_fname,
706                                                 uint32_t *dosmode)
707 {
708         return NT_STATUS_NOT_IMPLEMENTED;
709 }
710
711 struct vfs_not_implemented_get_dos_attributes_state {
712         struct vfs_aio_state aio_state;
713         uint32_t dosmode;
714 };
715
716 struct tevent_req *vfs_not_implemented_get_dos_attributes_send(
717                         TALLOC_CTX *mem_ctx,
718                         struct tevent_context *ev,
719                         struct vfs_handle_struct *handle,
720                         files_struct *dir_fsp,
721                         struct smb_filename *smb_fname)
722 {
723         struct tevent_req *req = NULL;
724         struct vfs_not_implemented_get_dos_attributes_state *state = NULL;
725
726         req = tevent_req_create(mem_ctx, &state,
727                         struct vfs_not_implemented_get_dos_attributes_state);
728         if (req == NULL) {
729                 return NULL;
730         }
731
732         tevent_req_nterror(req, NT_STATUS_NOT_IMPLEMENTED);
733         return tevent_req_post(req, ev);
734 }
735
736 NTSTATUS vfs_not_implemented_get_dos_attributes_recv(
737                         struct tevent_req *req,
738                         struct vfs_aio_state *aio_state,
739                         uint32_t *dosmode)
740 {
741         struct vfs_not_implemented_get_dos_attributes_state *state =
742                 tevent_req_data(req,
743                 struct vfs_not_implemented_get_dos_attributes_state);
744         NTSTATUS status;
745
746         if (tevent_req_is_nterror(req, &status)) {
747                 tevent_req_received(req);
748                 return status;
749         }
750
751         *aio_state = state->aio_state;
752         *dosmode = state->dosmode;
753         tevent_req_received(req);
754         return NT_STATUS_OK;
755 }
756
757 NTSTATUS vfs_not_implemented_fget_dos_attributes(struct vfs_handle_struct *handle,
758                                                  struct files_struct *fsp,
759                                                  uint32_t *dosmode)
760 {
761         return NT_STATUS_NOT_IMPLEMENTED;
762 }
763
764 NTSTATUS vfs_not_implemented_set_dos_attributes(struct vfs_handle_struct *handle,
765                                                 const struct smb_filename *smb_fname,
766                                                 uint32_t dosmode)
767 {
768         return NT_STATUS_NOT_IMPLEMENTED;
769 }
770
771 NTSTATUS vfs_not_implemented_fset_dos_attributes(struct vfs_handle_struct *handle,
772                                                  struct files_struct *fsp,
773                                                  uint32_t dosmode)
774 {
775         return NT_STATUS_NOT_IMPLEMENTED;
776 }
777
778 NTSTATUS vfs_not_implemented_fget_nt_acl(vfs_handle_struct *handle, files_struct *fsp,
779                                          uint32_t security_info,
780                                          TALLOC_CTX *mem_ctx,
781                                          struct security_descriptor **ppdesc)
782 {
783         return NT_STATUS_NOT_IMPLEMENTED;
784 }
785
786 NTSTATUS vfs_not_implemented_get_nt_acl(vfs_handle_struct *handle,
787                                         const struct smb_filename *smb_fname,
788                                         uint32_t security_info,
789                                         TALLOC_CTX *mem_ctx,
790                                         struct security_descriptor **ppdesc)
791 {
792         return NT_STATUS_NOT_IMPLEMENTED;
793 }
794
795 NTSTATUS vfs_not_implemented_fset_nt_acl(vfs_handle_struct *handle, files_struct *fsp,
796                                          uint32_t security_info_sent,
797                                          const struct security_descriptor *psd)
798 {
799         return NT_STATUS_NOT_IMPLEMENTED;
800 }
801
802 SMB_ACL_T vfs_not_implemented_sys_acl_get_file(vfs_handle_struct *handle,
803                                                const struct smb_filename *smb_fname,
804                                                SMB_ACL_TYPE_T type,
805                                                TALLOC_CTX *mem_ctx)
806 {
807         errno = ENOSYS;
808         return (SMB_ACL_T) NULL;
809 }
810
811 SMB_ACL_T vfs_not_implemented_sys_acl_get_fd(vfs_handle_struct *handle,
812                                              files_struct *fsp, TALLOC_CTX *mem_ctx)
813 {
814         errno = ENOSYS;
815         return (SMB_ACL_T) NULL;
816 }
817
818 int vfs_not_implemented_sys_acl_blob_get_file(vfs_handle_struct *handle,
819                                 const struct smb_filename *smb_fname,
820                                 TALLOC_CTX *mem_ctx,
821                                 char **blob_description,
822                                 DATA_BLOB *blob)
823 {
824         errno = ENOSYS;
825         return -1;
826 }
827
828 int vfs_not_implemented_sys_acl_blob_get_fd(vfs_handle_struct *handle,
829                                 files_struct *fsp, TALLOC_CTX *mem_ctx,
830                                 char **blob_description, DATA_BLOB *blob)
831 {
832         errno = ENOSYS;
833         return -1;
834 }
835
836 int vfs_not_implemented_sys_acl_set_file(vfs_handle_struct *handle,
837                                 const struct smb_filename *smb_fname,
838                                 SMB_ACL_TYPE_T acltype,
839                                 SMB_ACL_T theacl)
840 {
841         errno = ENOSYS;
842         return -1;
843 }
844
845 int vfs_not_implemented_sys_acl_set_fd(vfs_handle_struct *handle, files_struct *fsp,
846                                        SMB_ACL_T theacl)
847 {
848         errno = ENOSYS;
849         return -1;
850 }
851
852 int vfs_not_implemented_sys_acl_delete_def_file(vfs_handle_struct *handle,
853                                         const struct smb_filename *smb_fname)
854 {
855         errno = ENOSYS;
856         return -1;
857 }
858
859 ssize_t vfs_not_implemented_getxattr(vfs_handle_struct *handle,
860                                 const struct smb_filename *smb_fname,
861                                 const char *name,
862                                 void *value,
863                                 size_t size)
864 {
865         errno = ENOSYS;
866         return -1;
867 }
868
869 struct vfs_not_implemented_getxattrat_state {
870         struct vfs_aio_state aio_state;
871         ssize_t xattr_size;
872         uint8_t *xattr_value;
873 };
874
875 struct tevent_req *vfs_not_implemented_getxattrat_send(
876                         TALLOC_CTX *mem_ctx,
877                         struct tevent_context *ev,
878                         struct vfs_handle_struct *handle,
879                         files_struct *dir_fsp,
880                         const struct smb_filename *smb_fname,
881                         const char *xattr_name,
882                         size_t alloc_hint)
883 {
884         struct tevent_req *req = NULL;
885         struct vfs_not_implemented_getxattrat_state *state = NULL;
886
887         req = tevent_req_create(mem_ctx, &state,
888                                 struct vfs_not_implemented_getxattrat_state);
889         if (req == NULL) {
890                 return NULL;
891         }
892
893         tevent_req_error(req, ENOSYS);
894         return tevent_req_post(req, ev);
895 }
896
897 ssize_t vfs_not_implemented_getxattrat_recv(struct tevent_req *req,
898                                     struct vfs_aio_state *aio_state,
899                                     TALLOC_CTX *mem_ctx,
900                                     uint8_t **xattr_value)
901 {
902         struct vfs_not_implemented_getxattrat_state *state = tevent_req_data(
903                 req, struct vfs_not_implemented_getxattrat_state);
904         ssize_t xattr_size;
905
906         if (tevent_req_is_unix_error(req, &aio_state->error)) {
907                 tevent_req_received(req);
908                 return -1;
909         }
910
911         *aio_state = state->aio_state;
912         xattr_size = state->xattr_size;
913         if (xattr_value != NULL) {
914                 *xattr_value = talloc_move(mem_ctx, &state->xattr_value);
915         }
916
917         tevent_req_received(req);
918         return xattr_size;
919 }
920
921 ssize_t vfs_not_implemented_fgetxattr(vfs_handle_struct *handle,
922                               struct files_struct *fsp, const char *name,
923                               void *value, size_t size)
924 {
925         errno = ENOSYS;
926         return -1;
927 }
928
929 ssize_t vfs_not_implemented_listxattr(vfs_handle_struct *handle,
930                                       const struct smb_filename *smb_fname,
931                                       char *list,
932                                       size_t size)
933 {
934         errno = ENOSYS;
935         return -1;
936 }
937
938 ssize_t vfs_not_implemented_flistxattr(vfs_handle_struct *handle,
939                                        struct files_struct *fsp, char *list,
940                                        size_t size)
941 {
942         errno = ENOSYS;
943         return -1;
944 }
945
946 int vfs_not_implemented_removexattr(vfs_handle_struct *handle,
947                                     const struct smb_filename *smb_fname,
948                                     const char *name)
949 {
950         errno = ENOSYS;
951         return -1;
952 }
953
954 int vfs_not_implemented_fremovexattr(vfs_handle_struct *handle,
955                                      struct files_struct *fsp, const char *name)
956 {
957         errno = ENOSYS;
958         return -1;
959 }
960
961 int vfs_not_implemented_setxattr(vfs_handle_struct *handle,
962                                  const struct smb_filename *smb_fname,
963                                  const char *name,
964                                  const void *value,
965                                  size_t size,
966                                  int flags)
967 {
968         errno = ENOSYS;
969         return -1;
970 }
971
972 int vfs_not_implemented_fsetxattr(vfs_handle_struct *handle, struct files_struct *fsp,
973                                   const char *name, const void *value, size_t size,
974                                   int flags)
975 {
976         errno = ENOSYS;
977         return -1;
978 }
979
980 bool vfs_not_implemented_aio_force(struct vfs_handle_struct *handle,
981                                    struct files_struct *fsp)
982 {
983         errno = ENOSYS;
984         return false;
985 }
986
987 NTSTATUS vfs_not_implemented_audit_file(struct vfs_handle_struct *handle,
988                                         struct smb_filename *file,
989                                         struct security_acl *sacl,
990                                         uint32_t access_requested,
991                                         uint32_t access_denied)
992 {
993         return NT_STATUS_NOT_IMPLEMENTED;
994 }
995
996 NTSTATUS vfs_not_implemented_durable_cookie(struct vfs_handle_struct *handle,
997                                             struct files_struct *fsp,
998                                             TALLOC_CTX *mem_ctx,
999                                             DATA_BLOB *cookie)
1000 {
1001         return NT_STATUS_NOT_IMPLEMENTED;
1002 }
1003
1004 NTSTATUS vfs_not_implemented_durable_disconnect(struct vfs_handle_struct *handle,
1005                                                 struct files_struct *fsp,
1006                                                 const DATA_BLOB old_cookie,
1007                                                 TALLOC_CTX *mem_ctx,
1008                                                 DATA_BLOB *new_cookie)
1009 {
1010         return NT_STATUS_NOT_IMPLEMENTED;
1011 }
1012
1013 NTSTATUS vfs_not_implemented_durable_reconnect(struct vfs_handle_struct *handle,
1014                                                struct smb_request *smb1req,
1015                                                struct smbXsrv_open *op,
1016                                                const DATA_BLOB old_cookie,
1017                                                TALLOC_CTX *mem_ctx,
1018                                                struct files_struct **fsp,
1019                                                DATA_BLOB *new_cookie)
1020 {
1021         return NT_STATUS_NOT_IMPLEMENTED;
1022 }
1023
1024 /* VFS operations structure */
1025
1026 static struct vfs_fn_pointers vfs_not_implemented_fns = {
1027         /* Disk operations */
1028
1029         .connect_fn = vfs_not_implemented_connect,
1030         .disconnect_fn = vfs_not_implemented_disconnect,
1031         .disk_free_fn = vfs_not_implemented_disk_free,
1032         .get_quota_fn = vfs_not_implemented_get_quota,
1033         .set_quota_fn = vfs_not_implemented_set_quota,
1034         .get_shadow_copy_data_fn = vfs_not_implemented_get_shadow_copy_data,
1035         .statvfs_fn = vfs_not_implemented_statvfs,
1036         .fs_capabilities_fn = vfs_not_implemented_fs_capabilities,
1037         .get_dfs_referrals_fn = vfs_not_implemented_get_dfs_referrals,
1038         .snap_check_path_fn = vfs_not_implemented_snap_check_path,
1039         .snap_create_fn = vfs_not_implemented_snap_create,
1040         .snap_delete_fn = vfs_not_implemented_snap_delete,
1041
1042         /* Directory operations */
1043
1044         .opendir_fn = vfs_not_implemented_opendir,
1045         .fdopendir_fn = vfs_not_implemented_fdopendir,
1046         .readdir_fn = vfs_not_implemented_readdir,
1047         .seekdir_fn = vfs_not_implemented_seekdir,
1048         .telldir_fn = vfs_not_implemented_telldir,
1049         .rewind_dir_fn = vfs_not_implemented_rewind_dir,
1050         .mkdir_fn = vfs_not_implemented_mkdir,
1051         .rmdir_fn = vfs_not_implemented_rmdir,
1052         .closedir_fn = vfs_not_implemented_closedir,
1053
1054         /* File operations */
1055
1056         .open_fn = vfs_not_implemented_open,
1057         .create_file_fn = vfs_not_implemented_create_file,
1058         .close_fn = vfs_not_implemented_close_fn,
1059         .pread_fn = vfs_not_implemented_pread,
1060         .pread_send_fn = vfs_not_implemented_pread_send,
1061         .pread_recv_fn = vfs_not_implemented_pread_recv,
1062         .pwrite_fn = vfs_not_implemented_pwrite,
1063         .pwrite_send_fn = vfs_not_implemented_pwrite_send,
1064         .pwrite_recv_fn = vfs_not_implemented_pwrite_recv,
1065         .lseek_fn = vfs_not_implemented_lseek,
1066         .sendfile_fn = vfs_not_implemented_sendfile,
1067         .recvfile_fn = vfs_not_implemented_recvfile,
1068         .rename_fn = vfs_not_implemented_rename,
1069         .fsync_send_fn = vfs_not_implemented_fsync_send,
1070         .fsync_recv_fn = vfs_not_implemented_fsync_recv,
1071         .stat_fn = vfs_not_implemented_stat,
1072         .fstat_fn = vfs_not_implemented_fstat,
1073         .lstat_fn = vfs_not_implemented_lstat,
1074         .get_alloc_size_fn = vfs_not_implemented_get_alloc_size,
1075         .unlink_fn = vfs_not_implemented_unlink,
1076         .chmod_fn = vfs_not_implemented_chmod,
1077         .fchmod_fn = vfs_not_implemented_fchmod,
1078         .chown_fn = vfs_not_implemented_chown,
1079         .fchown_fn = vfs_not_implemented_fchown,
1080         .lchown_fn = vfs_not_implemented_lchown,
1081         .chdir_fn = vfs_not_implemented_chdir,
1082         .getwd_fn = vfs_not_implemented_getwd,
1083         .ntimes_fn = vfs_not_implemented_ntimes,
1084         .ftruncate_fn = vfs_not_implemented_ftruncate,
1085         .fallocate_fn = vfs_not_implemented_fallocate,
1086         .lock_fn = vfs_not_implemented_lock,
1087         .kernel_flock_fn = vfs_not_implemented_kernel_flock,
1088         .linux_setlease_fn = vfs_not_implemented_linux_setlease,
1089         .getlock_fn = vfs_not_implemented_getlock,
1090         .symlink_fn = vfs_not_implemented_symlink,
1091         .readlink_fn = vfs_not_implemented_vfs_readlink,
1092         .link_fn = vfs_not_implemented_link,
1093         .mknod_fn = vfs_not_implemented_mknod,
1094         .realpath_fn = vfs_not_implemented_realpath,
1095         .chflags_fn = vfs_not_implemented_chflags,
1096         .file_id_create_fn = vfs_not_implemented_file_id_create,
1097         .fs_file_id_fn = vfs_not_implemented_fs_file_id,
1098         .offload_read_send_fn = vfs_not_implemented_offload_read_send,
1099         .offload_read_recv_fn = vfs_not_implemented_offload_read_recv,
1100         .offload_write_send_fn = vfs_not_implemented_offload_write_send,
1101         .offload_write_recv_fn = vfs_not_implemented_offload_write_recv,
1102         .get_compression_fn = vfs_not_implemented_get_compression,
1103         .set_compression_fn = vfs_not_implemented_set_compression,
1104
1105         .streaminfo_fn = vfs_not_implemented_streaminfo,
1106         .get_real_filename_fn = vfs_not_implemented_get_real_filename,
1107         .connectpath_fn = vfs_not_implemented_connectpath,
1108         .brl_lock_windows_fn = vfs_not_implemented_brl_lock_windows,
1109         .brl_unlock_windows_fn = vfs_not_implemented_brl_unlock_windows,
1110         .strict_lock_check_fn = vfs_not_implemented_strict_lock_check,
1111         .translate_name_fn = vfs_not_implemented_translate_name,
1112         .fsctl_fn = vfs_not_implemented_fsctl,
1113         .readdir_attr_fn = vfs_not_implemented_readdir_attr,
1114         .audit_file_fn = vfs_not_implemented_audit_file,
1115
1116         /* DOS attributes. */
1117         .get_dos_attributes_fn = vfs_not_implemented_get_dos_attributes,
1118         .get_dos_attributes_send_fn = vfs_not_implemented_get_dos_attributes_send,
1119         .get_dos_attributes_recv_fn = vfs_not_implemented_get_dos_attributes_recv,
1120         .fget_dos_attributes_fn = vfs_not_implemented_fget_dos_attributes,
1121         .set_dos_attributes_fn = vfs_not_implemented_set_dos_attributes,
1122         .fset_dos_attributes_fn = vfs_not_implemented_fset_dos_attributes,
1123
1124         /* NT ACL operations. */
1125
1126         .fget_nt_acl_fn = vfs_not_implemented_fget_nt_acl,
1127         .get_nt_acl_fn = vfs_not_implemented_get_nt_acl,
1128         .fset_nt_acl_fn = vfs_not_implemented_fset_nt_acl,
1129
1130         /* POSIX ACL operations. */
1131
1132         .sys_acl_get_file_fn = vfs_not_implemented_sys_acl_get_file,
1133         .sys_acl_get_fd_fn = vfs_not_implemented_sys_acl_get_fd,
1134         .sys_acl_blob_get_file_fn = vfs_not_implemented_sys_acl_blob_get_file,
1135         .sys_acl_blob_get_fd_fn = vfs_not_implemented_sys_acl_blob_get_fd,
1136         .sys_acl_set_file_fn = vfs_not_implemented_sys_acl_set_file,
1137         .sys_acl_set_fd_fn = vfs_not_implemented_sys_acl_set_fd,
1138         .sys_acl_delete_def_file_fn = vfs_not_implemented_sys_acl_delete_def_file,
1139
1140         /* EA operations. */
1141         .getxattr_fn = vfs_not_implemented_getxattr,
1142         .getxattrat_send_fn = vfs_not_implemented_getxattrat_send,
1143         .getxattrat_recv_fn = vfs_not_implemented_getxattrat_recv,
1144         .fgetxattr_fn = vfs_not_implemented_fgetxattr,
1145         .listxattr_fn = vfs_not_implemented_listxattr,
1146         .flistxattr_fn = vfs_not_implemented_flistxattr,
1147         .removexattr_fn = vfs_not_implemented_removexattr,
1148         .fremovexattr_fn = vfs_not_implemented_fremovexattr,
1149         .setxattr_fn = vfs_not_implemented_setxattr,
1150         .fsetxattr_fn = vfs_not_implemented_fsetxattr,
1151
1152         /* aio operations */
1153         .aio_force_fn = vfs_not_implemented_aio_force,
1154
1155         /* durable handle operations */
1156         .durable_cookie_fn = vfs_not_implemented_durable_cookie,
1157         .durable_disconnect_fn = vfs_not_implemented_durable_disconnect,
1158         .durable_reconnect_fn = vfs_not_implemented_durable_reconnect,
1159 };
1160
1161 static_decl_vfs;
1162 NTSTATUS vfs_not_implemented_init(TALLOC_CTX *ctx)
1163 {
1164         /*
1165          * smb_vfs_assert_all_fns() makes sure every
1166          * call is implemented.
1167          */
1168         smb_vfs_assert_all_fns(&vfs_not_implemented_fns, "vfs_not_implemented");
1169         return smb_register_vfs(SMB_VFS_INTERFACE_VERSION, "vfs_not_implemented",
1170                                 &vfs_not_implemented_fns);
1171 }