mirror of
https://github.com/wichtounet/thor-os.git
synced 2025-09-09 04:22:04 -04:00
Add more logging
This commit is contained in:
parent
3021aed283
commit
fc87097bf0
@ -85,6 +85,8 @@ size_t devfs::devfs_file_system::get_file(const path& file_path, vfs::file& f){
|
|||||||
}
|
}
|
||||||
|
|
||||||
size_t devfs::devfs_file_system::read(const path& file_path, char* buffer, size_t count, size_t offset, size_t& read){
|
size_t devfs::devfs_file_system::read(const path& file_path, char* buffer, size_t count, size_t offset, size_t& read){
|
||||||
|
logging::logf(logging::log_level::TRACE, "devfs: read(buffer=%p, count=%d, offset=%d)\n", buffer, count, offset);
|
||||||
|
|
||||||
//Cannot access the root for reading
|
//Cannot access the root for reading
|
||||||
if(file_path.is_root()){
|
if(file_path.is_root()){
|
||||||
return std::ERROR_PERMISSION_DENIED;
|
return std::ERROR_PERMISSION_DENIED;
|
||||||
|
@ -229,6 +229,7 @@ size_t fat32::fat32_file_system::read(const path& file_path, char* buffer, size_
|
|||||||
vfs::file file;
|
vfs::file file;
|
||||||
auto result = get_file(file_path, file);
|
auto result = get_file(file_path, file);
|
||||||
if(result > 0){
|
if(result > 0){
|
||||||
|
logging::logf(logging::log_level::TRACE, "fat32: invalid file\n");
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -237,11 +238,13 @@ size_t fat32::fat32_file_system::read(const path& file_path, char* buffer, size_
|
|||||||
|
|
||||||
//Check the offset parameter
|
//Check the offset parameter
|
||||||
if(offset > file_size){
|
if(offset > file_size){
|
||||||
|
logging::logf(logging::log_level::TRACE, "fat32: invalid offset\n");
|
||||||
return std::ERROR_INVALID_OFFSET;
|
return std::ERROR_INVALID_OFFSET;
|
||||||
}
|
}
|
||||||
|
|
||||||
//No need to read the cluster if there are no content
|
//No need to read the cluster if there are no content
|
||||||
if(file_size == 0 || count == 0){
|
if(file_size == 0 || count == 0){
|
||||||
|
logging::logf(logging::log_level::TRACE, "fat32: nothing to read\n");
|
||||||
read = 0;
|
read = 0;
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
@ -262,6 +265,7 @@ size_t fat32::fat32_file_system::read(const path& file_path, char* buffer, size_
|
|||||||
auto cluster_last = (cluster + 1) * cluster_size;
|
auto cluster_last = (cluster + 1) * cluster_size;
|
||||||
|
|
||||||
if(first < cluster_last){
|
if(first < cluster_last){
|
||||||
|
logging::logf(logging::log_level::TRACE, "fat32: read_sectors\n");
|
||||||
if(read_sectors(cluster_lba(cluster_number), fat_bs->sectors_per_cluster, cluster_buffer.get())){
|
if(read_sectors(cluster_lba(cluster_number), fat_bs->sectors_per_cluster, cluster_buffer.get())){
|
||||||
size_t i = 0;
|
size_t i = 0;
|
||||||
|
|
||||||
@ -273,6 +277,7 @@ size_t fat32::fat32_file_system::read(const path& file_path, char* buffer, size_
|
|||||||
buffer[position++] = cluster_buffer[i];
|
buffer[position++] = cluster_buffer[i];
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
logging::logf(logging::log_level::TRACE, "fat32: read failed\n");
|
||||||
return std::ERROR_FAILED;
|
return std::ERROR_FAILED;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
@ -299,6 +304,8 @@ size_t fat32::fat32_file_system::read(const path& file_path, char* buffer, size_
|
|||||||
|
|
||||||
read = last - first;
|
read = last - first;
|
||||||
|
|
||||||
|
logging::logf(logging::log_level::TRACE, "fat32: finished read\n");
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user