-
Notifications
You must be signed in to change notification settings - Fork 51
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
Added API allowing user to choose settings at runtime - replacement of PR#49 #51
Added API allowing user to choose settings at runtime - replacement of PR#49 #51
Conversation
…t runtime initial mounting options.
…t_ctime for linux.
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.
time_t ff_atime; | ||
time_t ff_mtime; | ||
time_t ff_ctime; |
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.
Is this a backward compatible change? An in what happens to users using these fields? Or are these internal?
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.
No it is not backwards compatible - This is to fix #50 . What is allowed and not allowed in terms of breaking compatibility for Lab projects?
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.
@phelter asked:
What is allowed and not allowed in terms of breaking compatibility for Lab projects?
There is not an official guideline about "breaking compatibility". I'd like to break as little as possible, and avoid complex or tricky constructions like the use of #undef
.
I just compiled a big Xilinx project, which contains an FTP-server and a compression module, all with ffconfigTIME_SUPPORT
defined.
I must say that the code rarely refers to the one of the 3 fields (st_[amc]time
).
Another way to void compilation errors would be :
#if( DOWNWARD_COMPATIBLE )
#define st_atime ff_atime
#define st_mtime ff_mtime
#define st_ctime ff_ctime
#endif
but that might cause problems in applications that also use stdio.h
Note that the compiler error is easy to understand:
gzip.cpp:746: error: 'struct stat_type' has no member named 'st_mtime'
Can you add some comments about the compatibility break?
Thanks
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.
If compatibility with many different flavors of environments what I'd suggest is:
- Avoid
#defines
in your code - if you must then prefix them with something likeFREERTOS_PLUS_FAT_<NAME>
to ensure there is a low risk of them conflicting with other#defines
in other libraries. - Own your naming convention and typenames for your project. In this instance FF_STAT shares the linux names and portion of that struct. If you intend on supporting Linux AND other libraries - need to own the structure. FWIW this struct also doesn't meet the FreeRTOS naming criteria of adding an
x
prefix. - Do not copy for the sake of copying other environment's structures. If you intend your API to be used as a wrapper for others then own the structure definition and do the translation to the other platforms.
@htibosch - are you referring to adding comments in the code about compatibility issues? If so I'd suggest the code is not the place for that, but release notes between versions is a better place to provide that type of information - i.e. provide search/replace information on compatibility breaks. Happy to provide a sed script if you like. Something like:
sed -e 's/st_(a|m|c)time/ff_$1time/g' *.c
pxStatBuffer->ff_atime = prvFileTime( &( xDirEntry.xAccessedTime ) ); | ||
pxStatBuffer->ff_mtime = prvFileTime( &( xDirEntry.xModifiedTime ) ); | ||
pxStatBuffer->ff_ctime = prvFileTime( &( xDirEntry.xCreateTime ) ); |
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.
Same here. Would this break existing users code?
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.
Can you please have a look at my earlier response?
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 would only break existing user code if they are accessing the values inside the pxStatBuffer in their code in some way associated with st_[a|m|c]time
. It can be mitigated by providing users a description of the breaking change in this Lab-Project
based repo.
The other option is to possibly investigate replacing the entire struct for Linux based examples with the linux stat
structure instead of using home-grown version, and ensuring compatibility between the FF_Stat and linux stat
is maintained - see #50 (comment).
To fix the formatting, would you please apply this patch @phelter? |
We have been discussing this internally as this is a breaking change. I shall share what we discussed and the conclusions drawn here:
|
Thank you @phelter for this PR, I approve it as it is. |
Description
Thank you for your changes @phelter - I am creating this PR on your behalf so that we can review this.
Test Steps
Checklist:
Related Issue
This should replace #49.
By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.