vfs: add snapshot create/delete hooks
authorDavid Disseldorp <ddiss@samba.org>
Tue, 10 Apr 2012 01:16:57 +0000 (03:16 +0200)
committerDavid Disseldorp <ddiss@samba.org>
Wed, 19 Sep 2012 03:59:04 +0000 (05:59 +0200)
source3/include/vfs.h
source3/include/vfs_macros.h
source3/smbd/vfs.c

index f360eb160bed1c89c84bd6428a7ec478704e9b34..e68c6f616a5386b3f7c3d2b87ba816c920443268 100644 (file)
 /* Bump to version 30 - Samba 4.0.0 will ship with interface version 30 */
 /* Leave at 30 - not yet released. Added conn->cwd to save vfs_GetWd() calls. */
 /* Leave at 30 - not yet released. add SMB_VFS_COPY_CHUNK() */
+/* Leave at 30 - not yet released. add snapshot create/delete calls */
 #define SMB_VFS_INTERFACE_VERSION 30
 
 /*
@@ -620,6 +621,25 @@ struct vfs_fn_pointers {
        NTSTATUS (*copy_chunk_recv_fn)(struct vfs_handle_struct *handle,
                                       struct tevent_req *req,
                                       off_t *copied);
+       NTSTATUS (*snap_check_path_fn)(struct vfs_handle_struct *handle,
+                                      TALLOC_CTX *mem_ctx,
+                                      const char *service_path,
+                                      char **base_volume);
+       struct tevent_req *(*snap_create_send_fn)(struct vfs_handle_struct *handle,
+                                                 TALLOC_CTX *mem_ctx,
+                                                 struct tevent_context *ev,
+                                                 const char *base_volume,
+                                                 time_t *tstamp);
+       NTSTATUS (*snap_create_recv_fn)(struct vfs_handle_struct *handle,
+                                       struct tevent_req *req,
+                                       TALLOC_CTX *mem_ctx,
+                                       char **base_path, char **snap_path);
+       struct tevent_req *(*snap_delete_send_fn)(struct vfs_handle_struct *handle,
+                                                 TALLOC_CTX *mem_ctx,
+                                                 struct tevent_context *ev,
+                                                 char *snap_path);
+       NTSTATUS (*snap_delete_recv_fn)(struct vfs_handle_struct *handle,
+                                       struct tevent_req *req);
 
        NTSTATUS (*streaminfo_fn)(struct vfs_handle_struct *handle,
                                  struct files_struct *fsp,
@@ -1094,6 +1114,25 @@ struct tevent_req *smb_vfs_call_copy_chunk_send(struct vfs_handle_struct *handle
 NTSTATUS smb_vfs_call_copy_chunk_recv(struct vfs_handle_struct *handle,
                                      struct tevent_req *req,
                                      off_t *copied);
+NTSTATUS smb_vfs_call_snap_check_path(vfs_handle_struct *handle,
+                                     TALLOC_CTX *mem_ctx,
+                                     const char *service_path,
+                                     char **base_volume);
+struct tevent_req *smb_vfs_call_snap_create_send(struct vfs_handle_struct *handle,
+                                                TALLOC_CTX *mem_ctx,
+                                                struct tevent_context *ev,
+                                                const char *base_volume,
+                                                time_t *tstamp);
+NTSTATUS smb_vfs_call_snap_create_recv(struct vfs_handle_struct *handle,
+                                      struct tevent_req *req,
+                                      TALLOC_CTX *mem_ctx,
+                                      char **base_path, char **snap_path);
+struct tevent_req *smb_vfs_call_snap_delete_send(struct vfs_handle_struct *handle,
+                                                TALLOC_CTX *mem_ctx,
+                                                struct tevent_context *ev,
+                                                char *snap_path);
+NTSTATUS smb_vfs_call_snap_delete_recv(struct vfs_handle_struct *handle,
+                                      struct tevent_req *req);
 NTSTATUS smb_vfs_call_fget_nt_acl(struct vfs_handle_struct *handle,
                                  struct files_struct *fsp,
                                  uint32 security_info,
index 67b5af526f453447faf5dfe6d0eb7465ebf53879..bf64441733fa25e69759c1cbb0d771c7689f1019 100644 (file)
 #define SMB_VFS_NEXT_COPY_CHUNK_RECV(handle, req, copied) \
        smb_vfs_call_copy_chunk_recv((handle)->next, (req), (copied))
 
+#define SMB_VFS_SNAP_CHECK_PATH(conn, mem_ctx, service_path, base_volume) \
+       smb_vfs_call_snap_check_path((conn)->vfs_handles, (mem_ctx), (service_path), (base_volume))
+#define SMB_VFS_SNAP_CREATE_SEND(conn, mem_ctx, ev, base_volume, tstamp) \
+       smb_vfs_call_snap_create_send((conn)->vfs_handles, (mem_ctx), (ev), (base_volume), (tstamp))
+#define SMB_VFS_SNAP_CREATE_RECV(conn, req, mem_ctx, base_path, snap_path) \
+       smb_vfs_call_snap_create_recv((conn)->vfs_handles, (req), (mem_ctx), (base_path), (snap_path))
+#define SMB_VFS_SNAP_DELETE_SEND(conn, mem_ctx, ev, snap_path) \
+       smb_vfs_call_snap_delete_send((conn)->vfs_handles, (mem_ctx), (ev), (snap_path))
+#define SMB_VFS_SNAP_DELETE_RECV(conn, req) \
+       smb_vfs_call_snap_delete_recv((conn)->vfs_handles, (req))
+
 #define SMB_VFS_FGET_NT_ACL(fsp, security_info, ppdesc) \
        smb_vfs_call_fget_nt_acl((fsp)->conn->vfs_handles, (fsp), (security_info), (ppdesc))
 #define SMB_VFS_NEXT_FGET_NT_ACL(handle, fsp, security_info, ppdesc) \
index b8d90df77cca6a132ee6a3a07db0c7e3a77511f5..e82a68fe18764210ae6448cc373f79250652ff79 100644 (file)
@@ -2184,6 +2184,53 @@ NTSTATUS smb_vfs_call_copy_chunk_recv(struct vfs_handle_struct *handle,
        return handle->fns->copy_chunk_recv_fn(handle, req, copied);
 }
 
+NTSTATUS smb_vfs_call_snap_check_path(vfs_handle_struct *handle,
+                                     TALLOC_CTX *mem_ctx,
+                                     const char *service_path,
+                                     char **base_volume)
+{
+       VFS_FIND(snap_check_path);
+       return handle->fns->snap_check_path_fn(handle, mem_ctx, service_path,
+                                              base_volume);
+}
+
+struct tevent_req *smb_vfs_call_snap_create_send(struct vfs_handle_struct *handle,
+                                                TALLOC_CTX *mem_ctx,
+                                                struct tevent_context *ev,
+                                                const char *base_volume,
+                                                time_t *tstamp)
+{
+       VFS_FIND(snap_create_send);
+       return handle->fns->snap_create_send_fn(handle, mem_ctx, ev,
+                                               base_volume, tstamp);
+}
+
+NTSTATUS smb_vfs_call_snap_create_recv(struct vfs_handle_struct *handle,
+                                      struct tevent_req *req,
+                                      TALLOC_CTX *mem_ctx,
+                                      char **base_path, char **snap_path)
+{
+       VFS_FIND(snap_create_recv);
+       return handle->fns->snap_create_recv_fn(handle, req, mem_ctx,
+                                               base_path, snap_path);
+}
+
+struct tevent_req *smb_vfs_call_snap_delete_send(struct vfs_handle_struct *handle,
+                                                TALLOC_CTX *mem_ctx,
+                                                struct tevent_context *ev,
+                                                char *snap_path)
+{
+       VFS_FIND(snap_delete_send);
+       return handle->fns->snap_delete_send_fn(handle, mem_ctx, ev, snap_path);
+}
+
+NTSTATUS smb_vfs_call_snap_delete_recv(struct vfs_handle_struct *handle,
+                                      struct tevent_req *req)
+{
+       VFS_FIND(snap_delete_recv);
+       return handle->fns->snap_delete_recv_fn(handle, req);
+}
+
 NTSTATUS smb_vfs_call_fget_nt_acl(struct vfs_handle_struct *handle,
                                  struct files_struct *fsp,
                                  uint32 security_info,