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

Generated by: LCOV version 1.14