38[[nodiscard]]
inline int mount(
const char *dev_path,
39 const char *mount_point) {
40 return ove_fs_mount(dev_path, mount_point);
47inline void unmount(
const char *mount_point) {
48 ove_fs_unmount(mount_point);
56[[nodiscard]]
inline int unlink(
const char *path) {
57 return ove_fs_unlink(path);
66[[nodiscard]]
inline int rename(
const char *old_path,
67 const char *new_path) {
68 return ove_fs_rename(old_path, new_path);
88 File() : handle_(nullptr) {}
96 File &operator=(
const File &) =
delete;
102 File(
File &&other) noexcept : handle_(other.handle_) {
103 other.handle_ =
nullptr;
112 if (
this != &other) {
114 handle_ = other.handle_;
115 other.handle_ =
nullptr;
126 [[nodiscard]]
int open(
const char *path,
int flags) {
127 return ove_fs_open(&handle_, path, flags);
140 ret = ove_fs_close(handle_);
153 [[nodiscard]]
int read(
void *buf,
size_t count,
size_t *bytes_read) {
154 return ove_fs_read(handle_, buf, count, bytes_read);
164 [[nodiscard]]
int write(
const void *buf,
size_t count,
165 size_t *bytes_written) {
166 return ove_fs_write(handle_, buf, count, bytes_written);
175 [[nodiscard]]
int seek(
long offset,
int whence) {
176 return ove_fs_seek(handle_, offset, whence);
184 return ove_fs_tell(handle_);
192 [[nodiscard]]
int size(
size_t *out_size) {
193 return ove_fs_size(handle_, out_size);
200 bool valid()
const {
return handle_ !=
nullptr; }
206 ove_file_t
handle()
const {
return handle_; }
226 Dir() : handle_(nullptr) {}
233 Dir(
const Dir &) =
delete;
234 Dir &operator=(
const Dir &) =
delete;
240 Dir(
Dir &&other) noexcept : handle_(other.handle_) {
241 other.handle_ =
nullptr;
250 if (
this != &other) {
252 handle_ = other.handle_;
253 other.handle_ =
nullptr;
263 [[nodiscard]]
int open(
const char *path) {
264 return ove_fs_opendir(&handle_, path);
277 ret = ove_fs_closedir(handle_);
289 [[nodiscard]]
int readdir(
struct ove_dirent *entry) {
290 return ove_fs_readdir(handle_, entry);
297 bool valid()
const {
return handle_ !=
nullptr; }
303 ove_dir_t
handle()
const {
return handle_; }
RAII wrapper around an oveRTOS directory handle.
Definition fs.hpp:221
int close()
Closes the directory and invalidates the handle.
Definition fs.hpp:274
int open(const char *path)
Opens a directory at the specified path.
Definition fs.hpp:263
Dir & operator=(Dir &&other) noexcept
Move-assignment operator — closes the current directory and takes ownership.
Definition fs.hpp:249
int readdir(struct ove_dirent *entry)
Reads the next entry from the directory.
Definition fs.hpp:289
Dir(Dir &&other) noexcept
Move constructor — transfers ownership of the directory handle.
Definition fs.hpp:240
ove_dir_t handle() const
Returns the raw oveRTOS directory handle.
Definition fs.hpp:303
~Dir()
Destroys the Dir object, closing the directory if it is still open.
Definition fs.hpp:231
bool valid() const
Returns true if the directory handle is valid.
Definition fs.hpp:297
Dir()
Constructs a Dir object with no open directory (invalid state).
Definition fs.hpp:226
RAII wrapper around an oveRTOS file handle.
Definition fs.hpp:83
int seek(long offset, int whence)
Repositions the file offset.
Definition fs.hpp:175
int open(const char *path, int flags)
Opens a file at the specified path.
Definition fs.hpp:126
long tell()
Returns the current file offset.
Definition fs.hpp:183
int write(const void *buf, size_t count, size_t *bytes_written)
Writes bytes to the file at the current position.
Definition fs.hpp:164
int read(void *buf, size_t count, size_t *bytes_read)
Reads bytes from the file at the current position.
Definition fs.hpp:153
bool valid() const
Returns true if the file handle is valid (file is open).
Definition fs.hpp:200
int size(size_t *out_size)
Returns the size of the file.
Definition fs.hpp:192
int close()
Closes the file and invalidates the handle.
Definition fs.hpp:137
File()
Constructs a File object with no open file (invalid state).
Definition fs.hpp:88
~File()
Destroys the file object, closing the file if it is still open.
Definition fs.hpp:93
File & operator=(File &&other) noexcept
Move-assignment operator — closes the current file and takes ownership.
Definition fs.hpp:111
File(File &&other) noexcept
Move constructor — transfers ownership of the file handle.
Definition fs.hpp:102
ove_file_t handle() const
Returns the raw oveRTOS file handle.
Definition fs.hpp:206
int mount(const char *dev_path, const char *mount_point)
Mounts a filesystem at the given mount point.
Definition fs.hpp:38
void unmount(const char *mount_point)
Unmounts a previously mounted filesystem.
Definition fs.hpp:47
int rename(const char *old_path, const char *new_path)
Renames or moves a file or directory.
Definition fs.hpp:66
int unlink(const char *path)
Deletes a file from the filesystem.
Definition fs.hpp:56
Top-level namespace for all oveRTOS C++ abstractions.
Definition app.hpp:19
Common type definitions and concepts for the C++ wrapper layer.