acassis commented on code in PR #16642:
URL: https://github.com/apache/nuttx/pull/16642#discussion_r2197660455


##########
drivers/mtd/ftl.c:
##########
@@ -789,7 +883,8 @@ static int ftl_unlink(FAR struct inode *inode)
  *
  ****************************************************************************/
 
-int ftl_initialize_by_path(FAR const char *path, FAR struct mtd_dev_s *mtd)
+int ftl_initialize_by_path(FAR const char *path, FAR struct mtd_dev_s *mtd,
+                           int oflags)

Review Comment:
   > However, as you know, the current logic of this patch is that when a node 
uses **`register_mtddriver()`for mtd registration, we can pass oflags when 
opening the mtd_path.** This requires us to modify ftl_initialize_by_path() to 
accept oflags as a parameter. The open with oflags and oflags pass logic is 
shown in the figure(The MTD device undergoes two conversions: blockproxy and 
mtdproxy.): 
![image](https://private-user-images.githubusercontent.com/138179549/463263046-2d0fa858-5c00-4551-a275-3011271ef5ad.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3NTIxNTE2MDIsIm5iZiI6MTc1MjE1MTMwMiwicGF0aCI6Ii8xMzgxNzk1NDkvNDYzMjYzMDQ2LTJkMGZhODU4LTVjMDAtNDU1MS1hMjc1LTMwMTEyNzFlZjVhZC5wbmc_WC1BbXotQWxnb3JpdGhtPUFXUzQtSE1BQy1TSEEyNTYmWC1BbXotQ3JlZGVudGlhbD1BS0lBVkNPRFlMU0E1M1BRSzRaQSUyRjIwMjUwNzEwJTJGdXMtZWFzdC0xJTJGczMlMkZhd3M0X3JlcXVlc3QmWC1BbXotRGF0ZT0yMDI1MDcxMFQxMjQxNDJaJlgtQW16LUV4cGlyZXM
 
9MzAwJlgtQW16LVNpZ25hdHVyZT01NGMwYTI2MTk2ZDU3ZTdjNTYzNTljNzJiYmVjMmE2OGNmMDljMzk3NmY2OTQyMThjZjY0MjMwMWMxYTUyOTc1JlgtQW16LVNpZ25lZEhlYWRlcnM9aG9zdCJ9.h5Z8iRcfBfwRWxiXfqiaXkckzRk22yM_IEA93FbRsFk)
   > 
   > Of course, if you directly use `ftl_initialize_by_path() `to register the 
MTD as a block device, the registration determines the FTL's oflags. The block 
device's opening process only goes through one conversion, and at this time, it 
is impossible to pass oflags during the open process.
   
   @jingfei195887 very nice diagram, please include it in the Documentation/ to 
be used as reference for anyone studying the FTL/MTD



-- 
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: commits-unsubscr...@nuttx.apache.org

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

Reply via email to