From 3d36164fe5a366cf206ed3d2e8dc5b4d9e366c14 Mon Sep 17 00:00:00 2001 From: Sebastian Huber Date: Mon, 25 Jan 2016 21:18:41 +0100 Subject: 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 7a49978de0..28b4627c3e 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 a14fe866f0..88f5d8cef3 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 8f5906d067..2c108ba78c 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 72b21e8e1d..033ba871ed 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 d72cefea7d..645156e3d0 100644 --- a/testsuites/sptests/spsysinit01/init.c +++ b/testsuites/sptests/spsysinit01/init.c @@ -16,6 +16,8 @@ #include "config.h" #endif +#include + #include #include #include @@ -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 */ -- cgit v1.2.3