mirror of
https://github.com/RGBCube/serenity
synced 2025-05-31 04:58:13 +00:00
Kernel: Rename OffsetDiskDevice to DiskPartition
This commit is contained in:
parent
8eb492aa11
commit
32d78a8526
5 changed files with 70 additions and 70 deletions
63
Kernel/Devices/DiskPartition.cpp
Normal file
63
Kernel/Devices/DiskPartition.cpp
Normal file
|
@ -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";
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue