Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

fs: move kernel_write to fs/read_write.c

Signed-off-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>

authored by

Christoph Hellwig and committed by
Al Viro
ac452aca 317d5a5f

+16 -17
+16 -1
fs/read_write.c
··· 496 496 inc_syscw(current); 497 497 return ret; 498 498 } 499 - 500 499 EXPORT_SYMBOL(__kernel_write); 500 + 501 + ssize_t kernel_write(struct file *file, const char *buf, size_t count, 502 + loff_t pos) 503 + { 504 + mm_segment_t old_fs; 505 + ssize_t res; 506 + 507 + old_fs = get_fs(); 508 + set_fs(get_ds()); 509 + /* The cast to a user pointer is valid due to the set_fs() */ 510 + res = vfs_write(file, (__force const char __user *)buf, count, &pos); 511 + set_fs(old_fs); 512 + 513 + return res; 514 + } 515 + EXPORT_SYMBOL(kernel_write); 501 516 502 517 ssize_t vfs_write(struct file *file, const char __user *buf, size_t count, loff_t *pos) 503 518 {
-16
fs/splice.c
··· 364 364 return res; 365 365 } 366 366 367 - ssize_t kernel_write(struct file *file, const char *buf, size_t count, 368 - loff_t pos) 369 - { 370 - mm_segment_t old_fs; 371 - ssize_t res; 372 - 373 - old_fs = get_fs(); 374 - set_fs(get_ds()); 375 - /* The cast to a user pointer is valid due to the set_fs() */ 376 - res = vfs_write(file, (__force const char __user *)buf, count, &pos); 377 - set_fs(old_fs); 378 - 379 - return res; 380 - } 381 - EXPORT_SYMBOL(kernel_write); 382 - 383 367 static ssize_t default_file_splice_read(struct file *in, loff_t *ppos, 384 368 struct pipe_inode_info *pipe, size_t len, 385 369 unsigned int flags)