Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

cifs: Add a function to read into an iter from a socket

Add a helper function to read data from a socket into the given iterator.

Signed-off-by: David Howells <dhowells@redhat.com>
cc: Steve French <sfrench@samba.org>
cc: Shyam Prasad N <nspmangalore@gmail.com>
cc: Rohith Surabattula <rohiths.msft@gmail.com>
cc: Jeff Layton <jlayton@kernel.org>
cc: linux-cifs@vger.kernel.org

Link: https://lore.kernel.org/r/164928617874.457102.10021662143234315566.stgit@warthog.procyon.org.uk/ # v1
Link: https://lore.kernel.org/r/165211419563.3154751.18431990381145195050.stgit@warthog.procyon.org.uk/ # v1
Link: https://lore.kernel.org/r/165348879662.2106726.16881134187242702351.stgit@warthog.procyon.org.uk/ # v1
Link: https://lore.kernel.org/r/165364826398.3334034.12541600783145647319.stgit@warthog.procyon.org.uk/ # v3
Link: https://lore.kernel.org/r/166126395495.708021.12328677373159554478.stgit@warthog.procyon.org.uk/ # v1
Link: https://lore.kernel.org/r/166697258876.61150.3530237818849429372.stgit@warthog.procyon.org.uk/ # rfc
Link: https://lore.kernel.org/r/166732031039.3186319.10691316510079412635.stgit@warthog.procyon.org.uk/ # rfc
Signed-off-by: Steve French <stfrench@microsoft.com>

authored by

David Howells and committed by
Steve French
16541195 b8713c4d

+17
+3
fs/cifs/cifsproto.h
··· 244 244 struct page *page, 245 245 unsigned int page_offset, 246 246 unsigned int to_read); 247 + int cifs_read_iter_from_socket(struct TCP_Server_Info *server, 248 + struct iov_iter *iter, 249 + unsigned int to_read); 247 250 extern int cifs_setup_cifs_sb(struct cifs_sb_info *cifs_sb); 248 251 void cifs_mount_put_conns(struct cifs_mount_ctx *mnt_ctx); 249 252 int cifs_mount_get_session(struct cifs_mount_ctx *mnt_ctx);
+14
fs/cifs/connect.c
··· 733 733 return cifs_readv_from_socket(server, &smb_msg); 734 734 } 735 735 736 + int 737 + cifs_read_iter_from_socket(struct TCP_Server_Info *server, struct iov_iter *iter, 738 + unsigned int to_read) 739 + { 740 + struct msghdr smb_msg = { .msg_iter = *iter }; 741 + int ret; 742 + 743 + iov_iter_truncate(&smb_msg.msg_iter, to_read); 744 + ret = cifs_readv_from_socket(server, &smb_msg); 745 + if (ret > 0) 746 + iov_iter_advance(iter, ret); 747 + return ret; 748 + } 749 + 736 750 static bool 737 751 is_smb_response(struct TCP_Server_Info *server, unsigned char type) 738 752 {