1
0
mirror of https://github.com/RPCS3/rpcs3.git synced 2024-11-22 10:42:36 +01:00

Implement lv2_mp_flag::cache

Identify /dev_hdd1 without unsafe path comparison.
This commit is contained in:
Nekotekina 2021-03-16 19:37:00 +03:00
parent f801dc6558
commit 8fcebebae3
4 changed files with 5 additions and 6 deletions

View File

@ -81,7 +81,7 @@ struct syscache_info
{
idm::select<lv2_fs_object, lv2_file>([](u32 /*id*/, lv2_file& file)
{
if (file.file && std::memcmp("/dev_hdd1/", file.name.data(), 10) == 0)
if (file.file && file.mp->flags & lv2_mp_flag::cache)
{
file.lock = 2;
}

View File

@ -14,7 +14,7 @@ LOG_CHANNEL(sys_fs);
lv2_fs_mount_point g_mp_sys_dev_root;
lv2_fs_mount_point g_mp_sys_no_device;
lv2_fs_mount_point g_mp_sys_dev_hdd0{"/dev_hdd0"};
lv2_fs_mount_point g_mp_sys_dev_hdd1{"/dev_hdd1", 512, 32768, lv2_mp_flag::no_uid_gid};
lv2_fs_mount_point g_mp_sys_dev_hdd1{"/dev_hdd1", 512, 32768, lv2_mp_flag::no_uid_gid + lv2_mp_flag::cache};
lv2_fs_mount_point g_mp_sys_dev_usb{"", 512, 4096, lv2_mp_flag::no_uid_gid};
lv2_fs_mount_point g_mp_sys_dev_bdvd{"", 2048, 65536, lv2_mp_flag::read_only + lv2_mp_flag::no_uid_gid};
lv2_fs_mount_point g_mp_sys_host_root{"", 512, 512, lv2_mp_flag::strict_get_block_size + lv2_mp_flag::no_uid_gid};
@ -702,8 +702,7 @@ error_code sys_fs_close(ppu_thread& ppu, u32 fd)
return CELL_EBADF;
}
if (std::memcmp(file->name.data(), "/dev_hdd1/", 10) != 0
&& !(file->mp->flags & lv2_mp_flag::read_only) && file->flags & CELL_FS_O_ACCMODE)
if (!(file->mp->flags & (lv2_mp_flag::read_only + lv2_mp_flag::cache)) && file->flags & CELL_FS_O_ACCMODE)
{
// Special: Ensure temporary directory for gamedata writes will remain on disk before final gamedata commitment
file->file.sync(); // For cellGameContentPermit atomicity

View File

@ -127,6 +127,7 @@ enum class lv2_mp_flag
read_only,
no_uid_gid,
strict_get_block_size,
cache,
__bitset_enum_max
};

View File

@ -758,8 +758,7 @@ bool vfs::host::rename(const std::string& from, const std::string& to, const lv2
file.restore_data.seek_pos = file.file.pos();
if (std::memcmp(file.name.data(), "/dev_hdd1/", 10) != 0
&& !(file.mp->flags & lv2_mp_flag::read_only) && file.flags & CELL_FS_O_ACCMODE)
if (!(file.mp->flags & (lv2_mp_flag::read_only + lv2_mp_flag::cache)) && file.flags & CELL_FS_O_ACCMODE)
{
file.file.sync(); // For cellGameContentPermit atomicity
}