[PATCH] add freelist data structure to score

Sebastian Huber sebastian.huber at embedded-brains.de
Tue Jul 16 12:25:14 UTC 2013


Hello Ashi,

On 07/16/2013 05:57 AM, Ashi wrote:
> diff --git a/cpukit/score/include/rtems/score/freechain.h b/cpukit/score/include/rtems/score/freechain.h
> new file mode 100644
> index 0000000..f645842
> --- /dev/null
> +++ b/cpukit/score/include/rtems/score/freechain.h
> @@ -0,0 +1,138 @@
> +/**
> + * @file
> + *
> + * @ingroup ScoreFreechain
> + *
> + * @brief Freechain Handler API
> + */
> +/*
> + * Copyright (c) 2013 Gedare Bloom.
> + *
> + * The license and distribution terms for this file may be
> + * found in the file LICENSE in this distribution or at
> + *http://www.rtems.com/license/LICENSE.
> + */
> +
> +#ifndef _FREECHAIN_H
> +#define _FREECHAIN_H
> +
> +#include <rtems/score/chain.h>
> +#include <rtems/rtems/types.h>
> +#include <rtems/score/wkspace.h>
> +
> +/**
> + * @defgroup ScoreFreechain Freechain Handler API
> + *
> + * @ingroup Score
> + *
> + * The Freechain Handler is used to manage a chain of nodes, of which size can
> + * automatically increase when there is no free node left. This handler provides one data structure:
> + * Freechain_Control.
> + */
> +/**@{*/
> +
> +#ifdef __cplusplus
> +extern "C" {
> +#endif
> +
> +/**
> + * @typedef Freechain_Control
> + */
> +typedef struct Freechain_Control Freechain_Control;
> +
> +/**
> + * @brief Extends the freechain.
> + *
> + * @param[in] freechain The freechain control.
> + */
> +typedef void *( *Freechain_Extend )( Freechain_Control *freechain );

since the return value is only used to indicate the status I would use a bool 
return type here.

> +
> +/**
> + * @typedef freechain_callout
> + *
> + * @param[in] freechain The freechain control.
> + * @param[in] nodes The new added nodes.
> + */
> +typedef void (*freechain_callout)(
> +  Freechain_Control *freechain,
> +  void *nodes
> +);

We no longer need this callout handler.

The rest looks fine.

-- 
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
PGP     : Public key available on request.

Diese Nachricht ist keine geschäftliche Mitteilung im Sinne des EHUG.



More information about the devel mailing list