*/
fcs_t fcs;
} BattFsPageHeader;
+/* Ensure structure has no padding added */
+STATIC_ASSERT(sizeof(BattFsPageHeader) == 12);
+
+
+/**
+ * Mark for valid pages.
+ * Simply set to 1 all field bits.
+ */
+#define MARK_PAGE_VALID ((1 << (CPU_BITS_PER_CHAR * sizeof(mark_t))) - 1)
/**
* Max number of files.
*/
#define BATTFS_MAX_FILES (1 << (CPU_BITS_PER_CHAR * sizeof(inode_t)))
-/* Ensure structure has no padding added */
-STATIC_ASSERT(sizeof(BattFsPageHeader) == 12);
-
/* Fwd decl */
struct BattFsSuper;
*/
typedef uint16_t pgcnt_t;
+/**
+ * Sentinel used to keep trace of unset pages in disk->pag_array.
+ */
+#define PAGE_UNSET_SENTINEL ((1 << (CPU_BITS_PER_CHAR * sizeof(pgcnt_t))) - 1)
+
/**
* Type interface for disk init function.
* \return true if all is ok, false otherwise.
* Is used by the filesystem to represent
* the entire disk in memory.
*/
- pgcnt_t *page_array;
+ pgcnt_t *page_array;
+
+ mark_t min_free; ///< Lowest sequence number of free page
+ mark_t max_free; ///< Highest sequence number of free page
disk_size_t disk_size; ///< Size of the disk, in bytes (page_count * page_size).
disk_size_t free_bytes; ///< Free space on the disk.