LCOV - code coverage report
Current view: top level - examples/VFS - skel_transparent.c (source / functions) Hit Total Coverage
Test: coverage report for recycleplus df22b230 Lines: 3 371 0.8 %
Date: 2024-02-14 10:14:15 Functions: 1 108 0.9 %

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

Generated by: LCOV version 1.14