diff options
author | Christopher Haster <chaster@utexas.edu> | 2018-01-26 23:26:25 +0300 |
---|---|---|
committer | Christopher Haster <chaster@utexas.edu> | 2018-01-26 23:26:25 +0300 |
commit | 035552a858f562872d9c47809606fbe329106030 (patch) | |
tree | e5055f467cb262b9cc3345a9e9061dd5aa9aa749 /lfs.h | |
parent | 997c2e594e2880b15d3ec069aae4320c110c3bf0 (diff) |
Add version info for software library and on-disk structures
An annoying part of filesystems is that the software library can change
independently of the on-disk structures. For this reason versioning is
very important, and must be handled separately for the software and
on-disk parts.
In this patch, littlefs provides two version numbers at compile time,
with major and minor parts, in the form of 6 macros.
LFS_VERSION // Library version, uint32_t encoded
LFS_VERSION_MAJOR // Major - Backwards incompatible changes
LFS_VERSION_MINOR // Minor - Feature additions
LFS_DISK_VERSION // On-disk version, uint32_t encoded
LFS_DISK_VERSION_MAJOR // Major - Backwards incompatible changes
LFS_DISK_VERSION_MINOR // Minor - Feature additions
Note that littlefs will error if it finds a major version number that
is different, or a minor version number that has regressed.
Diffstat (limited to 'lfs.h')
-rw-r--r-- | lfs.h | 17 |
1 files changed, 17 insertions, 0 deletions
@@ -22,6 +22,23 @@ #include <stdbool.h> +/// Version info /// + +// Software library version +// Major (top-nibble), incremented on backwards incompatible changes +// Minor (bottom-nibble), incremented on feature additions +#define LFS_VERSION 0x00010002 +#define LFS_VERSION_MAJOR (0xffff & (LFS_VERSION >> 16)) +#define LFS_VERSION_MINOR (0xffff & (LFS_VERSION >> 0)) + +// Version of On-disk data structures +// Major (top-nibble), incremented on backwards incompatible changes +// Minor (bottom-nibble), incremented on feature additions +#define LFS_DISK_VERSION 0x00010001 +#define LFS_DISK_VERSION_MAJOR (0xffff & (LFS_DISK_VERSION >> 16)) +#define LFS_DISK_VERSION_MINOR (0xffff & (LFS_DISK_VERSION >> 0)) + + /// Definitions /// // Type definitions |