mwprocapture: fix linux 4.14 patch

This commit is contained in:
Cray Elliott 2017-12-23 22:50:23 -08:00
parent 5379bb4def
commit ac4a225488

View File

@ -1,24 +1,25 @@
diff -Naur ProCaptureForLinux_3773/src/sources/ospi/linux-file.c ProCaptureForLinux_3773_new/src/sources/ospi/linux-file.c
--- ProCaptureForLinux_3773/src/sources/ospi/linux-file.c 2017-12-15 01:59:57.000000000 -0800
+++ ProCaptureForLinux_3773_new/src/sources/ospi/linux-file.c 2017-12-23 22:14:08.351092413 -0800
@@ -7,8 +7,8 @@
+++ ProCaptureForLinux_3773_new/src/sources/ospi/linux-file.c 2017-12-23 22:47:33.666823299 -0800
@@ -7,8 +7,9 @@
#include "linux-file.h"
-#include <asm/uaccess.h>
#include <linux/sched.h>
+#include <asm/uaccess.h>
+#include <linux/version.h>
struct file *linux_file_open(const char *path, int flags, int mode)
{
@@ -28,29 +28,36 @@
@@ -28,29 +29,36 @@
filp_close(file, NULL);
}
-ssize_t linux_file_read(struct file *file, loff_t offset, unsigned char *data, size_t size)
+ssize_t linux_file_read(struct file *file, loff_t offset, const void *data, size_t size)
+ssize_t linux_file_read(struct file *file, loff_t offset, void *data, size_t size)
{
+#if defined(HAVE_KERNEL_WRITE_PPOS)
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(4,14,0)
+ return(kernel_read(file, data, size, &offset));
+#else
mm_segment_t oldfs;
@ -37,7 +38,7 @@ diff -Naur ProCaptureForLinux_3773/src/sources/ospi/linux-file.c ProCaptureForLi
-ssize_t linux_file_write(struct file *file, loff_t offset, unsigned char *data, size_t size)
+ssize_t linux_file_write(struct file *file, loff_t offset, const void *data, size_t size)
{
+#if defined(HAVE_KERNEL_WRITE_PPOS)
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(4,14,0)
+ return(kernel_write(file, data, size, &offset));
+#else
mm_segment_t oldfs;
@ -46,7 +47,7 @@ diff -Naur ProCaptureForLinux_3773/src/sources/ospi/linux-file.c ProCaptureForLi
oldfs = get_fs();
set_fs(get_ds());
- ret = vfs_write(file, data, size, &offset);
+ ret = vfs_write(file, (unsigned char *)data, size, &offset);
+ ret = vfs_write(file, (const unsigned char *)data, size, &offset);
set_fs(oldfs);
return ret;
@ -55,13 +56,13 @@ diff -Naur ProCaptureForLinux_3773/src/sources/ospi/linux-file.c ProCaptureForLi
-
diff -Naur ProCaptureForLinux_3773/src/sources/ospi/linux-file.h ProCaptureForLinux_3773_new/src/sources/ospi/linux-file.h
--- ProCaptureForLinux_3773/src/sources/ospi/linux-file.h 2017-12-15 01:59:57.000000000 -0800
+++ ProCaptureForLinux_3773_new/src/sources/ospi/linux-file.h 2017-12-23 21:57:18.263237473 -0800
+++ ProCaptureForLinux_3773_new/src/sources/ospi/linux-file.h 2017-12-23 22:46:22.028545189 -0800
@@ -13,9 +13,9 @@
void linux_file_close(struct file *file);
-ssize_t linux_file_read(struct file *file, loff_t offset, unsigned char *data, size_t size);
+ssize_t linux_file_read(struct file *file, loff_t offset, const void *data, size_t size);
+ssize_t linux_file_read(struct file *file, loff_t offset, void *data, size_t size);
-ssize_t linux_file_write(struct file *file, loff_t offset, unsigned char *data, size_t size);
+ssize_t linux_file_write(struct file *file, loff_t offset, const void *data, size_t size);