summaryrefslogtreecommitdiff
path: root/Kernel/FileSystem/File.cpp
blob: 2ca225a0df5bfb396eae7c054705ebd89ba3c352 (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
46
47
48
49
50
51
52
53
54
55
56
57
/*
 * Copyright (c) 2018-2020, Andreas Kling <kling@serenityos.org>
 *
 * SPDX-License-Identifier: BSD-2-Clause
 */

#include <AK/StringView.h>
#include <Kernel/FileSystem/File.h>
#include <Kernel/FileSystem/FileDescription.h>

namespace Kernel {

File::File()
{
}

File::~File()
{
}

KResultOr<NonnullRefPtr<FileDescription>> File::open(int options)
{
    auto description = FileDescription::create(*this);
    if (!description.is_error()) {
        description.value()->set_rw_mode(options);
        description.value()->set_file_flags(options);
    }
    return description;
}

KResult File::close()
{
    return KSuccess;
}

int File::ioctl(FileDescription&, unsigned, FlatPtr)
{
    return -ENOTTY;
}

KResultOr<Region*> File::mmap(Process&, FileDescription&, const Range&, u64, int, bool)
{
    return ENODEV;
}

KResult File::attach(FileDescription&)
{
    m_attach_count++;
    return KSuccess;
}

void File::detach(FileDescription&)
{
    m_attach_count--;
}

}