diff options
author | Jeremy Allison <jra@samba.org> | 2019-08-09 15:28:34 -0700 |
---|---|---|
committer | Jeremy Allison <jra@samba.org> | 2019-08-16 19:52:33 +0000 |
commit | a85433f4bdeaf493e5c4cbf1c4c0feb5b34a415a (patch) | |
tree | c66598c788f4ac486cb851ef745143572ded9d04 /source3/modules/vfs_snapper.c | |
parent | a2d27f9113cef750a2e9fe2aac3c70dc7191dada (diff) | |
download | samba-a85433f4bdeaf493e5c4cbf1c4c0feb5b34a415a.tar.gz |
s3: VFS: vfs_snapper. Implement renameat().
Currently identical to rename().
Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
Diffstat (limited to 'source3/modules/vfs_snapper.c')
-rw-r--r-- | source3/modules/vfs_snapper.c | 35 |
1 files changed, 35 insertions, 0 deletions
diff --git a/source3/modules/vfs_snapper.c b/source3/modules/vfs_snapper.c index 03bcf658ec6..6222b2f19a8 100644 --- a/source3/modules/vfs_snapper.c +++ b/source3/modules/vfs_snapper.c @@ -2036,6 +2036,40 @@ static int snapper_gmt_rename(vfs_handle_struct *handle, return SMB_VFS_NEXT_RENAME(handle, smb_fname_src, smb_fname_dst); } +static int snapper_gmt_renameat(vfs_handle_struct *handle, + files_struct *srcfsp, + const struct smb_filename *smb_fname_src, + files_struct *dstfsp, + const struct smb_filename *smb_fname_dst) +{ + time_t timestamp_src, timestamp_dst; + + if (!snapper_gmt_strip_snapshot(talloc_tos(), handle, + smb_fname_src->base_name, + ×tamp_src, NULL)) { + return -1; + } + if (!snapper_gmt_strip_snapshot(talloc_tos(), handle, + smb_fname_dst->base_name, + ×tamp_dst, NULL)) { + return -1; + } + if (timestamp_src != 0) { + errno = EXDEV; + return -1; + } + if (timestamp_dst != 0) { + errno = EROFS; + return -1; + } + return SMB_VFS_NEXT_RENAMEAT(handle, + srcfsp, + smb_fname_src, + dstfsp, + smb_fname_dst); +} + + static int snapper_gmt_symlink(vfs_handle_struct *handle, const char *link_contents, const struct smb_filename *new_smb_fname) @@ -2855,6 +2889,7 @@ static struct vfs_fn_pointers snapper_fns = { .disk_free_fn = snapper_gmt_disk_free, .get_quota_fn = snapper_gmt_get_quota, .rename_fn = snapper_gmt_rename, + .renameat_fn = snapper_gmt_renameat, .link_fn = snapper_gmt_link, .symlink_fn = snapper_gmt_symlink, .stat_fn = snapper_gmt_stat, |