mirror of
https://github.com/littlefs-project/littlefs.git
synced 2025-12-27 09:38:26 +00:00
Added LFS_WCOMPAT_RDONLY and LFS_RCOMPAT_WRONLY
LFS_WCOMPAT_RDONLY seems generally useful for tools that just want to mark a filesystem is read-only. This is a common flag that exists in other filesystems (RO_COMPAT_READONLY in ext4 for example). LFS_RCOMPAT_WRONLY, on the other hand, is a bit more of a joke, but there could be some niche use cases for it (preventing double mounts?). Fortunately, these flags require no extra code, and fall out naturally from our wcompat/rcompat handling. --- Originally, the idea was to also add LFS_F_RDONLY, to match LFS_M_RDONLY and set the LFS_WCOMPAT_RDONLY flag during format. But this doesn't really work with the current API, since lfsr_format would just give you an empty filesystem you can't write to. Which is a bit silly. Maybe we should add something like lfsr_fs_mkrdonly in the future? This is probably low-priority.
This commit is contained in:
@@ -149,6 +149,7 @@ FLAGS = [
|
||||
# Read-compat flags
|
||||
('RCOMPAT', 'NONSTANDARD',
|
||||
0x0001, "Non-standard filesystem format" ),
|
||||
('RCOMPAT', 'WRONLY', 0x0002, "Reading is disallowed" ),
|
||||
('RCOMPAT', 'GRM', 0x0004, "May use a global-remove" ),
|
||||
('RCOMPAT', 'MSPROUT', 0x0010, "May use an inlined mdir" ),
|
||||
('RCOMPAT', 'MLEAF', 0x0020, "May use a single mdir pointer" ),
|
||||
@@ -164,6 +165,7 @@ FLAGS = [
|
||||
# Write-compat flags
|
||||
('WCOMPAT', 'NONSTANDARD',
|
||||
0x0001, "Non-standard filesystem format" ),
|
||||
('WCOMPAT', 'RDONLY', 0x0002, "Writing is disallowed" ),
|
||||
|
||||
('wcompat', 'OVERFLOW',0x8000, "Can't represent all flags" ),
|
||||
|
||||
|
||||
Reference in New Issue
Block a user