|
@@ -17,6 +17,7 @@
|
|
|
#include <linux/splice.h>
|
|
|
#include <linux/compat.h>
|
|
|
#include "read_write.h"
|
|
|
+#include "internal.h"
|
|
|
|
|
|
#include <asm/uaccess.h>
|
|
|
#include <asm/unistd.h>
|
|
@@ -417,6 +418,30 @@ ssize_t do_sync_write(struct file *filp, const char __user *buf, size_t len, lof
|
|
|
|
|
|
EXPORT_SYMBOL(do_sync_write);
|
|
|
|
|
|
+ssize_t __kernel_write(struct file *file, const char *buf, size_t count, loff_t *pos)
|
|
|
+{
|
|
|
+ mm_segment_t old_fs;
|
|
|
+ const char __user *p;
|
|
|
+ ssize_t ret;
|
|
|
+
|
|
|
+ old_fs = get_fs();
|
|
|
+ set_fs(get_ds());
|
|
|
+ p = (__force const char __user *)buf;
|
|
|
+ if (count > MAX_RW_COUNT)
|
|
|
+ count = MAX_RW_COUNT;
|
|
|
+ if (file->f_op->write)
|
|
|
+ ret = file->f_op->write(file, p, count, pos);
|
|
|
+ else
|
|
|
+ ret = do_sync_write(file, p, count, pos);
|
|
|
+ set_fs(old_fs);
|
|
|
+ if (ret > 0) {
|
|
|
+ fsnotify_modify(file);
|
|
|
+ add_wchar(current, ret);
|
|
|
+ }
|
|
|
+ inc_syscw(current);
|
|
|
+ return ret;
|
|
|
+}
|
|
|
+
|
|
|
ssize_t vfs_write(struct file *file, const char __user *buf, size_t count, loff_t *pos)
|
|
|
{
|
|
|
ssize_t ret;
|