static int pipe_inode_write(struct inode *node, struct iobuf *iob) { struct pipe_inode *pin = vop_info(node, pipe_inode); if (pin->pin_type != PIN_WRONLY) { return -E_INVAL; } size_t ret; if ((ret = pipe_state_write(pin->state, iob->io_base, iob->io_resid)) != 0) { iobuf_skip(iob, ret); } return 0; }
static int pipe_inode_write(struct inode *node, struct iobuf *iob, int io_flags) { bool no_block = (io_flags & O_NONBLOCK) ? 1 : 0; struct pipe_inode *pin = vop_info(node, pipe_inode); if (pin->pin_type != PIN_WRONLY) { return -E_INVAL; } size_t ret; if ((ret = pipe_state_write(pin->state, iob->io_base, iob->io_resid, no_block)) != 0) { iobuf_skip(iob, ret); } return 0; }