apache / apache/nuttx

[BUG] `stat()` does not work on flash partition with BCH layer

Open
#16,074 5 comments 0 reactions 0 assignees View on GitHub
Arch: all Area: Drivers Area: Kernel OS: Linux Type: Bug
Dominant language
C
Stars
4k
Forks
1.7k
Avg merge
1d 17h
Merged PRs (30d)
237

Description

### Description / Steps to reproduce the issue

Flash partition configured as BCH layer (device driver created with `bchdev_register`) doesn't allow `stat` call to obtain the information about an underlying MTD device/flash. This is caused by `INODE_IS_MTD` not being set and thus
function `inode_stat` falls to the last `else` statement and does not fill the necessary information.

This is a logical output as BCH layer is registered as a standard character device driver, therefore it is not considered as MTD but as a standard driver (ADC, PWM, etc.). This, however, makes the `stat` call unusable for it.

We should probably find a way how to pass an information there is a MTD device under the driver and that we should access it with a standard `MTDIOC_GEOMETRY` ioctl to obtain the required information and pass them to the user.

### On which OS does this issue occur?

[OS: Linux]

### What is the version of your OS?

Ubuntu 22.04.5 LTS

### NuttX Version

master

### Issue Architecture

[Arch: all]

### Issue Area

[Area: Kernel], [Area: Drivers]

### Host information

_No response_

### Verification

- [x] I have verified before submitting the report.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.