* [patch -v2 01/23] sunrpc: use simple_read_from_buffer
[not found] <20080601231329.223608711@gmail.com>
@ 2008-06-01 23:13 ` akinobu.mita
2008-06-02 5:35 ` Alexey Dobriyan
2008-06-01 23:13 ` [patch -v2 11/23] airo: " akinobu.mita-Re5JQEeQqe8AvxtiuMwx3w
1 sibling, 1 reply; 4+ messages in thread
From: akinobu.mita @ 2008-06-01 23:13 UTC (permalink / raw)
To: linux-kernel; +Cc: David S. Miller, netdev
[-- 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,
--
^ permalink raw reply [flat|nested] 4+ messages in thread
* [patch -v2 11/23] airo: use simple_read_from_buffer
[not found] <20080601231329.223608711@gmail.com>
2008-06-01 23:13 ` [patch -v2 01/23] sunrpc: use simple_read_from_buffer akinobu.mita
@ 2008-06-01 23:13 ` akinobu.mita-Re5JQEeQqe8AvxtiuMwx3w
1 sibling, 0 replies; 4+ messages in thread
From: akinobu.mita-Re5JQEeQqe8AvxtiuMwx3w @ 2008-06-01 23:13 UTC (permalink / raw)
To: linux-kernel-u79uwXL29TY76Z2rM5mHXA
Cc: John W. Linville, netdev-u79uwXL29TY76Z2rM5mHXA,
linux-wireless-u79uwXL29TY76Z2rM5mHXA
[-- Attachment #1: airo-use-simple-read-from-buffer.patch --]
[-- Type: text/plain, Size: 1434 bytes --]
Signed-off-by: Akinobu Mita <akinobu.mita-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
Cc: John W. Linville <linville-2XuSBdqkA4R54TAoqtyWWQ@public.gmane.org>
Cc: netdev-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
Cc: linux-wireless-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
---
drivers/net/wireless/airo.c | 15 +++------------
1 file changed, 3 insertions(+), 12 deletions(-)
Index: 2.6-git/drivers/net/wireless/airo.c
===================================================================
--- 2.6-git.orig/drivers/net/wireless/airo.c
+++ 2.6-git/drivers/net/wireless/airo.c
@@ -4560,22 +4560,13 @@ static ssize_t proc_read( struct file *f
size_t len,
loff_t *offset )
{
- loff_t pos = *offset;
- struct proc_data *priv = (struct proc_data*)file->private_data;
+ struct proc_data *priv = file->private_data;
if (!priv->rbuffer)
return -EINVAL;
- if (pos < 0)
- return -EINVAL;
- if (pos >= priv->readlen)
- return 0;
- if (len > priv->readlen - pos)
- len = priv->readlen - pos;
- if (copy_to_user(buffer, priv->rbuffer + pos, len))
- return -EFAULT;
- *offset = pos + len;
- return len;
+ return simple_read_from_buffer(buffer, len, offset, priv->rbuffer,
+ priv->readlen);
}
/*
--
--
To unsubscribe from this list: send the line "unsubscribe linux-wireless" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [patch -v2 01/23] sunrpc: use simple_read_from_buffer
2008-06-01 23:13 ` [patch -v2 01/23] sunrpc: use simple_read_from_buffer akinobu.mita
@ 2008-06-02 5:35 ` Alexey Dobriyan
2008-06-02 12:11 ` Akinobu Mita
0 siblings, 1 reply; 4+ messages in thread
From: Alexey Dobriyan @ 2008-06-02 5:35 UTC (permalink / raw)
To: akinobu.mita; +Cc: linux-kernel, David S. Miller, netdev
On Mon, Jun 02, 2008 at 08:13:30AM +0900, akinobu.mita@gmail.com wrote:
> 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);
> }
Please, switch to seq_file:
seq_printf(m, "%lu\n", cd->flush_time);
return 0;
and that's everything module have to worry about.
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [patch -v2 01/23] sunrpc: use simple_read_from_buffer
2008-06-02 5:35 ` Alexey Dobriyan
@ 2008-06-02 12:11 ` Akinobu Mita
0 siblings, 0 replies; 4+ messages in thread
From: Akinobu Mita @ 2008-06-02 12:11 UTC (permalink / raw)
To: Alexey Dobriyan; +Cc: linux-kernel, David S. Miller, netdev
>> + len = sprintf(tbuf, "%lu\n", cd->flush_time);
>> +
>> + return simple_read_from_buffer(buf, count, ppos, tbuf, len);
>> }
>
> Please, switch to seq_file:
>
> seq_printf(m, "%lu\n", cd->flush_time);
> return 0;
>
> and that's everything module have to worry about.
>
OK. I'll drop this patch from the patch series.
And I'll send this seq_file convertion in another chance.
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2008-06-02 12:11 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
[not found] <20080601231329.223608711@gmail.com>
2008-06-01 23:13 ` [patch -v2 01/23] sunrpc: use simple_read_from_buffer akinobu.mita
2008-06-02 5:35 ` Alexey Dobriyan
2008-06-02 12:11 ` Akinobu Mita
2008-06-01 23:13 ` [patch -v2 11/23] airo: " akinobu.mita-Re5JQEeQqe8AvxtiuMwx3w
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).