-
Notifications
You must be signed in to change notification settings - Fork 1.4k
mtd/ftl: Rename ftl_initialize_by_path to ftl_initialize #16793
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
base: master
Are you sure you want to change the base?
Conversation
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.
Please fix the Documentation as well (to use new the new API function parameters):
https://nuttx.apache.org/docs/latest/applications/examples/media/index.html
https://nuttx.apache.org/docs/latest/components/drivers/special/mtd.html
removed.
keep as before since it describe the legacy method still work. |
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.
Thank you @xiaoxiang781216 :-)
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.
Ah sorry, @acassis is right:
-
We are removing wrapping function and replacing it with internal function that has different API.
-
I understand this comes from bigger change in MTD, but doc should stay in sync with code and we should put some remark on the API change and give working example.
-
This https://nuttx.apache.org/docs/latest/applications/examples/media/index.html states:
MTD drivers need an additional wrapper layer, the FTL wrapper must first be used to convert the MTD driver to a block device:
int ret = ftl_initialize(<N>, mtd);
ret = bchdev_register(/dev/mtdblock<N>, <path-to-character-driver>, false);While the new API would be:
ftl_initialize(FAR const char *path, FAR struct mtd_dev_s *mtd, int oflags), so the example will looks something like this?int ret = ftl_initialize(/dev/mtdblock<N>, mtd, O_RDWR); ret = bchdev_register(/dev/mtdblock<N>, <path-to-character-driver>, false); -
What do you think @mlyszczek @jingfei195887 ? :-)
|
Well, I don't really feel in the position to comment on such changes, but since you've asked ;) This is public function so it will probably break someone's code. But change is rather minor and it will not silently break anyone's code (such case should never ever happen). So if this is documented in "upgrade" section of documentation with explanation how to properly migrate, I think this should be fine, as it's rather quick fix. I would consider adding very short info after compilation fails, that breakage might be caused by API change and that user should refer to documentation (link to page). Maybe even lock it behind kconfig like |
since ftl_initialize isn't used anymore after: apache#16642 apache#16738 Signed-off-by: Xiang Xiao <[email protected]>
|
I update the document and add the breaking change mark, please review again, @acassis @cederom @mlyszczek . |
follow up kernel side change: apache/nuttx#16793 Signed-off-by: Xiang Xiao <[email protected]>
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.
Please wait until it is clear how multiple ftl (simple, dhara. ...) are going to be supported.
See #16789.
The rename doesn't impact multiple FTL support. |
Maybe not, but if the result of multiple FTL support is that both |
ftl_initialize_by_path is more functionality than ftl_initialize, so all ftl_initialize could switch to call ftl_initialize_by_path without problem. Why do you think multiple FTL need the old ftl_initialize? |
Consistency, if there are other device drivers that are using the |
|
Okay, I can understand rationale behind this change, it simplifies stuff, but it is also breaking change as noted by several people, so I marked PR with [BREAKING] tag do it is clearly visible in the PR log, and I have updated PR description on what changes and how (this description also should land into git commit message). We may want to wait until #16789 is resolved, true, just in case the "by path" is still desired and we do not have to revert anything we would leave stuff as-is :-) |
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.
After going through some other examples I am convinced that the proposal using a path instead of a minor is the correct approach. This also decouples this PR from #16789 as this will be modified to also use a path instead of a minor.
|
@cederom please review again |
|
This is breaking change so we should keep |
|
@cederom I think we don't need to add [BREAKING] in the commit, just the Label is enough. Adding it in the commit passes a wrong message to anyone reading it later. |
|
This is the point of Putting it on github label only does not help, as it is not noted in the GIT LOG which is most important (first search), then release notes (based on PR title). Please start using this tag in the pr topics and git commit topics these are most important. No one later looks into github, there are people who avoid github. GIT LOG is most important + release notes :-) |
|
Look its not a problem of avoiding breaking changes, we need them sometimes, and cannot avoid them. But we should not hide them. Quite opposite we should expose them, even small breaks. Here we change API, replace functions, removing functions, changing their parameters and functionality. It is important I understand and it helps. But this is breaking change, so we should clearly mark it. Then someone says hey my function worked different way, they go |
|
I am okay with this code change, no drama ot voting is required as concerns we discussed already, I just want us to follow rule 1.13.9 of https://github.com/apache/nuttx/blob/master/CONTRIBUTING.md in all processed pr/commits please :-) |
|
@jerpelea the release notes use github tag to distinguish breaking changes right? |
|
@cederom I think adding [BREAKING] will deviates from conventional standard like used by other similar projects like Linux kernel and it will make the title cluttered, it should fit to 50 characters. I suggest adding "BREAKING CHANGE:" in the commit foot, this way will work better for humans and automatic searching scripts |
|
@cederom please let us to follow the https://www.conventionalcommits.org/en/v1.0.0/ it will simplify use of NuttX commits with standardized tools |
|
Do you as you please. This requirement is already in Contributing Guide for over 3 months and everyone seems to ignore it :-( |
Okay we may discuss this approach on the dev mailing list :-) The "!" mark before ":" in the git commit topic seems shorter. Then we can have "BREAKING CHANGE" in the description footer with optional one sentence summary (not sure why is that is the commit message already contains that). Still I think "[BREAKING]" in the git commit topic prefix and PR title is more clear and visible :-P |
I think following the conventional commits standard will be beneficial to the project. I will submit a PR with the proposal modification and call a discussion in the mailing list. |
|
It has been more than a month, @cederom please revisit. |
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.
the commit introduces an compatibility breaking change and PR and commit are not marked as breaking change.
We should consider that community may use the old function name and will create issues for them.
I see 2 options
- mark both the PR and commit so that downstream developers are made aware of the change
- leave the functions as they are and mark 1 function as deprecated (to be removed from NuttX 13.0.0)
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.
This is a breaking change.
We need breaking change to be verified on real world hardware.
As indicated by Xiang here, it needs hardware testing. Merging must wait for this.
|
@xiaoxiang781216 any update on hardware testing about this breaking change? |
@acassis but this patch just rename the function, no any functionality change. |
Summary
Impact
int ftl_initialize_by_path(FAR const char *path, FAR struct mtd_dev_s *mtd, int oflags)becomesint ftl_initialize(FAR const char *path, FAR struct mtd_dev_s *mtd, int oflags).int ftl_initialize(int minor, FAR struct mtd_dev_s *mtd)is gone. It wrappedftl_initialize_by_path()before, now it is used directly where path and oflags needs to be passed as described above.Testing