- Removed virtual functions for all of the stat stuff. This did however introduce some issues, mainly with /proc becoming out of sync if you changed your ID. I propose we do the linux thing and just have a stat update function which is optional, but allows dynamic updates of stat fields for cases such as those in uid/gid in /proc. - Simplified the API, although still kind of annoying it is a bit simpler. - Moved some of the FS structure from having the FS inode inside the in memory inode to a Serialise <-> Deserialise model where Inodes are deserialised from disk into in memory ones and then back into on disk ones when it comes time for syncing. This makes it semantically better in my opinion, as it explicitly separates disk and non-disk functionality.
30 lines
844 B
C++
30 lines
844 B
C++
#include <kernel/Device/Device.h>
|
|
|
|
namespace Kernel
|
|
{
|
|
|
|
class DebugDevice final : public CharacterDevice
|
|
{
|
|
public:
|
|
static BAN::ErrorOr<BAN::RefPtr<DebugDevice>> create(mode_t, uid_t, gid_t);
|
|
|
|
virtual BAN::StringView name() const override { return "debug"_sv; }
|
|
|
|
protected:
|
|
DebugDevice(mode_t mode, uid_t uid, gid_t gid, dev_t rdev)
|
|
: CharacterDevice(mode, uid, gid)
|
|
{
|
|
m_rdev = rdev;
|
|
}
|
|
|
|
virtual BAN::ErrorOr<size_t> read_impl(off_t, BAN::ByteSpan) override { return 0; }
|
|
virtual BAN::ErrorOr<size_t> write_impl(off_t, BAN::ConstByteSpan buffer) override;
|
|
|
|
virtual bool can_read_impl() const override { return false; }
|
|
virtual bool can_write_impl() const override { return true; }
|
|
virtual bool has_error_impl() const override { return false; }
|
|
virtual bool has_hungup_impl() const override { return false; }
|
|
};
|
|
|
|
}
|