ajuckler opened a new pull request, #17264:
URL: https://github.com/apache/nuttx/pull/17264

   ## Summary
   
   The [NuttX 
documentation](https://nuttx.apache.org/docs/12.7.0/components/drivers/block/eeprom.html#file-systems)
 states that it is possible to use an EEPROM character driver with a file 
system by converting it to a block device using the loop device (`losetup`). 
However, `losetup()` fails  with message `File is too small for blocksize` 
because the `st_size` field is not populated by the `stat()` function when used 
on character drivers.
   
   This MR fixes this error by:
   * Allowing to retrieve the geometry of an EEPROM character driver using 
ioctl;
   * Using this geometry to populate the `st_size` field on `stat()`.
   
   ## Impact
   
   The `eeprom_25xx_e` enum contents have changed due to the addition of the 
sector size.
   
   ## Testing
   
   Tested on a custom target (STM32F7-based) with a Rhom BR25G256FVT EEPROM 
(equivalent to a Microchip 25xx256).
   
   Following piece of code would fail before the changes in fs_stat:
   ```c
   ee25xx_initialize(spi_p, "/dev/ee25xx", EEPROM_25XX256, 0);
   losetup("/dev/ee25blk", "/dev/ee25xx", 64, 0, 0);
   ```
   
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to