Functions |
void | battfs_to_disk (struct BattFsPageHeader *hdr, uint8_t *buf) |
| Convert from memory representation to disk structure.
|
void | disk_to_battfs (uint8_t *buf, struct BattFsPageHeader *hdr) |
| Convert from disk structure to memory representation.
|
static fcs_t | computeFcs (struct BattFsPageHeader *hdr) |
| Compute the fcs of the header.
|
static bool | readHdr (struct BattFsSuper *disk, pgcnt_t page, struct BattFsPageHeader *hdr) |
| Read header of page in hdr.
|
static pgcnt_t | countPages (pgoff_t *filelen_table, inode_t inode) |
| Count the number of pages from inode 0 to inode in filelen_table.
|
static void | movePages (struct BattFsSuper *disk, pgcnt_t src, int offset) |
| Move all pages in page allocation array from src to src + offset.
|
static bool | countDiskFilePages (struct BattFsSuper *disk, pgoff_t *filelen_table) |
| Count number of pages per file on disk.
|
static bool | fillPageArray (struct BattFsSuper *disk, pgoff_t *filelen_table) |
| Fill page allocation array of disk using file lenghts in filelen_table.
|
bool | battfs_mount (struct BattFsSuper *disk, struct KBlock *dev, pgcnt_t *page_array, size_t array_size) |
| Initialize and mount disk described by disk.
|
bool | battfs_fsck (struct BattFsSuper *disk) |
| Check the filesystem.
|
static int | battfs_flush (struct KFile *fd) |
| Flush file fd.
|
static int | battfs_fileclose (struct KFile *fd) |
| Close file fd.
|
static size_t | battfs_write (struct KFile *fd, const void *_buf, size_t size) |
| Write to file fd size bytes from buf.
|
static size_t | battfs_read (struct KFile *fd, void *_buf, size_t size) |
| Read from file fd size bytes in buf.
|
static bool | findFile (BattFsSuper *disk, inode_t inode, pgcnt_t *last) |
| Search file inode in disk using a binary search.
|
bool | battfs_fileExists (BattFsSuper *disk, inode_t inode) |
static file_size_t | countFileSize (BattFsSuper *disk, pgcnt_t *start, inode_t inode) |
| Count size of file inode on disk, starting at pointer start in disk->page_array.
|
bool | battfs_fileopen (BattFsSuper *disk, BattFs *fd, inode_t inode, filemode_t mode) |
| Open file inode from disk in mode.
|
bool | battfs_umount (struct BattFsSuper *disk) |
| Umount disk.
|
BattFS: a filesystem for embedded platforms (implementation).
- Author:
- Francesco Sacchi <batt@develer.com>
Definition in file battfs.c.
Fill page allocation array of disk using file lenghts in filelen_table.
The page allocation array is an array containings all file infos. Is ordered by file, and within each file is ordered by page offset inside file. e.g. : at page array[0] you will find page address of the first page of the first file (if present). Free blocks are allocated after the last file.
- Returns:
- true if ok, false on disk read errors.
- Note:
- The whole disk is scanned at max twice.
Definition at line 267 of file battfs.c.