[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 #include <linux/crash_dump.h> 28 #include <linux/backing-dev.h> 29 #include <linux/bootmem.h> 30 31 #include <asm/uaccess.h> 32 #include <asm/io.h> ··· 579 return count; 580 } 581 582 #ifdef CONFIG_MMU 583 /* 584 * For fun, we are using the MMU for this. ··· 798 .llseek = null_lseek, 799 .read = read_null, 800 .write = write_null, 801 }; 802 803 #if defined(CONFIG_ISA) || !defined(__mc68000__)
··· 27 #include <linux/crash_dump.h> 28 #include <linux/backing-dev.h> 29 #include <linux/bootmem.h> 30 + #include <linux/pipe_fs_i.h> 31 32 #include <asm/uaccess.h> 33 #include <asm/io.h> ··· 578 return count; 579 } 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 + 593 #ifdef CONFIG_MMU 594 /* 595 * For fun, we are using the MMU for this. ··· 785 .llseek = null_lseek, 786 .read = read_null, 787 .write = write_null, 788 + .splice_write = splice_write_null, 789 }; 790 791 #if defined(CONFIG_ISA) || !defined(__mc68000__)