mirror of
https://github.com/DragonOS-Community/DragonOS.git
synced 2025-06-18 08:06:32 +00:00
新版文件系统重构完成 (#198)
1.重构:VFS 2. 重构:ProcFS 3. 重构:DevFS 4. 重构:FAT32 5. 重构:AHCI驱动 6. 新增:RamFS 7. 新增:MountFS 8. 新增:FAT12 9. 新增:FAT16 10. 重构:设备抽象 Co-authored-by: guanjinquan <1666320330@qq.com> Co-authored-by: DaJiYuQia <88259094+DaJiYuQia@users.noreply.github.com>
This commit is contained in:
@ -4,6 +4,7 @@
|
||||
#include <dirent.h>
|
||||
#include <errno.h>
|
||||
#include <fcntl.h>
|
||||
#include <libsystem/syscall.h>
|
||||
#include <signal.h>
|
||||
#include <stddef.h>
|
||||
#include <stdio.h>
|
||||
@ -12,7 +13,6 @@
|
||||
#include <sys/stat.h>
|
||||
#include <sys/wait.h>
|
||||
#include <unistd.h>
|
||||
#include <libsystem/syscall.h>
|
||||
|
||||
// 当前工作目录(在main_loop中初始化)
|
||||
char *shell_current_path = NULL;
|
||||
@ -68,7 +68,7 @@ static char *get_target_filepath(const char *filename, int *result_path_len)
|
||||
memset(file_path, 0, *result_path_len + 2);
|
||||
|
||||
strncpy(file_path, filename, *result_path_len);
|
||||
if(filename[(*result_path_len)-1]!='/')
|
||||
if (filename[(*result_path_len) - 1] != '/')
|
||||
file_path[*result_path_len] = '/';
|
||||
}
|
||||
|
||||
@ -258,11 +258,11 @@ int shell_cmd_ls(int argc, char **argv)
|
||||
break;
|
||||
|
||||
int color = COLOR_WHITE;
|
||||
if (buf->d_type & VFS_IF_DIR)
|
||||
if (buf->d_type == DT_DIR)
|
||||
color = COLOR_YELLOW;
|
||||
else if (buf->d_type & VFS_IF_FILE)
|
||||
else if (buf->d_type == DT_REG)
|
||||
color = COLOR_INDIGO;
|
||||
else if (buf->d_type & VFS_IF_DEVICE)
|
||||
else if (buf->d_type == DT_BLK || buf->d_type == DT_CHR)
|
||||
color = COLOR_GREEN;
|
||||
|
||||
char output_buf[256] = {0};
|
||||
@ -315,9 +315,10 @@ int shell_cmd_cat(int argc, char **argv)
|
||||
lseek(fd, 0, SEEK_SET);
|
||||
|
||||
char *buf = (char *)malloc(512);
|
||||
memset(buf, 0, 512);
|
||||
|
||||
while (file_size > 0)
|
||||
{
|
||||
memset(buf, 0, 512);
|
||||
int l = read(fd, buf, 511);
|
||||
buf[l] = '\0';
|
||||
|
||||
|
@ -90,7 +90,7 @@ void main_loop(int kb_fd)
|
||||
int main()
|
||||
{
|
||||
// 打开键盘文件
|
||||
char kb_file_path[] = "/dev/char/ps2.kb0";
|
||||
char kb_file_path[] = "/dev/char/ps2_keyboard";
|
||||
|
||||
int kb_fd = open(kb_file_path, 0);
|
||||
print_ascii_logo();
|
||||
|
Reference in New Issue
Block a user