source: rtems/cpukit/include/rtems/score/freechain.h @ 0f5b2c09

5
Last change on this file since 0f5b2c09 was 2afb22b, checked in by Chris Johns <chrisj@…>, on 12/23/17 at 07:18:56

Remove make preinstall

A speciality of the RTEMS build system was the make preinstall step. It
copied header files from arbitrary locations into the build tree. The
header files were included via the -Bsome/build/tree/path GCC command
line option.

This has at least seven problems:

  • The make preinstall step itself needs time and disk space.
  • Errors in header files show up in the build tree copy. This makes it hard for editors to open the right file to fix the error.
  • There is no clear relationship between source and build tree header files. This makes an audit of the build process difficult.
  • The visibility of all header files in the build tree makes it difficult to enforce API barriers. For example it is discouraged to use BSP-specifics in the cpukit.
  • An introduction of a new build system is difficult.
  • Include paths specified by the -B option are system headers. This may suppress warnings.
  • The parallel build had sporadic failures on some hosts.

This patch removes the make preinstall step. All installed header
files are moved to dedicated include directories in the source tree.
Let @RTEMS_CPU@ be the target architecture, e.g. arm, powerpc, sparc,
etc. Let @RTEMS_BSP_FAMILIY@ be a BSP family base directory, e.g.
erc32, imx, qoriq, etc.

The new cpukit include directories are:

  • cpukit/include
  • cpukit/score/cpu/@RTEMS_CPU@/include
  • cpukit/libnetworking

The new BSP include directories are:

  • bsps/include
  • bsps/@RTEMS_CPU@/include
  • bsps/@RTEMS_CPU@/@RTEMS_BSP_FAMILIY@/include

There are build tree include directories for generated files.

The include directory order favours the most general header file, e.g.
it is not possible to override general header files via the include path
order.

The "bootstrap -p" option was removed. The new "bootstrap -H" option
should be used to regenerate the "headers.am" files.

Update #3254.

  • Property mode set to 100644
File size: 2.5 KB
Line 
1/**
2 * @file
3 *
4 * @ingroup ScoreFreechain
5 *
6 * @brief Freechain Handler API
7 */
8/*
9 * Copyright (c) 2013 Gedare Bloom.
10 *
11 * The license and distribution terms for this file may be
12 * found in the file LICENSE in this distribution or at
13 * http://www.rtems.org/license/LICENSE.
14 */
15
16#ifndef _RTEMS_SCORE_FREECHAIN_H
17#define _RTEMS_SCORE_FREECHAIN_H
18
19#include <rtems/score/basedefs.h>
20#include <rtems/score/chain.h>
21
22#ifdef __cplusplus
23extern "C" {
24#endif
25
26/**
27 * @defgroup ScoreFreechain Freechain Handler
28 *
29 * @ingroup Score
30 *
31 * The Freechain Handler is used to manage a chain of nodes, of which size can
32 * automatically increase when there is no free node left. This handler
33 * provides one data structure: Freechain_Control.
34 *
35 * @{
36 */
37
38/**
39 * @brief Allocator function.
40 */
41typedef void *( *Freechain_Allocator )( size_t size );
42
43/**
44 * @brief The freechain control.
45 */
46typedef struct {
47  /**
48   * @brief Chain of free nodes.
49   */
50  Chain_Control Free;
51} Freechain_Control;
52
53/**
54 * @brief Initializes a freechain.
55 *
56 * This routine initializes the freechain control structure to manage a chain
57 * of nodes.  In case the freechain is empty the extend handler is called to
58 * get more nodes.
59 *
60 * @param[in] freechain The freechain control to initialize.
61 * @param[in] allocator The allocator function.
62 * @param[in] number_nodes The initial number of nodes.
63 * @param[in] node_size The node size.
64 */
65void _Freechain_Initialize(
66  Freechain_Control   *freechain,
67  Freechain_Allocator  allocator,
68  size_t               number_nodes,
69  size_t               node_size
70);
71
72/**
73 * @brief Gets a node from the freechain.
74 *
75 * @param[in] freechain The freechain control.
76 * @param[in] allocator The allocator function.
77 * @param[in] number_nodes_to_extend The number of nodes in case an extend is
78 *   necessary due to an empty freechain.
79 * @param[in] node_size The node size.
80 *
81 * @retval NULL The freechain is empty and the extend operation failed.
82 * @retval otherwise Pointer to a node.  The node ownership passes to the
83 * caller.
84 */
85void *_Freechain_Get(
86  Freechain_Control   *freechain,
87  Freechain_Allocator  allocator,
88  size_t               number_nodes_to_extend,
89  size_t               node_size
90);
91
92/**
93 * @brief Puts a node back onto the freechain.
94 *
95 * @param[in] freechain The freechain control.
96 * @param[in] node The node to put back.  The node may be @c NULL, in this case
97 *   the function does nothing.
98 */
99void _Freechain_Put(
100  Freechain_Control *freechain,
101  void              *node
102);
103
104/**@}*/
105
106#ifdef __cplusplus
107}
108#endif
109
110#endif
111/* end of include file */
Note: See TracBrowser for help on using the repository browser.