blob: 60fbab1d41d32c45f096059b52d91b2f3d086250 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
|
#pragma once
#include <AK/AKString.h>
#include <AK/Retainable.h>
#include <AK/Retained.h>
#include <AK/Types.h>
#include <Kernel/KResult.h>
#include <Kernel/LinearAddress.h>
class FileDescriptor;
class Process;
class Region;
class File : public Retainable<File> {
public:
virtual ~File();
virtual KResultOr<Retained<FileDescriptor>> open(int options);
virtual void close();
virtual bool can_read(FileDescriptor&) const = 0;
virtual bool can_write(FileDescriptor&) const = 0;
virtual ssize_t read(FileDescriptor&, byte*, ssize_t) = 0;
virtual ssize_t write(FileDescriptor&, const byte*, ssize_t) = 0;
virtual int ioctl(FileDescriptor&, unsigned request, unsigned arg);
virtual KResultOr<Region*> mmap(Process&, LinearAddress preferred_laddr, size_t offset, size_t size);
virtual String absolute_path() const = 0;
virtual const char* class_name() const = 0;
virtual bool is_seekable() const { return false; }
virtual bool is_shared_memory() const { return false; }
virtual bool is_fifo() const { return false; }
virtual bool is_device() const { return false; }
virtual bool is_tty() const { return false; }
virtual bool is_master_pty() const { return false; }
virtual bool is_block_device() const { return false; }
virtual bool is_character_device() const { return false; }
protected:
File();
};
|