1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-26 01:27:43 +00:00

Kernel: Add File, a base class for anything that a FileDescriptor can wrap.

FileDescriptor is getting out of control, and the layering isn't quite right
so let's make a File class that everything can inherit from. Then we can
stop worrying about all kinds of specifics in FileDescriptor.
This commit is contained in:
Andreas Kling 2019-04-28 14:53:50 +02:00
parent 75734aa003
commit 7ec1f6ab3c
2 changed files with 67 additions and 0 deletions

31
Kernel/File.cpp Normal file
View file

@ -0,0 +1,31 @@
#include <Kernel/File.h>
#include <Kernel/FileSystem/FileDescriptor.h>
File::File()
{
}
File::~File()
{
}
KResultOr<Retained<FileDescriptor>> File::open(int options)
{
UNUSED_PARAM(options);
return FileDescriptor::create(this);
}
void File::close()
{
}
int File::ioctl(Process&, unsigned, unsigned)
{
return -ENOTTY;
}
KResultOr<Region*> File::mmap(Process&, LinearAddress, size_t, size_t)
{
return KResult(-ENODEV);
}