[PATCH] splice: add ->splice_write support for /dev/null

Useful for testing.

Signed-off-by: Jens Axboe <axboe@suse.de>

+14
+14
drivers/char/mem.c
··· 27 27 #include <linux/crash_dump.h> 28 28 #include <linux/backing-dev.h> 29 29 #include <linux/bootmem.h> 30 + #include <linux/pipe_fs_i.h> 30 31 31 32 #include <asm/uaccess.h> 32 33 #include <asm/io.h> ··· 579 578 return count; 580 579 } 581 580 581 + static int pipe_to_null(struct pipe_inode_info *info, struct pipe_buffer *buf, 582 + struct splice_desc *sd) 583 + { 584 + return sd->len; 585 + } 586 + 587 + static ssize_t splice_write_null(struct pipe_inode_info *pipe,struct file *out, 588 + loff_t *ppos, size_t len, unsigned int flags) 589 + { 590 + return splice_from_pipe(pipe, out, ppos, len, flags, pipe_to_null); 591 + } 592 + 582 593 #ifdef CONFIG_MMU 583 594 /* 584 595 * For fun, we are using the MMU for this. ··· 798 785 .llseek = null_lseek, 799 786 .read = read_null, 800 787 .write = write_null, 788 + .splice_write = splice_write_null, 801 789 }; 802 790 803 791 #if defined(CONFIG_ISA) || !defined(__mc68000__)