[PATCH] add freelist data structure to score

Ashi ashi08104 at gmail.com
Wed Jul 24 08:07:53 UTC 2013


On Mon, Jul 22, 2013 at 11:08 PM, Sebastian Huber <
sebastian.huber at 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 at embedded-**brains.de<sebastian.huber at embedded-brains.de>
> PGP     : Public key available on request.
>
> Diese Nachricht ist keine geschäftliche Mitteilung im Sinne des EHUG.
>

Cheers,
Zhongwei
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.rtems.org/pipermail/devel/attachments/20130724/09f945e9/attachment-0001.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: freechain.patch
Type: application/octet-stream
Size: 15602 bytes
Desc: not available
URL: <http://lists.rtems.org/pipermail/devel/attachments/20130724/09f945e9/attachment-0001.obj>


More information about the devel mailing list