Added LFS_MULTIVERSION, made lfs2.0 support a compile-time option

The code-cost wasn't that bad: 16556 B -> 16754 B (+1.2%)

But moving write support of older versions behind a compile-time flag
allows us to be a bit more liberal with what gets added to support older
versions, since the cost won't hit most users.
This commit is contained in:
Christopher Haster
2023-06-14 15:46:36 -05:00
parent b72c96d440
commit eb9af7abe5
3 changed files with 29 additions and 3 deletions

2
lfs.h
View File

@@ -264,11 +264,13 @@ struct lfs_config {
// Defaults to block_size when zero.
lfs_size_t metadata_max;
#ifdef LFS_MULTIVERSION
// On-disk version to use when writing in the form of 16-bit major version
// + 16-bit minor version. This limiting metadata to what is supported by
// older minor versions. Note that some features will be lost. Defaults to
// to the most recent minor version when zero.
uint32_t disk_version;
#endif
};
// File info structure