Changeset 0161b93d in rtems


Ignore:
Timestamp:
Mar 3, 2020, 6:23:53 PM (4 months ago)
Author:
Sebastian Huber <sebastian.huber@…>
Branches:
5, master
Children:
16ed7f64
Parents:
103a371
git-author:
Sebastian Huber <sebastian.huber@…> (03/03/20 18:23:53)
git-committer:
Sebastian Huber <sebastian.huber@…> (03/09/20 16:26:54)
Message:

imfs: Replace devfs with an IMFS specialization

Add a simplified path evaluation function IMFS_eval_path_devfs() for a
device only IMFS configuration.

The code size can be further reduced by the application if it disables
the support for legacy IO drivers via:

#define CONFIGURE_IMFS_DISABLE_MKNOD
#define CONFIGURE_IMFS_DISABLE_MKNOD_DEVICE

Obsolete CONFIGURE_MAXIMUM_DEVICES. Remove BSP_MAXIMUM_DEVICES.

Update #3894.
Update #3898.

Files:
1 added
17 deleted
14 edited

Legend:

Unmodified
Added
Removed
  • bsps/i386/pc386/include/bsp.h

    r103a371 r0161b93d  
    240240void breakpoint(void);
    241241
    242 #define BSP_MAXIMUM_DEVICES 6
    243 
    244242/*
    245243 * Debug helper methods
  • bsps/riscv/griscv/include/bsp.h

    r103a371 r0161b93d  
    7070#define BSP_NUMBER_OF_TERMIOS_PORTS 8
    7171
    72 /* Make sure maximum number of consoles fit in filesystem */
    73 #define BSP_MAXIMUM_DEVICES 8
    74 
    7572/* GRLIB driver functions */
    7673
  • bsps/sparc/leon3/include/bsp.h

    r103a371 r0161b93d  
    6161/* Maximum supported APBUARTs by BSP */
    6262#define BSP_NUMBER_OF_TERMIOS_PORTS 8
    63 
    64 /* Make sure maximum number of consoles fit in filesystem */
    65 #define BSP_MAXIMUM_DEVICES 8
    6663
    6764/*
  • cpukit/Makefile.am

    r103a371 r0161b93d  
    381381librtemscpu_a_SOURCES += libfs/src/defaults/default_write.c
    382382librtemscpu_a_SOURCES += libfs/src/defaults/default_writev.c
    383 librtemscpu_a_SOURCES += libfs/src/devfs/devclose.c
    384 librtemscpu_a_SOURCES += libfs/src/devfs/devfs_eval.c
    385 librtemscpu_a_SOURCES += libfs/src/devfs/devfs_init.c
    386 librtemscpu_a_SOURCES += libfs/src/devfs/devfs_mknod.c
    387 librtemscpu_a_SOURCES += libfs/src/devfs/devfs_show.c
    388 librtemscpu_a_SOURCES += libfs/src/devfs/devioctl.c
    389 librtemscpu_a_SOURCES += libfs/src/devfs/devopen.c
    390 librtemscpu_a_SOURCES += libfs/src/devfs/devread.c
    391 librtemscpu_a_SOURCES += libfs/src/devfs/devstat.c
    392 librtemscpu_a_SOURCES += libfs/src/devfs/devwrite.c
    393383librtemscpu_a_SOURCES += libfs/src/dosfs/fat.c
    394384librtemscpu_a_SOURCES += libfs/src/dosfs/fat_fat_operations.c
     
    422412librtemscpu_a_SOURCES += libfs/src/imfs/imfs_dir_minimal.c
    423413librtemscpu_a_SOURCES += libfs/src/imfs/imfs_eval.c
     414librtemscpu_a_SOURCES += libfs/src/imfs/imfs_eval_devfs.c
    424415librtemscpu_a_SOURCES += libfs/src/imfs/imfs_fchmod.c
    425416librtemscpu_a_SOURCES += libfs/src/imfs/imfs_fifo.c
  • cpukit/headers.am

    r103a371 r0161b93d  
    8383include_rtems_HEADERS += include/rtems/counter.h
    8484include_rtems_HEADERS += include/rtems/cpuuse.h
    85 include_rtems_HEADERS += include/rtems/devfs.h
    8685include_rtems_HEADERS += include/rtems/deviceio.h
    8786include_rtems_HEADERS += include/rtems/devnull.h
  • cpukit/include/rtems/confdefs/bsp.h

    r103a371 r0161b93d  
    4949  #undef BSP_INITIAL_EXTENSION
    5050  #undef BSP_INTERRUPT_STACK_SIZE
    51   #undef BSP_MAXIMUM_DEVICES
    5251  #undef CONFIGURE_BSP_PREREQUISITE_DRIVERS
    5352  #undef CONFIGURE_MALLOC_BSP_SUPPORTS_SBRK
  • cpukit/include/rtems/confdefs/libio.h

    r103a371 r0161b93d  
    4848
    4949#ifdef CONFIGURE_FILESYSTEM_ALL
    50   #define CONFIGURE_FILESYSTEM_DEVFS
    5150  #define CONFIGURE_FILESYSTEM_DOSFS
    5251  #define CONFIGURE_FILESYSTEM_FTPFS
     
    5655  #define CONFIGURE_FILESYSTEM_RFS
    5756  #define CONFIGURE_FILESYSTEM_TFTPFS
    58 #endif
    59 
    60 #ifdef CONFIGURE_USE_DEVFS_AS_BASE_FILESYSTEM
    61   #define CONFIGURE_FILESYSTEM_DEVFS
    62 #elif !defined(CONFIGURE_APPLICATION_DISABLE_FILESYSTEM)
    63   #define _CONFIGURE_USE_IMFS_AS_BASE_FILESYSTEM
    6457#endif
    6558
     
    7972#endif
    8073
     74#ifdef CONFIGURE_USE_DEVFS_AS_BASE_FILESYSTEM
     75  #define CONFIGURE_IMFS_DISABLE_CHMOD
     76  #define CONFIGURE_IMFS_DISABLE_CHOWN
     77  #define CONFIGURE_IMFS_DISABLE_LINK
     78  #define CONFIGURE_IMFS_DISABLE_MKNOD_FILE
     79  #define CONFIGURE_IMFS_DISABLE_MOUNT
     80  #define CONFIGURE_IMFS_DISABLE_READDIR
     81  #define CONFIGURE_IMFS_DISABLE_READLINK
     82  #define CONFIGURE_IMFS_DISABLE_RENAME
     83  #define CONFIGURE_IMFS_DISABLE_RMNOD
     84  #define CONFIGURE_IMFS_DISABLE_SYMLINK
     85  #define CONFIGURE_IMFS_DISABLE_UNMOUNT
     86  #define CONFIGURE_IMFS_DISABLE_UTIME
     87#endif
     88
    8189#ifdef CONFIGURE_APPLICATION_DISABLE_FILESYSTEM
    8290  #ifdef CONFIGURE_USE_DEVFS_AS_BASE_FILESYSTEM
     
    8896  #endif
    8997
    90   #ifdef CONFIGURE_FILESYSTEM_DEVFS
    91     #error "CONFIGURE_APPLICATION_DISABLE_FILESYSTEM cannot be used together with CONFIGURE_FILESYSTEM_DEVFS"
    92   #endif
    93 
    9498  #ifdef CONFIGURE_FILESYSTEM_DOSFS
    9599    #error "CONFIGURE_APPLICATION_DISABLE_FILESYSTEM cannot be used together with CONFIGURE_FILESYSTEM_DOSFS"
     
    119123    #error "CONFIGURE_APPLICATION_DISABLE_FILESYSTEM cannot be used together with CONFIGURE_FILESYSTEM_TFTPFS"
    120124  #endif
    121 #else
    122   #define _CONFIGURE_FILESYSTEM_INITIALIZE
    123 #endif
    124 
    125 #ifdef CONFIGURE_FILESYSTEM_DEVFS
    126 #include <rtems/devfs.h>
    127 #endif
     125#endif
     126
     127#include <rtems/imfs.h>
    128128
    129129#ifdef CONFIGURE_FILESYSTEM_DOSFS
     
    135135#endif
    136136
    137 #if defined(CONFIGURE_FILESYSTEM_IMFS) \
    138   || defined(_CONFIGURE_USE_IMFS_AS_BASE_FILESYSTEM)
    139 #include <rtems/imfs.h>
    140 #endif
    141 
    142137#ifdef CONFIGURE_FILESYSTEM_JFFS2
    143138#include <rtems/jffs2.h>
     
    160155#endif
    161156
    162 #ifdef CONFIGURE_USE_DEVFS_AS_BASE_FILESYSTEM
    163 
    164 #ifndef CONFIGURE_MAXIMUM_DEVICES
    165   #ifdef BSP_MAXIMUM_DEVICES
    166     #define CONFIGURE_MAXIMUM_DEVICES BSP_MAXIMUM_DEVICES
    167   #else
    168     #define CONFIGURE_MAXIMUM_DEVICES 4
    169   #endif
    170 #endif
    171 
    172 static devFS_node devFS_root_filesystem_nodes[ CONFIGURE_MAXIMUM_DEVICES ];
    173 
    174 static const devFS_data _Filesystem_Root_data = {
    175   devFS_root_filesystem_nodes,
    176   CONFIGURE_MAXIMUM_DEVICES
    177 };
    178 
    179 #define _CONFIGURE_FILESYSTEM_ROOT_TYPE RTEMS_FILESYSTEM_TYPE_DEVFS
    180 
    181 #endif /* CONFIGURE_USE_DEVFS_AS_BASE_FILESYSTEM */
    182 
    183 #ifdef _CONFIGURE_USE_IMFS_AS_BASE_FILESYSTEM
     157#ifndef CONFIGURE_APPLICATION_DISABLE_FILESYSTEM
    184158
    185159#ifndef CONFIGURE_IMFS_MEMFILE_BYTES_PER_BLOCK
     
    199173const int imfs_memfile_bytes_per_block = CONFIGURE_IMFS_MEMFILE_BYTES_PER_BLOCK;
    200174
    201 static IMFS_fs_info_t _IMFS_fs_info;
    202 
    203 static const rtems_filesystem_operations_table _IMFS_ops = {
     175static IMFS_fs_info_t IMFS_root_fs_info;
     176
     177static const rtems_filesystem_operations_table IMFS_root_ops = {
    204178  rtems_filesystem_default_lock,
    205179  rtems_filesystem_default_unlock,
    206   IMFS_eval_path,
     180  #ifdef CONFIGURE_USE_DEVFS_AS_BASE_FILESYSTEM
     181    IMFS_eval_path_devfs,
     182  #else
     183    IMFS_eval_path,
     184  #endif
    207185  #ifdef CONFIGURE_IMFS_DISABLE_LINK
    208186    rtems_filesystem_default_link,
     
    267245};
    268246
    269 static const IMFS_mknod_controls _IMFS_mknod_controls = {
     247static const IMFS_mknod_controls IMFS_root_mknod_controls = {
    270248  #ifdef CONFIGURE_IMFS_DISABLE_READDIR
    271249    &IMFS_mknod_control_dir_minimal,
     
    273251    &IMFS_mknod_control_dir_default,
    274252  #endif
    275   &IMFS_mknod_control_device,
     253  #ifdef CONFIGURE_IMFS_DISABLE_MKNOD_DEVICE
     254    &IMFS_mknod_control_enosys,
     255  #else
     256    &IMFS_mknod_control_device,
     257  #endif
    276258  #ifdef CONFIGURE_IMFS_DISABLE_MKNOD_FILE
    277259    &IMFS_mknod_control_enosys,
     
    286268};
    287269
    288 static const IMFS_mount_data _Filesystem_Root_data = {
    289   &_IMFS_fs_info,
    290   &_IMFS_ops,
    291   &_IMFS_mknod_controls
    292 };
    293 
    294 #define _CONFIGURE_FILESYSTEM_ROOT_TYPE "/"
    295 
    296 #endif /* _CONFIGURE_USE_IMFS_AS_BASE_FILESYSTEM */
    297 
    298 #ifdef _CONFIGURE_FILESYSTEM_INITIALIZE
     270static const IMFS_mount_data IMFS_root_mount_data = {
     271  &IMFS_root_fs_info,
     272  &IMFS_root_ops,
     273  &IMFS_root_mknod_controls
     274};
    299275
    300276#if defined(CONFIGURE_FILESYSTEM_DEVFS) \
     
    347323
    348324const rtems_filesystem_table_t rtems_filesystem_table[] = {
    349   #ifdef _CONFIGURE_USE_IMFS_AS_BASE_FILESYSTEM
    350     { "/", IMFS_initialize_support },
    351   #endif
     325  { "/", IMFS_initialize_support },
    352326  #ifdef CONFIGURE_FILESYSTEM_ENTRY_DEVFS
    353327    CONFIGURE_FILESYSTEM_ENTRY_DEVFS,
     
    381355  NULL,
    382356  NULL,
    383   _CONFIGURE_FILESYSTEM_ROOT_TYPE,
     357  "/",
    384358  RTEMS_FILESYSTEM_READ_WRITE,
    385   &_Filesystem_Root_data
     359  &IMFS_root_mount_data
    386360};
    387361
     
    392366);
    393367
    394 #endif /* _CONFIGURE_FILESYSTEM_INITIALIZE */
     368#endif /* !CONFIGURE_APPLICATION_DISABLE_FILESYSTEM */
    395369
    396370#ifndef CONFIGURE_MAXIMUM_FILE_DESCRIPTORS
  • cpukit/include/rtems/confdefs/obsolete.h

    r103a371 r0161b93d  
    6666#endif
    6767
     68#ifdef CONFIGURE_MAXIMUM_DEVICES
     69  #warning "The CONFIGURE_MAXIMUM_DEVICES configuration option is obsolete since RTEMS 5.1"
     70#endif
     71
    6872#ifdef CONFIGURE_ENABLE_GO
    6973  #warning "The CONFIGURE_ENABLE_GO configuration option is obsolete since RTEMS 5.1"
  • cpukit/include/rtems/imfs.h

    r103a371 r0161b93d  
    538538
    539539/**
     540 * @brief IMFS device filesystem evaluation node support.
     541 */
     542extern void IMFS_eval_path_devfs(
     543  rtems_filesystem_eval_path_context_t *ctx
     544);
     545
     546/**
    540547 * @brief Create a new IMFS link node.
    541548 *
  • testsuites/libtests/Makefile.am

    r103a371 r0161b93d  
    269269devfs01_SOURCES = devfs01/init.c
    270270devfs01_CPPFLAGS = $(AM_CPPFLAGS) $(TEST_FLAGS_devfs01) \
    271         $(support_includes)
    272 endif
    273 
    274 if TEST_devfs02
    275 lib_tests += devfs02
    276 lib_screens += devfs02/devfs02.scn
    277 lib_docs += devfs02/devfs02.doc
    278 devfs02_SOURCES = devfs02/init.c
    279 devfs02_CPPFLAGS = $(AM_CPPFLAGS) $(TEST_FLAGS_devfs02) \
    280         $(support_includes)
    281 endif
    282 
    283 if TEST_devfs03
    284 lib_tests += devfs03
    285 lib_screens += devfs03/devfs03.scn
    286 lib_docs += devfs03/devfs03.doc
    287 devfs03_SOURCES = devfs03/init.c
    288 devfs03_CPPFLAGS = $(AM_CPPFLAGS) $(TEST_FLAGS_devfs03) \
    289271        $(support_includes)
    290272endif
  • testsuites/libtests/configure.ac

    r103a371 r0161b93d  
    120120RTEMS_TEST_CHECK([defaultconfig01])
    121121RTEMS_TEST_CHECK([devfs01])
    122 RTEMS_TEST_CHECK([devfs02])
    123 RTEMS_TEST_CHECK([devfs03])
    124122RTEMS_TEST_CHECK([devfs04])
    125123RTEMS_TEST_CHECK([deviceio01])
  • testsuites/libtests/devfs01/init.c

    r103a371 r0161b93d  
     1/* SPDX-License-Identifier: BSD-2-Clause */
     2
    13/*
    2  *  COPYRIGHT (c) 1989-2012.
    3  *  On-Line Applications Research Corporation (OAR).
     4 * Copyright (C) 2020 embedded brains GmbH (http://www.embedded-brains.de)
    45 *
    5  *  The license and distribution terms for this file may be
    6  *  found in the file LICENSE in this distribution or at
    7  *  http://www.rtems.org/license/LICENSE.
     6 * Redistribution and use in source and binary forms, with or without
     7 * modification, are permitted provided that the following conditions
     8 * are met:
     9 * 1. Redistributions of source code must retain the above copyright
     10 *    notice, this list of conditions and the following disclaimer.
     11 * 2. Redistributions in binary form must reproduce the above copyright
     12 *    notice, this list of conditions and the following disclaimer in the
     13 *    documentation and/or other materials provided with the distribution.
     14 *
     15 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
     16 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
     17 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
     18 * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
     19 * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
     20 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
     21 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
     22 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
     23 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
     24 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
     25 * POSSIBILITY OF SUCH DAMAGE.
    826 */
    927
     
    1331
    1432#include <tmacros.h>
    15 #include "test_support.h"
    16 #include <rtems/devfs.h>
    1733#include <errno.h>
    1834
    1935const char rtems_test_name[] = "DEVFS 1";
    2036
    21 /* forward declarations to avoid warnings */
    22 rtems_task Init(rtems_task_argument argument);
    23 
    24 rtems_task Init(
    25   rtems_task_argument argument
    26 )
     37static void Init(rtems_task_argument argument)
    2738{
    2839  TEST_BEGIN();
    2940
    30   puts( "devFS_Show" );
    31   devFS_Show();
    32  
    3341  TEST_END();
    34 
    3542  rtems_test_exit(0);
    3643}
    3744
    38 /* configuration information */
     45#define CONFIGURE_APPLICATION_DOES_NOT_NEED_CLOCK_DRIVER
    3946
    40 #define CONFIGURE_APPLICATION_NEEDS_CLOCK_DRIVER
     47#define CONFIGURE_APPLICATION_NEEDS_SIMPLE_CONSOLE_DRIVER
    4148
    42 #define CONFIGURE_MAXIMUM_TASKS             1
     49#define CONFIGURE_MAXIMUM_TASKS 1
     50
    4351#define CONFIGURE_INITIAL_EXTENSIONS RTEMS_TEST_INITIAL_EXTENSION
    4452
     
    5058
    5159#include <rtems/confdefs.h>
    52 /* end of file */
  • testsuites/libtests/devfs04/init.c

    r103a371 r0161b93d  
    1414#include <tmacros.h>
    1515#include "test_support.h"
    16 #include <rtems/devfs.h>
    1716#include <errno.h>
    1817#include <unistd.h>
    1918#include <sys/types.h>
    2019#include <sys/stat.h>
     20#include <sys/ioctl.h>
    2121#include <fcntl.h>
    2222#include "test_driver.h"
    23 #include <rtems/devnull.h>
    2423
    2524const char rtems_test_name[] = "DEVFS 4";
    2625
    27 /* forward declarations to avoid warnings */
    28 rtems_task Init(rtems_task_argument argument);
    29 
    30 rtems_task Init(
     26static rtems_task Init(
    3127  rtems_task_argument argument
    3228)
     
    8985#define CONFIGURE_RTEMS_INIT_TASKS_TABLE
    9086
    91 /* Make sure that we have enough devices for all BSPs */
    92 #define CONFIGURE_MAXIMUM_DEVICES 64
    93 
    9487#define CONFIGURE_USE_DEVFS_AS_BASE_FILESYSTEM
    9588
  • testsuites/libtests/deviceio01/init.c

    r103a371 r0161b93d  
    1414#include <tmacros.h>
    1515#include "test_support.h"
    16 #include <rtems/devfs.h>
    1716#include <errno.h>
    1817#include <unistd.h>
    1918#include <sys/types.h>
    2019#include <sys/stat.h>
     20#include <sys/ioctl.h>
    2121#include <fcntl.h>
    2222#include "test_driver.h"
     
    2525const char rtems_test_name[] = "DEVICEIO 1";
    2626
    27 /* forward declarations to avoid warnings */
    28 rtems_task Init(rtems_task_argument argument);
    29 
    30 rtems_task Init(
     27static rtems_task Init(
    3128  rtems_task_argument argument
    3229)
Note: See TracChangeset for help on using the changeset viewer.