1
0
mirror of https://github.com/systemd/systemd synced 2024-07-09 04:26:06 +00:00

copy: rename reflink_full() -> reflink_range()

The commit b640e274a7 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.
This commit is contained in:
Yu Watanabe 2023-04-28 14:05:29 +09:00
parent c63dde8099
commit 71e84b4be6
3 changed files with 4 additions and 4 deletions

View File

@ -69,7 +69,7 @@ static int copy_cluster(
ssize_t l;
int r;
r = reflink_full(sfd, soffset, dfd, doffset, cluster_size);
r = reflink_range(sfd, soffset, dfd, doffset, cluster_size);
if (r >= 0)
return r;

View File

@ -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,

View File

@ -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);