source: rtems/cpukit/include/rtems/sparse-disk.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: 4.4 KB
Line 
1/**
2 * @file
3 *
4 * @ingroup rtems_sparse_disk
5 *
6 * @brief Sparse disk block device API.
7 */
8
9/*
10 * Copyright (c) 2012 embedded brains GmbH.  All rights reserved.
11 *
12 *  embedded brains GmbH
13 *  Obere Lagerstr. 30
14 *  82178 Puchheim
15 *  Germany
16 *  <rtems@embedded-brains.de>
17 *
18 * The license and distribution terms for this file may be
19 * found in the file LICENSE in this distribution or at
20 * http://www.rtems.org/license/LICENSE.
21 */
22
23#ifndef SPARSE_DISK_H
24#define SPARSE_DISK_H
25
26#include <stddef.h>
27#include <stdint.h>
28#include <rtems.h>
29#include <rtems/diskdevs.h>
30
31#ifdef __cplusplus
32extern "C" {
33#endif /* __cplusplus */
34
35/**
36 * @defgroup rtems_sparse_disk Sparse Disk Device
37 *
38 * @ingroup rtems_blkdev
39 *
40 */
41/**@{**/
42
43typedef struct {
44  rtems_blkdev_bnum  block;
45  void              *data;
46} rtems_sparse_disk_key;
47
48typedef struct rtems_sparse_disk rtems_sparse_disk;
49
50typedef void (*rtems_sparse_disk_delete_handler)(rtems_sparse_disk *sparse_disk);
51
52struct rtems_sparse_disk {
53  rtems_id                         mutex;
54  rtems_blkdev_bnum                blocks_with_buffer;
55  size_t                           used_count;
56  uint32_t                         media_block_size;
57  rtems_sparse_disk_delete_handler delete_handler;
58  uint8_t                          fill_pattern;
59  rtems_sparse_disk_key           *key_table;
60};
61
62/**
63 * @brief Creates and registers a sparse disk.
64 *
65 * @param[in] device_file_name The device file name path.
66 * @param[in] media_block_size The media block size in bytes.
67 * @param[in] blocks_with_buffer Blocks of the device with a buffer.  Other
68 * blocks can store only fill pattern value bytes.
69 * @param[in] block_count The media block count of the device.  It is the sum
70 * of blocks with buffer and blocks that contain only fill pattern value bytes.
71 * @param[in] fill_pattern The fill pattern specifies the byte value of blocks
72 * without a buffer.  It is also the initial value for blocks with a buffer.
73 *
74 * @retval RTEMS_SUCCESSFUL Successful operation.
75 * @retval RTEMS_INVALID_NUMBER Media block size or media block count is not
76 * positive.  The blocks with buffer count is greater than the media block count.
77 * @retval RTEMS_NO_MEMORY Not enough memory.
78 * @retval RTEMS_TOO_MANY Cannot create semaphore.
79 * @retval RTEMS_UNSATISFIED Cannot create generic device node.
80 *
81 * @see rtems_sparse_disk_register().
82 */
83rtems_status_code rtems_sparse_disk_create_and_register(
84  const char        *device_file_name,
85  uint32_t           media_block_size,
86  rtems_blkdev_bnum  blocks_with_buffer,
87  rtems_blkdev_bnum  media_block_count,
88  uint8_t            fill_pattern
89);
90
91/**
92 * @brief Frees a sparse disk.
93 *
94 * Calls free() on the sparse disk pointer.
95 */
96void rtems_sparse_disk_free( rtems_sparse_disk *sparse_disk );
97
98/**
99 * @brief Initializes and registers a sparse disk.
100 *
101 * This will create one semaphore for mutual exclusion.
102 *
103 * @param[in] device_file_name The device file name path.
104 * @param[in, out] sparse_disk The sparse disk.
105 * @param[in] media_block_size The media block size in bytes.
106 * @param[in] blocks_with_buffer Blocks of the device with a buffer.  Other
107 * blocks can store only fill pattern value bytes.
108 * @param[in] block_count The media block count of the device.  It is the sum
109 * of blocks with buffer and blocks that contain only fill pattern value bytes.
110 * @param[in] fill_pattern The fill pattern specifies the byte value of blocks
111 * without a buffer.  It is also the initial value for blocks with a buffer.
112 * @param[in] sparse_disk_delete The sparse disk delete handler.
113 *
114 * @retval RTEMS_SUCCESSFUL Successful operation.
115 * @retval RTEMS_INVALID_NUMBER Media block size or media block count is not
116 * positive.  The blocks with buffer count is greater than the media block count.
117 * @retval RTEMS_INVALID_ADDRESS Invalid sparse disk address.
118 * @retval RTEMS_TOO_MANY Cannot create semaphore.
119 * @retval RTEMS_UNSATISFIED Cannot create generic device node.
120 */
121rtems_status_code rtems_sparse_disk_register(
122  const char                       *device_file_name,
123  rtems_sparse_disk                *sparse_disk,
124  uint32_t                          media_block_size,
125  rtems_blkdev_bnum                 blocks_with_buffer,
126  rtems_blkdev_bnum                 media_block_count,
127  uint8_t                           fill_pattern,
128  rtems_sparse_disk_delete_handler  sparse_disk_delete
129);
130
131/** @} */
132
133#ifdef __cplusplus
134}
135#endif /* __cplusplus */
136
137#endif /* SPARSE_DISK_H */
Note: See TracBrowser for help on using the repository browser.