mirror of
https://github.com/ByteWelder/Tactility.git
synced 2026-04-18 09:25:06 +00:00
Add file_system driver
This commit is contained in:
parent
880bae3fae
commit
7293ea8928
22
TactilityKernel/include/tactility/drivers/file_system.h
Normal file
22
TactilityKernel/include/tactility/drivers/file_system.h
Normal file
@ -0,0 +1,22 @@
|
|||||||
|
#pragma once
|
||||||
|
|
||||||
|
#include <tactility/error.h>
|
||||||
|
|
||||||
|
struct Device;
|
||||||
|
|
||||||
|
struct FileSystemApi {
|
||||||
|
error_t (*mount)(struct Device* device);
|
||||||
|
error_t (*unmount)(struct Device* device);
|
||||||
|
bool (*is_mounted)(struct Device* device);
|
||||||
|
error_t (*get_mount_path)(struct Device*, char* out_path);
|
||||||
|
};
|
||||||
|
|
||||||
|
extern const struct DeviceType FILE_SYSTEM_TYPE;
|
||||||
|
|
||||||
|
error_t file_system_mount(struct Device* device);
|
||||||
|
|
||||||
|
error_t file_system_unmount(struct Device* device);
|
||||||
|
|
||||||
|
bool file_system_is_mounted(struct Device* device);
|
||||||
|
|
||||||
|
error_t file_system_get_mount_path(struct Device*, char* out_path);
|
||||||
27
TactilityKernel/source/drivers/file_system.cpp
Normal file
27
TactilityKernel/source/drivers/file_system.cpp
Normal file
@ -0,0 +1,27 @@
|
|||||||
|
#include <tactility/drivers/file_system.h>
|
||||||
|
|
||||||
|
#define INTERNAL_API(driver) ((struct FileSystem*)(driver)->api)
|
||||||
|
|
||||||
|
error_t file_system_mount(struct Device* device) {
|
||||||
|
const auto* driver = device_get_driver(device);
|
||||||
|
return INTERNAL_API(driver)->mount(device);
|
||||||
|
}
|
||||||
|
|
||||||
|
error_t file_system_unmount(struct Device* device) {
|
||||||
|
const auto* driver = device_get_driver(device);
|
||||||
|
return INTERNAL_API(driver)->unmount(device);
|
||||||
|
}
|
||||||
|
|
||||||
|
bool file_system_is_mounted(struct Device* device) {
|
||||||
|
const auto* driver = device_get_driver(device);
|
||||||
|
return INTERNAL_API(driver)->is_mounted(device);
|
||||||
|
}
|
||||||
|
|
||||||
|
error_t file_system_get_mount_path(struct Device*, char* out_path) {
|
||||||
|
const auto* driver = device_get_driver(device);
|
||||||
|
return INTERNAL_API(driver)->get_mount_path(device, out_path);
|
||||||
|
}
|
||||||
|
|
||||||
|
const struct DeviceType FILE_SYSTEM_TYPE {
|
||||||
|
.name = "file-system"
|
||||||
|
};
|
||||||
Loading…
x
Reference in New Issue
Block a user