Further implemented sys_fs_get_mount_info() and sys_fs_get_mount_info_size()

This commit is contained in:
brian218 2022-11-13 22:15:46 +08:00 committed by Megamouse
parent 16098c38c8
commit 13ca1a7f09
3 changed files with 132 additions and 89 deletions

View file

@ -73,6 +73,11 @@ bool vfs::mount(std::string_view vpath, std::string_view path, bool is_dir)
list.back()->path += '/';
if (!is_dir && list.back()->path.ends_with('/'))
vfs_log.error("File mounted with trailing /.");
const auto mp = lv2_fs_object::get_mp(vpath_backup);
if (mp == &g_mp_sys_dev_usb)
mp->is_mounted |= (1U << vpath_backup.back() - '0');
else
mp->is_mounted = 1U;
vfs_log.notice("Mounted path \"%s\" to \"%s\"", vpath_backup, list.back()->path);
return true;
}
@ -180,6 +185,12 @@ bool vfs::unmount(std::string_view vpath)
};
unmount_children(table.root, 0);
const auto mp = lv2_fs_object::get_mp(vpath);
if (mp == &g_mp_sys_dev_usb)
mp->is_mounted &= ~(1U << vpath.back() - '0');
else
mp->is_mounted = 0U;
return true;
}