Skip to content
GitLab
Projects Groups Topics Snippets
  • /
  • Help
    • Help
    • Support
    • Community forum
    • Submit feedback
    • Contribute to GitLab
  • Sign in
  • P proj5-FAT32onMaQueOS
  • Project information
    • Project information
    • Activity
    • Labels
    • Members
  • Repository
    • Repository
    • Files
    • Commits
    • Branches
    • Tags
    • Contributor statistics
    • Graph
    • Compare revisions
  • Issues 0
    • Issues 0
    • List
    • Boards
    • Service Desk
    • Milestones
  • Merge requests 0
    • Merge requests 0
  • CI/CD
    • CI/CD
    • Pipelines
    • Jobs
    • Schedules
  • Deployments
    • Deployments
    • Environments
    • Releases
  • Packages and registries
    • Packages and registries
    • Package Registry
    • Terraform modules
  • Monitor
    • Monitor
    • Metrics
    • Incidents
  • Analytics
    • Analytics
    • Value stream
    • CI/CD
    • Repository
  • Wiki
    • Wiki
  • Snippets
    • Snippets
  • Activity
  • Graph
  • Create a new issue
  • Jobs
  • Commits
  • Issue Boards
Collapse sidebar
  • CrewUnionProblemKill
  • proj5-FAT32onMaQueOS
  • Wiki
  • 系统调用文档
  • sys_mount 函数介绍

sys_mount 函数介绍 · Changes

Page history
Create 系统调用文档/sys_mount 函数介绍 authored Jun 15, 2024 by Little Leaf's avatar Little Leaf
Hide whitespace changes
Inline Side-by-side
系统调用文档/sys_mount-函数介绍.md 0 → 100644
View page @ 6440133a
```c
int sys_mount()
{
// 1. 读取引导分区数据
uint32_t N = fat32_read_N();
struct fat_boot_sector *boot_sector_data = fat32_read_boot_sector(N);
if (boot_sector_data == NULL)
{
// 处理错误
fprintf(stderr, "Failed to read boot sector.\n");
return -1;
}
// 2. 从引导分区读取数据到 BPB
struct fat_bios_param_block *bpb = fat32_read_bpb(boot_sector_data);
if (bpb == NULL)
{
// 处理错误
fprintf(stderr, "Failed to read BPB.\n");
free(boot_sector_data);
return -1;
}
// 3. 将 FAT 读入内存
uint32_t *fat = fat32_read_fat(bpb, file_allocation_table);
if (fat == NULL)
{
// 处理错误
fprintf(stderr, "Failed to read FAT.\n");
free(boot_sector_data);
free(bpb);
return -1;
}
// 4. 将根目录读入内存
fat32_read_root_dir(fat, bpb);
// 清理分配的内存
free(boot_sector_data);
free(bpb);
free(fat);
return 0;
}
```
\ No newline at end of file
Clone repository
  • Home
  • uploads
    • 0bc768dbb7fc0582616552f906240a99
      • Readme
  • 云端开发环境
  • 文档规范
  • 比赛题目分析和相关资料调研
  • 系统测试
  • 系统调用文档
    • sys_create函数
    • sys_destroy 函数介绍
      • find_directory_entry 函数介绍
        • read_custor 函数介绍
    • sys_mount 函数介绍