Commit graph

8 commits

Author SHA1 Message Date
Franciszek Zdobylak
1eb104795e fs: ext2: Use disk structs to access data on disk
This commits changes how data on the disk is accessed. There are disk
structures which are packed and their fields are stored in little endian
byte order. To use data in the program structures it has to be translated
from little endian to cpu endianness.

Signed-off-by: Franciszek Zdobylak <fzdobylak@antmicro.com>
2023-08-03 12:22:01 -04:00
Franciszek Zdobylak
984bdab456 fs: ext2: update how memory is allocated in ext2
- `ext2_file` and `ext2_dir` merged into one struct and allocated from
  dedicated slab
- `ext2_inode` allocated from dedicated slab
- `ext2_disk_dentry` allocated from heap (because their size is not
  constant)
- `ext2_bgroup` and `ext2_disk_superblock` statically allocated

Signed-off-by: Franciszek Zdobylak <fzdobylak@antmicro.com>
2023-08-03 12:22:01 -04:00
Franciszek Zdobylak
1f62d99e7e fs: ext2: Update memory writes
Fix the behavior when data should be written to storage device. Now all
writes are done directly to disk_access layer (where it might possibly
be cached).

Signed-off-by: Franciszek Zdobylak <fzdobylak@antmicro.com>
2023-08-03 12:22:01 -04:00
Franciszek Zdobylak
dfd845b131 fs: ext2: fix blocks and inodes handling
Changes:
  - Added few assertions to check if some assumptions are correct
  - Fix removing blocks during trucate and inode removal
  - Clear entry in inode table after inode has been removed

Signed-off-by: Franciszek Zdobylak <fzdobylak@antmicro.com>
2023-08-03 12:22:01 -04:00
Franciszek Zdobylak
b814246764 fs: ext2: create correct file system in mkfs
Changes:
  - Add fs::sync function
  - Make correct file system in mkfs
  - Add few assertions to ensure that all assumptions are correct

Signed-off-by: Franciszek Zdobylak <fzdobylak@antmicro.com>
2023-08-03 12:22:01 -04:00
Franciszek Zdobylak
f793e0b3c3 fs: ext2: implement unlink
Introduce fs_unlink function.

Signed-off-by: Franciszek Zdobylak <fzdobylak@antmicro.com>
2023-08-03 12:22:01 -04:00
Franciszek Zdobylak
64da407ea5 fs: ext2: create dir and file operations
Introduced functions:
  - open
  - close
  - mkdir

Signed-off-by: Franciszek Zdobylak <fzdobylak@antmicro.com>
2023-08-03 12:22:01 -04:00
Franciszek Zdobylak
1eccf55102 fs: ext2: Implementation of basic operations
Included operations:
  - mount
  - unmount
  - mkfs
  - statvfs

Signed-off-by: Franciszek Zdobylak <fzdobylak@antmicro.com>
2023-08-03 12:22:01 -04:00