diff options
author | Sebastian Huber <sebastian.huber@embedded-brains.de> | 2013-04-24 14:30:42 +0200 |
---|---|---|
committer | Sebastian Huber <sebastian.huber@embedded-brains.de> | 2013-04-26 10:57:08 +0200 |
commit | a290fbe946944385480cff7b388a6cd8b9d27d38 (patch) | |
tree | 0304af8b9649aa9b8073b13027d1f81ed07bfbff /cpukit | |
parent | libcsupport: Remove superfluous assignments (diff) | |
download | rtems-a290fbe946944385480cff7b388a6cd8b9d27d38.tar.bz2 |
libcsupport: Make LibIO helper const
Add and use rtems_libio_helper function type. Add and use
rtems_libio_helper_null() instead of NULL pointer.
Diffstat (limited to 'cpukit')
-rw-r--r-- | cpukit/libcsupport/Makefile.am | 1 | ||||
-rw-r--r-- | cpukit/libcsupport/include/rtems/libio.h | 15 | ||||
-rw-r--r-- | cpukit/libcsupport/src/libio_helper_null.c | 30 | ||||
-rw-r--r-- | cpukit/libcsupport/src/libio_init.c | 4 | ||||
-rw-r--r-- | cpukit/sapi/include/confdefs.h | 30 |
5 files changed, 55 insertions, 25 deletions
diff --git a/cpukit/libcsupport/Makefile.am b/cpukit/libcsupport/Makefile.am index 76147c9873..42de63cf1d 100644 --- a/cpukit/libcsupport/Makefile.am +++ b/cpukit/libcsupport/Makefile.am @@ -55,6 +55,7 @@ ASSOCIATION_C_FILES = src/assoclocalbyname.c \ BASE_FS_C_FILES = src/base_fs.c src/mount.c src/unmount.c src/libio.c \ src/mount-mgr.c src/mount-mktgt.c src/libio_init.c \ src/privateenv.c \ + src/libio_helper_null.c \ src/open_dev_console.c src/__usrenv.c src/rtems_mkdir.c TERMIOS_C_FILES = src/cfgetispeed.c src/cfgetospeed.c src/cfsetispeed.c \ diff --git a/cpukit/libcsupport/include/rtems/libio.h b/cpukit/libcsupport/include/rtems/libio.h index 51e25c98c7..02db6bb4e6 100644 --- a/cpukit/libcsupport/include/rtems/libio.h +++ b/cpukit/libcsupport/include/rtems/libio.h @@ -1386,16 +1386,17 @@ static inline rtems_device_minor_number rtems_filesystem_dev_minor_t( */ void rtems_filesystem_initialize( void ); -typedef void (*rtems_libio_init_functions_t)(void); -extern rtems_libio_init_functions_t rtems_libio_init_helper; +typedef void (*rtems_libio_helper)(void); -void open_dev_console(void); +extern const rtems_libio_helper rtems_libio_init_helper; -typedef void (*rtems_libio_supp_functions_t)(void); -extern rtems_libio_supp_functions_t rtems_libio_supp_helper; +extern const rtems_libio_helper rtems_libio_supp_helper; -typedef void (*rtems_fs_init_functions_t)(void); -extern rtems_fs_init_functions_t rtems_fs_init_helper; +extern const rtems_libio_helper rtems_fs_init_helper; + +void rtems_libio_helper_null(void); + +void open_dev_console(void); /** * @brief Creates a directory and all its parent directories according to diff --git a/cpukit/libcsupport/src/libio_helper_null.c b/cpukit/libcsupport/src/libio_helper_null.c new file mode 100644 index 0000000000..17bdb7a557 --- /dev/null +++ b/cpukit/libcsupport/src/libio_helper_null.c @@ -0,0 +1,30 @@ +/** + * @file + * + * @ingroup LibIO + */ + +/* + * Copyright (c) 2013 embedded brains GmbH. All rights reserved. + * + * embedded brains GmbH + * Obere Lagerstr. 30 + * 82178 Puchheim + * Germany + * <rtems@embedded-brains.de> + * + * The license and distribution terms for this file may be + * found in the file LICENSE in this distribution or at + * http://www.rtems.com/license/LICENSE. + */ + +#if HAVE_CONFIG_H + #include "config.h" +#endif + +#include <rtems/libio.h> + +void rtems_libio_helper_null(void) +{ + /* Do nothing */ +} diff --git a/cpukit/libcsupport/src/libio_init.c b/cpukit/libcsupport/src/libio_init.c index 3496b59b5e..655c2e353f 100644 --- a/cpukit/libcsupport/src/libio_init.c +++ b/cpukit/libcsupport/src/libio_init.c @@ -78,7 +78,5 @@ void rtems_libio_init( void ) /* * Initialize the base file system infrastructure. */ - - if (rtems_fs_init_helper) - (* rtems_fs_init_helper)(); + (* rtems_fs_init_helper)(); } diff --git a/cpukit/sapi/include/confdefs.h b/cpukit/sapi/include/confdefs.h index 1e1e3bb39e..04d8ae2a12 100644 --- a/cpukit/sapi/include/confdefs.h +++ b/cpukit/sapi/include/confdefs.h @@ -92,26 +92,26 @@ extern rtems_driver_address_table Device_drivers[]; #include <rtems/libio.h> #ifdef CONFIGURE_INIT -rtems_libio_init_functions_t rtems_libio_init_helper = - #ifdef CONFIGURE_APPLICATION_DISABLE_FILESYSTEM - NULL; - #else +const rtems_libio_helper rtems_libio_init_helper = + #ifdef CONFIGURE_APPLICATION_DISABLE_FILESYSTEM + rtems_libio_helper_null; + #else rtems_libio_init; - #endif + #endif -rtems_libio_supp_functions_t rtems_libio_supp_helper = - #ifdef CONFIGURE_APPLICATION_DISABLE_FILESYSTEM - NULL; - #else +const rtems_libio_helper rtems_libio_supp_helper = + #ifdef CONFIGURE_APPLICATION_DISABLE_FILESYSTEM + rtems_libio_helper_null; + #else open_dev_console; - #endif + #endif -rtems_fs_init_functions_t rtems_fs_init_helper = - #ifdef CONFIGURE_APPLICATION_DISABLE_FILESYSTEM - NULL; - #else +const rtems_libio_helper rtems_fs_init_helper = + #ifdef CONFIGURE_APPLICATION_DISABLE_FILESYSTEM + rtems_libio_helper_null; + #else rtems_filesystem_initialize; - #endif + #endif #endif #endif |