-
Notifications
You must be signed in to change notification settings - Fork 944
Add LFS_READONLY define, to allow smaller builds providing read-only mode #480
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
+177
−6
Merged
Changes from 1 commit
Commits
Show all changes
10 commits
Select commit
Hold shift + click to select a range
8e6826c
Add LFS_READYONLY define, to allow smaller builds providing read-only…
maximevince 46b5033
LFS_READONLY: undef unavailable function declarations altogether
maximevince 882aae5
LFS_READONLY: even less code, assert on write attempts
maximevince 69da107
LFS_READONLY: remove LFS_O_WRONLY and other flags when compiling with…
maximevince 0360629
LFS_READONLY: do not annotate #endif, as requested
maximevince 83fd2e8
LFS_READONLY: move ifdef before comments blocks, rework dangling open…
maximevince 35cc31e
LFS_READONLY: ifdef file flags that are not needed in read-only mode
maximevince 94c9c4c
LFS_READONLY: slight refactor
maximevince 5c4e375
Added read-only build+size reporting to CI
geky 99c960b
LFS_READONLY: ifdef LFS_F_ERRED out as well
maximevince File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
LFS_READONLY: ifdef file flags that are not needed in read-only mode
- Loading branch information
commit 35cc31e408d6ff4169ec7e5fe285f35c93cfea0f
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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 it possible (and worth it) also #if'ing these constants like
LFS_F_DIRTYwhich are not supposed to be used in read-only mode?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.
It was easy for
LFS_F_DIRTYandLFS_F_WRITING.However, I am not sure about
LFS_F_ERRED.It's documented as "An error occurred during write", but it has one non-obvious use at the end of
int lfs_file_opencfg().It seems you could end up there when e.g.
lfs_malloc()fails, or when opening a file for read hits anLFS_ERR_NOENT(here) (among other possibilities).Both of which cases do not seem to be strictly write-related.
So I conclude that this constant is needed in
LFS_READONLYmode as well.This is implemented in 35cc31e
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, it's not actually used in
lfs_file_closebut in the implicitlfs_file_sync. The purpose of the LFS_F_ERRED flag is to telllfs_file_closeto release resources without writing out to disk.lfs_file_opencfgimmediately callslfs_file_closeif an error occurs.You have the implicit
lfs_file_syncremoved in LFS_READONLY mode, so it should be safe to remove this line as well.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.
I only noticed this comment now. I have
ifdefedLFS_F_ERREDout completely. (99c960b)