From: Kinglong Mee <kinglongmee@gmail.com>
To: "J. Bruce Fields" <bfields@fieldses.org>, linux-nfs@vger.kernel.org
Cc: Trond Myklebust <trond.myklebust@primarydata.com>,
Kinglong Mee <kinglongmee@gmail.com>
Subject: [PATCH 7/7] sunrpc: use simple_read_from_buffer for reading cache flush
Date: Tue, 7 Feb 2017 21:50:32 +0800 [thread overview]
Message-ID: <02295874-6761-724a-ec8c-cc5159bc0d98@gmail.com> (raw)
In-Reply-To: <59432847-8e45-4423-c441-0c67ee645f38@gmail.com>
Signed-off-by: Kinglong Mee <kinglongmee@gmail.com>
---
net/sunrpc/cache.c | 15 +++------------
1 file changed, 3 insertions(+), 12 deletions(-)
diff --git a/net/sunrpc/cache.c b/net/sunrpc/cache.c
index 9e8561d..2f06f51 100644
--- a/net/sunrpc/cache.c
+++ b/net/sunrpc/cache.c
@@ -1427,20 +1427,11 @@ static ssize_t read_flush(struct file *file, char __user *buf,
struct cache_detail *cd)
{
char tbuf[22];
- unsigned long p = *ppos;
size_t len;
- snprintf(tbuf, sizeof(tbuf), "%lu\n", convert_to_wallclock(cd->flush_time));
- len = strlen(tbuf);
- if (p >= len)
- return 0;
- len -= p;
- if (len > count)
- len = count;
- if (copy_to_user(buf, (void*)(tbuf+p), len))
- return -EFAULT;
- *ppos += len;
- return len;
+ len = snprintf(tbuf, sizeof(tbuf), "%lu\n",
+ convert_to_wallclock(cd->flush_time));
+ return simple_read_from_buffer(buf, count, ppos, tbuf, len);
}
static ssize_t write_flush(struct file *file, const char __user *buf,
--
2.9.3
next prev parent reply other threads:[~2017-02-07 13:50 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-02-07 13:44 [PATCH 0/7] Some cleanups and updates for sunrpc Kinglong Mee
2017-02-07 13:46 ` [PATCH 1/7] sunrpc: error out if register_shrinker fail Kinglong Mee
2017-02-07 13:47 ` [PATCH 2/7] sunrpc/nfs: cleanup procfs/pipefs entry in cache_detail Kinglong Mee
2017-02-07 13:48 ` [PATCH 3/7] sunrpc: rename NFS_NGROUPS to UNX_NGROUPS for auth unix Kinglong Mee
2017-02-07 13:48 ` [PATCH 4/7] sunrpc: remove dead codes of cr_magic in rpc_cred Kinglong Mee
2017-02-07 13:49 ` [PATCH 5/7] sunrpc: update the comments of sunrpc proc path Kinglong Mee
2017-02-07 13:49 ` [PATCH 6/7] sunrpc: record rpc client pointer in seq->private directly Kinglong Mee
2017-02-07 13:50 ` Kinglong Mee [this message]
2017-02-17 17:03 ` [PATCH 0/7] Some cleanups and updates for sunrpc J. Bruce Fields
2017-02-17 17:25 ` Trond Myklebust
2017-02-17 19:09 ` bfields
2017-02-17 21:15 ` Anna Schumaker
2017-02-17 21:26 ` bfields
2017-02-17 22:18 ` Trond Myklebust
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=02295874-6761-724a-ec8c-cc5159bc0d98@gmail.com \
--to=kinglongmee@gmail.com \
--cc=bfields@fieldses.org \
--cc=linux-nfs@vger.kernel.org \
--cc=trond.myklebust@primarydata.com \
/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
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).