提交 512b2268 编写于 作者: A Al Viro

switch hci_vhci to ->write_iter()

Signed-off-by: NAl Viro <viro@zeniv.linux.org.uk>
上级 13ba33e8
...@@ -160,13 +160,11 @@ static int vhci_create_device(struct vhci_data *data, __u8 opcode) ...@@ -160,13 +160,11 @@ static int vhci_create_device(struct vhci_data *data, __u8 opcode)
} }
static inline ssize_t vhci_get_user(struct vhci_data *data, static inline ssize_t vhci_get_user(struct vhci_data *data,
const struct iovec *iov, struct iov_iter *from)
unsigned long count)
{ {
size_t len = iov_length(iov, count); size_t len = iov_iter_count(from);
struct sk_buff *skb; struct sk_buff *skb;
__u8 pkt_type, opcode; __u8 pkt_type, opcode;
unsigned long i;
int ret; int ret;
if (len < 2 || len > HCI_MAX_FRAME_SIZE) if (len < 2 || len > HCI_MAX_FRAME_SIZE)
...@@ -176,12 +174,9 @@ static inline ssize_t vhci_get_user(struct vhci_data *data, ...@@ -176,12 +174,9 @@ static inline ssize_t vhci_get_user(struct vhci_data *data,
if (!skb) if (!skb)
return -ENOMEM; return -ENOMEM;
for (i = 0; i < count; i++) { if (copy_from_iter(skb_put(skb, len), len, from) != len) {
if (copy_from_user(skb_put(skb, iov[i].iov_len), kfree_skb(skb);
iov[i].iov_base, iov[i].iov_len)) { return -EFAULT;
kfree_skb(skb);
return -EFAULT;
}
} }
pkt_type = *((__u8 *) skb->data); pkt_type = *((__u8 *) skb->data);
...@@ -294,13 +289,12 @@ static ssize_t vhci_read(struct file *file, ...@@ -294,13 +289,12 @@ static ssize_t vhci_read(struct file *file,
return ret; return ret;
} }
static ssize_t vhci_write(struct kiocb *iocb, const struct iovec *iov, static ssize_t vhci_write(struct kiocb *iocb, struct iov_iter *from)
unsigned long count, loff_t pos)
{ {
struct file *file = iocb->ki_filp; struct file *file = iocb->ki_filp;
struct vhci_data *data = file->private_data; struct vhci_data *data = file->private_data;
return vhci_get_user(data, iov, count); return vhci_get_user(data, from);
} }
static unsigned int vhci_poll(struct file *file, poll_table *wait) static unsigned int vhci_poll(struct file *file, poll_table *wait)
...@@ -365,7 +359,7 @@ static int vhci_release(struct inode *inode, struct file *file) ...@@ -365,7 +359,7 @@ static int vhci_release(struct inode *inode, struct file *file)
static const struct file_operations vhci_fops = { static const struct file_operations vhci_fops = {
.owner = THIS_MODULE, .owner = THIS_MODULE,
.read = vhci_read, .read = vhci_read,
.aio_write = vhci_write, .write_iter = vhci_write,
.poll = vhci_poll, .poll = vhci_poll,
.open = vhci_open, .open = vhci_open,
.release = vhci_release, .release = vhci_release,
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册