iov_iter: Use accessor function
Use accessor functions to access an iterator's type and direction. This allows for the possibility of using some other method of determining the type of iterator than if-chains with bitwise-AND conditions. Signed-off-by: David Howells <dhowells@redhat.com>
This commit is contained in:
@@ -2054,14 +2054,22 @@ int smbd_recv(struct smbd_connection *info, struct msghdr *msg)
|
||||
|
||||
info->smbd_recv_pending++;
|
||||
|
||||
switch (msg->msg_iter.type) {
|
||||
case READ | ITER_KVEC:
|
||||
if (iov_iter_rw(&msg->msg_iter) == WRITE) {
|
||||
/* It's a bug in upper layer to get there */
|
||||
cifs_dbg(VFS, "CIFS: invalid msg iter dir %u\n",
|
||||
iov_iter_rw(&msg->msg_iter));
|
||||
rc = -EINVAL;
|
||||
goto out;
|
||||
}
|
||||
|
||||
switch (iov_iter_type(&msg->msg_iter)) {
|
||||
case ITER_KVEC:
|
||||
buf = msg->msg_iter.kvec->iov_base;
|
||||
to_read = msg->msg_iter.kvec->iov_len;
|
||||
rc = smbd_recv_buf(info, buf, to_read);
|
||||
break;
|
||||
|
||||
case READ | ITER_BVEC:
|
||||
case ITER_BVEC:
|
||||
page = msg->msg_iter.bvec->bv_page;
|
||||
page_offset = msg->msg_iter.bvec->bv_offset;
|
||||
to_read = msg->msg_iter.bvec->bv_len;
|
||||
@@ -2071,10 +2079,11 @@ int smbd_recv(struct smbd_connection *info, struct msghdr *msg)
|
||||
default:
|
||||
/* It's a bug in upper layer to get there */
|
||||
cifs_dbg(VFS, "CIFS: invalid msg type %d\n",
|
||||
msg->msg_iter.type);
|
||||
iov_iter_type(&msg->msg_iter));
|
||||
rc = -EINVAL;
|
||||
}
|
||||
|
||||
out:
|
||||
info->smbd_recv_pending--;
|
||||
wake_up(&info->wait_smbd_recv_pending);
|
||||
|
||||
|
Reference in New Issue
Block a user