1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162 |
- #include "volume_id_internal.h"
- #define LFS_SB1_OFFSET 0x10
- #define LFS_MAGIC_NAME "littlefs"
- #define LFS_MAGIC_LEN 8
- struct lfs_super_block {
- uint8_t entry_type;
- uint8_t entry_len;
- uint8_t att_len;
- uint8_t name_len;
- uint64_t root_dir;
- uint32_t block_size;
- uint32_t block_count;
- uint16_t ver_major;
- uint16_t ver_minor;
- uint8_t magic[LFS_MAGIC_LEN];
- } PACKED;
- int FAST_FUNC volume_id_probe_lfs(struct volume_id *id )
- {
- struct lfs_super_block *sb;
-
- dbg("lfs: probing at offset 0x%x", LFS_SB1_OFFSET);
- sb = volume_id_get_buffer(id, LFS_SB1_OFFSET, sizeof(*sb));
- if (!sb)
- return -1;
- if (memcmp(sb->magic, LFS_MAGIC_NAME, LFS_MAGIC_LEN) != 0)
- return -1;
- IF_FEATURE_BLKID_TYPE(id->type = LFS_MAGIC_NAME);
- return 0;
- }
|