~aleteoryx/muditaos

ref: 3780b4844c170a0e8f5f3b1fa615f0732009bbd8 muditaos/module-vfs/src/deprecated/vfs.cpp -rw-r--r-- 4.0 KiB
3780b484 — Lucjan Bryndza [EGD-5074] Add native fscore for emulator 5 years ago
                                                                                
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
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
// Copyright (c) 2017-2020, Mudita Sp. z.o.o. All rights reserved.
// For licensing, see https://github.com/mudita/MuditaOS/LICENSE.md

#include "vfs.hpp"
#include <purefs/filesystem_paths.hpp>
#include <memory>
#include <cstring>
#include <log/log.hpp>

#define eMMCHIDDEN_SECTOR_COUNT 8
#define eMMCPRIMARY_PARTITIONS  2
#define eMMCHUNDRED_64_BIT      100ULL
#define eMMCPARTITION_NUMBER    0
#define eMMCBYTES_PER_MB        (1024ull * 1024ull)
#define eMMCSECTORS_PER_MB      (eMMCBYTES_PER_MB / 512ull)

/* Used as a magic number to indicate that an FF_Disk_t structure is a RAM
   disk. */
#define eMMCSIGNATURE             0x61606362
#define mainIO_MANAGER_CACHE_SIZE (15UL * FSL_SDMMC_DEFAULT_BLOCK_SIZE)

#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wdeprecated-declarations"

std::atomic<bool> vfs::initDone{false};

FILE *vfs::fopen(const char *filename, const char *mode)
{
    LOG_FATAL("Unupported call [%s] !!!!", __PRETTY_FUNCTION__);
    return nullptr;
}

int vfs::fclose(FILE *stream)
{
    LOG_FATAL("Unupported call [%s] !!!!", __PRETTY_FUNCTION__);
    return -1;
}

int vfs::remove(const char *name)
{
    LOG_FATAL("Unupported call [%s] !!!!", __PRETTY_FUNCTION__);
    return -1;
}

size_t vfs::fread(void *ptr, size_t size, size_t count, FILE *stream)
{
    LOG_FATAL("Unupported call [%s] !!!!", __PRETTY_FUNCTION__);
    return -1;
}

size_t vfs::fwrite(const void *ptr, size_t size, size_t count, FILE *stream)
{
    LOG_FATAL("Unupported call [%s] !!!!", __PRETTY_FUNCTION__);
    return -1;
}

int vfs::fseek(FILE *stream, long int offset, int origin)
{
    LOG_FATAL("Unupported call [%s] !!!!", __PRETTY_FUNCTION__);
    return -1;
}

long int vfs::ftell(FILE *stream)
{
    LOG_FATAL("Unupported call [%s] !!!!", __PRETTY_FUNCTION__);
    return -1;
}

void vfs::rewind(FILE *stream)
{
    LOG_FATAL("Unupported call [%s] !!!!", __PRETTY_FUNCTION__);
}

size_t vfs::filelength(FILE *stream)
{
    LOG_FATAL("Unupported call [%s] !!!!", __PRETTY_FUNCTION__);
    return 0;
}

char *vfs::fgets(char *buff, size_t count, FILE *stream)
{
    LOG_FATAL("Unupported call [%s] !!!!", __PRETTY_FUNCTION__);
    return nullptr;
}

std::string vfs::getcurrdir()
{
    LOG_FATAL("Unupported call [%s] !!!!", __PRETTY_FUNCTION__);
    return {};
}

static inline bool hasEnding(std::string const &fullString, std::string const &ending)
{
    LOG_FATAL("Unupported call [%s] !!!!", __PRETTY_FUNCTION__);
    return false;
}

std::vector<vfs::DirectoryEntry> vfs::listdir(const char *path, const std::string &ext, const bool bypassRootCheck)
{

    LOG_FATAL("Unupported call [%s] !!!!", __PRETTY_FUNCTION__);
    return {};
}

bool vfs::eof(FILE *stream)
{
    LOG_FATAL("Unupported call [%s] !!!!", __PRETTY_FUNCTION__);
    return false;
}

std::string vfs::getline(FILE *stream, uint32_t length)
{
    LOG_FATAL("Unupported call [%s] !!!!", __PRETTY_FUNCTION__);
    return {};
}

vfs::FilesystemStats vfs::getFilesystemStats()
{
    LOG_FATAL("Unupported call [%s] !!!!", __PRETTY_FUNCTION__);
    return {};
}

std::string vfs::relativeToRoot(const std::string path)
{
    return path;
}

bool vfs::isDir(const char *path)
{
    LOG_FATAL("Unupported call [%s] !!!!", __PRETTY_FUNCTION__);
    return false;
}

bool vfs::fileExists(const char *path)
{
    LOG_FATAL("Unupported call [%s] !!!!", __PRETTY_FUNCTION__);
    return false;
}

int vfs::deltree(const char *path)
{
    LOG_FATAL("Unupported call [%s] !!!!", __PRETTY_FUNCTION__);
    return -1;
}

int vfs::mkdir(const char *dir)
{
    LOG_FATAL("Unupported call [%s] !!!!", __PRETTY_FUNCTION__);
    return -1;
}

int vfs::rename(const char *oldname, const char *newname)
{
    LOG_FATAL("Unupported call [%s] !!!!", __PRETTY_FUNCTION__);
    return -1;
}

std::string vfs::lastErrnoToStr()
{
    return {};
}

size_t vfs::fprintf(FILE *stream, const char *format, ...)
{
    LOG_FATAL("Unupported call [%s] !!!!", __PRETTY_FUNCTION__);
    return -1;
}
auto vfs::getAbsolutePath(std::string_view path) const -> std::string
{
    return std::string(path);
}

vfs::~vfs()
{}

vfs::vfs()
{}

void vfs::Init()
{}

#pragma GCC diagnostic pop