You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@nuttx.apache.org by GitBox <gi...@apache.org> on 2020/05/27 03:24:40 UTC

[GitHub] [incubator-nuttx] xiaoxiang781216 commented on pull request #1120: fs/vfs/fs_stat.c: fill file size for mtd inode

xiaoxiang781216 commented on pull request #1120:
URL: https://github.com/apache/incubator-nuttx/pull/1120#issuecomment-633786353


   > > Of course the approach with separate universal ioctl function returning underlying media size, as @patacongo suggested, will be much better.
   > 
   > According to the the things Xiang said, he is started some work on a mystery change. But my impression is that we should hide the character driver all together. If there were logic like this in inode_stat(), then I think we complete the illusion).
   
   Yes, I think it is a good idea to hide the proxy(bch and ftl) from user since we add the proxy transparently.
    
   > 
   > ```
   > type = inode type
   > size = 0;
   > 
   > if <type == character driver> then
   >     if <BIOC_GEOMETRY succeeds> then
   >         type = block driver
   >         calculate size
   >     else if <MTDIOC_GEOMETRY succeeeds them
   >         type = MTD driver
   >         calculate size
   >     endif
   >     Create the state buffer based on the type
   > endif
   > ```
   > 
   > That is a gross over-simplification, but I think we could use the ioctls to distinguish if a character driver if a proxy for a block or mtd driver, then hide the character driver altogether.
   
   The order need change like this:
   ```
   if <type == character driver> then
       if <MTDIOC_GEOMETRY succeeeds them
           type = MTD driver
           calculate size
       else if <BIOC_GEOMETRY succeeds> then
           type = block driver
           calculate size
       endif
       Create the state buffer based on the type
   endif
   ```
   since MTD proxy(FLT) implment BIOC_GEOMETRY too.


----------------------------------------------------------------
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.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org