ladybird/Kernel/Devices/DiskPartition.h
Andreas Kling 5254a320d8 Kernel: Remove use of copy_ref() in favor of regular RefPtr copies.
This is obviously more readable. If we ever run into a situation where
ref count churn is actually causing trouble in the future, we can deal with
it then. For now, let's keep it simple. :^)
2019-07-11 15:40:04 +02:00

25 lines
802 B
C++

#pragma once
#include <AK/RefPtr.h>
#include <Kernel/Devices/DiskDevice.h>
class DiskPartition final : public DiskDevice {
public:
static NonnullRefPtr<DiskPartition> create(NonnullRefPtr<DiskDevice>, unsigned block_offset);
virtual ~DiskPartition();
virtual unsigned block_size() const override;
virtual bool read_block(unsigned index, u8* out) const override;
virtual bool write_block(unsigned index, const u8*) override;
virtual bool read_blocks(unsigned index, u16 count, u8*) override;
virtual bool write_blocks(unsigned index, u16 count, const u8*) override;
private:
virtual const char* class_name() const override;
DiskPartition(NonnullRefPtr<DiskDevice>, unsigned block_offset);
NonnullRefPtr<DiskDevice> m_device;
unsigned m_block_offset;
};