summaryrefslogtreecommitdiff
path: root/source3/modules
diff options
context:
space:
mode:
authorMichael Adam <obnox@samba.org>2013-05-31 00:18:52 +0200
committerAndrew Bartlett <abartlet@samba.org>2013-10-05 09:21:22 +1300
commit38e108563d7e9e14203bf4dabfda09bd1408e980 (patch)
tree5f680c66667b90eeeade1ec57699c3b7133c09b9 /source3/modules
parent4cc5140bbe207f08d9b4fb0d119e74cc839e55dd (diff)
downloadsamba-38e108563d7e9e14203bf4dabfda09bd1408e980.tar.gz
samba-38e108563d7e9e14203bf4dabfda09bd1408e980.tar.bz2
samba-38e108563d7e9e14203bf4dabfda09bd1408e980.zip
shadow_copy2: introduce shadow_copy2_snapshot_path()
This builds the posix snapshot path for the connection at the provided timestamp. For the non-snapdirseverywhere case. Signed-off-by: Michael Adam <obnox@samba.org> Reviewed-by: Andrew Bartlett <abartlet@samba.org>
Diffstat (limited to 'source3/modules')
-rw-r--r--source3/modules/vfs_shadow_copy2.c37
1 files changed, 37 insertions, 0 deletions
diff --git a/source3/modules/vfs_shadow_copy2.c b/source3/modules/vfs_shadow_copy2.c
index ac6cdbb42d..ec608849cc 100644
--- a/source3/modules/vfs_shadow_copy2.c
+++ b/source3/modules/vfs_shadow_copy2.c
@@ -253,6 +253,43 @@ static char *shadow_copy2_insert_string(TALLOC_CTX *mem_ctx,
}
/**
+ * Build the posix snapshot path for the connection
+ * at the given timestamp, i.e. the absolute posix path
+ * that contains the snapshot for this file system.
+ *
+ * This only applies to classical case, i.e. not
+ * to the "snapdirseverywhere" mode.
+ */
+static char *shadow_copy2_snapshot_path(TALLOC_CTX *mem_ctx,
+ struct vfs_handle_struct *handle,
+ time_t snapshot)
+{
+ fstring snaptime_string;
+ size_t snaptime_len = 0;
+ char *result = NULL;
+ struct shadow_copy2_config *config;
+
+ SMB_VFS_HANDLE_GET_DATA(handle, config, struct shadow_copy2_config,
+ return NULL);
+
+ snaptime_len = shadow_copy2_posix_gmt_string(handle,
+ snapshot,
+ snaptime_string,
+ sizeof(snaptime_string));
+ if (snaptime_len <= 0) {
+ return NULL;
+ }
+
+ result = talloc_asprintf(mem_ctx, "%s/%s",
+ config->snapshot_basepath, snaptime_string);
+ if (result == NULL) {
+ DEBUG(1, (__location__ " talloc_asprintf failed\n"));
+ }
+
+ return result;
+}
+
+/**
* Strip a snapshot component from an filename as
* handed in via the smb layer.
* Returns the parsed timestamp and the stripped filename.