fs: make the pipe_buf_operations ->confirm operation optional
Just return 0 for success if it is not present. Signed-off-by: Christoph Hellwig <hch@lst.de> Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
This commit is contained in:

committed by
Al Viro

parent
76887c2567
commit
b8d9e7f241
17
fs/pipe.c
17
fs/pipe.c
@@ -200,22 +200,6 @@ bool generic_pipe_buf_get(struct pipe_inode_info *pipe, struct pipe_buffer *buf)
|
|||||||
}
|
}
|
||||||
EXPORT_SYMBOL(generic_pipe_buf_get);
|
EXPORT_SYMBOL(generic_pipe_buf_get);
|
||||||
|
|
||||||
/**
|
|
||||||
* generic_pipe_buf_confirm - verify contents of the pipe buffer
|
|
||||||
* @info: the pipe that the buffer belongs to
|
|
||||||
* @buf: the buffer to confirm
|
|
||||||
*
|
|
||||||
* Description:
|
|
||||||
* This function does nothing, because the generic pipe code uses
|
|
||||||
* pages that are always good when inserted into the pipe.
|
|
||||||
*/
|
|
||||||
int generic_pipe_buf_confirm(struct pipe_inode_info *info,
|
|
||||||
struct pipe_buffer *buf)
|
|
||||||
{
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
EXPORT_SYMBOL(generic_pipe_buf_confirm);
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* generic_pipe_buf_release - put a reference to a &struct pipe_buffer
|
* generic_pipe_buf_release - put a reference to a &struct pipe_buffer
|
||||||
* @pipe: the pipe that the buffer belongs to
|
* @pipe: the pipe that the buffer belongs to
|
||||||
@@ -232,7 +216,6 @@ void generic_pipe_buf_release(struct pipe_inode_info *pipe,
|
|||||||
EXPORT_SYMBOL(generic_pipe_buf_release);
|
EXPORT_SYMBOL(generic_pipe_buf_release);
|
||||||
|
|
||||||
static const struct pipe_buf_operations anon_pipe_buf_ops = {
|
static const struct pipe_buf_operations anon_pipe_buf_ops = {
|
||||||
.confirm = generic_pipe_buf_confirm,
|
|
||||||
.release = anon_pipe_buf_release,
|
.release = anon_pipe_buf_release,
|
||||||
.steal = anon_pipe_buf_steal,
|
.steal = anon_pipe_buf_steal,
|
||||||
.get = generic_pipe_buf_get,
|
.get = generic_pipe_buf_get,
|
||||||
|
@@ -156,7 +156,6 @@ static int user_page_pipe_buf_steal(struct pipe_inode_info *pipe,
|
|||||||
}
|
}
|
||||||
|
|
||||||
static const struct pipe_buf_operations user_page_pipe_buf_ops = {
|
static const struct pipe_buf_operations user_page_pipe_buf_ops = {
|
||||||
.confirm = generic_pipe_buf_confirm,
|
|
||||||
.release = page_cache_pipe_buf_release,
|
.release = page_cache_pipe_buf_release,
|
||||||
.steal = user_page_pipe_buf_steal,
|
.steal = user_page_pipe_buf_steal,
|
||||||
.get = generic_pipe_buf_get,
|
.get = generic_pipe_buf_get,
|
||||||
@@ -331,7 +330,6 @@ ssize_t generic_file_splice_read(struct file *in, loff_t *ppos,
|
|||||||
EXPORT_SYMBOL(generic_file_splice_read);
|
EXPORT_SYMBOL(generic_file_splice_read);
|
||||||
|
|
||||||
const struct pipe_buf_operations default_pipe_buf_ops = {
|
const struct pipe_buf_operations default_pipe_buf_ops = {
|
||||||
.confirm = generic_pipe_buf_confirm,
|
|
||||||
.release = generic_pipe_buf_release,
|
.release = generic_pipe_buf_release,
|
||||||
.steal = generic_pipe_buf_steal,
|
.steal = generic_pipe_buf_steal,
|
||||||
.get = generic_pipe_buf_get,
|
.get = generic_pipe_buf_get,
|
||||||
@@ -339,7 +337,6 @@ const struct pipe_buf_operations default_pipe_buf_ops = {
|
|||||||
|
|
||||||
/* Pipe buffer operations for a socket and similar. */
|
/* Pipe buffer operations for a socket and similar. */
|
||||||
const struct pipe_buf_operations nosteal_pipe_buf_ops = {
|
const struct pipe_buf_operations nosteal_pipe_buf_ops = {
|
||||||
.confirm = generic_pipe_buf_confirm,
|
|
||||||
.release = generic_pipe_buf_release,
|
.release = generic_pipe_buf_release,
|
||||||
.get = generic_pipe_buf_get,
|
.get = generic_pipe_buf_get,
|
||||||
};
|
};
|
||||||
|
@@ -82,7 +82,7 @@ struct pipe_buf_operations {
|
|||||||
* and that the contents are good. If the pages in the pipe belong
|
* and that the contents are good. If the pages in the pipe belong
|
||||||
* to a file system, we may need to wait for IO completion in this
|
* to a file system, we may need to wait for IO completion in this
|
||||||
* hook. Returns 0 for good, or a negative error value in case of
|
* hook. Returns 0 for good, or a negative error value in case of
|
||||||
* error.
|
* error. If not present all pages are considered good.
|
||||||
*/
|
*/
|
||||||
int (*confirm)(struct pipe_inode_info *, struct pipe_buffer *);
|
int (*confirm)(struct pipe_inode_info *, struct pipe_buffer *);
|
||||||
|
|
||||||
@@ -195,6 +195,8 @@ static inline void pipe_buf_release(struct pipe_inode_info *pipe,
|
|||||||
static inline int pipe_buf_confirm(struct pipe_inode_info *pipe,
|
static inline int pipe_buf_confirm(struct pipe_inode_info *pipe,
|
||||||
struct pipe_buffer *buf)
|
struct pipe_buffer *buf)
|
||||||
{
|
{
|
||||||
|
if (!buf->ops->confirm)
|
||||||
|
return 0;
|
||||||
return buf->ops->confirm(pipe, buf);
|
return buf->ops->confirm(pipe, buf);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -232,7 +234,6 @@ void free_pipe_info(struct pipe_inode_info *);
|
|||||||
|
|
||||||
/* Generic pipe buffer ops functions */
|
/* Generic pipe buffer ops functions */
|
||||||
bool generic_pipe_buf_get(struct pipe_inode_info *, struct pipe_buffer *);
|
bool generic_pipe_buf_get(struct pipe_inode_info *, struct pipe_buffer *);
|
||||||
int generic_pipe_buf_confirm(struct pipe_inode_info *, struct pipe_buffer *);
|
|
||||||
int generic_pipe_buf_steal(struct pipe_inode_info *, struct pipe_buffer *);
|
int generic_pipe_buf_steal(struct pipe_inode_info *, struct pipe_buffer *);
|
||||||
void generic_pipe_buf_release(struct pipe_inode_info *, struct pipe_buffer *);
|
void generic_pipe_buf_release(struct pipe_inode_info *, struct pipe_buffer *);
|
||||||
|
|
||||||
|
@@ -1177,7 +1177,6 @@ static void relay_pipe_buf_release(struct pipe_inode_info *pipe,
|
|||||||
}
|
}
|
||||||
|
|
||||||
static const struct pipe_buf_operations relay_pipe_buf_ops = {
|
static const struct pipe_buf_operations relay_pipe_buf_ops = {
|
||||||
.confirm = generic_pipe_buf_confirm,
|
|
||||||
.release = relay_pipe_buf_release,
|
.release = relay_pipe_buf_release,
|
||||||
.steal = generic_pipe_buf_steal,
|
.steal = generic_pipe_buf_steal,
|
||||||
.get = generic_pipe_buf_get,
|
.get = generic_pipe_buf_get,
|
||||||
|
@@ -7574,7 +7574,6 @@ static bool buffer_pipe_buf_get(struct pipe_inode_info *pipe,
|
|||||||
|
|
||||||
/* Pipe buffer operations for a buffer. */
|
/* Pipe buffer operations for a buffer. */
|
||||||
static const struct pipe_buf_operations buffer_pipe_buf_ops = {
|
static const struct pipe_buf_operations buffer_pipe_buf_ops = {
|
||||||
.confirm = generic_pipe_buf_confirm,
|
|
||||||
.release = buffer_pipe_buf_release,
|
.release = buffer_pipe_buf_release,
|
||||||
.get = buffer_pipe_buf_get,
|
.get = buffer_pipe_buf_get,
|
||||||
};
|
};
|
||||||
|
@@ -130,7 +130,6 @@ out:
|
|||||||
}
|
}
|
||||||
|
|
||||||
static const struct pipe_buf_operations smc_pipe_ops = {
|
static const struct pipe_buf_operations smc_pipe_ops = {
|
||||||
.confirm = generic_pipe_buf_confirm,
|
|
||||||
.release = smc_rx_pipe_buf_release,
|
.release = smc_rx_pipe_buf_release,
|
||||||
.get = generic_pipe_buf_get
|
.get = generic_pipe_buf_get
|
||||||
};
|
};
|
||||||
|
Reference in New Issue
Block a user