diff options
author | Conrad Pankoff <deoxxa@fknsrs.biz> | 2019-06-02 19:38:37 +1000 |
---|---|---|
committer | Andreas Kling <awesomekling@gmail.com> | 2019-06-02 12:37:29 +0200 |
commit | 32d78a8526d24116d25fbe50db552beb6b2e1ce9 (patch) | |
tree | 356c8a1045061d176874fdcce90b005df1caa7d5 /Kernel | |
parent | 8eb492aa11c6030d2b5f65e97c9c6b55325f36fd (diff) | |
download | serenity-32d78a8526d24116d25fbe50db552beb6b2e1ce9.zip |
Kernel: Rename OffsetDiskDevice to DiskPartition
Diffstat (limited to 'Kernel')
-rw-r--r-- | Kernel/Devices/DiskPartition.cpp | 63 | ||||
-rw-r--r-- | Kernel/Devices/DiskPartition.h (renamed from Kernel/Devices/OffsetDiskDevice.h) | 8 | ||||
-rw-r--r-- | Kernel/Devices/OffsetDiskDevice.cpp | 63 | ||||
-rw-r--r-- | Kernel/Makefile | 2 | ||||
-rw-r--r-- | Kernel/init.cpp | 4 |
5 files changed, 70 insertions, 70 deletions
diff --git a/Kernel/Devices/DiskPartition.cpp b/Kernel/Devices/DiskPartition.cpp new file mode 100644 index 0000000000..413e1cb0a4 --- /dev/null +++ b/Kernel/Devices/DiskPartition.cpp @@ -0,0 +1,63 @@ +#include <Kernel/Devices/DiskPartition.h> + +// #define OFFD_DEBUG + +Retained<DiskPartition> DiskPartition::create(Retained<DiskDevice>&& device, unsigned block_offset) +{ + return adopt(*new DiskPartition(move(device), block_offset)); +} + +DiskPartition::DiskPartition(Retained<DiskDevice>&& device, unsigned block_offset) + : m_device(move(device)), m_block_offset(block_offset) +{ +} + +DiskPartition::~DiskPartition() +{ +} + +unsigned DiskPartition::block_size() const +{ + return m_device->block_size(); +} + +bool DiskPartition::read_block(unsigned index, byte* out) const +{ +#ifdef OFFD_DEBUG + kprintf("DiskPartition::read_block %u (really: %u)\n", index, m_block_offset + index); +#endif + + return m_device->read_block(m_block_offset + index, out); +} + +bool DiskPartition::write_block(unsigned index, const byte* data) +{ +#ifdef OFFD_DEBUG + kprintf("DiskPartition::write_block %u (really: %u)\n", index, m_block_offset + index); +#endif + + return m_device->write_block(m_block_offset + index, data); +} + +bool DiskPartition::read_blocks(unsigned index, word count, byte* out) +{ +#ifdef OFFD_DEBUG + kprintf("DiskPartition::read_blocks %u (really: %u) count=%u\n", index, m_block_offset + index, count); +#endif + + return m_device->read_blocks(m_block_offset + index, count, out); +} + +bool DiskPartition::write_blocks(unsigned index, word count, const byte* data) +{ +#ifdef OFFD_DEBUG + kprintf("DiskPartition::write_blocks %u (really: %u) count=%u\n", index, m_block_offset + index, count); +#endif + + return m_device->write_blocks(m_block_offset + index, count, data); +} + +const char* DiskPartition::class_name() const +{ + return "DiskPartition"; +} diff --git a/Kernel/Devices/OffsetDiskDevice.h b/Kernel/Devices/DiskPartition.h index aaa2350319..c4e1b39ee9 100644 --- a/Kernel/Devices/OffsetDiskDevice.h +++ b/Kernel/Devices/DiskPartition.h @@ -3,10 +3,10 @@ #include <AK/RetainPtr.h> #include <Kernel/Devices/DiskDevice.h> -class OffsetDiskDevice final : public DiskDevice { +class DiskPartition final : public DiskDevice { public: - static Retained<OffsetDiskDevice> create(Retained<DiskDevice>&& device, unsigned block_offset); - virtual ~OffsetDiskDevice(); + static Retained<DiskPartition> create(Retained<DiskDevice>&& device, unsigned block_offset); + virtual ~DiskPartition(); virtual unsigned block_size() const override; virtual bool read_block(unsigned index, byte* out) const override; @@ -17,7 +17,7 @@ public: private: virtual const char* class_name() const override; - OffsetDiskDevice(Retained<DiskDevice>&&, unsigned); + DiskPartition(Retained<DiskDevice>&&, unsigned); Retained<DiskDevice> m_device; unsigned m_block_offset; diff --git a/Kernel/Devices/OffsetDiskDevice.cpp b/Kernel/Devices/OffsetDiskDevice.cpp deleted file mode 100644 index 74d66853c4..0000000000 --- a/Kernel/Devices/OffsetDiskDevice.cpp +++ /dev/null @@ -1,63 +0,0 @@ -#include <Kernel/Devices/OffsetDiskDevice.h> - -// #define OFFD_DEBUG - -Retained<OffsetDiskDevice> OffsetDiskDevice::create(Retained<DiskDevice>&& device, unsigned block_offset) -{ - return adopt(*new OffsetDiskDevice(move(device), block_offset)); -} - -OffsetDiskDevice::OffsetDiskDevice(Retained<DiskDevice>&& device, unsigned block_offset) - : m_device(move(device)), m_block_offset(block_offset) -{ -} - -OffsetDiskDevice::~OffsetDiskDevice() -{ -} - -unsigned OffsetDiskDevice::block_size() const -{ - return m_device->block_size(); -} - -bool OffsetDiskDevice::read_block(unsigned index, byte* out) const -{ -#ifdef OFFD_DEBUG - kprintf("OffsetDiskDevice::read_block %u (really: %u)\n", index, m_block_offset + index); -#endif - - return m_device->read_block(m_block_offset + index, out); -} - -bool OffsetDiskDevice::write_block(unsigned index, const byte* data) -{ -#ifdef OFFD_DEBUG - kprintf("OffsetDiskDevice::write_block %u (really: %u)\n", index, m_block_offset + index); -#endif - - return m_device->write_block(m_block_offset + index, data); -} - -bool OffsetDiskDevice::read_blocks(unsigned index, word count, byte* out) -{ -#ifdef OFFD_DEBUG - kprintf("OffsetDiskDevice::read_blocks %u (really: %u) count=%u\n", index, m_block_offset + index, count); -#endif - - return m_device->read_blocks(m_block_offset + index, count, out); -} - -bool OffsetDiskDevice::write_blocks(unsigned index, word count, const byte* data) -{ -#ifdef OFFD_DEBUG - kprintf("OffsetDiskDevice::write_blocks %u (really: %u) count=%u\n", index, m_block_offset + index, count); -#endif - - return m_device->write_blocks(m_block_offset + index, count, data); -} - -const char* OffsetDiskDevice::class_name() const -{ - return "OffsetDiskDevice"; -} diff --git a/Kernel/Makefile b/Kernel/Makefile index d79761bfeb..4da36b2020 100644 --- a/Kernel/Makefile +++ b/Kernel/Makefile @@ -65,7 +65,7 @@ VFS_OBJS = \ Devices/ZeroDevice.o \ Devices/RandomDevice.o \ Devices/DebugLogDevice.o \ - Devices/OffsetDiskDevice.o \ + Devices/DiskPartition.o \ FileSystem/FileSystem.o \ FileSystem/DiskBackedFileSystem.o \ FileSystem/Ext2FileSystem.o \ diff --git a/Kernel/init.cpp b/Kernel/init.cpp index 7b346d678f..e3992f7f1e 100644 --- a/Kernel/init.cpp +++ b/Kernel/init.cpp @@ -6,7 +6,7 @@ #include "Process.h" #include "PIC.h" #include <Kernel/Devices/IDEDiskDevice.h> -#include <Kernel/Devices/OffsetDiskDevice.h> +#include <Kernel/Devices/DiskPartition.h> #include "KSyms.h" #include <Kernel/Devices/NullDevice.h> #include <Kernel/Devices/ZeroDevice.h> @@ -72,7 +72,7 @@ VFS* vfs; auto dev_random = make<RandomDevice>(); auto dev_ptmx = make<PTYMultiplexer>(); auto dev_hd0 = IDEDiskDevice::create(); - auto dev_hd0p1 = OffsetDiskDevice::create(dev_hd0.copy_ref(), PARTITION_OFFSET); + auto dev_hd0p1 = DiskPartition::create(dev_hd0.copy_ref(), PARTITION_OFFSET); auto e2fs = Ext2FS::create(dev_hd0p1.copy_ref()); e2fs->initialize(); |