Add "fast page" to KERNEL_OFFSET. This is always present in page
tables and only requires changing the page table entry to map. This
requires no interrupts since it should only be for very operations
like memcpy.
I used to map all temporary mappings to vaddr 0, but this is much
better. C++ standard always says that nullptr access is undefined
and this gets rid of it.
Fixed some bugs I found along the way
This commit consists of multiple big changes
1. blocks for inodes are now allocated on demand
- reading from non allocated block will just return zeroes
- writing to non allocated block allocates it
2. code doesn't really use raw pointers anymore
- all casts to uint32_t or structures are now replaced with
spans. either as<T> or as_span<T> which both are bounds
checked
3. code doesn't depend on random macros for accessing indirect blocks
- i added some recursive functions which take care of this :)
Ext2 inodes can now be unlinked from directories and after last
inode closes (destructor gets called) we check if link count is 0
and cleanup the inode from filesystem
ATADevice now stores its name instead of using static buffer. Old
static buffer was changing on every name query. I just hadn't noticed
since virtual machine disks were always sda.
SATA drives can now be used with banan-os. This allows much faster
disk access (writing 10 MiB from 30s to 1.5s). This can definitely
be optimized but the main slow down is probably the whole disk
structure in the os.
AHCI drive is now the default when running qemu.
This is kinda weird behaviour, but it ensures the user cannot
create e.g. CharacterDevice with mode having IFLNK.
The Inode overrider is the only one setting the mode.
RamInode is now a general RamInode with no data. RamFileInode is now
a inode for regular files. This is much cleaner and more intuitive
since there is no reason for most non-regular inodes to hold data
Vector.
Every inode holds a weak pointer to shared file data. This contains
physical addresses of pages for inode file data. Physical addresses
are allocated and read on demand.
When last shared mapping is unmapped. The inodes shared data is freed
and written to the inode.