9 #ifndef TGT_OS_TYPE_VXWORKS 10 #include <sys/statvfs.h> 24 if (::rmdir(path) == -1) {
32 if (::unlink(path) == -1) {
40 if (::rename(originPath, destPath) == -1) {
48 const char* cwd = ::getcwd(path, static_cast<size_t>(bufferSize));
57 if (::chdir(path) == -1) {
66 #ifdef TGT_OS_TYPE_VXWORKS 67 return Status::NOT_SUPPORTED;
70 static_assert(std::numeric_limits<FwSizeType>::max() >= std::numeric_limits<fsblkcnt_t>::max(),
71 "FwSizeType must be able to hold fsblkcnt_t");
73 "FwSizeType must be able to hold fsblkcnt_t");
74 static_assert(std::numeric_limits<FwSizeType>::max() >= std::numeric_limits<unsigned long>::max(),
75 "FwSizeType must be able to hold unsigned long");
76 struct statvfs fsStat;
77 int ret = statvfs(path, &fsStat);
87 if (block_size == 0) {
92 if (free_blocks > (std::numeric_limits<FwSizeType>::max() / block_size) ||
93 total_blocks > (std::numeric_limits<FwSizeType>::max() / block_size)) {
96 freeBytes = free_blocks * block_size;
97 totalBytes = total_blocks * block_size;
103 return &this->m_handle;
108 struct stat path_stat;
109 const I32 status = lstat(path, &path_stat);
111 if (S_ISDIR(path_stat.st_mode)) {
112 pathType = PathType::DIRECTORY;
113 }
else if (S_ISREG(path_stat.st_mode)) {
114 pathType = PathType::FILE;
116 pathType = PathType::OTHER;
Status _removeDirectory(const char *path) override
Remove a directory at the specified path.
PlatformSizeType FwSizeType
Status _changeWorkingDirectory(const char *path) override
Change the current working directory to the specified path.
Status _rename(const char *sourcePath, const char *destPath) override
Rename a file from source to destination.
Status _getPathType(const char *path, PathType &pathType) override
Get the type of the path (file, directory, etc.)
Status _removeFile(const char *path) override
Remove a file at the specified path.
FileSystemHandle * getHandle() override
Get the raw FileSystem handle.
static U32 min(const U32 a, const U32 b)
Status _getFreeSpace(const char *path, FwSizeType &totalBytes, FwSizeType &freeBytes) override
Get filesystem free and total space in bytes on the filesystem containing the specified path...
FileSystem::Status errno_to_filesystem_status(int errno_input)
Status _getWorkingDirectory(char *path, FwSizeType bufferSize) override
Get the current working directory.
Operation was successful.