Skip to content

Commit

Permalink
Merge pull request #1487 from Sonicadvance1/rootfs_stop_trying_so_hard
Browse files Browse the repository at this point in the history
RootFS: Stop trying to retry rootfs after five times
  • Loading branch information
lioncash authored Jan 1, 2022
2 parents 0808599 + 9f8071c commit a45bc75
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 3 deletions.
9 changes: 7 additions & 2 deletions Source/Common/RootFSSetup.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -358,18 +358,23 @@ ErrorResult SetupSquashFS(char **const envp) {
return ErrorResult::ERROR_SUCCESS;
}

bool Setup(char **const envp) {
bool Setup(char **const envp, uint32_t TryCount) {
// We need to setup the rootfs here
// If the configuration is set to use a folder then there is nothing to do
// If it is setup to use a squashfs then we need to do something more complex

if (TryCount > 5) {
// Fail if we have retried too many times
return false;
}

// Nothing to do
auto Result = SetupSquashFS(envp);
if (Result == ErrorResult::ERROR_FAIL) {
return false;
}
else if (Result == ErrorResult::ERROR_TRYAGAIN) {
return Setup(envp);
return Setup(envp, TryCount + 1);
}

// ERROR_SUCCESS
Expand Down
2 changes: 1 addition & 1 deletion Source/Common/RootFSSetup.h
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,6 @@ namespace FEX::RootFS {
std::string GetRootFSSocketFile(std::string const &MountPath);
// Checks if the rootfs lock exists
bool CheckLockExists(std::string const &LockPath, std::string *MountPath = nullptr);
bool Setup(char **const envp);
bool Setup(char **const envp, uint32_t TryCount = 0);
void Shutdown();
}

0 comments on commit a45bc75

Please sign in to comment.