Nios® II Software Developer Handbook

ID 683525
Date 8/28/2023
Public
Document Table of Contents

8.7.2.1. Create a Device Instance

Creating and registering a file system is very similar to creating and registering a character-mode device. To make a file system available, create an instance of the alt_dev structure.

For more information, refer to the “Character-Mode Device Drivers” chapter.

The only distinction is that the name field of the device represents the mount point for the file subsystem. Of course, you must also provide any necessary functions to access the file subsystem, such as read() and write(), similar to the case of the character-mode device.

Note: If you do not provide an implementation of fstat(), the default behavior returns the value for a character-mode device, which is incorrect behavior for a file subsystem.