summaryrefslogtreecommitdiff
path: root/source3/modules/vfs_snapper.c
diff options
context:
space:
mode:
authorJeremy Allison <jra@samba.org>2017-06-01 11:45:25 -0700
committerJeremy Allison <jra@samba.org>2017-06-18 02:49:25 +0200
commit0da76414fdc6a0aacea6282a76b384a702615408 (patch)
treee762b30e8ffbe21577be8f6d65dd2f0480787d82 /source3/modules/vfs_snapper.c
parent0037815453fa6141d3c0325c3ab197326324ab53 (diff)
downloadsamba-0da76414fdc6a0aacea6282a76b384a702615408.tar.gz
s3: VFS: Change SMB_VFS_GET_QUOTA to use const struct smb_filename * instead of const char *.
We need to migrate all pathname based VFS calls to use a struct to finish modernising the VFS with extra timestamp and flags parameters. Signed-off-by: Jeremy Allison <jra@samba.org> Reviewed-by: Richard Sharpe <realrichardsharpe@gmail.com>
Diffstat (limited to 'source3/modules/vfs_snapper.c')
-rw-r--r--source3/modules/vfs_snapper.c46
1 files changed, 31 insertions, 15 deletions
diff --git a/source3/modules/vfs_snapper.c b/source3/modules/vfs_snapper.c
index 774f7ee3c69..41800bf7a3a 100644
--- a/source3/modules/vfs_snapper.c
+++ b/source3/modules/vfs_snapper.c
@@ -3032,22 +3032,25 @@ static uint64_t snapper_gmt_disk_free(vfs_handle_struct *handle,
return ret;
}
-static int snapper_gmt_get_quota(vfs_handle_struct *handle, const char *path,
- enum SMB_QUOTA_TYPE qtype, unid_t id,
- SMB_DISK_QUOTA *dq)
+static int snapper_gmt_get_quota(vfs_handle_struct *handle,
+ const struct smb_filename *smb_fname,
+ enum SMB_QUOTA_TYPE qtype,
+ unid_t id,
+ SMB_DISK_QUOTA *dq)
{
- time_t timestamp;
- char *stripped;
+ time_t timestamp = 0;
+ char *stripped = NULL;
int ret;
- int saved_errno;
- char *conv;
+ int saved_errno = 0;
+ char *conv = NULL;
+ struct smb_filename *conv_smb_fname = NULL;
- if (!snapper_gmt_strip_snapshot(talloc_tos(), handle, path, &timestamp,
- &stripped)) {
+ if (!snapper_gmt_strip_snapshot(talloc_tos(), handle,
+ smb_fname->base_name, &timestamp, &stripped)) {
return -1;
}
if (timestamp == 0) {
- return SMB_VFS_NEXT_GET_QUOTA(handle, path, qtype, id, dq);
+ return SMB_VFS_NEXT_GET_QUOTA(handle, smb_fname, qtype, id, dq);
}
conv = snapper_gmt_convert(talloc_tos(), handle, stripped, timestamp);
@@ -3055,13 +3058,26 @@ static int snapper_gmt_get_quota(vfs_handle_struct *handle, const char *path,
if (conv == NULL) {
return -1;
}
-
- ret = SMB_VFS_NEXT_GET_QUOTA(handle, conv, qtype, id, dq);
-
- saved_errno = errno;
+ conv_smb_fname = synthetic_smb_fname(talloc_tos(),
+ conv,
+ NULL,
+ NULL,
+ smb_fname->flags);
TALLOC_FREE(conv);
- errno = saved_errno;
+ if (conv_smb_fname == NULL) {
+ errno = ENOMEM;
+ return -1;
+ }
+ ret = SMB_VFS_NEXT_GET_QUOTA(handle, conv_smb_fname, qtype, id, dq);
+
+ if (ret == -1) {
+ saved_errno = errno;
+ }
+ TALLOC_FREE(conv_smb_fname);
+ if (saved_errno != 0) {
+ errno = saved_errno;
+ }
return ret;
}