From: David Howells <dhowells@redhat.com> To: Steve French <smfrench@gmail.com> Cc: Steve French <sfrench@samba.org>, Shyam Prasad N <nspmangalore@gmail.com>, Rohith Surabattula <rohiths.msft@gmail.com>, linux-cifs@vger.kernel.org, dhowells@redhat.com, Shyam Prasad N <nspmangalore@gmail.com>, Rohith Surabattula <rohiths.msft@gmail.com>, Jeff Layton <jlayton@kernel.org>, Al Viro <viro@zeniv.linux.org.uk>, linux-cifs@vger.kernel.org, linux-fsdevel@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH 4/7] cifs: Add a function to read into an iter from a socket Date: Wed, 25 May 2022 15:26:36 +0100 [thread overview] Message-ID: <165348879662.2106726.16881134187242702351.stgit@warthog.procyon.org.uk> (raw) In-Reply-To: <165348876794.2106726.9240233279581920208.stgit@warthog.procyon.org.uk> 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: linux-cifs@vger.kernel.org --- fs/cifs/cifsproto.h | 3 +++ fs/cifs/connect.c | 16 ++++++++++++++++ 2 files changed, 19 insertions(+) diff --git a/fs/cifs/cifsproto.h b/fs/cifs/cifsproto.h index 0df3b24a0bf4..dd4931308ea6 100644 --- a/fs/cifs/cifsproto.h +++ b/fs/cifs/cifsproto.h @@ -245,6 +245,9 @@ extern int cifs_read_page_from_socket(struct TCP_Server_Info *server, unsigned int page_offset, unsigned int to_read); extern int cifs_setup_cifs_sb(struct cifs_sb_info *cifs_sb); +extern int cifs_read_iter_from_socket(struct TCP_Server_Info *server, + struct iov_iter *iter, + unsigned int to_read); extern int cifs_match_super(struct super_block *, void *); extern int cifs_mount(struct cifs_sb_info *cifs_sb, struct smb3_fs_context *ctx); extern void cifs_umount(struct cifs_sb_info *); diff --git a/fs/cifs/connect.c b/fs/cifs/connect.c index 42e14f408856..0d532d559f70 100644 --- a/fs/cifs/connect.c +++ b/fs/cifs/connect.c @@ -764,6 +764,22 @@ cifs_read_page_from_socket(struct TCP_Server_Info *server, struct page *page, return cifs_readv_from_socket(server, &smb_msg); } +int +cifs_read_iter_from_socket(struct TCP_Server_Info *server, struct iov_iter *iter, + unsigned int to_read) +{ + struct msghdr smb_msg; + int ret; + + smb_msg.msg_iter = *iter; + if (smb_msg.msg_iter.count > to_read) + smb_msg.msg_iter.count = to_read; + ret = cifs_readv_from_socket(server, &smb_msg); + if (ret > 0) + iov_iter_advance(iter, ret); + return ret; +} + static bool is_smb_response(struct TCP_Server_Info *server, unsigned char type) {
next prev parent reply other threads:[~2022-05-25 14:27 UTC|newest] Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top 2022-05-25 14:26 [PATCH 0/7] cifs: Use iov_iters down to the network transport David Howells 2022-05-25 14:26 ` [PATCH 1/7] iov_iter: Add a function to extract an iter's buffers to a bvec iter David Howells 2022-05-25 14:26 ` [PATCH 2/7] iov_iter: Add a general purpose iteration function David Howells 2022-05-25 14:26 ` [PATCH 3/7] cifs: Add some helper functions David Howells 2022-05-25 14:26 ` David Howells [this message] 2022-05-25 14:26 ` [PATCH 5/7] cifs: Change the I/O paths to use an iterator rather than a page list David Howells 2022-05-25 14:26 ` [PATCH 6/7] cifs: Remove unused code David Howells 2022-05-25 14:26 ` [PATCH 7/7] cifs, ksmbd: Fix MAX_SGE count for softiwarp David Howells 2022-05-25 15:32 ` [PATCH 0/7] cifs: Use iov_iters down to the network transport Tom Talpey
Reply instructions: You may reply publicly to this message via plain-text email using any one of the following methods: * Save the following mbox file, import it into your mail client, and reply-to-all from there: mbox Avoid top-posting and favor interleaved quoting: https://en.wikipedia.org/wiki/Posting_style#Interleaved_style * Reply using the --to, --cc, and --in-reply-to switches of git-send-email(1): git send-email \ --in-reply-to=165348879662.2106726.16881134187242702351.stgit@warthog.procyon.org.uk \ --to=dhowells@redhat.com \ --cc=jlayton@kernel.org \ --cc=linux-cifs@vger.kernel.org \ --cc=linux-fsdevel@vger.kernel.org \ --cc=linux-kernel@vger.kernel.org \ --cc=nspmangalore@gmail.com \ --cc=rohiths.msft@gmail.com \ --cc=sfrench@samba.org \ --cc=smfrench@gmail.com \ --cc=viro@zeniv.linux.org.uk \ --subject='Re: [PATCH 4/7] cifs: Add a function to read into an iter from a socket' \ /path/to/YOUR_REPLY https://kernel.org/pub/software/scm/git/docs/git-send-email.html * If your mail client supports setting the In-Reply-To header via mailto: links, try the mailto: link
This is an external index of several public inboxes, see mirroring instructions on how to clone and mirror all data and code used by this external index.