From: "Kirill A. Shutemov" <k.shutemov@velesys.com>
To: ALT Linux Team development discussions <devel@lists.altlinux.org>
Subject: Re: [devel] asm/page.h
Date: Tue, 19 Feb 2008 14:42:40 +0200
Message-ID: <20080219124240.GB7792@localhost.localdomain> (raw)
In-Reply-To: <20080219014945.GB9733@wo.int.altlinux.org>
[-- Attachment #1: Type: text/plain, Size: 2244 bytes --]
On [Tue, 19.02.2008 04:49], Dmitry V. Levin wrote:
> On Tue, Feb 19, 2008 at 03:40:41AM +0300, Kirill Maslinsky wrote:
> > On Tue, Feb 19, 2008 at 02:23:41AM +0200, Led wrote:
> > > Tuesday, 19 February 2008 02:18:11 Kirill Maslinsky написав:
> >
> > [...]
> >
> > > > - if (size > PAGE_SIZE)
> > > > - bulk.len = PAGE_SIZE;
> > > > + if (size > sysconf(_SC_PAGESIZE))
> > > > + bulk.len = sysconf(_SC_PAGESIZE);
> >
> > > Зачем дважды вызывать? ИМХО лучше завести переменную page_size.
> >
> > Логично. Вот так будет корректно?
> >
> > --- a/eciadsl-usermode/pusb-linux.c
> > +++ b/eciadsl-usermode/pusb-linux.c
> > @@ -29,7 +29,6 @@
> > #include <string.h>
> >
> > #include "pusb-linux.h"
> > -#include <asm/page.h>
> >
> > #include "pusb.h"
> >
> > @@ -431,6 +430,7 @@ inline int pusb_endpoint_rw(int fd, int ep, unsigned char* buf, int size, int ti
> > static struct usbdevfs_bulktransfer bulk;
> > static int ret;
> > int received = 0;
> > + int page_size = sysconf(_SC_PAGESIZE);
> >
> > do
> > {
> > @@ -438,8 +438,8 @@ inline int pusb_endpoint_rw(int fd, int ep, unsigned char* buf, int size, int ti
> >
> > bulk.len = size;
> >
> > - if (size > PAGE_SIZE)
> > - bulk.len = PAGE_SIZE;
> > + if (size > page_size)
> > + bulk.len = page_size;
> >
> > Вы меня простите за тупые вопросы, я просто этого языка (C) вообще не знаю,
> > опасаюсь напортачить.
>
> Код синтаксически корректный, но upstream может захотеть соптимизировать
> количество вызовов sysconf.
А проверить возвращаемое из sysconf значение не нужно? А то мало ли что...
--
Regards, Kirill A. Shutemov
+ Belarus, Minsk
+ Velesys Ltd, http://www.velesys.com/
+ ALT Linux Team, http://www.altlinux.com/
[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 197 bytes --]
next prev parent reply other threads:[~2008-02-19 12:42 UTC|newest]
Thread overview: 21+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-02-18 21:09 ` [devel] xawtv4-4.0-alt3.cvs20070625.2: i586 rebuild failed Hihin Ruslan
2008-02-18 21:40 ` [devel] asm/page.h Dmitry V. Levin
2008-02-18 22:38 ` Kirill Maslinsky
2008-02-18 23:42 ` Led
2008-02-18 23:45 ` Led
2008-02-19 0:06 ` Dmitry V. Levin
2008-02-19 0:18 ` Kirill Maslinsky
2008-02-19 0:23 ` Led
2008-02-19 0:40 ` Kirill Maslinsky
2008-02-19 0:55 ` Led
2008-02-19 1:49 ` Dmitry V. Levin
2008-02-19 12:42 ` Kirill A. Shutemov [this message]
2008-02-19 12:43 ` Mikhail Gusarov
2008-02-20 4:54 ` Ildar Mulyukov
2008-02-20 14:33 ` Kirill Maslinsky
2008-02-19 9:43 ` Slava Semushin
2008-02-19 1:48 ` Dmitry V. Levin
2008-02-19 15:03 ` Led
2008-02-19 0:11 ` Kirill Maslinsky
2008-02-19 0:22 ` Led
2008-02-19 12:35 ` Kirill A. Shutemov
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=20080219124240.GB7792@localhost.localdomain \
--to=k.shutemov@velesys.com \
--cc=devel@lists.altlinux.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
ALT Linux Team development discussions
This inbox may be cloned and mirrored by anyone:
git clone --mirror http://lore.altlinux.org/devel/0 devel/git/0.git
# If you have public-inbox 1.1+ installed, you may
# initialize and index your mirror using the following commands:
public-inbox-init -V2 devel devel/ http://lore.altlinux.org/devel \
devel@altlinux.org devel@altlinux.ru devel@lists.altlinux.org devel@lists.altlinux.ru devel@linux.iplabs.ru mandrake-russian@linuxteam.iplabs.ru sisyphus@linuxteam.iplabs.ru
public-inbox-index devel
Example config snippet for mirrors.
Newsgroup available over NNTP:
nntp://lore.altlinux.org/org.altlinux.lists.devel
AGPL code for this site: git clone https://public-inbox.org/public-inbox.git