-
Notifications
You must be signed in to change notification settings - Fork 3k
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
Conversation
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 |
There was a problem hiding this comment.
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 ?
There was a problem hiding this comment.
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
@geky is there a rason why get_block_device function is not from FileSystemLike class? |
@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. |
thanks @geky will it be in the same PR? |
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 |
request from the abstraction of format, |
I think this can be replaced by #4908. |
Result: FAILUREYour command has finished executing! Here's what you wrote!
OutputTest failed! |
This has been replaced by #4908 |
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