Skip to contentSkip to conversation

ioctl: add note regarding CLONE_RANGE(len=0) behaviour

PATCH New David Disseldorp 1 participant 1 message Feb 6, 2014 Btrfs file system

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 ioctl: add note regarding CLONE_RANGE(len=0) behaviour

A BTRFS_IOC_CLONE_RANGE request with a src_length value of zero has the effect of cloning all data from src_offset through to end-of-file.

Document this behaviour in the header file for those who (like me) incorrectly assume that no data is cloned in such a case.

---
 ioctl.h | 1 +
 1 file changed, 1 insertion(+)
ioctl.h +1 -0
index a589cd7..f7d435d 100644
@@ -506,6 +506,7 @@ static inline char *btrfs_err_str(enum btrfs_err_code err_code)
 #define BTRFS_IOC_SCAN_DEV _IOW(BTRFS_IOCTL_MAGIC, 4, \
 				   struct btrfs_ioctl_vol_args)
 
+/* With a @src_length of zero, the range from @src_offset->EOF is cloned! */
 struct btrfs_ioctl_clone_range_args {
 	__s64 src_fd;
 	__u64 src_offset, src_length;
Signature · 1 line
1.8.4.5