examples/VFS/skel_transparent: make vfs_fn_pointers static
[vlendec/samba-autobuild/.git] / examples / VFS / skel_transparent.c
index 02e818424d286c4e395373e7384bf1a27c6d0bd7..d84e6deee479feae075f1c9b13f8bb769804c561 100644 (file)
@@ -23,6 +23,7 @@
 
 #include "../source3/include/includes.h"
 #include "lib/util/tevent_unix.h"
+#include "lib/util/tevent_ntstatus.h"
 
 /* PLEASE,PLEASE READ THE VFS MODULES CHAPTER OF THE 
    SAMBA DEVELOPERS GUIDE!!!!!!
@@ -47,18 +48,22 @@ static void skel_disconnect(vfs_handle_struct *handle)
        SMB_VFS_NEXT_DISCONNECT(handle);
 }
 
-static uint64_t skel_disk_free(vfs_handle_struct *handle, const char *path,
-                              bool small_query, uint64_t *bsize,
-                              uint64_t *dfree, uint64_t *dsize)
+static uint64_t skel_disk_free(vfs_handle_struct *handle,
+                               const struct smb_filename *smb_fname,
+                               uint64_t *bsize,
+                               uint64_t *dfree,
+                               uint64_t *dsize)
 {
-       return SMB_VFS_NEXT_DISK_FREE(handle, path, small_query, bsize,
-                                     dfree, dsize);
+       return SMB_VFS_NEXT_DISK_FREE(handle, smb_fname, bsize, dfree, dsize);
 }
 
-static int skel_get_quota(vfs_handle_struct *handle, enum SMB_QUOTA_TYPE qtype,
-                         unid_t id, SMB_DISK_QUOTA *dq)
+static int skel_get_quota(vfs_handle_struct *handle,
+                               const struct smb_filename *smb_fname,
+                               enum SMB_QUOTA_TYPE qtype,
+                               unid_t id,
+                               SMB_DISK_QUOTA *dq)
 {
-       return SMB_VFS_NEXT_GET_QUOTA(handle, qtype, id, dq);
+       return SMB_VFS_NEXT_GET_QUOTA(handle, smb_fname, qtype, id, dq);
 }
 
 static int skel_set_quota(vfs_handle_struct *handle, enum SMB_QUOTA_TYPE qtype,
@@ -76,10 +81,11 @@ static int skel_get_shadow_copy_data(vfs_handle_struct *handle,
                                                 labels);
 }
 
-static int skel_statvfs(struct vfs_handle_struct *handle, const char *path,
+static int skel_statvfs(struct vfs_handle_struct *handle,
+                       const struct smb_filename *smb_fname,
                        struct vfs_statvfs_struct *statbuf)
 {
-       return SMB_VFS_NEXT_STATVFS(handle, path, statbuf);
+       return SMB_VFS_NEXT_STATVFS(handle, smb_fname, statbuf);
 }
 
 static uint32_t skel_fs_capabilities(struct vfs_handle_struct *handle,
@@ -94,14 +100,45 @@ static NTSTATUS skel_get_dfs_referrals(struct vfs_handle_struct *handle,
        return SMB_VFS_NEXT_GET_DFS_REFERRALS(handle, r);
 }
 
-static DIR *skel_opendir(vfs_handle_struct *handle, const char *fname,
-                        const char *mask, uint32 attr)
+static DIR *skel_opendir(vfs_handle_struct *handle,
+                       const struct smb_filename *smb_fname,
+                       const char *mask,
+                       uint32_t attr)
 {
-       return SMB_VFS_NEXT_OPENDIR(handle, fname, mask, attr);
+       return SMB_VFS_NEXT_OPENDIR(handle, smb_fname, mask, attr);
+}
+
+static NTSTATUS skel_snap_check_path(struct vfs_handle_struct *handle,
+                                    TALLOC_CTX *mem_ctx,
+                                    const char *service_path,
+                                    char **base_volume)
+{
+       return SMB_VFS_NEXT_SNAP_CHECK_PATH(handle, mem_ctx, service_path,
+                                           base_volume);
+}
+
+static NTSTATUS skel_snap_create(struct vfs_handle_struct *handle,
+                                TALLOC_CTX *mem_ctx,
+                                const char *base_volume,
+                                time_t *tstamp,
+                                bool rw,
+                                char **base_path,
+                                char **snap_path)
+{
+       return SMB_VFS_NEXT_SNAP_CREATE(handle, mem_ctx, base_volume, tstamp,
+                                       rw, base_path, snap_path);
+}
+
+static NTSTATUS skel_snap_delete(struct vfs_handle_struct *handle,
+                                TALLOC_CTX *mem_ctx,
+                                char *base_path,
+                                char *snap_path)
+{
+       return SMB_VFS_NEXT_SNAP_DELETE(handle, mem_ctx, base_path, snap_path);
 }
 
 static DIR *skel_fdopendir(vfs_handle_struct *handle, files_struct *fsp,
-                          const char *mask, uint32 attr)
+                          const char *mask, uint32_t attr)
 {
        return SMB_VFS_NEXT_FDOPENDIR(handle, fsp, mask, attr);
 }
@@ -127,14 +164,17 @@ static void skel_rewind_dir(vfs_handle_struct *handle, DIR *dirp)
        SMB_VFS_NEXT_REWINDDIR(handle, dirp);
 }
 
-static int skel_mkdir(vfs_handle_struct *handle, const char *path, mode_t mode)
+static int skel_mkdir(vfs_handle_struct *handle,
+               const struct smb_filename *smb_fname,
+               mode_t mode)
 {
-       return SMB_VFS_NEXT_MKDIR(handle, path, mode);
+       return SMB_VFS_NEXT_MKDIR(handle, smb_fname, mode);
 }
 
-static int skel_rmdir(vfs_handle_struct *handle, const char *path)
+static int skel_rmdir(vfs_handle_struct *handle,
+               const struct smb_filename *smb_fname)
 {
-       return SMB_VFS_NEXT_RMDIR(handle, path);
+       return SMB_VFS_NEXT_RMDIR(handle, smb_fname);
 }
 
 static int skel_closedir(vfs_handle_struct *handle, DIR *dir)
@@ -142,11 +182,6 @@ static int skel_closedir(vfs_handle_struct *handle, DIR *dir)
        return SMB_VFS_NEXT_CLOSEDIR(handle, dir);
 }
 
-static void skel_init_search_op(struct vfs_handle_struct *handle, DIR *dirp)
-{
-       SMB_VFS_NEXT_INIT_SEARCH_OP(handle, dirp);
-}
-
 static int skel_open(vfs_handle_struct *handle, struct smb_filename *smb_fname,
                     files_struct *fsp, int flags, mode_t mode)
 {
@@ -163,11 +198,14 @@ static NTSTATUS skel_create_file(struct vfs_handle_struct *handle,
                                 uint32_t create_options,
                                 uint32_t file_attributes,
                                 uint32_t oplock_request,
+                                struct smb2_lease *lease,
                                 uint64_t allocation_size,
                                 uint32_t private_flags,
                                 struct security_descriptor *sd,
                                 struct ea_list *ea_list,
-                                files_struct ** result, int *pinfo)
+                                files_struct ** result, int *pinfo,
+                                const struct smb2_create_blobs *in_context_blobs,
+                                struct smb2_create_blobs *out_context_blobs)
 {
        return SMB_VFS_NEXT_CREATE_FILE(handle,
                                        req,
@@ -179,9 +217,11 @@ static NTSTATUS skel_create_file(struct vfs_handle_struct *handle,
                                        create_options,
                                        file_attributes,
                                        oplock_request,
+                                       lease,
                                        allocation_size,
                                        private_flags,
-                                       sd, ea_list, result, pinfo);
+                                       sd, ea_list, result, pinfo,
+                                       in_context_blobs, out_context_blobs);
 }
 
 static int skel_close_fn(vfs_handle_struct *handle, files_struct *fsp)
@@ -189,12 +229,6 @@ static int skel_close_fn(vfs_handle_struct *handle, files_struct *fsp)
        return SMB_VFS_NEXT_CLOSE(handle, fsp);
 }
 
-static ssize_t skel_vfs_read(vfs_handle_struct *handle, files_struct *fsp,
-                            void *data, size_t n)
-{
-       return SMB_VFS_NEXT_READ(handle, fsp, data, n);
-}
-
 static ssize_t skel_pread(vfs_handle_struct *handle, files_struct *fsp,
                          void *data, size_t n, off_t offset)
 {
@@ -203,7 +237,7 @@ static ssize_t skel_pread(vfs_handle_struct *handle, files_struct *fsp,
 
 struct skel_pread_state {
        ssize_t ret;
-       int err;
+       struct vfs_aio_state vfs_aio_state;
 };
 
 static void skel_pread_done(struct tevent_req *subreq);
@@ -237,29 +271,24 @@ static void skel_pread_done(struct tevent_req *subreq)
        struct skel_pread_state *state =
            tevent_req_data(req, struct skel_pread_state);
 
-       state->ret = SMB_VFS_PREAD_RECV(subreq, &state->err);
+       state->ret = SMB_VFS_PREAD_RECV(subreq, &state->vfs_aio_state);
        TALLOC_FREE(subreq);
        tevent_req_done(req);
 }
 
-static ssize_t skel_pread_recv(struct tevent_req *req, int *err)
+static ssize_t skel_pread_recv(struct tevent_req *req,
+                              struct vfs_aio_state *vfs_aio_state)
 {
        struct skel_pread_state *state =
            tevent_req_data(req, struct skel_pread_state);
 
-       if (tevent_req_is_unix_error(req, err)) {
+       if (tevent_req_is_unix_error(req, &vfs_aio_state->error)) {
                return -1;
        }
-       *err = state->err;
+       *vfs_aio_state = state->vfs_aio_state;
        return state->ret;
 }
 
-static ssize_t skel_write(vfs_handle_struct *handle, files_struct *fsp,
-                         const void *data, size_t n)
-{
-       return SMB_VFS_NEXT_WRITE(handle, fsp, data, n);
-}
-
 static ssize_t skel_pwrite(vfs_handle_struct *handle, files_struct *fsp,
                           const void *data, size_t n, off_t offset)
 {
@@ -268,7 +297,7 @@ static ssize_t skel_pwrite(vfs_handle_struct *handle, files_struct *fsp,
 
 struct skel_pwrite_state {
        ssize_t ret;
-       int err;
+       struct vfs_aio_state vfs_aio_state;
 };
 
 static void skel_pwrite_done(struct tevent_req *subreq);
@@ -303,20 +332,21 @@ static void skel_pwrite_done(struct tevent_req *subreq)
        struct skel_pwrite_state *state =
            tevent_req_data(req, struct skel_pwrite_state);
 
-       state->ret = SMB_VFS_PWRITE_RECV(subreq, &state->err);
+       state->ret = SMB_VFS_PWRITE_RECV(subreq, &state->vfs_aio_state);
        TALLOC_FREE(subreq);
        tevent_req_done(req);
 }
 
-static ssize_t skel_pwrite_recv(struct tevent_req *req, int *err)
+static ssize_t skel_pwrite_recv(struct tevent_req *req,
+                               struct vfs_aio_state *vfs_aio_state)
 {
        struct skel_pwrite_state *state =
            tevent_req_data(req, struct skel_pwrite_state);
 
-       if (tevent_req_is_unix_error(req, err)) {
+       if (tevent_req_is_unix_error(req, &vfs_aio_state->error)) {
                return -1;
        }
-       *err = state->err;
+       *vfs_aio_state = state->vfs_aio_state;
        return state->ret;
 }
 
@@ -346,14 +376,9 @@ static int skel_rename(vfs_handle_struct *handle,
        return SMB_VFS_NEXT_RENAME(handle, smb_fname_src, smb_fname_dst);
 }
 
-static int skel_fsync(vfs_handle_struct *handle, files_struct *fsp)
-{
-       return SMB_VFS_NEXT_FSYNC(handle, fsp);
-}
-
 struct skel_fsync_state {
        int ret;
-       int err;
+       struct vfs_aio_state vfs_aio_state;
 };
 
 static void skel_fsync_done(struct tevent_req *subreq);
@@ -385,20 +410,21 @@ static void skel_fsync_done(struct tevent_req *subreq)
        struct skel_fsync_state *state =
            tevent_req_data(req, struct skel_fsync_state);
 
-       state->ret = SMB_VFS_FSYNC_RECV(subreq, &state->err);
+       state->ret = SMB_VFS_FSYNC_RECV(subreq, &state->vfs_aio_state);
        TALLOC_FREE(subreq);
        tevent_req_done(req);
 }
 
-static int skel_fsync_recv(struct tevent_req *req, int *err)
+static int skel_fsync_recv(struct tevent_req *req,
+                          struct vfs_aio_state *vfs_aio_state)
 {
        struct skel_fsync_state *state =
            tevent_req_data(req, struct skel_fsync_state);
 
-       if (tevent_req_is_unix_error(req, err)) {
+       if (tevent_req_is_unix_error(req, &vfs_aio_state->error)) {
                return -1;
        }
-       *err = state->err;
+       *vfs_aio_state = state->vfs_aio_state;
        return state->ret;
 }
 
@@ -432,9 +458,11 @@ static int skel_unlink(vfs_handle_struct *handle,
        return SMB_VFS_NEXT_UNLINK(handle, smb_fname);
 }
 
-static int skel_chmod(vfs_handle_struct *handle, const char *path, mode_t mode)
+static int skel_chmod(vfs_handle_struct *handle,
+                       const struct smb_filename *smb_fname,
+                       mode_t mode)
 {
-       return SMB_VFS_NEXT_CHMOD(handle, path, mode);
+       return SMB_VFS_NEXT_CHMOD(handle, smb_fname, mode);
 }
 
 static int skel_fchmod(vfs_handle_struct *handle, files_struct *fsp,
@@ -443,10 +471,12 @@ static int skel_fchmod(vfs_handle_struct *handle, files_struct *fsp,
        return SMB_VFS_NEXT_FCHMOD(handle, fsp, mode);
 }
 
-static int skel_chown(vfs_handle_struct *handle, const char *path, uid_t uid,
-                     gid_t gid)
+static int skel_chown(vfs_handle_struct *handle,
+                       const struct smb_filename *smb_fname,
+                       uid_t uid,
+                       gid_t gid)
 {
-       return SMB_VFS_NEXT_CHOWN(handle, path, uid, gid);
+       return SMB_VFS_NEXT_CHOWN(handle, smb_fname, uid, gid);
 }
 
 static int skel_fchown(vfs_handle_struct *handle, files_struct *fsp,
@@ -455,20 +485,24 @@ static int skel_fchown(vfs_handle_struct *handle, files_struct *fsp,
        return SMB_VFS_NEXT_FCHOWN(handle, fsp, uid, gid);
 }
 
-static int skel_lchown(vfs_handle_struct *handle, const char *path, uid_t uid,
-                      gid_t gid)
+static int skel_lchown(vfs_handle_struct *handle,
+                       const struct smb_filename *smb_fname,
+                       uid_t uid,
+                       gid_t gid)
 {
-       return SMB_VFS_NEXT_LCHOWN(handle, path, uid, gid);
+       return SMB_VFS_NEXT_LCHOWN(handle, smb_fname, uid, gid);
 }
 
-static int skel_chdir(vfs_handle_struct *handle, const char *path)
+static int skel_chdir(vfs_handle_struct *handle,
+                       const struct smb_filename *smb_fname)
 {
-       return SMB_VFS_NEXT_CHDIR(handle, path);
+       return SMB_VFS_NEXT_CHDIR(handle, smb_fname);
 }
 
-static char *skel_getwd(vfs_handle_struct *handle)
+static struct smb_filename *skel_getwd(vfs_handle_struct *handle,
+                                       TALLOC_CTX *ctx)
 {
-       return SMB_VFS_NEXT_GETWD(handle);
+       return SMB_VFS_NEXT_GETWD(handle, ctx);
 }
 
 static int skel_ntimes(vfs_handle_struct *handle,
@@ -485,7 +519,7 @@ static int skel_ftruncate(vfs_handle_struct *handle, files_struct *fsp,
 }
 
 static int skel_fallocate(vfs_handle_struct *handle, files_struct *fsp,
-                         enum vfs_fallocate_mode mode, off_t offset, off_t len)
+                         uint32_t mode, off_t offset, off_t len)
 {
        return SMB_VFS_NEXT_FALLOCATE(handle, fsp, mode, offset, len);
 }
@@ -497,8 +531,8 @@ static bool skel_lock(vfs_handle_struct *handle, files_struct *fsp, int op,
 }
 
 static int skel_kernel_flock(struct vfs_handle_struct *handle,
-                            struct files_struct *fsp, uint32 share_mode,
-                            uint32 access_mask)
+                            struct files_struct *fsp, uint32_t share_mode,
+                            uint32_t access_mask)
 {
        return SMB_VFS_NEXT_KERNEL_FLOCK(handle, fsp, share_mode, access_mask);
 }
@@ -516,54 +550,48 @@ static bool skel_getlock(vfs_handle_struct *handle, files_struct *fsp,
        return SMB_VFS_NEXT_GETLOCK(handle, fsp, poffset, pcount, ptype, ppid);
 }
 
-static int skel_symlink(vfs_handle_struct *handle, const char *oldpath,
-                       const char *newpath)
-{
-       return SMB_VFS_NEXT_SYMLINK(handle, oldpath, newpath);
-}
-
-static int skel_vfs_readlink(vfs_handle_struct *handle, const char *path,
-                            char *buf, size_t bufsiz)
+static int skel_symlink(vfs_handle_struct *handle,
+                       const char *link_contents,
+                       const struct smb_filename *new_smb_fname)
 {
-       return SMB_VFS_NEXT_READLINK(handle, path, buf, bufsiz);
+       return SMB_VFS_NEXT_SYMLINK(handle, link_contents, new_smb_fname);
 }
 
-static int skel_link(vfs_handle_struct *handle, const char *oldpath,
-                    const char *newpath)
+static int skel_vfs_readlink(vfs_handle_struct *handle,
+                       const struct smb_filename *smb_fname,
+                       char *buf,
+                       size_t bufsiz)
 {
-       return SMB_VFS_NEXT_LINK(handle, oldpath, newpath);
+       return SMB_VFS_NEXT_READLINK(handle, smb_fname, buf, bufsiz);
 }
 
-static int skel_mknod(vfs_handle_struct *handle, const char *path, mode_t mode,
-                     SMB_DEV_T dev)
+static int skel_link(vfs_handle_struct *handle,
+                       const struct smb_filename *old_smb_fname,
+                       const struct smb_filename *new_smb_fname)
 {
-       return SMB_VFS_NEXT_MKNOD(handle, path, mode, dev);
+       return SMB_VFS_NEXT_LINK(handle, old_smb_fname, new_smb_fname);
 }
 
-static char *skel_realpath(vfs_handle_struct *handle, const char *path)
+static int skel_mknod(vfs_handle_struct *handle,
+                       const struct smb_filename *smb_fname,
+                       mode_t mode,
+                       SMB_DEV_T dev)
 {
-       return SMB_VFS_NEXT_REALPATH(handle, path);
+       return SMB_VFS_NEXT_MKNOD(handle, smb_fname, mode, dev);
 }
 
-static NTSTATUS skel_notify_watch(struct vfs_handle_struct *handle,
-                                 struct sys_notify_context *ctx,
-                                 const char *path,
-                                 uint32_t *filter,
-                                 uint32_t *subdir_filter,
-                                 void (*callback) (struct sys_notify_context *ctx,
-                                                   void *private_data,
-                                                   struct notify_event *ev),
-                                 void *private_data, void *handle_p)
+static struct smb_filename *skel_realpath(vfs_handle_struct *handle,
+                       TALLOC_CTX *ctx,
+                       const struct smb_filename *smb_fname)
 {
-       return SMB_VFS_NEXT_NOTIFY_WATCH(handle, ctx, path,
-                                        filter, subdir_filter, callback,
-                                        private_data, handle_p);
+       return SMB_VFS_NEXT_REALPATH(handle, ctx, smb_fname);
 }
 
-static int skel_chflags(vfs_handle_struct *handle, const char *path,
+static int skel_chflags(vfs_handle_struct *handle,
+                       const struct smb_filename *smb_fname,
                        uint flags)
 {
-       return SMB_VFS_NEXT_CHFLAGS(handle, path, flags);
+       return SMB_VFS_NEXT_CHFLAGS(handle, smb_fname, flags);
 }
 
 static struct file_id skel_file_id_create(vfs_handle_struct *handle,
@@ -572,16 +600,199 @@ static struct file_id skel_file_id_create(vfs_handle_struct *handle,
        return SMB_VFS_NEXT_FILE_ID_CREATE(handle, sbuf);
 }
 
+struct skel_offload_read_state {
+       struct vfs_handle_struct *handle;
+       DATA_BLOB token;
+};
+
+static void skel_offload_read_done(struct tevent_req *subreq);
+
+static struct tevent_req *skel_offload_read_send(
+       TALLOC_CTX *mem_ctx,
+       struct tevent_context *ev,
+       struct vfs_handle_struct *handle,
+       struct files_struct *fsp,
+       uint32_t fsctl,
+       uint32_t ttl,
+       off_t offset,
+       size_t to_copy)
+{
+       struct tevent_req *req = NULL;
+       struct skel_offload_read_state *state = NULL;
+       struct tevent_req *subreq = NULL;
+
+       req = tevent_req_create(mem_ctx, &state, struct skel_offload_read_state);
+       if (req == NULL) {
+               return NULL;
+       }
+       *state = (struct skel_offload_read_state) {
+               .handle = handle,
+       };
+
+       subreq = SMB_VFS_NEXT_OFFLOAD_READ_SEND(mem_ctx, ev, handle, fsp,
+                                               fsctl, ttl, offset, to_copy);
+       if (tevent_req_nomem(subreq, req)) {
+               return tevent_req_post(req, ev);
+       }
+       tevent_req_set_callback(subreq, skel_offload_read_done, req);
+       return req;
+}
+
+static void skel_offload_read_done(struct tevent_req *subreq)
+{
+       struct tevent_req *req = tevent_req_callback_data(
+               subreq, struct tevent_req);
+       struct skel_offload_read_state *state = tevent_req_data(
+               req, struct skel_offload_read_state);
+       NTSTATUS status;
+
+       status = SMB_VFS_NEXT_OFFLOAD_READ_RECV(subreq,
+                                               state->handle,
+                                               state,
+                                               &state->token);
+       TALLOC_FREE(subreq);
+       if (tevent_req_nterror(req, status)) {
+               return;
+       }
+
+       tevent_req_done(req);
+       return;
+}
+
+static NTSTATUS skel_offload_read_recv(struct tevent_req *req,
+                                      struct vfs_handle_struct *handle,
+                                      TALLOC_CTX *mem_ctx,
+                                      DATA_BLOB *_token)
+{
+       struct skel_offload_read_state *state = tevent_req_data(
+               req, struct skel_offload_read_state);
+       DATA_BLOB token;
+       NTSTATUS status;
+
+       if (tevent_req_is_nterror(req, &status)) {
+               tevent_req_received(req);
+               return status;
+       }
+
+       token = data_blob_talloc(mem_ctx,
+                                state->token.data,
+                                state->token.length);
+
+       tevent_req_received(req);
+
+       if (token.data == NULL) {
+               return NT_STATUS_NO_MEMORY;
+       }
+
+       *_token = token;
+       return NT_STATUS_OK;
+}
+
+struct skel_offload_write_state {
+       struct vfs_handle_struct *handle;
+       off_t copied;
+};
+static void skel_offload_write_done(struct tevent_req *subreq);
+
+static struct tevent_req *skel_offload_write_send(struct vfs_handle_struct *handle,
+                                              TALLOC_CTX *mem_ctx,
+                                              struct tevent_context *ev,
+                                              uint32_t fsctl,
+                                              DATA_BLOB *token,
+                                              off_t transfer_offset,
+                                              struct files_struct *dest_fsp,
+                                              off_t dest_off,
+                                              off_t num)
+{
+       struct tevent_req *req;
+       struct tevent_req *subreq;
+       struct skel_offload_write_state *state;
+
+       req = tevent_req_create(mem_ctx, &state, struct skel_offload_write_state);
+       if (req == NULL) {
+               return NULL;
+       }
+
+       state->handle = handle;
+       subreq = SMB_VFS_NEXT_OFFLOAD_WRITE_SEND(handle, state, ev,
+                                             fsctl, token, transfer_offset,
+                                             dest_fsp, dest_off, num);
+       if (tevent_req_nomem(subreq, req)) {
+               return tevent_req_post(req, ev);
+       }
+
+       tevent_req_set_callback(subreq, skel_offload_write_done, req);
+       return req;
+}
+
+static void skel_offload_write_done(struct tevent_req *subreq)
+{
+       struct tevent_req *req = tevent_req_callback_data(
+               subreq, struct tevent_req);
+       struct skel_offload_write_state *state
+                       = tevent_req_data(req, struct skel_offload_write_state);
+       NTSTATUS status;
+
+       status = SMB_VFS_NEXT_OFFLOAD_WRITE_RECV(state->handle,
+                                             subreq,
+                                             &state->copied);
+       TALLOC_FREE(subreq);
+       if (tevent_req_nterror(req, status)) {
+               return;
+       }
+       tevent_req_done(req);
+}
+
+static NTSTATUS skel_offload_write_recv(struct vfs_handle_struct *handle,
+                                    struct tevent_req *req,
+                                    off_t *copied)
+{
+       struct skel_offload_write_state *state
+                       = tevent_req_data(req, struct skel_offload_write_state);
+       NTSTATUS status;
+
+       *copied = state->copied;
+       if (tevent_req_is_nterror(req, &status)) {
+               tevent_req_received(req);
+               return status;
+       }
+
+       tevent_req_received(req);
+       return NT_STATUS_OK;
+}
+
+static NTSTATUS skel_get_compression(struct vfs_handle_struct *handle,
+                                    TALLOC_CTX *mem_ctx,
+                                    struct files_struct *fsp,
+                                    struct smb_filename *smb_fname,
+                                    uint16_t *_compression_fmt)
+{
+       return SMB_VFS_NEXT_GET_COMPRESSION(handle, mem_ctx, fsp, smb_fname,
+                                           _compression_fmt);
+}
+
+static NTSTATUS skel_set_compression(struct vfs_handle_struct *handle,
+                                    TALLOC_CTX *mem_ctx,
+                                    struct files_struct *fsp,
+                                    uint16_t compression_fmt)
+{
+       return SMB_VFS_NEXT_SET_COMPRESSION(handle, mem_ctx, fsp,
+                                           compression_fmt);
+}
+
 static NTSTATUS skel_streaminfo(struct vfs_handle_struct *handle,
                                struct files_struct *fsp,
-                               const char *fname,
+                               const struct smb_filename *smb_fname,
                                TALLOC_CTX *mem_ctx,
                                unsigned int *num_streams,
                                struct stream_struct **streams)
 {
        return SMB_VFS_NEXT_STREAMINFO(handle,
-                                      fsp,
-                                      fname, mem_ctx, num_streams, streams);
+                               fsp,
+                               smb_fname,
+                               mem_ctx,
+                               num_streams,
+                               streams);
 }
 
 static int skel_get_real_filename(struct vfs_handle_struct *handle,
@@ -594,19 +805,18 @@ static int skel_get_real_filename(struct vfs_handle_struct *handle,
 }
 
 static const char *skel_connectpath(struct vfs_handle_struct *handle,
-                                   const char *filename)
+                               const struct smb_filename *smb_fname)
 {
-       return SMB_VFS_NEXT_CONNECTPATH(handle, filename);
+       return SMB_VFS_NEXT_CONNECTPATH(handle, smb_fname);
 }
 
 static NTSTATUS skel_brl_lock_windows(struct vfs_handle_struct *handle,
                                      struct byte_range_lock *br_lck,
                                      struct lock_struct *plock,
-                                     bool blocking_lock,
-                                     struct blocking_lock_record *blr)
+                                     bool blocking_lock)
 {
        return SMB_VFS_NEXT_BRL_LOCK_WINDOWS(handle,
-                                            br_lck, plock, blocking_lock, blr);
+                                            br_lck, plock, blocking_lock);
 }
 
 static bool skel_brl_unlock_windows(struct vfs_handle_struct *handle,
@@ -619,24 +829,16 @@ static bool skel_brl_unlock_windows(struct vfs_handle_struct *handle,
 
 static bool skel_brl_cancel_windows(struct vfs_handle_struct *handle,
                                    struct byte_range_lock *br_lck,
-                                   struct lock_struct *plock,
-                                   struct blocking_lock_record *blr)
-{
-       return SMB_VFS_NEXT_BRL_CANCEL_WINDOWS(handle, br_lck, plock, blr);
-}
-
-static bool skel_strict_lock(struct vfs_handle_struct *handle,
-                            struct files_struct *fsp,
-                            struct lock_struct *plock)
+                                   struct lock_struct *plock)
 {
-       return SMB_VFS_NEXT_STRICT_LOCK(handle, fsp, plock);
+       return SMB_VFS_NEXT_BRL_CANCEL_WINDOWS(handle, br_lck, plock);
 }
 
-static void skel_strict_unlock(struct vfs_handle_struct *handle,
-                              struct files_struct *fsp,
-                              struct lock_struct *plock)
+static bool skel_strict_lock_check(struct vfs_handle_struct *handle,
+                                  struct files_struct *fsp,
+                                  struct lock_struct *plock)
 {
-       SMB_VFS_NEXT_STRICT_UNLOCK(handle, fsp, plock);
+       return SMB_VFS_NEXT_STRICT_LOCK_CHECK(handle, fsp, plock);
 }
 
 static NTSTATUS skel_translate_name(struct vfs_handle_struct *handle,
@@ -667,8 +869,52 @@ static NTSTATUS skel_fsctl(struct vfs_handle_struct *handle,
                                  in_len, _out_data, max_out_len, out_len);
 }
 
+static NTSTATUS skel_readdir_attr(struct vfs_handle_struct *handle,
+                                 const struct smb_filename *fname,
+                                 TALLOC_CTX *mem_ctx,
+                                 struct readdir_attr_data **pattr_data)
+{
+       return SMB_VFS_NEXT_READDIR_ATTR(handle, fname, mem_ctx, pattr_data);
+}
+
+static NTSTATUS skel_get_dos_attributes(struct vfs_handle_struct *handle,
+                               struct smb_filename *smb_fname,
+                               uint32_t *dosmode)
+{
+       return SMB_VFS_NEXT_GET_DOS_ATTRIBUTES(handle,
+                               smb_fname,
+                               dosmode);
+}
+
+static NTSTATUS skel_fget_dos_attributes(struct vfs_handle_struct *handle,
+                               struct files_struct *fsp,
+                               uint32_t *dosmode)
+{
+       return SMB_VFS_NEXT_FGET_DOS_ATTRIBUTES(handle,
+                               fsp,
+                               dosmode);
+}
+
+static NTSTATUS skel_set_dos_attributes(struct vfs_handle_struct *handle,
+                               const struct smb_filename *smb_fname,
+                               uint32_t dosmode)
+{
+       return SMB_VFS_NEXT_SET_DOS_ATTRIBUTES(handle,
+                               smb_fname,
+                               dosmode);
+}
+
+static NTSTATUS skel_fset_dos_attributes(struct vfs_handle_struct *handle,
+                               struct files_struct *fsp,
+                               uint32_t dosmode)
+{
+       return SMB_VFS_NEXT_FSET_DOS_ATTRIBUTES(handle,
+                               fsp,
+                               dosmode);
+}
+
 static NTSTATUS skel_fget_nt_acl(vfs_handle_struct *handle, files_struct *fsp,
-                                uint32 security_info,
+                                uint32_t security_info,
                                 TALLOC_CTX *mem_ctx,
                                 struct security_descriptor **ppdesc)
 {
@@ -677,39 +923,31 @@ static NTSTATUS skel_fget_nt_acl(vfs_handle_struct *handle, files_struct *fsp,
 }
 
 static NTSTATUS skel_get_nt_acl(vfs_handle_struct *handle,
-                               const char *name, uint32 security_info,
+                               const struct smb_filename *smb_fname,
+                               uint32_t security_info,
                                TALLOC_CTX *mem_ctx,
                                struct security_descriptor **ppdesc)
 {
-       return SMB_VFS_NEXT_GET_NT_ACL(handle, name, security_info, mem_ctx,
-                                      ppdesc);
+       return SMB_VFS_NEXT_GET_NT_ACL(handle,
+                               smb_fname,
+                               security_info,
+                               mem_ctx,
+                               ppdesc);
 }
 
 static NTSTATUS skel_fset_nt_acl(vfs_handle_struct *handle, files_struct *fsp,
-                                uint32 security_info_sent,
+                                uint32_t security_info_sent,
                                 const struct security_descriptor *psd)
 {
        return SMB_VFS_NEXT_FSET_NT_ACL(handle, fsp, security_info_sent, psd);
 }
 
-static int skel_chmod_acl(vfs_handle_struct *handle, const char *name,
-                         mode_t mode)
-{
-       return SMB_VFS_NEXT_CHMOD_ACL(handle, name, mode);
-}
-
-static int skel_fchmod_acl(vfs_handle_struct *handle, files_struct *fsp,
-                          mode_t mode)
-{
-       return SMB_VFS_NEXT_FCHMOD_ACL(handle, fsp, mode);
-}
-
 static SMB_ACL_T skel_sys_acl_get_file(vfs_handle_struct *handle,
-                                      const char *path_p,
+                                      const struct smb_filename *smb_fname,
                                       SMB_ACL_TYPE_T type,
                                       TALLOC_CTX *mem_ctx)
 {
-       return SMB_VFS_NEXT_SYS_ACL_GET_FILE(handle, path_p, type, mem_ctx);
+       return SMB_VFS_NEXT_SYS_ACL_GET_FILE(handle, smb_fname, type, mem_ctx);
 }
 
 static SMB_ACL_T skel_sys_acl_get_fd(vfs_handle_struct *handle,
@@ -719,10 +957,12 @@ static SMB_ACL_T skel_sys_acl_get_fd(vfs_handle_struct *handle,
 }
 
 static int skel_sys_acl_blob_get_file(vfs_handle_struct *handle,
-                                     const char *path_p, TALLOC_CTX *mem_ctx,
-                                     char **blob_description, DATA_BLOB *blob)
+                               const struct smb_filename *smb_fname,
+                               TALLOC_CTX *mem_ctx,
+                               char **blob_description,
+                               DATA_BLOB *blob)
 {
-       return SMB_VFS_NEXT_SYS_ACL_BLOB_GET_FILE(handle, path_p, mem_ctx,
+       return SMB_VFS_NEXT_SYS_ACL_BLOB_GET_FILE(handle, smb_fname, mem_ctx,
                                                  blob_description, blob);
 }
 
@@ -734,10 +974,13 @@ static int skel_sys_acl_blob_get_fd(vfs_handle_struct *handle,
                                                blob_description, blob);
 }
 
-static int skel_sys_acl_set_file(vfs_handle_struct *handle, const char *name,
-                                SMB_ACL_TYPE_T acltype, SMB_ACL_T theacl)
+static int skel_sys_acl_set_file(vfs_handle_struct *handle,
+                               const struct smb_filename *smb_fname,
+                               SMB_ACL_TYPE_T acltype,
+                               SMB_ACL_T theacl)
 {
-       return SMB_VFS_NEXT_SYS_ACL_SET_FILE(handle, name, acltype, theacl);
+       return SMB_VFS_NEXT_SYS_ACL_SET_FILE(handle, smb_fname,
+                       acltype, theacl);
 }
 
 static int skel_sys_acl_set_fd(vfs_handle_struct *handle, files_struct *fsp,
@@ -747,15 +990,18 @@ static int skel_sys_acl_set_fd(vfs_handle_struct *handle, files_struct *fsp,
 }
 
 static int skel_sys_acl_delete_def_file(vfs_handle_struct *handle,
-                                       const char *path)
+                                       const struct smb_filename *smb_fname)
 {
-       return SMB_VFS_NEXT_SYS_ACL_DELETE_DEF_FILE(handle, path);
+       return SMB_VFS_NEXT_SYS_ACL_DELETE_DEF_FILE(handle, smb_fname);
 }
 
-static ssize_t skel_getxattr(vfs_handle_struct *handle, const char *path,
-                            const char *name, void *value, size_t size)
+static ssize_t skel_getxattr(vfs_handle_struct *handle,
+                               const struct smb_filename *smb_fname,
+                               const char *name,
+                               void *value,
+                               size_t size)
 {
-       return SMB_VFS_NEXT_GETXATTR(handle, path, name, value, size);
+       return SMB_VFS_NEXT_GETXATTR(handle, smb_fname, name, value, size);
 }
 
 static ssize_t skel_fgetxattr(vfs_handle_struct *handle,
@@ -765,10 +1011,12 @@ static ssize_t skel_fgetxattr(vfs_handle_struct *handle,
        return SMB_VFS_NEXT_FGETXATTR(handle, fsp, name, value, size);
 }
 
-static ssize_t skel_listxattr(vfs_handle_struct *handle, const char *path,
-                             char *list, size_t size)
+static ssize_t skel_listxattr(vfs_handle_struct *handle,
+                               const struct smb_filename *smb_fname,
+                               char *list,
+                               size_t size)
 {
-       return SMB_VFS_NEXT_LISTXATTR(handle, path, list, size);
+       return SMB_VFS_NEXT_LISTXATTR(handle, smb_fname, list, size);
 }
 
 static ssize_t skel_flistxattr(vfs_handle_struct *handle,
@@ -778,10 +1026,11 @@ static ssize_t skel_flistxattr(vfs_handle_struct *handle,
        return SMB_VFS_NEXT_FLISTXATTR(handle, fsp, list, size);
 }
 
-static int skel_removexattr(vfs_handle_struct *handle, const char *path,
-                           const char *name)
+static int skel_removexattr(vfs_handle_struct *handle,
+                       const struct smb_filename *smb_fname,
+                       const char *name)
 {
-       return SMB_VFS_NEXT_REMOVEXATTR(handle, path, name);
+       return SMB_VFS_NEXT_REMOVEXATTR(handle, smb_fname, name);
 }
 
 static int skel_fremovexattr(vfs_handle_struct *handle,
@@ -790,11 +1039,15 @@ static int skel_fremovexattr(vfs_handle_struct *handle,
        return SMB_VFS_NEXT_FREMOVEXATTR(handle, fsp, name);
 }
 
-static int skel_setxattr(vfs_handle_struct *handle, const char *path,
-                        const char *name, const void *value, size_t size,
-                        int flags)
+static int skel_setxattr(vfs_handle_struct *handle,
+                       const struct smb_filename *smb_fname,
+                       const char *name,
+                       const void *value,
+                       size_t size,
+                       int flags)
 {
-       return SMB_VFS_NEXT_SETXATTR(handle, path, name, value, size, flags);
+       return SMB_VFS_NEXT_SETXATTR(handle, smb_fname,
+                       name, value, size, flags);
 }
 
 static int skel_fsetxattr(vfs_handle_struct *handle, struct files_struct *fsp,
@@ -810,22 +1063,63 @@ static bool skel_aio_force(struct vfs_handle_struct *handle,
        return SMB_VFS_NEXT_AIO_FORCE(handle, fsp);
 }
 
-static bool skel_is_offline(struct vfs_handle_struct *handle,
-                           const struct smb_filename *fname,
-                           SMB_STRUCT_STAT *sbuf)
+static NTSTATUS skel_audit_file(struct vfs_handle_struct *handle,
+                               struct smb_filename *file,
+                               struct security_acl *sacl,
+                               uint32_t access_requested,
+                               uint32_t access_denied)
+{
+       return SMB_VFS_NEXT_AUDIT_FILE(handle,
+                                      file,
+                                      sacl,
+                                      access_requested,
+                                      access_denied);
+}
+
+static NTSTATUS skel_durable_cookie(struct vfs_handle_struct *handle,
+                                   struct files_struct *fsp,
+                                   TALLOC_CTX *mem_ctx,
+                                   DATA_BLOB *cookie)
+{
+       return SMB_VFS_NEXT_DURABLE_COOKIE(handle,
+                                          fsp,
+                                          mem_ctx,
+                                          cookie);
+}
+
+static NTSTATUS skel_durable_disconnect(struct vfs_handle_struct *handle,
+                                       struct files_struct *fsp,
+                                       const DATA_BLOB old_cookie,
+                                       TALLOC_CTX *mem_ctx,
+                                       DATA_BLOB *new_cookie)
 {
-       return SMB_VFS_NEXT_IS_OFFLINE(handle, fname, sbuf);
+       return SMB_VFS_NEXT_DURABLE_DISCONNECT(handle,
+                                              fsp,
+                                              old_cookie,
+                                              mem_ctx,
+                                              new_cookie);
 }
 
-static int skel_set_offline(struct vfs_handle_struct *handle,
-                           const struct smb_filename *fname)
+static NTSTATUS skel_durable_reconnect(struct vfs_handle_struct *handle,
+                                      struct smb_request *smb1req,
+                                      struct smbXsrv_open *op,
+                                      const DATA_BLOB old_cookie,
+                                      TALLOC_CTX *mem_ctx,
+                                      struct files_struct **fsp,
+                                      DATA_BLOB *new_cookie)
 {
-       return SMB_VFS_NEXT_SET_OFFLINE(handle, fname);
+       return SMB_VFS_NEXT_DURABLE_RECONNECT(handle,
+                                             smb1req,
+                                             op,
+                                             old_cookie,
+                                             mem_ctx,
+                                             fsp,
+                                             new_cookie);
 }
 
 /* VFS operations structure */
 
-struct vfs_fn_pointers skel_transparent_fns = {
+static struct vfs_fn_pointers skel_transparent_fns = {
        /* Disk operations */
 
        .connect_fn = skel_connect,
@@ -837,6 +1131,9 @@ struct vfs_fn_pointers skel_transparent_fns = {
        .statvfs_fn = skel_statvfs,
        .fs_capabilities_fn = skel_fs_capabilities,
        .get_dfs_referrals_fn = skel_get_dfs_referrals,
+       .snap_check_path_fn = skel_snap_check_path,
+       .snap_create_fn = skel_snap_create,
+       .snap_delete_fn = skel_snap_delete,
 
        /* Directory operations */
 
@@ -849,18 +1146,15 @@ struct vfs_fn_pointers skel_transparent_fns = {
        .mkdir_fn = skel_mkdir,
        .rmdir_fn = skel_rmdir,
        .closedir_fn = skel_closedir,
-       .init_search_op_fn = skel_init_search_op,
 
        /* File operations */
 
        .open_fn = skel_open,
        .create_file_fn = skel_create_file,
        .close_fn = skel_close_fn,
-       .read_fn = skel_vfs_read,
        .pread_fn = skel_pread,
        .pread_send_fn = skel_pread_send,
        .pread_recv_fn = skel_pread_recv,
-       .write_fn = skel_write,
        .pwrite_fn = skel_pwrite,
        .pwrite_send_fn = skel_pwrite_send,
        .pwrite_recv_fn = skel_pwrite_recv,
@@ -868,7 +1162,6 @@ struct vfs_fn_pointers skel_transparent_fns = {
        .sendfile_fn = skel_sendfile,
        .recvfile_fn = skel_recvfile,
        .rename_fn = skel_rename,
-       .fsync_fn = skel_fsync,
        .fsync_send_fn = skel_fsync_send,
        .fsync_recv_fn = skel_fsync_recv,
        .stat_fn = skel_stat,
@@ -895,9 +1188,14 @@ struct vfs_fn_pointers skel_transparent_fns = {
        .link_fn = skel_link,
        .mknod_fn = skel_mknod,
        .realpath_fn = skel_realpath,
-       .notify_watch_fn = skel_notify_watch,
        .chflags_fn = skel_chflags,
        .file_id_create_fn = skel_file_id_create,
+       .offload_read_send_fn = skel_offload_read_send,
+       .offload_read_recv_fn = skel_offload_read_recv,
+       .offload_write_send_fn = skel_offload_write_send,
+       .offload_write_recv_fn = skel_offload_write_recv,
+       .get_compression_fn = skel_get_compression,
+       .set_compression_fn = skel_set_compression,
 
        .streaminfo_fn = skel_streaminfo,
        .get_real_filename_fn = skel_get_real_filename,
@@ -905,10 +1203,17 @@ struct vfs_fn_pointers skel_transparent_fns = {
        .brl_lock_windows_fn = skel_brl_lock_windows,
        .brl_unlock_windows_fn = skel_brl_unlock_windows,
        .brl_cancel_windows_fn = skel_brl_cancel_windows,
-       .strict_lock_fn = skel_strict_lock,
-       .strict_unlock_fn = skel_strict_unlock,
+       .strict_lock_check_fn = skel_strict_lock_check,
        .translate_name_fn = skel_translate_name,
        .fsctl_fn = skel_fsctl,
+       .readdir_attr_fn = skel_readdir_attr,
+       .audit_file_fn = skel_audit_file,
+
+       /* DOS attributes. */
+       .get_dos_attributes_fn = skel_get_dos_attributes,
+       .fget_dos_attributes_fn = skel_fget_dos_attributes,
+       .set_dos_attributes_fn = skel_set_dos_attributes,
+       .fset_dos_attributes_fn = skel_fset_dos_attributes,
 
        /* NT ACL operations. */
 
@@ -918,9 +1223,6 @@ struct vfs_fn_pointers skel_transparent_fns = {
 
        /* POSIX ACL operations. */
 
-       .chmod_acl_fn = skel_chmod_acl,
-       .fchmod_acl_fn = skel_fchmod_acl,
-
        .sys_acl_get_file_fn = skel_sys_acl_get_file,
        .sys_acl_get_fd_fn = skel_sys_acl_get_fd,
        .sys_acl_blob_get_file_fn = skel_sys_acl_blob_get_file,
@@ -942,13 +1244,23 @@ struct vfs_fn_pointers skel_transparent_fns = {
        /* aio operations */
        .aio_force_fn = skel_aio_force,
 
-       /* offline operations */
-       .is_offline_fn = skel_is_offline,
-       .set_offline_fn = skel_set_offline
+       /* durable handle operations */
+       .durable_cookie_fn = skel_durable_cookie,
+       .durable_disconnect_fn = skel_durable_disconnect,
+       .durable_reconnect_fn = skel_durable_reconnect,
 };
 
-NTSTATUS vfs_skel_transparent_init(void)
-{
+static_decl_vfs;
+NTSTATUS vfs_skel_transparent_init(TALLOC_CTX *ctx)
+{
+       /*
+        * smb_vfs_assert_all_fns() is only needed in
+        * order to have a complete example.
+        *
+        * A transparent vfs module typically don't
+        * need to implement every calls.
+        */
+       smb_vfs_assert_all_fns(&skel_transparent_fns, "skel_transparent");
        return smb_register_vfs(SMB_VFS_INTERFACE_VERSION, "skel_transparent",
                                &skel_transparent_fns);
 }