LCOV - code coverage report
Current view: top level - examples/VFS - skel_opaque.c (source / functions) Hit Total Coverage
Test: coverage report for fix-15632 9995c5c2 Lines: 3 309 1.0 %
Date: 2024-04-13 12:30:31 Functions: 1 99 1.0 %

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

Generated by: LCOV version 1.14