#3894 closed enhancement (fixed)

Replace the device filesystem with a specialization of the IMFS

Reported by: Sebastian Huber Owned by: Sebastian Huber
Priority: normal Milestone: 5.1
Component: fs Version: 5
Severity: normal Keywords:
Cc: Blocked By:
Blocking: #3898

Description

New device drivers (e.g. Termios, I2C, SPI, libbsd) use IMFS generic nodes to hook into the filesystem. This does not work with the device filesystem enabled by the

#define CONFIGURE_USE_DEVFS_AS_BASE_FILESYSTEM

configuration option. Replace the device filesystem with a specialization of the IMFS.

Change History (16)

comment:1 Changed on Mar 3, 2020 at 9:14:52 PM by Chris Johns

Will the changes include the examples and the devfs hello world example?

How doe the size of this approach compare to the devfs approach?

comment:2 in reply to:  1 ; Changed on Mar 4, 2020 at 5:48:53 AM by Sebastian Huber

Replying to Chris Johns:

Will the changes include the examples and the devfs hello world example?

Yes, the aim is to fix this example so that it works with Termios based console drivers.

How doe the size of this approach compare to the devfs approach?

I don't have numbers yet. I guess it will slightly increase.

You can further reduce the code size if you disable the support for the legacy IO drivers and use the new IMFS_add_node() instead.

I don't think this matters. If you want a minimal setup, then why do you want to use the POSIX open/read/write API to access devices? The POSIX functions pull in errno for example which pulls in the re-entrancy support which pulls in a hell of dependencies.

comment:3 Changed on Mar 4, 2020 at 8:46:30 AM by Sebastian Huber <sebastian.huber@…>

In 0b0cd93/rtems:

imfs: Remove IMFS_NODE_FLAG_NAME_ALLOCATED

Remove IMFS_NODE_FLAG_NAME_ALLOCATED and instead replace the node
control in rename operations. This avoids a special case in the general
node destruction which pulled in free().

Update #3894.

comment:4 Changed on Mar 4, 2020 at 8:46:34 AM by Sebastian Huber <sebastian.huber@…>

In 13b71f8/rtems:

imfs: Simplify IMFS_create_node()

Update #3894.

comment:5 Changed on Mar 4, 2020 at 8:46:37 AM by Sebastian Huber <sebastian.huber@…>

In fa44c39/rtems:

imfs: Add IMFS_add_node()

Update #3894.

comment:6 Changed on Mar 4, 2020 at 8:46:40 AM by Sebastian Huber <sebastian.huber@…>

In 7e3b5c0/rtems:

console: Use IMFS_add_node() for simple console

Change license to BSD-2-Clause according to file history.

Update #3053.
Update #3894.

comment:7 Changed on Mar 4, 2020 at 8:46:44 AM by Sebastian Huber <sebastian.huber@…>

In fa3005f/rtems:

console: Use IMFS_add_node() for simple task cons

Change license to BSD-2-Clause according to file history.

Update #3053.
Update #3894.

comment:8 Changed on Mar 4, 2020 at 6:05:38 PM by Sebastian Huber

Blocking: 3898 added

comment:9 in reply to:  2 Changed on Mar 6, 2020 at 6:58:06 AM by Sebastian Huber

Replying to Sebastian Huber:

Replying to Chris Johns:

How doe the size of this approach compare to the devfs approach?

I don't have numbers yet. I guess it will slightly increase.

I checked the code size change of the devfs04 test before and after the change to the IMFS specialization:

size pre/devfs04.exe

text data bss dec hex filename

57328 1152 17312 75792 12810 pre/devfs04.exe

size post/devfs04.exe

text data bss dec hex filename

58384 1152 16096 75632 12770 post/devfs04.exe

The code size increases by 1056 bytes on SPARCV8.

In case the support for legacy IO drivers is disabled via

#define CONFIGURE_IMFS_DISABLE_MKNOD_DEVICE
#define CONFIGURE_IMFS_DISABLE_MKNOD

the code size drops to:
size devfs04.exe

text data bss dec hex filename

56496 1152 16096 73744 12010 devfs04.exe

Using IMFS_add_node() gives you access to all file handlers and removes four layers of indirection, e.g.

read() -> device_read() -> rtems_deviceio_read() -> rtems_io_read() -> _IO_Driver_address_table -> device handler

compared to

read() -> device handler.

comment:10 Changed on Mar 9, 2020 at 6:00:01 PM by Sebastian Huber <sebastian.huber@…>

In 85c9145f/rtems:

imfs: Use _IMFS_get_time()

Update #3894.

comment:11 Changed on Mar 9, 2020 at 6:00:04 PM by Sebastian Huber <sebastian.huber@…>

In 83994913/rtems:

imfs: Constify imfs_memfile_bytes_per_block

The CONFIGURE_IMFS_MEMFILE_BYTES_PER_BLOCK value is validated by
<rtems/confdefs/libio.h>. Changing this value during runtime could lead
to memory corruption.

Update #3894.

comment:12 Changed on Mar 9, 2020 at 6:00:08 PM by Sebastian Huber <sebastian.huber@…>

In 277b9dd/rtems:

imfs: Remove unused handlers

Update #3894.

comment:13 Changed on Mar 9, 2020 at 6:00:11 PM by Sebastian Huber <sebastian.huber@…>

In 103a371/rtems:

imfs: Simplify code generation

Update #3894.

comment:14 Changed on Mar 9, 2020 at 6:00:14 PM by Sebastian Huber <sebastian.huber@…>

In 0161b93d/rtems:

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.

comment:15 Changed on Apr 1, 2020 at 7:05:50 AM by Sebastian Huber <sebastian.huber@…>

In 7cec259/rtems:

config: Remove CONFIGURE_FILESYSTEM_DEVFS

This filesystem no longer exists.

Remove unused RTEMS_FILESYSTEM_TYPE_DEVFS.

Update #3894.

comment:16 Changed on Apr 2, 2020 at 9:25:15 AM by Sebastian Huber

Resolution: fixed
Status: assignedclosed
Note: See TracTickets for help on using tickets.