esp_littlefs icon indicating copy to clipboard operation
esp_littlefs copied to clipboard

feat(esp_littlefs): Support O_DIRECTORY for WAMR

Open donghengqaz opened this issue 1 year ago • 6 comments

donghengqaz avatar Jul 21 '22 08:07 donghengqaz

@BrianPugh Although this opening flag may not be appropriate for littlefs, but some open source project based on GNU use this flag, so I hope esp_littlefs can support this.

donghengqaz avatar Jul 21 '22 08:07 donghengqaz

@donghengqaz thanks for the PRs! Can you try rebasing both of your PRs on my latest push to master? CI wasn't working properly and I think I fixed it. This way we can easily see if it works across a variety of ESP-IDF versions. Thanks!

BrianPugh avatar Jul 21 '22 15:07 BrianPugh

Im a bit confused on how this feature would work; lfs_file_open fails and then you just set the flags field. Can you explain and add a unit test? thanks!

BrianPugh avatar Jul 21 '22 19:07 BrianPugh

@donghengqaz , any thoughts on this? Would love to merge your PRs

BrianPugh avatar Jul 28 '22 20:07 BrianPugh

so @donghengqaz to merge this, I'm going to need a few things:

  1. Version guards since O_DIRECTORY only seems to be in >=v4.3
#if ESP_IDF_VERSION >= ESP_IDF_VERSION_VAL(4, 3, 0)
// Code Here
#endif
  1. I'm going to need a unit test.

  2. A bit of explanation on whats going on, I wouldn't expect this code to work.

BrianPugh avatar Aug 03 '22 15:08 BrianPugh

Hi @BrianPugh, thanks for Continuous attention. I create this PR to let esp-littlefs can also work on WAMR(https://github.com/bytecodealliance/wasm-micro-runtime), and its internal functions call like 'fd = open(PATH, O_DIRECTORY | flags)', and openat(fd, path, flags) .I talked with ESP-IDF's file-system maintainer in these days, and he plan to add openat and other family functions later, so please keep this PR, and when ESP-IDF has done, I will modify this PR and add unit tests.

donghengqaz avatar Aug 05 '22 07:08 donghengqaz

@BrianPugh I discuss with esp-idf team about this again, but they show it is hard for them to implement these APIs(like optnat), so I plan to implement these APIs in application layer. For this I hope to add option O_DIRECTORY support, and add features to get directory.

So this PR is needed, and I will implement F_GETPATH, then add test case, do you agree with this ?

donghengqaz avatar Jul 03 '23 02:07 donghengqaz

I think that sounds good to me! We will re-review once you believe its ready. Thank you!

BrianPugh avatar Jul 03 '23 17:07 BrianPugh

@BrianPugh I push my code including unit test, PTAL.

donghengqaz avatar Jul 04 '23 11:07 donghengqaz

I plan on releasing v1.6.0 with this change by the end of the weekend (after I fix up some of the tests a little more).

BrianPugh avatar Jul 07 '23 02:07 BrianPugh

I plan on releasing v1.6.0 with this change by the end of the weekend (after I fix up some of the tests a little more).

This is very help and I can use the v1.6.0 in https://components.espressif.com/components/joltwallet/littlefs.

donghengqaz avatar Jul 07 '23 03:07 donghengqaz