source: rtems/cpukit/include/rtems/rfs/rtems-rfs-mutex.h @ 2afb22b

5
Last change on this file since 2afb22b 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.4 KB
Line 
1/**
2 * @file
3 *
4 * @brief RTEMS File System Mutex
5 *
6 * @ingroup rtems_rfs
7 *
8 * RTEMS File System Mutex.
9 *
10 * It may be suprising we abstract this for the RTEMS file system but this code
11 * is designed to be run on host operating systems.
12 */
13
14/*
15 *  COPYRIGHT (c) 2010 Chris Johns <chrisj@rtems.org>
16 *
17 *  The license and distribution terms for this file may be
18 *  found in the file LICENSE in this distribution or at
19 *  http://www.rtems.org/license/LICENSE.
20 */
21
22#if !defined (_RTEMS_RFS_MUTEX_H_)
23#define _RTEMS_RFS_MUTEX_H_
24
25#include <errno.h>
26
27#include <rtems/rfs/rtems-rfs-trace.h>
28
29#if __rtems__
30#include <rtems.h>
31#include <rtems/error.h>
32#endif
33
34/**
35 * RFS Mutex type.
36 */
37#if __rtems__
38typedef rtems_id rtems_rfs_mutex;
39#else
40typedef uint32_t rtems_rfs_mutex; /* place holder */
41#endif
42
43/**
44 * @brief Create the mutex.
45 *
46 * @param [in] mutex is pointer to the mutex handle returned to the caller.
47 *
48 * @retval 0 Successful operation.
49 * @retval EIO An error occurred.
50 *
51 */
52int rtems_rfs_mutex_create (rtems_rfs_mutex* mutex);
53
54/**
55 * @brief Destroy the mutex.
56 *
57 * @param[in] mutex Reference to the mutex handle returned to the caller.
58 *
59 * @retval 0 Successful operation.
60 * @retval EIO An error occurred.
61 */
62int rtems_rfs_mutex_destroy (rtems_rfs_mutex* mutex);
63
64/**
65 * @brief Lock the mutex.
66 *
67 * @param[in] mutex is a pointer to the mutex to lock.
68 *
69 * @retval 0 Successful operation.
70 * @retval EIO An error occurred.
71 */
72static inline int
73rtems_rfs_mutex_lock (rtems_rfs_mutex* mutex)
74{
75#if __rtems__
76  rtems_status_code sc = rtems_semaphore_obtain (*mutex, RTEMS_WAIT, 0);
77  if (sc != RTEMS_SUCCESSFUL)
78  {
79#if RTEMS_RFS_TRACE
80    if (rtems_rfs_trace (RTEMS_RFS_TRACE_MUTEX))
81      printf ("rtems-rfs: mutex: obtain failed: %s\n",
82              rtems_status_text (sc));
83#endif
84    return EIO;
85  }
86#endif
87  return 0;
88}
89
90/**
91 * @brief Unlock the mutex.
92 *
93 * @param[in] mutex is a pointer to the mutex to unlock.
94 *
95 * @retval 0 Successful operation.
96 * @retval EIO An error occurred.
97 */
98static inline int
99rtems_rfs_mutex_unlock (rtems_rfs_mutex* mutex)
100{
101#if __rtems__
102  rtems_status_code sc = rtems_semaphore_release (*mutex);
103  if (sc != RTEMS_SUCCESSFUL)
104  {
105#if RTEMS_RFS_TRACE
106    if (rtems_rfs_trace (RTEMS_RFS_TRACE_MUTEX))
107      printf ("rtems-rfs: mutex: release failed: %s\n",
108              rtems_status_text (sc));
109#endif
110    return EIO;
111  }
112#endif
113  return 0;
114}
115
116#endif
Note: See TracBrowser for help on using the repository browser.