Real-time collaboration for Jupyter Notebooks, Linux Terminals, LaTeX, VS Code, R IDE, and more,
all in one place. Commercial Alternative to JupyterHub.
Real-time collaboration for Jupyter Notebooks, Linux Terminals, LaTeX, VS Code, R IDE, and more,
all in one place. Commercial Alternative to JupyterHub.
Path: blob/master/libraries/AP_Filesystem/AP_Filesystem_FATFS.h
Views: 1798
/*1FATFS backend for AP_Filesystem2*/34#pragma once56#include <sys/types.h>7#include <sys/stat.h>8#include <fcntl.h>9#include <errno.h>10#include <stddef.h>11#include "AP_Filesystem_backend.h"1213#if AP_FILESYSTEM_FATFS_ENABLED1415// Seek offset macros16#define SEEK_SET 017#define SEEK_CUR 118#define SEEK_END 21920class AP_Filesystem_FATFS : public AP_Filesystem_Backend21{22public:23// functions that closely match the equivalent posix calls24int open(const char *fname, int flags, bool allow_absolute_paths = false) override;25int close(int fd) override;26int32_t read(int fd, void *buf, uint32_t count) override;27int32_t write(int fd, const void *buf, uint32_t count) override;28int fsync(int fd) override;29int32_t lseek(int fd, int32_t offset, int whence) override;30int stat(const char *pathname, struct stat *stbuf) override;31int unlink(const char *pathname) override;32int mkdir(const char *pathname) override;33void *opendir(const char *pathname) override;34int rename(const char *oldpath, const char *newpath) override;35struct dirent *readdir(void *dirp) override;36int closedir(void *dirp) override;3738// return free disk space in bytes, -1 on error39int64_t disk_free(const char *path) override;4041// return total disk space in bytes, -1 on error42int64_t disk_space(const char *path) override;4344// set modification time on a file45bool set_mtime(const char *filename, const uint32_t mtime_sec) override;4647// retry mount of filesystem if needed48bool retry_mount(void) override;4950// unmount filesystem for reboot51void unmount(void) override;5253// format sdcard. This is async, monitor get_format_status for progress54bool format(void) override;55AP_Filesystem_Backend::FormatStatus get_format_status() const override;5657private:58void format_handler(void);59FormatStatus format_status;60};6162#endif // #if AP_FILESYSTEM_FATFS_ENABLED636465