From 71e84b4be68746dd61b52d274da864477350fe9b Mon Sep 17 00:00:00 2001 From: Yu Watanabe Date: Fri, 28 Apr 2023 14:05:29 +0900 Subject: copy: rename reflink_full() -> reflink_range() The commit b640e274a7c363a2b6394c9dce5671d9404d2e2a introduced reflink() and reflink_full(). We usually name function xyz_full() for fully parameterized version of xyz(), and xyz() is typically a inline alias of xyz_full(). But in this case, reflink() and reflink_full() call different ioctl(). Moreover, reflink_full() does partial reflink, while reflink() does full file reflink. That's super confusing. Let's rename reflink_full() to reflink_range(), the new name is consistent with ioctl name, and should be fine. --- src/shared/copy.c | 4 ++-- src/shared/copy.h | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) (limited to 'src/shared') diff --git a/src/shared/copy.c b/src/shared/copy.c index dd1306abe9..6a5a52309a 100644 --- a/src/shared/copy.c +++ b/src/shared/copy.c @@ -203,7 +203,7 @@ int copy_bytes_full( if (foffset == 0 && toffset == 0 && max_bytes == UINT64_MAX) r = reflink(fdf, fdt); /* full file reflink */ else - r = reflink_full(fdf, foffset, fdt, toffset, max_bytes == UINT64_MAX ? 0 : max_bytes); /* partial reflink */ + r = reflink_range(fdf, foffset, fdt, toffset, max_bytes == UINT64_MAX ? 0 : max_bytes); /* partial reflink */ if (r >= 0) { off_t t; @@ -1621,7 +1621,7 @@ int reflink(int infd, int outfd) { assert_cc(sizeof(struct file_clone_range) == sizeof(struct btrfs_ioctl_clone_range_args)); -int reflink_full(int infd, uint64_t in_offset, int outfd, uint64_t out_offset, uint64_t sz) { +int reflink_range(int infd, uint64_t in_offset, int outfd, uint64_t out_offset, uint64_t sz) { struct file_clone_range args = { .src_fd = infd, .src_offset = in_offset, diff --git a/src/shared/copy.h b/src/shared/copy.h index 4f97e542f5..c4482eba7e 100644 --- a/src/shared/copy.h +++ b/src/shared/copy.h @@ -106,4 +106,4 @@ static inline int copy_rights(int fdf, int fdt) { int copy_xattr(int df, const char *from, int dt, const char *to, CopyFlags copy_flags); int reflink(int infd, int outfd); -int reflink_full(int infd, uint64_t in_offset, int outfd, uint64_t out_offset, uint64_t sz); +int reflink_range(int infd, uint64_t in_offset, int outfd, uint64_t out_offset, uint64_t sz); -- cgit v1.2.1