Subject: [patch -v2 01/23] sunrpc: use simple_read_from_buffer

From: [email-masked]
Date: Mon, 02 Jun 2008 08:13:30 +0900

Signed-off-by: Akinobu Mita <[email-masked]>
Cc: "David S. Miller" <[email-masked]>
Cc: [email-masked]
---
 net/sunrpc/cache.c |   15 +++------------
 1 file changed, 3 insertions(+), 12 deletions(-)

Index: 2.6-git/net/sunrpc/cache.c
===================================================================
--- 2.6-git.orig/net/sunrpc/cache.c
+++ 2.6-git/net/sunrpc/cache.c
@@ -1271,20 +1271,11 @@ static ssize_t read_flush(struct file *f
 {
 	struct cache_detail *cd = PDE(file->f_path.dentry->d_inode)->data;
 	char tbuf[20];
-	unsigned long p = *ppos;
 	size_t len;
 
-	sprintf(tbuf, "%lu\n", 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 = sprintf(tbuf, "%lu\n", 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,

--