source: rtems/cpukit/include/rtems/fsmount.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: 5.0 KB
Line 
1/**
2 * @file rtems/fsmount.h
3 *
4 * @defgroup rtems_fstab File System Mount Support
5 *
6 * @ingroup FileSystemTypesAndMount
7 * @brief File System Mount Functions
8 *
9 * This file contains the fsmount functions. These functions       
10 * are used to mount a list of filesystems (and create their mount
11 * points before).
12 */
13
14/*
15 * Copyright (c) 2003 IMD
16 *   
17 * Ingenieurbuero fuer Microcomputertechnik Th. Doerfler     
18 * <Thomas.Doerfler@imd-systems.de>                 
19 * all rights reserved
20 *                   
21 * The license and distribution terms for this file may be       
22 * found in the file LICENSE in this distribution or at           
23 * http://www.rtems.org/license/LICENSE.
24 */
25 
26#ifndef _FSMOUNT_H
27#define _FSMOUNT_H
28
29#include <rtems.h>
30#include <rtems/libio.h>
31#include <rtems/libcsupport.h>
32
33#ifdef __cplusplus
34extern "C" {
35#endif
36
37/**
38 * @defgroup rtems_fstab File System Mount Support
39 *
40 * @ingroup FileSystemTypesAndMount
41 */
42/**@{**/
43
44/**
45 * File system mount report and abort condition flags.
46 *
47 * The flags define, which conditions will cause a report during the mount
48 * process (via printf()) or abort the mount process.
49 *
50 * @see rtems_fstab_entry and rtems_fsmount().
51 */
52typedef enum {
53  /**
54   * No conditions.
55   */
56  RTEMS_FSTAB_NONE = 0U,
57
58  /**
59   * Complete mount process was successful.
60   */
61  RTEMS_FSTAB_OK = 0x1U,
62
63  /**
64   * Mount point creation failed.
65   */
66  RTEMS_FSTAB_ERROR_MOUNT_POINT = 0x2U,
67
68  /**
69   * File system mount failed.
70   */
71  RTEMS_FSTAB_ERROR_MOUNT = 0x4U,
72
73  /**
74   * Something failed.
75   */
76  RTEMS_FSTAB_ERROR = RTEMS_FSTAB_ERROR_MOUNT_POINT | RTEMS_FSTAB_ERROR_MOUNT,
77
78  /**
79   * Any condition.
80   */
81  RTEMS_FSTAB_ANY = RTEMS_FSTAB_OK | RTEMS_FSTAB_ERROR
82} rtems_fstab_conditions;
83
84/**
85 * File system table entry.
86 */
87typedef struct {
88  /**
89   * Source for the mount.
90   */
91  const char *source;
92
93  /**
94   * Target for the mount.
95   */
96  const char *target;
97
98  /**
99   * File system operations.
100   */
101  const char *type;
102
103  /**
104   * File system mount options.
105   */
106  rtems_filesystem_options_t options;
107
108  /**
109   * Report @ref rtems_fstab_conditions "condition flags".
110   */
111  uint16_t report_reasons;
112
113  /**
114   * Abort @ref rtems_fstab_conditions "condition flags".
115   */
116  uint16_t abort_reasons;
117} rtems_fstab_entry;
118
119/**
120 * @brief Mounts the file systems listed in the file system mount table.
121 *
122 * Mounts the file systems listed in the file system mount table @a fstab of
123 * size @a size.
124 *
125 * Each file system will be mounted according to its table entry parameters.
126 * In case of an abort condition the corresponding table index will be reported
127 * in @a abort_index.  The pointer @a abort_index may be @c NULL.  The mount
128 * point paths will be created with rtems_mkdir() and need not exist
129 * beforehand.
130 *
131 * On success, zero is returned.  On error, -1 is returned, and @c errno is set
132 * appropriately.
133 *
134 * @see rtems_bdpart_register_from_disk().
135 *
136 * The following example code tries to mount a FAT file system within a SD
137 * Card.  Some cards do not have a partition table so at first it tries to find
138 * a file system inside the hole disk.  If this is successful the mount process
139 * will be aborted because the @ref RTEMS_FSTAB_OK condition is true.  If this
140 * did not work it tries to mount the file system inside the first partition.
141 * If this fails the mount process will not be aborted (this is already the
142 * last entry), but the last error status will be returned.
143 *
144 * @code
145 * #include <stdio.h>
146 * #include <string.h>
147 * #include <errno.h>
148 *
149 * #include <rtems.h>
150 * #include <rtems/bdpart.h>
151 * #include <rtems/error.h>
152 * #include <rtems/fsmount.h>
153 *
154 * static const rtems_fstab_entry fstab [] = {
155 *   {
156 *     .source = "/dev/sd-card-a",
157 *     .target = "/mnt",
158 *     .type = "dosfs",
159 *     .options = RTEMS_FILESYSTEM_READ_WRITE,
160 *     .report_reasons = RTEMS_FSTAB_ANY,
161 *     .abort_reasons = RTEMS_FSTAB_OK
162 *   }, {
163 *     .source = "/dev/sd-card-a1",
164 *     .target = "/mnt",
165 *     .type = "dosfs",
166 *     .options = RTEMS_FILESYSTEM_READ_WRITE,
167 *     .report_reasons = RTEMS_FSTAB_ANY,
168 *     .abort_reasons = RTEMS_FSTAB_NONE
169 *   }
170 * };
171 *
172 * static void my_mount(void)
173 * {
174 *   rtems_status_code sc = RTEMS_SUCCESSFUL;
175 *   int rv = 0;
176 *   size_t abort_index = 0;
177 *
178 *   sc = rtems_bdpart_register_from_disk("/dev/sd-card-a");
179 *   if (sc != RTEMS_SUCCESSFUL) {
180 *     printf("read partition table failed: %s\n", rtems_status_text(sc));
181 *   }
182 *
183 *   rv = rtems_fsmount(fstab, sizeof(fstab) / sizeof(fstab [0]), &abort_index);
184 *   if (rv != 0) {
185 *     printf("mount failed: %s\n", strerror(errno));
186 *   }
187 *   printf("mount aborted at %zu\n", abort_index);
188 * }
189 * @endcode
190 */
191int rtems_fsmount(
192  const rtems_fstab_entry *fstab,
193  size_t                   size,
194  size_t                  *abort_index
195);
196
197/** @} */
198
199typedef rtems_fstab_entry fstab_t;
200
201#define FSMOUNT_MNT_OK RTEMS_FSTAB_OK
202
203#define FSMOUNT_MNTPNT_CRTERR RTEMS_FSTAB_ERROR_MOUNT_POINT
204
205#define FSMOUNT_MNT_FAILED RTEMS_FSTAB_ERROR_MOUNT
206
207#ifdef __cplusplus
208}
209#endif
210
211#endif /* _FSMOUNT_H */
Note: See TracBrowser for help on using the repository browser.