Adopted implied LFS_O_FLUSH bit pattern in LFS_O_SYNC
LFS_O_SYNC always implies LFS_O_FLUSH, otherwise what exactly are you
syncing? Making this explicit in the bit pattern should hopefully make
this clear for curious users, though lfsr_file_flush would be called
anyways because of how lfsr_file_sync is implemented.
This also moves the LFS_O_DESYNC bit pattern around so SYNC/FLUSH are
neighbors. SYNC/DESYNC may seem related, but in lfsr_file_open they
actually are quite different:
LFS_O_FLUSH 0x0040 ---- ---- -1-- ----
LFS_O_SYNC 0x00c0 ---- ---- 11-- ----
LFS_O_DESYNC 0x0100 ---- ---1 ---- ----
Code changes, mostly just noise from moving bits around:
code stack
before: 35228 2680
after: 35244 (+0.0%) 2680 (+0.0%)
This commit is contained in:
@@ -9760,18 +9760,18 @@ static inline bool lfsr_o_isappend(uint32_t flags) {
|
||||
return flags & LFS_O_APPEND;
|
||||
}
|
||||
|
||||
static inline bool lfsr_o_isflush(uint32_t flags) {
|
||||
return flags & LFS_O_FLUSH;
|
||||
}
|
||||
|
||||
static inline bool lfsr_o_issync(uint32_t flags) {
|
||||
return flags & LFS_O_SYNC;
|
||||
return flags & (LFS_O_SYNC ^ LFS_O_FLUSH);
|
||||
}
|
||||
|
||||
static inline bool lfsr_o_isdesync(uint32_t flags) {
|
||||
return flags & LFS_O_DESYNC;
|
||||
}
|
||||
|
||||
static inline bool lfsr_o_isflush(uint32_t flags) {
|
||||
return flags & LFS_O_FLUSH;
|
||||
}
|
||||
|
||||
static inline bool lfsr_f_isunflush(uint32_t flags) {
|
||||
return flags & LFS_F_UNFLUSH;
|
||||
}
|
||||
|
||||
@@ -137,9 +137,9 @@ enum lfs_open_flags {
|
||||
LFS_O_EXCL = 0x0008, // Fail if a file already exists
|
||||
LFS_O_TRUNC = 0x0010, // Truncate the existing file to zero size
|
||||
LFS_O_APPEND = 0x0020, // Move to end of file on every write
|
||||
LFS_O_SYNC = 0x0040, // Sync metadata on every write
|
||||
LFS_O_DESYNC = 0x0080, // Do not sync or recieve file updates
|
||||
LFS_O_FLUSH = 0x0100, // Flush data on every write
|
||||
LFS_O_FLUSH = 0x0040, // Flush data on every write
|
||||
LFS_O_SYNC = 0x00c0, // Sync metadata on every write
|
||||
LFS_O_DESYNC = 0x0100, // Do not sync or recieve file updates
|
||||
#endif
|
||||
|
||||
// internally used flags
|
||||
|
||||
Reference in New Issue
Block a user