diff options
author | Andreas Kling <awesomekling@gmail.com> | 2019-05-03 22:59:58 +0200 |
---|---|---|
committer | Andreas Kling <awesomekling@gmail.com> | 2019-05-03 22:59:58 +0200 |
commit | 8b249bd09bc63ad3a9aa99cc268299f0239b2f7d (patch) | |
tree | 345d460dd10fdbb34bc6e6cc283fe51a33095391 /Kernel/FileSystem/Ext2FileSystem.cpp | |
parent | abb5c890e0960fa00cb566a9905e13cba078972b (diff) | |
download | serenity-8b249bd09bc63ad3a9aa99cc268299f0239b2f7d.zip |
Kernel+Userland: Implement mknod() syscall and add a /bin/mknod program.
Diffstat (limited to 'Kernel/FileSystem/Ext2FileSystem.cpp')
-rw-r--r-- | Kernel/FileSystem/Ext2FileSystem.cpp | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/Kernel/FileSystem/Ext2FileSystem.cpp b/Kernel/FileSystem/Ext2FileSystem.cpp index 094e09414f..b5161b6773 100644 --- a/Kernel/FileSystem/Ext2FileSystem.cpp +++ b/Kernel/FileSystem/Ext2FileSystem.cpp @@ -1064,7 +1064,7 @@ RetainPtr<Inode> Ext2FS::create_directory(InodeIdentifier parent_id, const Strin // NOTE: When creating a new directory, make the size 1 block. // There's probably a better strategy here, but this works for now. - auto inode = create_inode(parent_id, name, mode, block_size(), error); + auto inode = create_inode(parent_id, name, mode, block_size(), 0, error); if (!inode) return nullptr; @@ -1092,7 +1092,7 @@ RetainPtr<Inode> Ext2FS::create_directory(InodeIdentifier parent_id, const Strin return inode; } -RetainPtr<Inode> Ext2FS::create_inode(InodeIdentifier parent_id, const String& name, mode_t mode, off_t size, int& error) +RetainPtr<Inode> Ext2FS::create_inode(InodeIdentifier parent_id, const String& name, mode_t mode, off_t size, dev_t dev, int& error) { LOCKER(m_lock); ASSERT(parent_id.fsid() == fsid()); @@ -1168,6 +1168,11 @@ RetainPtr<Inode> Ext2FS::create_inode(InodeIdentifier parent_id, const String& n e2inode.i_dtime = 0; e2inode.i_links_count = initial_links_count; + if (is_character_device(mode)) + e2inode.i_block[0] = dev; + else if (is_block_device(mode)) + e2inode.i_block[1] = dev; + success = write_block_list_for_inode(inode_id, e2inode, blocks); ASSERT(success); |