summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichael Adam <obnox@samba.org>2013-06-01 02:14:41 +0200
committerAndrew Bartlett <abartlet@samba.org>2013-10-05 09:21:15 +1300
commitea898ea1ac1cc9364c5b7396db3902aeb114cfb8 (patch)
tree01629af499bced546c437eb2d553d2ed074ae2cd
parentc4f9954ebb04da94a5bcd2cb328fb2fbaf9fa062 (diff)
downloadsamba-ea898ea1ac1cc9364c5b7396db3902aeb114cfb8.tar.gz
samba-ea898ea1ac1cc9364c5b7396db3902aeb114cfb8.tar.bz2
samba-ea898ea1ac1cc9364c5b7396db3902aeb114cfb8.zip
shadow_copy2: implement disk_free
Signed-off-by: Michael Adam <obnox@samba.org> Reviewed-by: Andrew Bartlett <abartlet@samba.org>
-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 4c8ee25678..9462187362 100644
--- a/source3/modules/vfs_shadow_copy2.c
+++ b/source3/modules/vfs_shadow_copy2.c
@@ -1576,6 +1576,42 @@ static int shadow_copy2_get_real_filename(struct vfs_handle_struct *handle,
return ret;
}
+static uint64_t shadow_copy2_disk_free(vfs_handle_struct *handle,
+ const char *path, bool small_query,
+ uint64_t *bsize, uint64_t *dfree,
+ uint64_t *dsize)
+{
+ time_t timestamp;
+ char *stripped;
+ ssize_t ret;
+ int saved_errno;
+ char *conv;
+
+ if (!shadow_copy2_strip_snapshot(talloc_tos(), handle, path,
+ &timestamp, &stripped)) {
+ return -1;
+ }
+ if (timestamp == 0) {
+ return SMB_VFS_NEXT_DISK_FREE(handle, path, small_query,
+ bsize, dfree, dsize);
+ }
+
+ conv = shadow_copy2_convert(talloc_tos(), handle, stripped, timestamp);
+ TALLOC_FREE(stripped);
+ if (conv == NULL) {
+ return -1;
+ }
+
+ ret = SMB_VFS_NEXT_DISK_FREE(handle, conv, small_query, bsize, dfree,
+ dsize);
+
+ saved_errno = errno;
+ TALLOC_FREE(conv);
+ errno = saved_errno;
+
+ return ret;
+}
+
static int shadow_copy2_connect(struct vfs_handle_struct *handle,
const char *service, const char *user)
{
@@ -1814,6 +1850,7 @@ static int shadow_copy2_connect(struct vfs_handle_struct *handle,
static struct vfs_fn_pointers vfs_shadow_copy2_fns = {
.connect_fn = shadow_copy2_connect,
.opendir_fn = shadow_copy2_opendir,
+ .disk_free_fn = shadow_copy2_disk_free,
.rename_fn = shadow_copy2_rename,
.link_fn = shadow_copy2_link,
.symlink_fn = shadow_copy2_symlink,