[rtems commit] Use linker set for root file system initialization
Sebastian Huber
sebh at rtems.org
Wed Feb 3 09:34:55 UTC 2016
Module: rtems
Branch: master
Commit: 3d36164fe5a366cf206ed3d2e8dc5b4d9e366c14
Changeset: http://git.rtems.org/rtems/commit/?id=3d36164fe5a366cf206ed3d2e8dc5b4d9e366c14
Author: Sebastian Huber <sebastian.huber at embedded-brains.de>
Date: Mon Jan 25 21:18:41 2016 +0100
Use linker set for root file system initialization
Update #2408.
---
cpukit/libcsupport/include/rtems/libio.h | 2 --
cpukit/libcsupport/src/libio_init.c | 5 -----
cpukit/sapi/include/confdefs.h | 11 ++++++-----
cpukit/score/include/rtems/sysinit.h | 1 +
testsuites/sptests/spsysinit01/init.c | 24 ++++++++++++++++++++++++
5 files changed, 31 insertions(+), 12 deletions(-)
diff --git a/cpukit/libcsupport/include/rtems/libio.h b/cpukit/libcsupport/include/rtems/libio.h
index 7a49978..28b4627 100644
--- a/cpukit/libcsupport/include/rtems/libio.h
+++ b/cpukit/libcsupport/include/rtems/libio.h
@@ -1489,8 +1489,6 @@ extern const rtems_libio_helper rtems_libio_post_driver_helper;
extern const rtems_libio_helper rtems_libio_exit_helper;
-extern const rtems_libio_helper rtems_fs_init_helper;
-
void rtems_libio_helper_null(void);
void rtems_libio_post_driver(void);
diff --git a/cpukit/libcsupport/src/libio_init.c b/cpukit/libcsupport/src/libio_init.c
index a14fe86..88f5d8c 100644
--- a/cpukit/libcsupport/src/libio_init.c
+++ b/cpukit/libcsupport/src/libio_init.c
@@ -80,9 +80,4 @@ void rtems_libio_init( void )
);
if ( rc != RTEMS_SUCCESSFUL )
rtems_fatal_error_occurred( rc );
-
- /*
- * Initialize the base file system infrastructure.
- */
- (* rtems_fs_init_helper)();
}
diff --git a/cpukit/sapi/include/confdefs.h b/cpukit/sapi/include/confdefs.h
index 8f5906d..2c108ba 100644
--- a/cpukit/sapi/include/confdefs.h
+++ b/cpukit/sapi/include/confdefs.h
@@ -136,11 +136,12 @@ const rtems_libio_helper rtems_libio_exit_helper =
rtems_libio_exit;
#endif
-const rtems_libio_helper rtems_fs_init_helper =
- #ifdef CONFIGURE_APPLICATION_DISABLE_FILESYSTEM
- rtems_libio_helper_null;
- #else
- rtems_filesystem_initialize;
+ #ifndef CONFIGURE_APPLICATION_DISABLE_FILESYSTEM
+ RTEMS_SYSINIT_ITEM(
+ rtems_filesystem_initialize,
+ RTEMS_SYSINIT_ROOT_FILESYSTEM,
+ RTEMS_SYSINIT_ORDER_MIDDLE
+ );
#endif
#endif
#endif
diff --git a/cpukit/score/include/rtems/sysinit.h b/cpukit/score/include/rtems/sysinit.h
index 72b21e8..033ba87 100644
--- a/cpukit/score/include/rtems/sysinit.h
+++ b/cpukit/score/include/rtems/sysinit.h
@@ -57,6 +57,7 @@ extern "C" {
#define RTEMS_SYSINIT_POSIX_KEYS 00036b
#define RTEMS_SYSINIT_IDLE_THREADS 000380
#define RTEMS_SYSINIT_BSP_LIBC 000400
+#define RTEMS_SYSINIT_ROOT_FILESYSTEM 000401
#define RTEMS_SYSINIT_BEFORE_DRIVERS 000500
#define RTEMS_SYSINIT_BSP_PRE_DRIVERS 000600
#define RTEMS_SYSINIT_DEVICE_DRIVERS 000700
diff --git a/testsuites/sptests/spsysinit01/init.c b/testsuites/sptests/spsysinit01/init.c
index d72cefe..645156e 100644
--- a/testsuites/sptests/spsysinit01/init.c
+++ b/testsuites/sptests/spsysinit01/init.c
@@ -16,6 +16,8 @@
#include "config.h"
#endif
+#include <sys/stat.h>
+
#include <assert.h>
#include <pthread.h>
#include <string.h>
@@ -122,6 +124,8 @@ typedef enum {
IDLE_THREADS_POST,
BSP_LIBC_PRE,
BSP_LIBC_POST,
+ ROOT_FILESYSTEM_PRE,
+ ROOT_FILESYSTEM_POST,
BEFORE_DRIVERS_PRE,
BEFORE_DRIVERS_POST,
BSP_PRE_DRIVERS_PRE,
@@ -554,6 +558,26 @@ LAST(RTEMS_SYSINIT_BSP_LIBC)
next_step(BSP_LIBC_POST);
}
+FIRST(RTEMS_SYSINIT_ROOT_FILESYSTEM)
+{
+ struct stat st;
+ int rv;
+
+ rv = stat("/", &st);
+ assert(rv == -1);
+ next_step(ROOT_FILESYSTEM_PRE);
+}
+
+LAST(RTEMS_SYSINIT_ROOT_FILESYSTEM)
+{
+ struct stat st;
+ int rv;
+
+ rv = stat("/", &st);
+ assert(rv == 0);
+ next_step(ROOT_FILESYSTEM_POST);
+}
+
FIRST(RTEMS_SYSINIT_BEFORE_DRIVERS)
{
/* Omit test of build configuration specific pre and post conditions */
More information about the vc
mailing list