libcsupport: Make LibIO helper const

Add and use rtems_libio_helper function type.  Add and use
rtems_libio_helper_null() instead of NULL pointer.
This commit is contained in:
Sebastian Huber
2013-04-24 14:30:42 +02:00
parent aeba445349
commit a290fbe946
7 changed files with 57 additions and 34 deletions

View File

@@ -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 \

View File

@@ -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

View File

@@ -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 */
}

View File

@@ -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)();
}

View File

@@ -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