netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: akinobu.mita@gmail.com
To: linux-kernel@vger.kernel.org
Cc: "David S. Miller" <davem@davemloft.net>, netdev@vger.kernel.org
Subject: [patch -v2 01/23] sunrpc: use simple_read_from_buffer
Date: Mon, 02 Jun 2008 08:13:30 +0900	[thread overview]
Message-ID: <20080601231451.529328123@gmail.com> (raw)
In-Reply-To: 20080601231329.223608711@gmail.com

[-- Attachment #1: sunrpc-simple-read-from-buffer.patch --]
[-- Type: text/plain, Size: 1020 bytes --]

Signed-off-by: Akinobu Mita <akinobu.mita@gmail.com>
Cc: "David S. Miller" <davem@davemloft.net>
Cc: netdev@vger.kernel.org
---
 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,

-- 

       reply	other threads:[~2008-06-01 23:27 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <20080601231329.223608711@gmail.com>
2008-06-01 23:13 ` akinobu.mita [this message]
2008-06-02  5:35   ` [patch -v2 01/23] sunrpc: use simple_read_from_buffer Alexey Dobriyan
2008-06-02 12:11     ` Akinobu Mita
2008-06-01 23:13 ` [patch -v2 11/23] airo: " akinobu.mita-Re5JQEeQqe8AvxtiuMwx3w

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=20080601231451.529328123@gmail.com \
    --to=akinobu.mita@gmail.com \
    --cc=davem@davemloft.net \
    --cc=linux-kernel@vger.kernel.org \
    --cc=netdev@vger.kernel.org \
    /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).