Skip to content

LocalFileSystem: Repair the FileSystemLike hooks #4087

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Jun 4, 2017

Conversation

geky
Copy link
Contributor

@geky geky commented Mar 30, 2017

Repaired the FileSystemLike hooks needed by the LocalFileSystem. This introduces FileSystemLike which is similar to FileLike, and FileSystemHandle which is similar to FileHandle.

To implement a FileSystemLike with error codes, the following functions must be implemented for file/dir lookup (only file is required):

int open(FileHandle **file, const char *filename, int flags);
int open(DirHandle **dir, const char *path);

This pr adopts the FileSystemLike into LocalFileSystem, FileSystem, and the retarget code. Hooks are provided by the common FileSystem layer, so no implementation needs to change.

This should resolve #3983, however is dependent on #3867, which restricts this to version 5.5.

should resolve: #3983
cause: https://github.com/ARMmbed/mbed-os/pull/3773/files
cc @simonqhughes, @kjbracey-arm, @bridadan

Copy link
Contributor

@bridadan bridadan left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Seems ok to me!

@bridadan
Copy link
Contributor

bridadan commented Apr 3, 2017

@mbed-bot: TEST

HOST_OSES=ALL
BUILD_TOOLCHAINS=ALL
TARGETS=ALL

@mbed-bot
Copy link

mbed-bot commented Apr 3, 2017

[Build 1329]
SUCCESS: Building succeeded and tests were run! Be sure to check the test results

@0xc0170 0xc0170 requested review from simonqhughes and kjbracey April 4, 2017 11:40
@@ -109,3 +123,37 @@ size_t FileSystem::dir_size(fs_dir_t dir)
return size;
}

template <typename F>
Copy link
Contributor

@0xc0170 0xc0170 Apr 4, 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

worth documenting the intention with managed class ?

The previous one had // Internally used file objects with managed memory on close

@0xc0170
Copy link
Contributor

0xc0170 commented Apr 4, 2017

Jenkins CI failure:

[K64F ARM]   * K64F::ARM::FEATURES-FEATURE_LWIP-TESTS-MBEDMICRO-NET-GETHOSTBYNAME
[K64F ARM]         Building project gethostbyname (K64F, ARM)
[K64F ARM]         Scan: ARM
[K64F ARM]         Scan: FEATURE_LWIP
[K64F ARM]         Scan: FEATURE_STORAGE
[K64F ARM]         Scan: gethostbyname
[K64F ARM]         Compile [100.0%]: main.cpp
[K64F ARM]         [Warning] FileSystem.h@49,0:  #611-D: overloaded virtual function "mbed::FileSystemLike::open" is only partially overridden in class "mbed::FileSystem"
[K64F ARM]         Link: gethostbyname
[K64F ARM]         "/tmp/im5sfu", line 128 (column 3): Warning: L6312W: Empty Execution region description for region RW_IRAM1
[K64F ARM]         Error: L6218E: Undefined symbol mbed::FileSystem::open(mbed::Dir*, const char*) (referred from FileSystem.o).
[K64F ARM]         Error: L6218E: Undefined symbol mbed::FileSystem::open(mbed::File*, const char*, int) (referred from FileSystem.o).
[K64F ARM]         Finished: 0 information, 1 warning and 2 error messages.

Copy link
Contributor

@kjbracey kjbracey left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks reasonable to me - abstract FileSystemHandle returning abstract FileHandle etc - but I've never looked that hard at the FileSystem bits, so I don't have much basis for comparison.

Seems like the API could work with a device filing system which is my current mental test.

@geky geky mentioned this pull request Apr 5, 2017
@geky geky force-pushed the localfs-fslike-fix branch from 294ac38 to 5b68689 Compare April 5, 2017 20:50
@geky
Copy link
Contributor Author

geky commented Apr 5, 2017

Thanks for catching those @0xc0170! Should be updated. I always get surprised by these compiler differences.

@kjbracey-arm, I've been keeping a device filing system in mind as well :)

@bridadan
Copy link
Contributor

bridadan commented Apr 5, 2017

@mbed-bot: TEST

HOST_OSES=ALL
BUILD_TOOLCHAINS=ALL
TARGETS=ALL

@mbed-bot
Copy link

mbed-bot commented Apr 6, 2017

[Build 1336]
SUCCESS: Building succeeded and tests were run! Be sure to check the test results

@sg-
Copy link
Contributor

sg- commented Apr 10, 2017

This will need some serious docs work.

/morph test-nightly

@mbed-bot
Copy link

Result: FAILURE

Your command has finished executing! Here's what you wrote!

/morph test-nightly

@bridadan
Copy link
Contributor

/morph test-nightly

@mbed-bot
Copy link

Result: FAILURE

Your command has finished executing! Here's what you wrote!

/morph test-nightly

Output

mbed Build Number: 1881

Build failed!

@bridadan
Copy link
Contributor

@geky We haven't replaced the Jenkins build data after upgrading the CI system, however the public build results are still available here: http://mbedosci.cloudapp.net/results/nightly/1881

@geky geky force-pushed the localfs-fslike-fix branch from 5b68689 to 59ab957 Compare April 18, 2017 18:53
@geky
Copy link
Contributor Author

geky commented Apr 18, 2017

Updated with workaround, looks like some targets are defining an error_t type that conflicts with a standard type? Not worth fixing at the moment.
/morph test-nightly

@mbed-bot
Copy link

Result: FAILURE

Your command has finished executing! Here's what you wrote!

/morph test-nightly

Output

mbed Build Number: 30

Test failed!

@geky
Copy link
Contributor Author

geky commented Apr 19, 2017

Failures were related to networking issues last night, rerunning
/morph test-nightly

@mbed-bot
Copy link

Result: FAILURE

Your command has finished executing! Here's what you wrote!

/morph test-nightly

Output

mbed Build Number: 41

Test failed!

@adbridge
Copy link
Contributor

/morph test-nightly

@bridadan
Copy link
Contributor

@geky Looks like travis actually failed on this one, can you take a look?

@sg- sg- removed the needs: CI label Jun 2, 2017
@0xc0170 0xc0170 force-pushed the localfs-fslike-fix branch from f15fd29 to ba30b32 Compare June 2, 2017 10:50
@0xc0170
Copy link
Contributor

0xc0170 commented Jun 2, 2017

/morph test-nightly

@mbed-bot
Copy link

mbed-bot commented Jun 2, 2017

Result: ABORTED

Your command has finished executing! Here's what you wrote!

/morph test-nightly

Output

mbed Build Number: 420

Test failed!

@geky
Copy link
Contributor Author

geky commented Jun 3, 2017

@0xc0170, thanks for the rebase 👍

more merge conflicts I take it?

@sg-
Copy link
Contributor

sg- commented Jun 3, 2017

@geky mind fixing the conflict?

@0xc0170 0xc0170 force-pushed the localfs-fslike-fix branch from ba30b32 to 92c4384 Compare June 3, 2017 06:22
@0xc0170
Copy link
Contributor

0xc0170 commented Jun 3, 2017

Rebased

@sg-
Copy link
Contributor

sg- commented Jun 3, 2017

/morph test

@mbed-bot
Copy link

mbed-bot commented Jun 3, 2017

Result: FAILURE

Your command has finished executing! Here's what you wrote!

/morph test

Output

mbed Build Number: 428

Build failed!

@c1728p9 c1728p9 force-pushed the localfs-fslike-fix branch from 92c4384 to 5795373 Compare June 3, 2017 16:22
@c1728p9
Copy link
Contributor

c1728p9 commented Jun 3, 2017

/morph test

@mbed-bot
Copy link

mbed-bot commented Jun 3, 2017

Result: FAILURE

Your command has finished executing! Here's what you wrote!

/morph test

Output

mbed Build Number: 429

Build failed!

@0xc0170
Copy link
Contributor

0xc0170 commented Jun 3, 2017

retest uvisor

@0xc0170
Copy link
Contributor

0xc0170 commented Jun 3, 2017

Looks like we need to properly rebase ,retarget has errors (same was done with yesterday rebase?)

geky added 3 commits June 3, 2017 13:17
Required for other representations of FileSystems, ie LocalFileSystem

Introduces FileSystemHandle for the same behaviour as FileHandle and
DirHandle.

Requires the following to hook into file/dir lookup:
```
int open(FileHandle **file, const char *filename, int flags)
int open(DirHandle **dir, const char *path)
```

This hook is provided by the FileSystem class, so requires no changes
from implementations.
The old open/opendir functions did not provide a route for errors and
relied on implementations manually setting errno. Updated to return
errors directly.
@c1728p9 c1728p9 force-pushed the localfs-fslike-fix branch from 5795373 to 0fc5ce2 Compare June 3, 2017 18:19
@c1728p9
Copy link
Contributor

c1728p9 commented Jun 3, 2017

I removed the MBED_CONF_FILESYSTEM_PRESENT ifdef around ManagedFile and ManagedDir. Also updated ManagedFile to inherit from FileHandle and ManagedDir to inherit from DirHandle.

@c1728p9
Copy link
Contributor

c1728p9 commented Jun 3, 2017

/morph test

@mbed-bot
Copy link

mbed-bot commented Jun 3, 2017

Result: SUCCESS

Your command has finished executing! Here's what you wrote!

/morph test

Output

mbed Build Number: 430

All builds and test passed!

@sg- sg- merged commit 0da63ee into ARMmbed:master Jun 4, 2017
@geky
Copy link
Contributor Author

geky commented Jun 5, 2017

Thanks for the rebase! ManagedFile/ManagedDir are actually no longer used, but it's not like they will hurt master until we get around to removing them.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

LocalFileSystem stop working in mbed_lib_rev138
10 participants