From efd2965abf0beaa66e918107be0b667f086d6ea4 Mon Sep 17 00:00:00 2001 From: Sebastian Huber Date: Mon, 2 Feb 2015 15:25:26 +0100 Subject: Filesystem: Statically initialize rtems_libio_iops --- cpukit/libcsupport/include/rtems/libio_.h | 2 +- cpukit/libcsupport/src/libio_init.c | 8 +------- cpukit/sapi/include/confdefs.h | 6 ++++-- 3 files changed, 6 insertions(+), 10 deletions(-) (limited to 'cpukit') diff --git a/cpukit/libcsupport/include/rtems/libio_.h b/cpukit/libcsupport/include/rtems/libio_.h index 1300d39b41..c26782e015 100644 --- a/cpukit/libcsupport/include/rtems/libio_.h +++ b/cpukit/libcsupport/include/rtems/libio_.h @@ -65,7 +65,7 @@ extern rtems_id rtems_libio_semaphore; */ extern const uint32_t rtems_libio_number_iops; -extern rtems_libio_t *rtems_libio_iops; +extern rtems_libio_t rtems_libio_iops[]; extern rtems_libio_t *rtems_libio_iop_freelist; extern const rtems_filesystem_file_handlers_r rtems_filesystem_null_handlers; diff --git a/cpukit/libcsupport/src/libio_init.c b/cpukit/libcsupport/src/libio_init.c index e64ddd6e3a..a14fe866f0 100644 --- a/cpukit/libcsupport/src/libio_init.c +++ b/cpukit/libcsupport/src/libio_init.c @@ -38,7 +38,6 @@ */ rtems_id rtems_libio_semaphore; -rtems_libio_t *rtems_libio_iops; rtems_libio_t *rtems_libio_iop_freelist; void rtems_libio_init( void ) @@ -50,12 +49,7 @@ void rtems_libio_init( void ) if (rtems_libio_number_iops > 0) { - rtems_libio_iops = (rtems_libio_t *) calloc(rtems_libio_number_iops, - sizeof(rtems_libio_t)); - if (rtems_libio_iops == NULL) - rtems_fatal_error_occurred(RTEMS_NO_MEMORY); - - iop = rtems_libio_iop_freelist = rtems_libio_iops; + iop = rtems_libio_iop_freelist = &rtems_libio_iops[0]; for (i = 0 ; (i + 1) < rtems_libio_number_iops ; i++, iop++) iop->data1 = iop + 1; iop->data1 = NULL; diff --git a/cpukit/sapi/include/confdefs.h b/cpukit/sapi/include/confdefs.h index 569f136210..65d07facf6 100644 --- a/cpukit/sapi/include/confdefs.h +++ b/cpukit/sapi/include/confdefs.h @@ -92,7 +92,7 @@ extern rtems_initialization_tasks_table Initialization_tasks[]; #endif #ifndef RTEMS_SCHEDSIM -#include +#include #ifdef CONFIGURE_INIT const rtems_libio_helper rtems_libio_init_helper = @@ -153,11 +153,13 @@ const rtems_libio_helper rtems_fs_init_helper = #define CONFIGURE_LIBIO_POSIX_KEYS 1 #ifdef CONFIGURE_INIT + rtems_libio_t rtems_libio_iops[CONFIGURE_LIBIO_MAXIMUM_FILE_DESCRIPTORS]; + /** * When instantiating the configuration tables, this variable is * initialized to specify the maximum number of file descriptors. */ - const uint32_t rtems_libio_number_iops = CONFIGURE_LIBIO_MAXIMUM_FILE_DESCRIPTORS; + const uint32_t rtems_libio_number_iops = RTEMS_ARRAY_SIZE(rtems_libio_iops); #endif /** -- cgit v1.2.3