Compare commits
No commits in common. "868213bb85aa8283c2b7b5cf2e2ae6c868bddab3" and "00d625a6974f08456c53a52dd857911b91b14e79" have entirely different histories.
868213bb85
...
00d625a697
@ -28,7 +28,7 @@ namespace Ext2
|
||||
if (offset % block_size)
|
||||
{
|
||||
usize block_offset = (offset % block_size);
|
||||
usize block = TRY(find_block(offset / block_size));
|
||||
usize block = find_block(offset / block_size);
|
||||
usize size_to_read = block_size - block_offset;
|
||||
if (size_to_read > to_read) size_to_read = to_read;
|
||||
|
||||
@ -44,7 +44,7 @@ namespace Ext2
|
||||
|
||||
while (to_read >= block_size)
|
||||
{
|
||||
usize block = TRY(find_block(offset / block_size));
|
||||
usize block = find_block(offset / block_size);
|
||||
|
||||
usize host_offset = block * block_size;
|
||||
|
||||
@ -58,7 +58,7 @@ namespace Ext2
|
||||
|
||||
if (to_read > 0)
|
||||
{
|
||||
usize block = TRY(find_block(offset / block_size));
|
||||
usize block = find_block(offset / block_size);
|
||||
|
||||
usize host_offset = block * block_size;
|
||||
|
||||
@ -69,26 +69,11 @@ namespace Ext2
|
||||
return length;
|
||||
}
|
||||
|
||||
Result<usize> Inode::find_block(usize index) const
|
||||
usize Inode::find_block(usize index) const
|
||||
{
|
||||
if (index < 12) return m_raw_inode.direct_pointers[index];
|
||||
expect(index < 12, "ext2: Finding blocks in the indirect pointers is not yet supported");
|
||||
|
||||
usize block_index = (index - 12) * sizeof(u32);
|
||||
if (block_index >= m_fs->m_block_size)
|
||||
{
|
||||
fail("ext2: Finding blocks beyond the singly indirect pointer block is not yet supported");
|
||||
}
|
||||
|
||||
usize block_size = m_fs->m_block_size;
|
||||
|
||||
if (m_singly_indirect_block.is_empty())
|
||||
{
|
||||
TRY(m_singly_indirect_block.try_resize(block_size));
|
||||
TRY(m_fs->m_host_device->read(m_singly_indirect_block.data(), m_raw_inode.singly_indirect_ptr * block_size,
|
||||
block_size));
|
||||
}
|
||||
|
||||
return *reinterpret_cast<u32*>(&m_singly_indirect_block.data()[block_index]);
|
||||
return m_raw_inode.direct_pointers[index];
|
||||
}
|
||||
|
||||
Result<void> Inode::lazy_initialize_dir() const
|
||||
|
@ -1,6 +1,5 @@
|
||||
#pragma once
|
||||
#include "fs/ext2/FileSystem.h"
|
||||
#include <luna/Buffer.h>
|
||||
#include <luna/String.h>
|
||||
|
||||
#define EXT2_FIFO 0x1000
|
||||
@ -142,14 +141,12 @@ namespace Ext2
|
||||
FileSystem* m_fs;
|
||||
ino_t m_inum;
|
||||
|
||||
mutable Buffer m_singly_indirect_block;
|
||||
|
||||
String m_link;
|
||||
|
||||
mutable Vector<VFS::DirectoryEntry> m_entries;
|
||||
mutable bool m_dir_already_lazily_initialized { false };
|
||||
|
||||
Result<usize> find_block(usize index) const;
|
||||
usize find_block(usize index) const;
|
||||
|
||||
friend class FileSystem;
|
||||
};
|
||||
|
@ -235,7 +235,7 @@ namespace Scheduler
|
||||
{
|
||||
switch_context(old_thread, new_thread, regs);
|
||||
if (!old_thread->is_kernel) old_thread->fp_data.save();
|
||||
if (MMU::get_page_directory() != MMU::kernel_page_directory())
|
||||
if (old_thread->is_kernel && MMU::get_page_directory() != MMU::kernel_page_directory())
|
||||
old_thread->directory = MMU::get_page_directory();
|
||||
if (new_thread->directory) MMU::switch_page_directory(new_thread->directory);
|
||||
if (!new_thread->is_kernel)
|
||||
|
@ -7,6 +7,6 @@ cd $LUNA_ROOT
|
||||
|
||||
fakeroot -u -s $LUNA_ROOT/.fakeroot -- tools/install.sh
|
||||
|
||||
genext2fs -d base -B 4096 -b 1024 -L luna-rootfs -U -N 1024 build/ext2fs.bin
|
||||
genext2fs -d base -B 4096 -b 512 -L luna-rootfs -U -N 512 build/ext2fs.bin
|
||||
|
||||
fakeroot -u -i $LUNA_ROOT/.fakeroot mkbootimg luna.json Luna.iso
|
||||
fakeroot -u -i $LUNA_ROOT/.fakeroot -- mkbootimg luna.json Luna.iso
|
||||
|
Loading…
Reference in New Issue
Block a user