mirror of
https://github.com/hardkernel/linux.git
synced 2026-06-05 10:31:46 +09:00
Revert "splice, net: Add a splice_eof op to file-ops and socket-ops"
This reverts commit4713b7c756which is commit2bfc668509upstream. It breaks the Android kernel abi and can be brought back in the future in an abi-safe way if it is really needed. Bug: 161946584 Change-Id: I32d590ae0e683aed39bfddcd736301bce6e0dec9 Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
This commit is contained in:
31
fs/splice.c
31
fs/splice.c
@@ -763,17 +763,6 @@ static long do_splice_from(struct pipe_inode_info *pipe, struct file *out,
|
|||||||
return out->f_op->splice_write(pipe, out, ppos, len, flags);
|
return out->f_op->splice_write(pipe, out, ppos, len, flags);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
|
||||||
* Indicate to the caller that there was a premature EOF when reading from the
|
|
||||||
* source and the caller didn't indicate they would be sending more data after
|
|
||||||
* this.
|
|
||||||
*/
|
|
||||||
static void do_splice_eof(struct splice_desc *sd)
|
|
||||||
{
|
|
||||||
if (sd->splice_eof)
|
|
||||||
sd->splice_eof(sd);
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Attempt to initiate a splice from a file to a pipe.
|
* Attempt to initiate a splice from a file to a pipe.
|
||||||
*/
|
*/
|
||||||
@@ -874,7 +863,7 @@ ssize_t splice_direct_to_actor(struct file *in, struct splice_desc *sd,
|
|||||||
|
|
||||||
ret = do_splice_to(in, &pos, pipe, len, flags);
|
ret = do_splice_to(in, &pos, pipe, len, flags);
|
||||||
if (unlikely(ret <= 0))
|
if (unlikely(ret <= 0))
|
||||||
goto read_failure;
|
goto out_release;
|
||||||
|
|
||||||
read_len = ret;
|
read_len = ret;
|
||||||
sd->total_len = read_len;
|
sd->total_len = read_len;
|
||||||
@@ -914,15 +903,6 @@ done:
|
|||||||
file_accessed(in);
|
file_accessed(in);
|
||||||
return bytes;
|
return bytes;
|
||||||
|
|
||||||
read_failure:
|
|
||||||
/*
|
|
||||||
* If the user did *not* set SPLICE_F_MORE *and* we didn't hit that
|
|
||||||
* "use all of len" case that cleared SPLICE_F_MORE, *and* we did a
|
|
||||||
* "->splice_in()" that returned EOF (ie zero) *and* we have sent at
|
|
||||||
* least 1 byte *then* we will also do the ->splice_eof() call.
|
|
||||||
*/
|
|
||||||
if (ret == 0 && !more && len > 0 && bytes)
|
|
||||||
do_splice_eof(sd);
|
|
||||||
out_release:
|
out_release:
|
||||||
/*
|
/*
|
||||||
* If we did an incomplete transfer we must release
|
* If we did an incomplete transfer we must release
|
||||||
@@ -951,14 +931,6 @@ static int direct_splice_actor(struct pipe_inode_info *pipe,
|
|||||||
sd->flags);
|
sd->flags);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void direct_file_splice_eof(struct splice_desc *sd)
|
|
||||||
{
|
|
||||||
struct file *file = sd->u.file;
|
|
||||||
|
|
||||||
if (file->f_op->splice_eof)
|
|
||||||
file->f_op->splice_eof(file);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* do_splice_direct - splices data directly between two files
|
* do_splice_direct - splices data directly between two files
|
||||||
* @in: file to splice from
|
* @in: file to splice from
|
||||||
@@ -984,7 +956,6 @@ long do_splice_direct(struct file *in, loff_t *ppos, struct file *out,
|
|||||||
.flags = flags,
|
.flags = flags,
|
||||||
.pos = *ppos,
|
.pos = *ppos,
|
||||||
.u.file = out,
|
.u.file = out,
|
||||||
.splice_eof = direct_file_splice_eof,
|
|
||||||
.opos = opos,
|
.opos = opos,
|
||||||
};
|
};
|
||||||
long ret;
|
long ret;
|
||||||
|
|||||||
@@ -2187,7 +2187,6 @@ struct file_operations {
|
|||||||
int (*flock) (struct file *, int, struct file_lock *);
|
int (*flock) (struct file *, int, struct file_lock *);
|
||||||
ssize_t (*splice_write)(struct pipe_inode_info *, struct file *, loff_t *, size_t, unsigned int);
|
ssize_t (*splice_write)(struct pipe_inode_info *, struct file *, loff_t *, size_t, unsigned int);
|
||||||
ssize_t (*splice_read)(struct file *, loff_t *, struct pipe_inode_info *, size_t, unsigned int);
|
ssize_t (*splice_read)(struct file *, loff_t *, struct pipe_inode_info *, size_t, unsigned int);
|
||||||
void (*splice_eof)(struct file *file);
|
|
||||||
int (*setlease)(struct file *, long, struct file_lock **, void **);
|
int (*setlease)(struct file *, long, struct file_lock **, void **);
|
||||||
long (*fallocate)(struct file *file, int mode, loff_t offset,
|
long (*fallocate)(struct file *file, int mode, loff_t offset,
|
||||||
loff_t len);
|
loff_t len);
|
||||||
|
|||||||
@@ -210,7 +210,6 @@ struct proto_ops {
|
|||||||
int offset, size_t size, int flags);
|
int offset, size_t size, int flags);
|
||||||
ssize_t (*splice_read)(struct socket *sock, loff_t *ppos,
|
ssize_t (*splice_read)(struct socket *sock, loff_t *ppos,
|
||||||
struct pipe_inode_info *pipe, size_t len, unsigned int flags);
|
struct pipe_inode_info *pipe, size_t len, unsigned int flags);
|
||||||
void (*splice_eof)(struct socket *sock);
|
|
||||||
int (*set_peek_off)(struct sock *sk, int val);
|
int (*set_peek_off)(struct sock *sk, int val);
|
||||||
int (*peek_len)(struct socket *sock);
|
int (*peek_len)(struct socket *sock);
|
||||||
|
|
||||||
|
|||||||
@@ -38,7 +38,6 @@ struct splice_desc {
|
|||||||
struct file *file; /* file to read/write */
|
struct file *file; /* file to read/write */
|
||||||
void *data; /* cookie */
|
void *data; /* cookie */
|
||||||
} u;
|
} u;
|
||||||
void (*splice_eof)(struct splice_desc *sd); /* Unexpected EOF handler */
|
|
||||||
loff_t pos; /* file position */
|
loff_t pos; /* file position */
|
||||||
loff_t *opos; /* sendfile: output position */
|
loff_t *opos; /* sendfile: output position */
|
||||||
size_t num_spliced; /* number of bytes already spliced */
|
size_t num_spliced; /* number of bytes already spliced */
|
||||||
|
|||||||
@@ -1293,7 +1293,6 @@ struct proto {
|
|||||||
size_t len, int flags, int *addr_len);
|
size_t len, int flags, int *addr_len);
|
||||||
int (*sendpage)(struct sock *sk, struct page *page,
|
int (*sendpage)(struct sock *sk, struct page *page,
|
||||||
int offset, size_t size, int flags);
|
int offset, size_t size, int flags);
|
||||||
void (*splice_eof)(struct socket *sock);
|
|
||||||
int (*bind)(struct sock *sk,
|
int (*bind)(struct sock *sk,
|
||||||
struct sockaddr *addr, int addr_len);
|
struct sockaddr *addr, int addr_len);
|
||||||
int (*bind_add)(struct sock *sk,
|
int (*bind_add)(struct sock *sk,
|
||||||
|
|||||||
10
net/socket.c
10
net/socket.c
@@ -130,7 +130,6 @@ static ssize_t sock_sendpage(struct file *file, struct page *page,
|
|||||||
static ssize_t sock_splice_read(struct file *file, loff_t *ppos,
|
static ssize_t sock_splice_read(struct file *file, loff_t *ppos,
|
||||||
struct pipe_inode_info *pipe, size_t len,
|
struct pipe_inode_info *pipe, size_t len,
|
||||||
unsigned int flags);
|
unsigned int flags);
|
||||||
static void sock_splice_eof(struct file *file);
|
|
||||||
|
|
||||||
#ifdef CONFIG_PROC_FS
|
#ifdef CONFIG_PROC_FS
|
||||||
static void sock_show_fdinfo(struct seq_file *m, struct file *f)
|
static void sock_show_fdinfo(struct seq_file *m, struct file *f)
|
||||||
@@ -165,7 +164,6 @@ static const struct file_operations socket_file_ops = {
|
|||||||
.sendpage = sock_sendpage,
|
.sendpage = sock_sendpage,
|
||||||
.splice_write = generic_splice_sendpage,
|
.splice_write = generic_splice_sendpage,
|
||||||
.splice_read = sock_splice_read,
|
.splice_read = sock_splice_read,
|
||||||
.splice_eof = sock_splice_eof,
|
|
||||||
.show_fdinfo = sock_show_fdinfo,
|
.show_fdinfo = sock_show_fdinfo,
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -1093,14 +1091,6 @@ static ssize_t sock_splice_read(struct file *file, loff_t *ppos,
|
|||||||
return sock->ops->splice_read(sock, ppos, pipe, len, flags);
|
return sock->ops->splice_read(sock, ppos, pipe, len, flags);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void sock_splice_eof(struct file *file)
|
|
||||||
{
|
|
||||||
struct socket *sock = file->private_data;
|
|
||||||
|
|
||||||
if (sock->ops->splice_eof)
|
|
||||||
sock->ops->splice_eof(sock);
|
|
||||||
}
|
|
||||||
|
|
||||||
static ssize_t sock_read_iter(struct kiocb *iocb, struct iov_iter *to)
|
static ssize_t sock_read_iter(struct kiocb *iocb, struct iov_iter *to)
|
||||||
{
|
{
|
||||||
struct file *file = iocb->ki_filp;
|
struct file *file = iocb->ki_filp;
|
||||||
|
|||||||
Reference in New Issue
Block a user