Re: number of elements or bytes for kfifo_in etc

From: Huang Ying
Date: Wed Aug 18 2010 - 21:15:20 EST


On Thu, 2010-08-19 at 08:32 +0800, Huang Ying wrote:
> Hi, Stefani,
>
> On Thu, 2010-08-19 at 00:35 +0800, Stefani Seibold wrote:
> > Am Mittwoch, den 18.08.2010, 13:29 +0800 schrieb Huang Ying:
> > > Hi, Stefani,
> > >
> > > In new kfifo implementation in 2.6.36-rc1, description of the third
> > > parameter is:
> > >
> > > "@n: number of elements to be added"
> > >
> > > But if my understanding is correct, the actual implementation is:
> > >
> > > "@n: number of bytes to be added"
> > >
> >
> > Number of bytes is wrong, this is only valid for byte stream fifo's
> > where an element is a byte.
> >
> > Have a look at samples/kfifo/inttype-example.c where an element is a int
> > type.
>
> Yes. You are right. I misunderstood your code. Sorry for bothering.

And I found __kfifo->esize is used in __kfifo_in/out etc to convert
between elements and bytes. Maybe we can pull the conversion code to
corresponding macro, because where esize is constant and may be
optimized to bit shifting or nothing. What do you think about that?

Best Regards,
Huang Ying


--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/