mirror of
https://github.com/RPCS3/rpcs3.git
synced 2025-07-06 06:51:26 +12:00
sys_fs: Lock dev_hdd1 mount point at cellSysCacheClear
This commit is contained in:
parent
a178374052
commit
0b24b09a06
4 changed files with 16 additions and 19 deletions
|
@ -863,12 +863,6 @@ s32 cellFsStReadWaitCallback(u32 fd, u64 size, vm::ptr<void(s32 xfd, u64 xsize)>
|
||||||
|
|
||||||
using fs_aio_cb_t = vm::ptr<void(vm::ptr<CellFsAio> xaio, s32 error, s32 xid, u64 size)>;
|
using fs_aio_cb_t = vm::ptr<void(vm::ptr<CellFsAio> xaio, s32 error, s32 xid, u64 size)>;
|
||||||
|
|
||||||
// temporarily
|
|
||||||
struct lv2_fs_mount_point
|
|
||||||
{
|
|
||||||
std::mutex mutex;
|
|
||||||
};
|
|
||||||
|
|
||||||
struct fs_aio_thread : ppu_thread
|
struct fs_aio_thread : ppu_thread
|
||||||
{
|
{
|
||||||
using ppu_thread::ppu_thread;
|
using ppu_thread::ppu_thread;
|
||||||
|
|
|
@ -28,6 +28,8 @@ void fmt_class_string<CellSysCacheError>::format(std::string& out, u64 arg)
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
extern lv2_fs_mount_point g_mp_sys_dev_hdd1;
|
||||||
|
|
||||||
struct syscache_info
|
struct syscache_info
|
||||||
{
|
{
|
||||||
const std::string cache_root = Emu.GetHdd1Dir() + "/caches/";
|
const std::string cache_root = Emu.GetHdd1Dir() + "/caches/";
|
||||||
|
@ -77,6 +79,8 @@ struct syscache_info
|
||||||
// Poison opened files in /dev_hdd1 to return CELL_EIO on access
|
// Poison opened files in /dev_hdd1 to return CELL_EIO on access
|
||||||
if (remove_root)
|
if (remove_root)
|
||||||
{
|
{
|
||||||
|
std::lock_guard lock(g_mp_sys_dev_hdd1.mutex);
|
||||||
|
|
||||||
idm::select<lv2_fs_object, lv2_file>([](u32 id, lv2_file& file)
|
idm::select<lv2_fs_object, lv2_file>([](u32 id, lv2_file& file)
|
||||||
{
|
{
|
||||||
if (std::memcmp("/dev_hdd1", file.name.data(), 9) == 0)
|
if (std::memcmp("/dev_hdd1", file.name.data(), 9) == 0)
|
||||||
|
|
|
@ -10,15 +10,6 @@
|
||||||
|
|
||||||
LOG_CHANNEL(sys_fs);
|
LOG_CHANNEL(sys_fs);
|
||||||
|
|
||||||
struct lv2_fs_mount_point
|
|
||||||
{
|
|
||||||
const u32 sector_size = 512;
|
|
||||||
const u32 block_size = 4096;
|
|
||||||
const bs_t<lv2_mp_flag> flags{};
|
|
||||||
|
|
||||||
shared_mutex mutex;
|
|
||||||
};
|
|
||||||
|
|
||||||
lv2_fs_mount_point g_mp_sys_dev_hdd0;
|
lv2_fs_mount_point g_mp_sys_dev_hdd0;
|
||||||
lv2_fs_mount_point g_mp_sys_dev_hdd1{512, 32768, lv2_mp_flag::no_uid_gid};
|
lv2_fs_mount_point g_mp_sys_dev_hdd1{512, 32768, lv2_mp_flag::no_uid_gid};
|
||||||
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_usb{512, 4096, lv2_mp_flag::no_uid_gid};
|
||||||
|
@ -1277,14 +1268,14 @@ error_code sys_fs_fcntl(ppu_thread& ppu, u32 fd, u32 op, vm::ptr<void> _arg, u32
|
||||||
|
|
||||||
fs::file stream;
|
fs::file stream;
|
||||||
stream.reset(std::move(sdata_file));
|
stream.reset(std::move(sdata_file));
|
||||||
if (const u32 id = idm::import<lv2_fs_object, lv2_file>([&]() -> std::shared_ptr<lv2_file>
|
if (const u32 id = idm::import<lv2_fs_object, lv2_file>([&file = *file, &stream = stream]() -> std::shared_ptr<lv2_file>
|
||||||
{
|
{
|
||||||
if (!g_fxo->get<loaded_npdrm_keys>()->npdrm_fds.try_inc(16))
|
if (!g_fxo->get<loaded_npdrm_keys>()->npdrm_fds.try_inc(16))
|
||||||
{
|
{
|
||||||
return nullptr;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
return std::make_shared<lv2_file>(*file, std::move(stream), file->mode, file->flags, lv2_file_type::npdrm);
|
return std::make_shared<lv2_file>(file, std::move(stream), file.mode, file.flags, lv2_file_type::npdrm);
|
||||||
}))
|
}))
|
||||||
{
|
{
|
||||||
arg->out_code = CELL_OK;
|
arg->out_code = CELL_OK;
|
||||||
|
|
|
@ -3,6 +3,7 @@
|
||||||
#include "Emu/Memory/vm_ptr.h"
|
#include "Emu/Memory/vm_ptr.h"
|
||||||
#include "Emu/Cell/ErrorCodes.h"
|
#include "Emu/Cell/ErrorCodes.h"
|
||||||
#include "Utilities/File.h"
|
#include "Utilities/File.h"
|
||||||
|
#include "Utilities/mutex.h"
|
||||||
|
|
||||||
#include <string>
|
#include <string>
|
||||||
|
|
||||||
|
@ -121,8 +122,6 @@ struct FsMselfEntry
|
||||||
u8 m_reserve[16];
|
u8 m_reserve[16];
|
||||||
};
|
};
|
||||||
|
|
||||||
struct lv2_fs_mount_point;
|
|
||||||
|
|
||||||
enum class lv2_mp_flag
|
enum class lv2_mp_flag
|
||||||
{
|
{
|
||||||
read_only,
|
read_only,
|
||||||
|
@ -138,6 +137,15 @@ enum class lv2_file_type
|
||||||
npdrm,
|
npdrm,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
struct lv2_fs_mount_point
|
||||||
|
{
|
||||||
|
const u32 sector_size = 512;
|
||||||
|
const u32 block_size = 4096;
|
||||||
|
const bs_t<lv2_mp_flag> flags{};
|
||||||
|
|
||||||
|
shared_mutex mutex;
|
||||||
|
};
|
||||||
|
|
||||||
struct lv2_fs_object
|
struct lv2_fs_object
|
||||||
{
|
{
|
||||||
using id_type = lv2_fs_object;
|
using id_type = lv2_fs_object;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue