Add filesystem consistency check.
[bertos.git] / bertos / fs / battfs.h
index f46d8c8a80a7944c78e88d832b3c03293245fe7b..20f38e07458d413fd29fc75e55b095f5666b6c29 100644 (file)
@@ -192,7 +192,8 @@ typedef struct BattFsSuper
        disk_page_erase_t erase; ///< Page erase.
        disk_close_t close;      ///< Disk deinit.
 
-       pgaddr_t page_size;      ///< Size of a disk page, in bytes.
+       pgaddr_t page_size;      ///< Size of a memory page, in bytes. Used by disk low level driver.
+       pgaddr_t data_size;      ///< Size of space usable for data in a disk page, in bytes. The rest is used by the page header.
        pgcnt_t page_count;      ///< Number of pages on disk.
 
        /**
@@ -203,7 +204,6 @@ typedef struct BattFsSuper
         * the entire disk in memory.
         */
        pgcnt_t *page_array;
-       struct BattFsPageHeader curr_hdr; ///< Current page header (cached)-
        pgcnt_t curr_page;  ///< Current page loaded in disk buffer.
        bool cache_dirty;   ///< True if current cache is dirty (nneds to be flushed).
 
@@ -263,6 +263,7 @@ INLINE BattFs * BATTFS_CAST(KFile *fd)
 }
 
 bool battfs_init(struct BattFsSuper *d);
+bool battfs_fsck(struct BattFsSuper *disk);
 bool battfs_close(struct BattFsSuper *disk);
 
 bool battfs_fileExists(BattFsSuper *disk, inode_t inode);