mirror of
https://github.com/RGBCube/serenity
synced 2025-05-29 06:25:07 +00:00

It is now possible to mount ext2 `DiskDevice` devices under Serenity on any folder in the root filesystem. Currently any user can do this with any permissions. There's a fair amount of assumptions made here too, that might not be too good, but can be worked on in the future. This is a good start to allow more dynamic operation under the OS itself. It is also currently impossible to unmount and such, and devices will fail to mount in Linux as the FS 'needs to be cleaned'. I'll work on getting `umount` done ASAP to rectify this (as well as working on less assumption-making in the mount syscall. We don't want to just be able to mount DiskDevices!). This could probably be fixed with some `-t` flag or something similar.
28 lines
827 B
C++
28 lines
827 B
C++
#pragma once
|
|
|
|
#include <AK/RefCounted.h>
|
|
#include <AK/Types.h>
|
|
#include <Kernel/Devices/BlockDevice.h>
|
|
|
|
// FIXME: Support 64-bit DiskOffset
|
|
typedef u32 DiskOffset;
|
|
|
|
class DiskDevice : public BlockDevice {
|
|
public:
|
|
virtual ~DiskDevice();
|
|
|
|
virtual unsigned block_size() const = 0;
|
|
virtual bool read_block(unsigned index, u8*) const = 0;
|
|
virtual bool write_block(unsigned index, const u8*) = 0;
|
|
virtual const char* class_name() const = 0;
|
|
bool read(DiskOffset, unsigned length, u8*) const;
|
|
bool write(DiskOffset, unsigned length, const u8*);
|
|
|
|
virtual bool read_blocks(unsigned index, u16 count, u8*) = 0;
|
|
virtual bool write_blocks(unsigned index, u16 count, const u8*) = 0;
|
|
|
|
virtual bool is_disk_device() const override { return true; };
|
|
|
|
protected:
|
|
DiskDevice(int major, int minor);
|
|
};
|