Page Menu
Home
FreeBSD
Search
Configure Global Search
Log In
Files
F137763404
D22959.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Flag For Later
Award Token
Size
2 KB
Referenced Files
None
Subscribers
None
D22959.diff
View Options
Index: head/sys/amd64/linux/linux_dummy.c
===================================================================
--- head/sys/amd64/linux/linux_dummy.c
+++ head/sys/amd64/linux/linux_dummy.c
@@ -144,8 +144,6 @@
DUMMY(membarrier);
/* Linux 4.4: */
DUMMY(mlock2);
-/* Linux 4.5: */
-DUMMY(copy_file_range);
/* Linux 4.6: */
DUMMY(preadv2);
DUMMY(pwritev2);
Index: head/sys/amd64/linux32/linux32_dummy.c
===================================================================
--- head/sys/amd64/linux32/linux32_dummy.c
+++ head/sys/amd64/linux32/linux32_dummy.c
@@ -148,8 +148,6 @@
DUMMY(membarrier);
/* Linux 4.4: */
DUMMY(mlock2);
-/* Linux 4.5: */
-DUMMY(copy_file_range);
/* Linux 4.6: */
DUMMY(preadv2);
DUMMY(pwritev2);
Index: head/sys/arm64/linux/linux_dummy.c
===================================================================
--- head/sys/arm64/linux/linux_dummy.c
+++ head/sys/arm64/linux/linux_dummy.c
@@ -142,8 +142,6 @@
DUMMY(membarrier);
/* Linux 4.4: */
DUMMY(mlock2);
-/* Linux 4.5: */
-DUMMY(copy_file_range);
/* Linux 4.6: */
DUMMY(preadv2);
DUMMY(pwritev2);
Index: head/sys/compat/linux/linux_file.c
===================================================================
--- head/sys/compat/linux/linux_file.c
+++ head/sys/compat/linux/linux_file.c
@@ -1565,3 +1565,44 @@
return (kern_posix_fallocate(td, args->fd, args->offset,
args->len));
}
+
+int
+linux_copy_file_range(struct thread *td, struct linux_copy_file_range_args
+ *args)
+{
+ l_loff_t inoff, outoff, *inoffp, *outoffp;
+ int error, flags;
+
+ /*
+ * copy_file_range(2) on Linux doesn't define any flags (yet), so is
+ * the native implementation. Enforce it.
+ */
+ if (args->flags != 0) {
+ linux_msg(td, "copy_file_range unsupported flags 0x%x",
+ args->flags);
+ return (EINVAL);
+ }
+ flags = 0;
+ inoffp = outoffp = NULL;
+ if (args->off_in != NULL) {
+ error = copyin(args->off_in, &inoff, sizeof(l_loff_t));
+ if (error != 0)
+ return (error);
+ inoffp = &inoff;
+ }
+ if (args->off_out != NULL) {
+ error = copyin(args->off_out, &outoff, sizeof(l_loff_t));
+ if (error != 0)
+ return (error);
+ outoffp = &outoff;
+ }
+
+ error = kern_copy_file_range(td, args->fd_in, inoffp, args->fd_out,
+ outoffp, args->len, flags);
+ if (error == 0 && args->off_in != NULL)
+ error = copyout(inoffp, args->off_in, sizeof(l_loff_t));
+ if (error == 0 && args->off_out != NULL)
+ error = copyout(outoffp, args->off_out, sizeof(l_loff_t));
+ return (error);
+}
+
Index: head/sys/i386/linux/linux_dummy.c
===================================================================
--- head/sys/i386/linux/linux_dummy.c
+++ head/sys/i386/linux/linux_dummy.c
@@ -144,8 +144,6 @@
DUMMY(membarrier);
/* Linux 4.4: */
DUMMY(mlock2);
-/* Linux 4.5: */
-DUMMY(copy_file_range);
/* Linux 4.6: */
DUMMY(preadv2);
DUMMY(pwritev2);
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Wed, Nov 26, 2:53 PM (3 h, 47 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
26216384
Default Alt Text
D22959.diff (2 KB)
Attached To
Mode
D22959: linux(4): implement copy_file_range(2)
Attached
Detach File
Event Timeline
Log In to Comment