On Mon, Jul 22, 2013 at 11:08 PM, Sebastian Huber <
sebastian.hu...@embedded-brains.de> wrote:

> Hello Ashi,
>
> after the weekend I think we can further simplify the Freechain interface.
>  The node_size and bump_count are not necessary for the Freechain core
> routines (_Freechain_Get() and _Freechain_Put()).  Thus we should also
> remove them.  In case the extend handler needs more information you can use
> something like that:
>
> typedef struct {
>   Freechain_Control super;
>   size_t bump_count;
> } MyFreechain;
>
> bool MyFreechainExtend(Freechain_**Control *super)
> {
>   MyFreechain *self = (MyFreechain *) super;
>
>   ...
>
> }
>
> Thanks, Sebastian, it's a cool idea! I've update the code to this idea now.
And I also fix a bug in my previous code. In my previous code, the
test_node in test case is:
typedef struct {
  Object_Control obj;
  int x;
}test_node;

It should be Chain_Node, not Object_Control here. However, because
Object_Control's size is bigger than Chain_Node, the test case doesn't
crash.

The github url is: https://github.com/ashi08104/rtems/tree/add_freelist

-- 
> Sebastian Huber, embedded brains GmbH
>
> Address : Dornierstr. 4, D-82178 Puchheim, Germany
> Phone   : +49 89 189 47 41-16
> Fax     : +49 89 189 47 41-09
> E-Mail  : 
> sebastian.huber@embedded-**brains.de<sebastian.hu...@embedded-brains.de>
> PGP     : Public key available on request.
>
> Diese Nachricht ist keine geschäftliche Mitteilung im Sinne des EHUG.
>

Cheers,
Zhongwei

Attachment: freechain.patch
Description: Binary data

_______________________________________________
rtems-devel mailing list
rtems-devel@rtems.org
http://www.rtems.org/mailman/listinfo/rtems-devel

Reply via email to