diff options
| author | Amlal El Mahrouss <amlal@el-mahrouss-logic.com> | 2024-04-03 09:20:28 +0200 |
|---|---|---|
| committer | Amlal El Mahrouss <amlal@el-mahrouss-logic.com> | 2024-04-03 09:20:28 +0200 |
| commit | 3facc32b746a44b0e3a91cbe1897127194396d1b (patch) | |
| tree | 0725ebbf35a18e6933596ea5c765ac81adf7834f /Public/Developer/SystemLib/Sources/File.c | |
| parent | efc6b5d169d2b6eaabe7384141cec6054ae622a0 (diff) | |
MHR-3: See main changes below.
Kernel: Improve Disk interfaces regarding the struct they're using (all of them are using MountpountInterface now)
SystemLib: Start adding PowerPC code to the SystemLib to be cross compiled
as a PEF FAT binary.
Kernel: Adding new builtins to support a wide range of hardware.
Signed-off-by: Amlal El Mahrouss <amlal@el-mahrouss-logic.com>
Diffstat (limited to 'Public/Developer/SystemLib/Sources/File.c')
| -rw-r--r-- | Public/Developer/SystemLib/Sources/File.c | 38 |
1 files changed, 38 insertions, 0 deletions
diff --git a/Public/Developer/SystemLib/Sources/File.c b/Public/Developer/SystemLib/Sources/File.c new file mode 100644 index 00000000..1432e7e0 --- /dev/null +++ b/Public/Developer/SystemLib/Sources/File.c @@ -0,0 +1,38 @@ +/* ------------------------------------------- + + Copyright Mahrouss Logic + +------------------------------------------- */ + +#include <Headers/Defines.h> +#include <Headers/File.h> + +enum FileOp { + kFlushFile, + kReadFork, + kWriteFork, + kOpenFork, + kCloseFork, +}; + +/// @brief Opens a new file. +/// @param path where to find it. +/// @param r the restrict (rw, rwe, r+, w+, r, w) +/// @return +CA_EXTERN_C FSRef FsOpenFile(const CharacterTypeUTF8* path, const CharacterTypeUTF8* r) { + CA_MUST_PASS(kSharedApplication); + CA_MUST_PASS(path); + CA_MUST_PASS(r); + + return kSharedApplication->Invoke(kSharedApplication, kCallOpenFile, path, r); +} + +/// @brief Closes the file and flushes it to the said file. +/// @param refFs the filesystem reference. +/// @return +CA_EXTERN_C VoidType FsCloseFile(FSRef refFs) { + CA_MUST_PASS(kSharedApplication); + + kSharedApplication->Invoke(kSharedApplication, refFs, kFlushFile); + kSharedApplication->Invoke(kSharedApplication, kCallCloseFile, refFs); +}
\ No newline at end of file |
