mirror of
https://github.com/wichtounet/thor-os.git
synced 2025-09-09 04:22:04 -04:00
Prepare statfs
This commit is contained in:
parent
a31ccf17c4
commit
75b00e3301
@ -109,6 +109,7 @@ public:
|
||||
fat32_file_system(size_t disk, size_t partition);
|
||||
~fat32_file_system();
|
||||
|
||||
size_t statfs(statfs_info& file);
|
||||
size_t read(const std::vector<std::string>& file_path, std::string& content);
|
||||
size_t get_file(const std::vector<std::string>& file_path, vfs::file& file);
|
||||
size_t ls(const std::vector<std::string>& file_path, std::vector<vfs::file>& contents);
|
||||
@ -135,8 +136,6 @@ private:
|
||||
uint32_t find_free_cluster();
|
||||
};
|
||||
|
||||
uint64_t free_size(dd disk, const disks::partition_descriptor& partition);
|
||||
|
||||
}
|
||||
|
||||
#endif
|
||||
|
@ -8,6 +8,10 @@
|
||||
#ifndef VFS_FILE_SYSTEM_H
|
||||
#define VFS_FILE_SYSTEM_H
|
||||
|
||||
#include <statfs_info.hpp>
|
||||
#include <vector.hpp>
|
||||
#include <string.hpp>
|
||||
|
||||
#include "file.hpp"
|
||||
|
||||
namespace vfs {
|
||||
@ -15,6 +19,7 @@ namespace vfs {
|
||||
struct file_system {
|
||||
virtual ~file_system(){};
|
||||
|
||||
virtual size_t statfs(statfs_info& file) = 0;
|
||||
virtual size_t read(const std::vector<std::string>& file_path, std::string& content) = 0;
|
||||
virtual size_t get_file(const std::vector<std::string>& file_path, vfs::file& file) = 0;
|
||||
virtual size_t ls(const std::vector<std::string>& file_path, std::vector<vfs::file>& contents) = 0;
|
||||
|
@ -403,10 +403,11 @@ size_t fat32::fat32_file_system::rm(const std::vector<std::string>& file_path){
|
||||
}
|
||||
}
|
||||
|
||||
//TODO This will be migrated to statfs
|
||||
uint64_t fat32::free_size(dd disk, const disks::partition_descriptor& partition){
|
||||
size_t fat32::fat32_file_system::statfs(statfs_info& file){
|
||||
file.total_size = fat_bs->total_sectors_long * 512;
|
||||
file.free_size = fat_is->free_clusters * fat_bs->sectors_per_cluster * 512;
|
||||
|
||||
return 0;
|
||||
//TODO return fat_is->free_clusters * fat_bs->sectors_per_cluster * 512;
|
||||
}
|
||||
|
||||
/* Private methods implementation */
|
||||
|
18
tlib/include/statfs_info.hpp
Normal file
18
tlib/include/statfs_info.hpp
Normal file
@ -0,0 +1,18 @@
|
||||
//=======================================================================
|
||||
// Copyright Baptiste Wicht 2013-2014.
|
||||
// Distributed under the Boost Software License, Version 1.0.
|
||||
// (See accompanying file LICENSE_1_0.txt or copy at
|
||||
// http://www.boost.org/LICENSE_1_0.txt)
|
||||
//=======================================================================
|
||||
|
||||
#ifndef USER_STATFS_INFO_HPP
|
||||
#define USER_STATFS_INFO_HPP
|
||||
|
||||
#include <types.hpp>
|
||||
|
||||
struct statfs_info {
|
||||
size_t total_size;
|
||||
size_t free_size;
|
||||
};
|
||||
|
||||
#endif
|
Loading…
x
Reference in New Issue
Block a user