1
0
mirror of https://github.com/samba-team/samba.git synced 2024-12-24 21:34:56 +03:00

s3: VFS: vfs_crossrename. Implement renameat().

Currently identical to rename().

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
This commit is contained in:
Jeremy Allison 2019-08-09 14:16:12 -07:00
parent 4a415f63e6
commit c36ba3aff8

View File

@ -193,9 +193,38 @@ static int crossrename_rename(vfs_handle_struct *handle,
return result;
}
static int crossrename_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)
{
int result = -1;
START_PROFILE(syscall_renameat);
if (smb_fname_src->stream_name || smb_fname_dst->stream_name) {
errno = ENOENT;
goto out;
}
result = rename(smb_fname_src->base_name, smb_fname_dst->base_name);
if ((result == -1) && (errno == EXDEV)) {
/* Rename across filesystems needed. */
result = copy_reg(smb_fname_src->base_name,
smb_fname_dst->base_name);
}
out:
END_PROFILE(syscall_renameat);
return result;
}
static struct vfs_fn_pointers vfs_crossrename_fns = {
.connect_fn = crossrename_connect,
.rename_fn = crossrename_rename
.rename_fn = crossrename_rename,
.renameat_fn = crossrename_renameat
};
static_decl_vfs;