Skip to content

Commit

Permalink
Log: Rename IOS_FILEIO to IOS_FS
Browse files Browse the repository at this point in the history
Let's use the actual module name.

Also, the FS code is not all about files.
  • Loading branch information
leoetlino committed Mar 6, 2018
1 parent 9a8a3ca commit ac38814
Show file tree
Hide file tree
Showing 5 changed files with 31 additions and 36 deletions.
1 change: 0 additions & 1 deletion Source/Core/Common/Logging/Log.h
Expand Up @@ -31,7 +31,6 @@ enum LOG_TYPE
IOS,
IOS_DI,
IOS_ES,
IOS_FILEIO,
IOS_FS,
IOS_NET,
IOS_SD,
Expand Down
1 change: 0 additions & 1 deletion Source/Core/Common/Logging/LogManager.cpp
Expand Up @@ -99,7 +99,6 @@ LogManager::LogManager()
m_log[LogTypes::IOS] = {"IOS", "IOS"};
m_log[LogTypes::IOS_DI] = {"IOS_DI", "IOS - Drive Interface"};
m_log[LogTypes::IOS_ES] = {"IOS_ES", "IOS - ETicket Services"};
m_log[LogTypes::IOS_FILEIO] = {"IOS_FILEIO", "IOS - FileIO"};
m_log[LogTypes::IOS_FS] = {"IOS_FS", "IOS - Filesystem Services"};
m_log[LogTypes::IOS_SD] = {"IOS_SD", "IOS - SDIO"};
m_log[LogTypes::IOS_SSL] = {"IOS_SSL", "IOS - SSL"};
Expand Down
58 changes: 28 additions & 30 deletions Source/Core/Core/IOS/FS/HostBackend/FS.cpp
Expand Up @@ -173,7 +173,7 @@ ResultCode HostFileSystem::CreateFile(Uid, Gid, const std::string& path, FileAtt
// check if the file already exist
if (File::Exists(Filename))
{
INFO_LOG(IOS_FILEIO, "\tresult = FS_EEXIST");
INFO_LOG(IOS_FS, "\tresult = FS_EEXIST");
return ResultCode::AlreadyExists;
}

Expand All @@ -182,12 +182,12 @@ ResultCode HostFileSystem::CreateFile(Uid, Gid, const std::string& path, FileAtt
bool Result = File::CreateEmptyFile(Filename);
if (!Result)
{
ERROR_LOG(IOS_FILEIO, "FS: couldn't create new file");
ERROR_LOG(IOS_FS, "FS: couldn't create new file");
PanicAlert("FS: couldn't create new file");
return ResultCode::Invalid;
}

INFO_LOG(IOS_FILEIO, "\tresult = IPC_SUCCESS");
INFO_LOG(IOS_FS, "\tresult = IPC_SUCCESS");
return ResultCode::Success;
}

Expand All @@ -197,16 +197,15 @@ ResultCode HostFileSystem::CreateDirectory(Uid, Gid, const std::string& path,
{
if (!IsValidWiiPath(path))
{
WARN_LOG(IOS_FILEIO, "Not a valid path: %s", path.c_str());
WARN_LOG(IOS_FS, "Not a valid path: %s", path.c_str());
return ResultCode::Invalid;
}

std::string DirName(BuildFilename(path));

DirName += "/";
File::CreateFullPath(DirName);
_dbg_assert_msg_(IOS_FILEIO, File::IsDirectory(DirName), "FS: CREATE_DIR %s failed",
DirName.c_str());
_dbg_assert_msg_(IOS_FS, File::IsDirectory(DirName), "FS: CREATE_DIR %s failed", DirName.c_str());

return ResultCode::Success;
}
Expand All @@ -215,22 +214,22 @@ ResultCode HostFileSystem::Delete(Uid, Gid, const std::string& path)
{
if (!IsValidWiiPath(path))
{
WARN_LOG(IOS_FILEIO, "Not a valid path: %s", path.c_str());
WARN_LOG(IOS_FS, "Not a valid path: %s", path.c_str());
return ResultCode::Invalid;
}

std::string Filename = BuildFilename(path);
if (File::Delete(Filename))
{
INFO_LOG(IOS_FILEIO, "FS: DeleteFile %s", Filename.c_str());
INFO_LOG(IOS_FS, "FS: DeleteFile %s", Filename.c_str());
}
else if (File::DeleteDirRecursively(Filename))
{
INFO_LOG(IOS_FILEIO, "FS: DeleteDir %s", Filename.c_str());
INFO_LOG(IOS_FS, "FS: DeleteDir %s", Filename.c_str());
}
else
{
WARN_LOG(IOS_FILEIO, "FS: DeleteFile %s - failed!!!", Filename.c_str());
WARN_LOG(IOS_FS, "FS: DeleteFile %s - failed!!!", Filename.c_str());
}

return ResultCode::Success;
Expand All @@ -241,14 +240,14 @@ ResultCode HostFileSystem::Rename(Uid, Gid, const std::string& old_path,
{
if (!IsValidWiiPath(old_path))
{
WARN_LOG(IOS_FILEIO, "Not a valid path: %s", old_path.c_str());
WARN_LOG(IOS_FS, "Not a valid path: %s", old_path.c_str());
return ResultCode::Invalid;
}
std::string Filename = BuildFilename(old_path);

if (!IsValidWiiPath(new_path))
{
WARN_LOG(IOS_FILEIO, "Not a valid path: %s", new_path.c_str());
WARN_LOG(IOS_FS, "Not a valid path: %s", new_path.c_str());
return ResultCode::Invalid;
}

Expand All @@ -266,11 +265,11 @@ ResultCode HostFileSystem::Rename(Uid, Gid, const std::string& old_path,
// finally try to rename the file
if (File::Rename(Filename, FilenameRename))
{
INFO_LOG(IOS_FILEIO, "FS: Rename %s to %s", Filename.c_str(), FilenameRename.c_str());
INFO_LOG(IOS_FS, "FS: Rename %s to %s", Filename.c_str(), FilenameRename.c_str());
}
else
{
ERROR_LOG(IOS_FILEIO, "FS: Rename %s to %s - failed", Filename.c_str(), FilenameRename.c_str());
ERROR_LOG(IOS_FS, "FS: Rename %s to %s - failed", Filename.c_str(), FilenameRename.c_str());
return ResultCode::NotFound;
}

Expand All @@ -281,20 +280,20 @@ Result<std::vector<std::string>> HostFileSystem::ReadDirectory(Uid, Gid, const s
{
if (!IsValidWiiPath(path))
{
WARN_LOG(IOS_FILEIO, "Not a valid path: %s", path.c_str());
WARN_LOG(IOS_FS, "Not a valid path: %s", path.c_str());
return ResultCode::Invalid;
}

// the Wii uses this function to define the type (dir or file)
std::string DirName(BuildFilename(path));

INFO_LOG(IOS_FILEIO, "FS: IOCTL_READ_DIR %s", DirName.c_str());
INFO_LOG(IOS_FS, "FS: IOCTL_READ_DIR %s", DirName.c_str());

const File::FileInfo file_info(DirName);

if (!file_info.Exists())
{
WARN_LOG(IOS_FILEIO, "FS: Search not found: %s", DirName.c_str());
WARN_LOG(IOS_FS, "FS: Search not found: %s", DirName.c_str());
return ResultCode::NotFound;
}

Expand All @@ -303,7 +302,7 @@ Result<std::vector<std::string>> HostFileSystem::ReadDirectory(Uid, Gid, const s
// It's not a directory, so error.
// Games don't usually seem to care WHICH error they get, as long as it's <
// Well the system menu CARES!
WARN_LOG(IOS_FILEIO, "\tNot a directory - return FS_EINVAL");
WARN_LOG(IOS_FS, "\tNot a directory - return FS_EINVAL");
return ResultCode::Invalid;
}

Expand All @@ -327,7 +326,7 @@ Result<std::vector<std::string>> HostFileSystem::ReadDirectory(Uid, Gid, const s
for (File::FSTEntry& child : entry.children)
{
output.emplace_back(child.virtualName);
INFO_LOG(IOS_FILEIO, "\tFound: %s", child.virtualName.c_str());
INFO_LOG(IOS_FS, "\tFound: %s", child.virtualName.c_str());
}
return output;
}
Expand All @@ -340,7 +339,7 @@ Result<Metadata> HostFileSystem::GetMetadata(Uid, Gid, const std::string& path)

if (!IsValidWiiPath(path))
{
WARN_LOG(IOS_FILEIO, "Not a valid path: %s", path.c_str());
WARN_LOG(IOS_FS, "Not a valid path: %s", path.c_str());
return ResultCode::Invalid;
}

Expand All @@ -366,18 +365,17 @@ Result<Metadata> HostFileSystem::GetMetadata(Uid, Gid, const std::string& path)

if (info.IsDirectory())
{
INFO_LOG(IOS_FILEIO, "FS: GET_ATTR Directory %s - all permission flags are set",
Filename.c_str());
INFO_LOG(IOS_FS, "FS: GET_ATTR Directory %s - all permission flags are set", Filename.c_str());
}
else
{
if (info.Exists())
{
INFO_LOG(IOS_FILEIO, "FS: GET_ATTR %s - all permission flags are set", Filename.c_str());
INFO_LOG(IOS_FS, "FS: GET_ATTR %s - all permission flags are set", Filename.c_str());
}
else
{
INFO_LOG(IOS_FILEIO, "FS: GET_ATTR unknown %s", Filename.c_str());
INFO_LOG(IOS_FS, "FS: GET_ATTR unknown %s", Filename.c_str());
return ResultCode::NotFound;
}
}
Expand All @@ -401,15 +399,15 @@ ResultCode HostFileSystem::SetMetadata(Uid caller_uid, const std::string& path,
{
if (!IsValidWiiPath(path))
{
WARN_LOG(IOS_FILEIO, "Not a valid path: %s", path.c_str());
WARN_LOG(IOS_FS, "Not a valid path: %s", path.c_str());
return ResultCode::Invalid;
}
return ResultCode::Success;
}

Result<NandStats> HostFileSystem::GetNandStats()
{
WARN_LOG(IOS_FILEIO, "FS: GET STATS - returning static values for now");
WARN_LOG(IOS_FS, "FS: GET STATS - returning static values for now");
NandStats stats{};

// TODO: scrape the real amounts from somewhere...
Expand All @@ -428,15 +426,15 @@ Result<DirectoryStats> HostFileSystem::GetDirectoryStats(const std::string& wii_
{
if (!IsValidWiiPath(wii_path))
{
WARN_LOG(IOS_FILEIO, "Not a valid path: %s", wii_path.c_str());
WARN_LOG(IOS_FS, "Not a valid path: %s", wii_path.c_str());
return ResultCode::Invalid;
}

std::string path(BuildFilename(wii_path));
u32 fsBlocks = 0;
u32 iNodes = 0;

INFO_LOG(IOS_FILEIO, "IOCTL_GETUSAGE %s", path.c_str());
INFO_LOG(IOS_FS, "IOCTL_GETUSAGE %s", path.c_str());
if (File::IsDirectory(path))
{
File::FSTEntry parentDir = File::ScanDirectoryTree(path, true);
Expand All @@ -447,13 +445,13 @@ Result<DirectoryStats> HostFileSystem::GetDirectoryStats(const std::string& wii_

fsBlocks = (u32)(totalSize / (16 * 1024)); // one bock is 16kb

INFO_LOG(IOS_FILEIO, "FS: fsBlock: %i, iNodes: %i", fsBlocks, iNodes);
INFO_LOG(IOS_FS, "FS: fsBlock: %i, iNodes: %i", fsBlocks, iNodes);
}
else
{
fsBlocks = 0;
iNodes = 0;
WARN_LOG(IOS_FILEIO, "FS: fsBlock failed, cannot find directory: %s", path.c_str());
WARN_LOG(IOS_FS, "FS: fsBlock failed, cannot find directory: %s", path.c_str());
}

DirectoryStats stats;
Expand Down
2 changes: 1 addition & 1 deletion Source/Core/Core/IOS/FS/HostBackend/File.cpp
Expand Up @@ -70,7 +70,7 @@ Result<Fd> HostFileSystem::OpenFile(Uid uid, Gid gid, const std::string& path, F
// It should be created by ISFS_CreateFile, not here
if (!File::IsFile(host_path))
{
WARN_LOG(IOS_FILEIO, "FileIO: Open (%s) failed - File doesn't exist %s", Modes[u8(mode)],
WARN_LOG(IOS_FS, "FileIO: Open (%s) failed - File doesn't exist %s", Modes[u8(mode)],
host_path.c_str());
return ResultCode::NotFound;
}
Expand Down
5 changes: 2 additions & 3 deletions Source/Core/Core/WiiRoot.cpp
Expand Up @@ -57,12 +57,11 @@ void InitializeWiiRoot(bool use_temporary)
s_temp_wii_root = File::CreateTempDir();
if (s_temp_wii_root.empty())
{
ERROR_LOG(IOS_FILEIO, "Could not create temporary directory");
ERROR_LOG(IOS_FS, "Could not create temporary directory");
return;
}
File::CopyDir(File::GetSysDirectory() + WII_USER_DIR, s_temp_wii_root);
WARN_LOG(IOS_FILEIO, "Using temporary directory %s for minimal Wii FS",
s_temp_wii_root.c_str());
WARN_LOG(IOS_FS, "Using temporary directory %s for minimal Wii FS", s_temp_wii_root.c_str());
File::SetUserPath(D_SESSION_WIIROOT_IDX, s_temp_wii_root);
// Generate a SYSCONF with default settings for the temporary Wii NAND.
SysConf sysconf{Common::FromWhichRoot::FROM_SESSION_ROOT};
Expand Down

0 comments on commit ac38814

Please sign in to comment.