+typedef struct BattFsSuper
+{
+ disk_open_t open; ///< Disk init.
+ disk_page_read_t read; ///< Page read.
+ disk_page_write_t write; ///< Page write.
+ disk_page_erase_t erase; ///< Page erase.
+ disk_close_t close; ///< Disk deinit.
+
+ pgaddr_t page_size; ///< Size of a disk page, in bytes.
+ pgcnt_t page_count; ///< Number of pages on disk.
+
+ /**
+ * Page allocation array.
+ * This array must be allocated somewhere and
+ * must have enough space for page_count elements.
+ * Is used by the filesystem to represent
+ * the entire disk in memory.
+ */
+ pgcnt_t *page_array;
+
+ /**
+ * Lowest free page counter.
+ * This is the counter of the first availble free page.
+ */
+ mark_t free_start;
+
+ /**
+ * Highest free page counter.
+ * This value is the next to be used to mark a block as free.
+ */
+ mark_t free_next;
+
+ 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.
+
+ List file_opened_list; ///< List used to keep trace of open files.
+ /* TODO add other fields. */
+} BattFsSuper;
+
+typedef uint8_t filemode_t; ///< Type for file open modes.
+typedef uint32_t file_size_t; ///< Type for file sizes.
+
+/**
+ * Modes for battfs_fileopen.
+ * \{
+ */
+#define BATTFS_CREATE BV(0) ///< Create file if does not exist
+#define BATTFS_RD BV(1) ///< Open file for reading
+#define BATTFS_WR BV(2) ///< Open file fir writing
+/*/}*/
+
+
+/**
+ * Describe a BattFs file usign a KFile.
+ */
+typedef struct KFileBattFs
+{
+ KFile fd; ///< KFile context
+ Node link; ///< Link for inserting in opened file list
+ inode_t inode; ///< inode of the opened file
+ BattFsSuper *disk; ///< Disk context
+ filemode_t mode; ///< File open mode
+ pgcnt_t *start; ///< Pointer to page_array file start position.
+} KFileBattFs;
+
+/**
+ * Macro used to cast a KFile to a KFileBattFs.
+ * Also perform dynamic type check.
+ */
+INLINE KFileBattFs * KFILEBATTFS(KFile *fd)
+{
+ ASSERT(fd->_type == KFT_BATTFS);
+ return (KFileBattFs *)fd;
+}
+
+bool battfs_init(struct BattFsSuper *d);
+bool battfs_close(struct BattFsSuper *disk);
+
+bool battfs_fileExists(BattFsSuper *disk, inode_t inode);
+bool battfs_fileopen(BattFsSuper *disk, KFileBattFs *fd, inode_t inode, filemode_t mode);