Skip to content

fs: Add FileSystem::get_block_device #4886

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

Closed
wants to merge 1 commit into from
Closed

Conversation

geky
Copy link
Contributor

@geky geky commented Aug 10, 2017

Required for accessing the underlying block device. This can be used to modify the state of the block device outside of the filesystem.

The best example is if you are reformatting a filesystem:

BlockDevice *bd = fs.get_block_device();
fs.unmount();
FATFileSystem::format(bd);
fs.mount(bd);

This is required as part of #4737
alternative: #4908
cc @sg-, @netanelgonen, let me know if this API doesn't work for you

Required for accessing the underlying block device. This can be used to
modify the state of the block device outside of the filesystem.

The best example is if you are reformatting a filesystem:
BlockDevice *bd = fs.get_block_device();
fs.unmount();
FATFileSystem::format(bd);
fs.mount(bd);
@@ -106,6 +106,13 @@ class FATFileSystem : public FileSystem {
*/
virtual int mkdir(const char *path, mode_t mode);

/** Get the underlying block device
*
* @return The underlying block device, or NULL if not block
Copy link
Contributor

Choose a reason for hiding this comment

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

of NULL if the block device... (not is needed there in that context) or ?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Sorry, I think that was a typo, does this make more sense?

The underlying block device, or NULL if no block device has been mounted

@netanelgonen
Copy link
Contributor

@geky is there a rason why get_block_device function is not from FileSystemLike class?
this is currently make me cast to FileSystem...

@geky
Copy link
Contributor Author

geky commented Aug 13, 2017

@netanelgonen, the FileSystemLike interface includes things that may not be FileSystems and may not have block devices, for example the LPC1768 has the LocalFileSystem, which talks to an external chip that manages a filesystem.

Although thinking about it more, we should probably add isFileSystem and getFileSystem to the FilePath class to get a FileSystem directly. I can put up a patch next chance I get.

@netanelgonen
Copy link
Contributor

thanks @geky will it be in the same PR?
another thing, will the abstraction of the format function will be in this PR or should i open a new feature request?

@geky
Copy link
Contributor Author

geky commented Aug 14, 2017

Actually there is a bit of work needed around file paths, so the isFileSystem (conflicts, maybe isPhysicalFileSystem?) will probably come in on a different pr.

As for the format, opening a new feature request is a good idea. I can put up a proposal, although I'm not sure everyone will agree with it.

/morph test-nightly

@netanelgonen
Copy link
Contributor

request from the abstraction of format,
#4903

@geky
Copy link
Contributor Author

geky commented Aug 14, 2017

I think this can be replaced by #4908.

@mbed-bot
Copy link

Result: FAILURE

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

/morph test-nightly

Output

mbed Build Number: 1033

Test failed!

@geky
Copy link
Contributor Author

geky commented Aug 21, 2017

This has been replaced by #4908

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

Successfully merging this pull request may close these issues.

6 participants