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_Sys.h
Views: 1798
/*1This program is free software: you can redistribute it and/or modify2it under the terms of the GNU General Public License as published by3the Free Software Foundation, either version 3 of the License, or4(at your option) any later version.56This program is distributed in the hope that it will be useful,7but WITHOUT ANY WARRANTY; without even the implied warranty of8MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the9GNU General Public License for more details.1011You should have received a copy of the GNU General Public License12along with this program. If not, see <http://www.gnu.org/licenses/>.13*/1415#pragma once1617#include "AP_Filesystem_backend.h"1819#include "AP_Filesystem_config.h"2021#if AP_FILESYSTEM_SYS_ENABLED2223class ExpandingString;2425class AP_Filesystem_Sys : public AP_Filesystem_Backend26{27public:28// functions that closely match the equivalent posix calls29int open(const char *fname, int flags, bool allow_absolute_paths = false) override;30int close(int fd) override;31int32_t read(int fd, void *buf, uint32_t count) override;32int32_t lseek(int fd, int32_t offset, int whence) override;33int stat(const char *pathname, struct stat *stbuf) override;34void *opendir(const char *pathname) override;35struct dirent *readdir(void *dirp) override;36int closedir(void *dirp) override;3738private:39// only allow up to 4 files at a time40static constexpr uint8_t max_open_file = 4;41int8_t file_in_sysfs(const char *fname);4243struct DirReadTracker {44size_t file_offset;45struct dirent curr_file;46};4748struct rfile {49bool open;50uint32_t file_ofs;51ExpandingString *str;52} file[max_open_file];53};5455#endif // AP_FILESYSTEM_SYS_ENABLED565758