mirror of
https://github.com/wichtounet/thor-os.git
synced 2025-09-18 09:04:49 -04:00
Cleanup
This commit is contained in:
parent
fe81a99a44
commit
5c278a27aa
@ -69,7 +69,6 @@ std::unique_heap_array<partition_descriptor> partitions(const disk_descriptor& d
|
|||||||
bool partition_exists(const disk_descriptor& disk, uint64_t uuid);
|
bool partition_exists(const disk_descriptor& disk, uint64_t uuid);
|
||||||
|
|
||||||
void mount(const disk_descriptor& disk, uint64_t uuid);
|
void mount(const disk_descriptor& disk, uint64_t uuid);
|
||||||
void unmount();
|
|
||||||
std::vector<file> ls();
|
std::vector<file> ls();
|
||||||
uint64_t free_size();
|
uint64_t free_size();
|
||||||
|
|
||||||
|
@ -204,16 +204,6 @@ void disks::mount(const disk_descriptor& disk, uint64_t uuid){
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void disks::unmount(){
|
|
||||||
_mounted_disk = nullptr;
|
|
||||||
|
|
||||||
if(_mounted_partition){
|
|
||||||
delete _mounted_partition;
|
|
||||||
}
|
|
||||||
|
|
||||||
_mounted_partition = nullptr;
|
|
||||||
}
|
|
||||||
|
|
||||||
const disks::disk_descriptor* disks::mounted_disk(){
|
const disks::disk_descriptor* disks::mounted_disk(){
|
||||||
return _mounted_disk;
|
return _mounted_disk;
|
||||||
}
|
}
|
||||||
|
@ -56,8 +56,6 @@ void memory_command(const std::vector<std::string>& params);
|
|||||||
void kallocdebug_command(const std::vector<std::string>& params);
|
void kallocdebug_command(const std::vector<std::string>& params);
|
||||||
void disks_command(const std::vector<std::string>& params);
|
void disks_command(const std::vector<std::string>& params);
|
||||||
void partitions_command(const std::vector<std::string>& params);
|
void partitions_command(const std::vector<std::string>& params);
|
||||||
void mount_command(const std::vector<std::string>& params);
|
|
||||||
void unmount_command(const std::vector<std::string>& params);
|
|
||||||
void free_command(const std::vector<std::string>& params);
|
void free_command(const std::vector<std::string>& params);
|
||||||
void exec_command(const std::vector<std::string>& params);
|
void exec_command(const std::vector<std::string>& params);
|
||||||
void vesainfo_command(const std::vector<std::string>& params);
|
void vesainfo_command(const std::vector<std::string>& params);
|
||||||
@ -68,7 +66,7 @@ struct command_definition {
|
|||||||
void (*function)(const std::vector<std::string>&);
|
void (*function)(const std::vector<std::string>&);
|
||||||
};
|
};
|
||||||
|
|
||||||
command_definition commands[15] = {
|
command_definition commands[13] = {
|
||||||
{"help", help_command},
|
{"help", help_command},
|
||||||
{"uptime", uptime_command},
|
{"uptime", uptime_command},
|
||||||
{"clear", clear_command},
|
{"clear", clear_command},
|
||||||
@ -78,8 +76,6 @@ command_definition commands[15] = {
|
|||||||
{"kallocdebug", kallocdebug_command},
|
{"kallocdebug", kallocdebug_command},
|
||||||
{"disks", disks_command},
|
{"disks", disks_command},
|
||||||
{"partitions", partitions_command},
|
{"partitions", partitions_command},
|
||||||
{"mount", mount_command},
|
|
||||||
{"unmount", unmount_command},
|
|
||||||
{"free", free_command},
|
{"free", free_command},
|
||||||
{"exec", exec_command},
|
{"exec", exec_command},
|
||||||
{"vesainfo", vesainfo_command},
|
{"vesainfo", vesainfo_command},
|
||||||
@ -317,54 +313,6 @@ void partitions_command(const std::vector<std::string>& params){
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void mount_command(const std::vector<std::string>& params){
|
|
||||||
if(params.size() == 1){
|
|
||||||
auto md = disks::mounted_disk();
|
|
||||||
auto mp = disks::mounted_partition();
|
|
||||||
|
|
||||||
if(md && mp){
|
|
||||||
k_printf("%u:%u is mounted\n", md->uuid, mp->uuid);
|
|
||||||
} else {
|
|
||||||
k_print_line("Nothing is mounted");
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
if(params.size() != 3){
|
|
||||||
k_print_line("mount: Not enough params: mount disk partition");
|
|
||||||
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
auto disk_uuid = parse(params[1]);
|
|
||||||
auto partition_uuid = parse(params[2]);
|
|
||||||
|
|
||||||
if(disks::disk_exists(disk_uuid)){
|
|
||||||
auto& disk = disks::disk_by_uuid(disk_uuid);
|
|
||||||
|
|
||||||
if(disk.type != disks::disk_type::ATA){
|
|
||||||
k_print_line("Only ATA disks are supported");
|
|
||||||
} else {
|
|
||||||
if(disks::partition_exists(disk, partition_uuid)){
|
|
||||||
disks::mount(disk, partition_uuid);
|
|
||||||
} else {
|
|
||||||
k_printf("Partition %u does not exist\n", partition_uuid);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
k_printf("Disk %u does not exist\n", disk_uuid);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void unmount_command(const std::vector<std::string>& ){
|
|
||||||
if(!disks::mounted_partition() || !disks::mounted_disk()){
|
|
||||||
k_print_line("Nothing is mounted");
|
|
||||||
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
disks::unmount();
|
|
||||||
}
|
|
||||||
|
|
||||||
void free_command(const std::vector<std::string>&){
|
void free_command(const std::vector<std::string>&){
|
||||||
if(!disks::mounted_partition() || !disks::mounted_disk()){
|
if(!disks::mounted_partition() || !disks::mounted_disk()){
|
||||||
k_print_line("Nothing is mounted");
|
k_print_line("Nothing is mounted");
|
||||||
|
Loading…
x
Reference in New Issue
Block a user