From 0543598574b48f591bc70d3b9ede39b29459b2bc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?L=C3=A9o=20Lam?= Date: Wed, 14 Mar 2018 17:11:21 +0100 Subject: [PATCH] IOS/FS: Move /tmp clearing back to the IPC interface Prevents /tmp from being cleared unnecessarily; clearing /tmp is normally only done once every time IOS is reloaded. --- Source/Core/Core/IOS/FS/FileSystem.cpp | 6 ------ Source/Core/Core/IOS/FS/FileSystem.h | 3 --- Source/Core/Core/IOS/FS/FileSystemProxy.cpp | 6 ++++++ Source/Core/Core/IOS/FS/HostBackend/FS.cpp | 1 - 4 files changed, 6 insertions(+), 10 deletions(-) diff --git a/Source/Core/Core/IOS/FS/FileSystem.cpp b/Source/Core/Core/IOS/FS/FileSystem.cpp index e1651ad99b..66bd7659ae 100644 --- a/Source/Core/Core/IOS/FS/FileSystem.cpp +++ b/Source/Core/Core/IOS/FS/FileSystem.cpp @@ -84,12 +84,6 @@ Result FileHandle::GetStatus() const return m_fs->GetFileStatus(*m_fd); } -void FileSystem::Init() -{ - if (Delete(0, 0, "/tmp") == ResultCode::Success) - CreateDirectory(0, 0, "/tmp", 0, {Mode::ReadWrite, Mode::ReadWrite, Mode::ReadWrite}); -} - Result FileSystem::CreateAndOpenFile(Uid uid, Gid gid, const std::string& path, Modes modes) { diff --git a/Source/Core/Core/IOS/FS/FileSystem.h b/Source/Core/Core/IOS/FS/FileSystem.h index 3b6d8333f9..8b4b59a858 100644 --- a/Source/Core/Core/IOS/FS/FileSystem.h +++ b/Source/Core/Core/IOS/FS/FileSystem.h @@ -216,9 +216,6 @@ public: virtual Result GetNandStats() = 0; /// Get usage information about a directory (used cluster and inode counts). virtual Result GetDirectoryStats(const std::string& path) = 0; - -protected: - void Init(); }; template diff --git a/Source/Core/Core/IOS/FS/FileSystemProxy.cpp b/Source/Core/Core/IOS/FS/FileSystemProxy.cpp index 6a4bcd929d..181a739748 100644 --- a/Source/Core/Core/IOS/FS/FileSystemProxy.cpp +++ b/Source/Core/Core/IOS/FS/FileSystemProxy.cpp @@ -16,6 +16,7 @@ #include "Core/HW/Memmap.h" #include "Core/HW/SystemTimers.h" #include "Core/IOS/FS/FileSystem.h" +#include "Core/IOS/Uids.h" namespace IOS::HLE::Device { @@ -37,6 +38,11 @@ constexpr size_t CLUSTER_DATA_SIZE = 0x4000; FS::FS(Kernel& ios, const std::string& device_name) : Device(ios, device_name) { + if (ios.GetFS()->Delete(PID_KERNEL, PID_KERNEL, "/tmp") == ResultCode::Success) + { + ios.GetFS()->CreateDirectory(PID_KERNEL, PID_KERNEL, "/tmp", 0, + {Mode::ReadWrite, Mode::ReadWrite, Mode::ReadWrite}); + } } void FS::DoState(PointerWrap& p) diff --git a/Source/Core/Core/IOS/FS/HostBackend/FS.cpp b/Source/Core/Core/IOS/FS/HostBackend/FS.cpp index e5861cd60f..9ee4dc9fd1 100644 --- a/Source/Core/Core/IOS/FS/HostBackend/FS.cpp +++ b/Source/Core/Core/IOS/FS/HostBackend/FS.cpp @@ -103,7 +103,6 @@ bool HostFileSystem::FstEntry::CheckPermission(Uid caller_uid, Gid caller_gid, HostFileSystem::HostFileSystem(const std::string& root_path) : m_root_path{root_path} { - Init(); ResetFst(); LoadFst(); }