summaryrefslogtreecommitdiff
path: root/src/core/file_sys
diff options
context:
space:
mode:
authorGravatar bunnei2014-04-22 19:42:29 -0700
committerGravatar bunnei2014-04-22 19:42:29 -0700
commit7a136b8a84f9b21e120efe734f86725c46b8531b (patch)
tree23102d673fb6ab5a84e033d4360654d459fc41eb /src/core/file_sys
parentremoved duplicate rotl/rotr functions (diff)
downloadyuzu-7a136b8a84f9b21e120efe734f86725c46b8531b.tar.gz
yuzu-7a136b8a84f9b21e120efe734f86725c46b8531b.tar.xz
yuzu-7a136b8a84f9b21e120efe734f86725c46b8531b.zip
fixes to build on linux
Diffstat (limited to 'src/core/file_sys')
-rw-r--r--src/core/file_sys/meta_file_system.cpp42
-rw-r--r--src/core/file_sys/meta_file_system.h2
2 files changed, 22 insertions, 22 deletions
diff --git a/src/core/file_sys/meta_file_system.cpp b/src/core/file_sys/meta_file_system.cpp
index 01048e498..4347ff451 100644
--- a/src/core/file_sys/meta_file_system.cpp
+++ b/src/core/file_sys/meta_file_system.cpp
@@ -161,7 +161,7 @@ static bool RealPath(const std::string &currentDirectory, const std::string &inP
161 161
162IFileSystem *MetaFileSystem::GetHandleOwner(u32 handle) 162IFileSystem *MetaFileSystem::GetHandleOwner(u32 handle)
163{ 163{
164 std::lock_guard<std::mutex> guard(lock); 164 std::lock_guard<std::recursive_mutex> guard(lock);
165 for (size_t i = 0; i < fileSystems.size(); i++) 165 for (size_t i = 0; i < fileSystems.size(); i++)
166 { 166 {
167 if (fileSystems[i].system->OwnsHandle(handle)) 167 if (fileSystems[i].system->OwnsHandle(handle))
@@ -173,7 +173,7 @@ IFileSystem *MetaFileSystem::GetHandleOwner(u32 handle)
173 173
174bool MetaFileSystem::MapFilePath(const std::string &_inpath, std::string &outpath, MountPoint **system) 174bool MetaFileSystem::MapFilePath(const std::string &_inpath, std::string &outpath, MountPoint **system)
175{ 175{
176 std::lock_guard<std::mutex> guard(lock); 176 std::lock_guard<std::recursive_mutex> guard(lock);
177 std::string realpath; 177 std::string realpath;
178 178
179 // Special handling: host0:command.txt (as seen in Super Monkey Ball Adventures, for example) 179 // Special handling: host0:command.txt (as seen in Super Monkey Ball Adventures, for example)
@@ -227,7 +227,7 @@ bool MetaFileSystem::MapFilePath(const std::string &_inpath, std::string &outpat
227 227
228void MetaFileSystem::Mount(std::string prefix, IFileSystem *system) 228void MetaFileSystem::Mount(std::string prefix, IFileSystem *system)
229{ 229{
230 std::lock_guard<std::mutex> guard(lock); 230 std::lock_guard<std::recursive_mutex> guard(lock);
231 MountPoint x; 231 MountPoint x;
232 x.prefix = prefix; 232 x.prefix = prefix;
233 x.system = system; 233 x.system = system;
@@ -236,7 +236,7 @@ void MetaFileSystem::Mount(std::string prefix, IFileSystem *system)
236 236
237void MetaFileSystem::Unmount(std::string prefix, IFileSystem *system) 237void MetaFileSystem::Unmount(std::string prefix, IFileSystem *system)
238{ 238{
239 std::lock_guard<std::mutex> guard(lock); 239 std::lock_guard<std::recursive_mutex> guard(lock);
240 MountPoint x; 240 MountPoint x;
241 x.prefix = prefix; 241 x.prefix = prefix;
242 x.system = system; 242 x.system = system;
@@ -245,7 +245,7 @@ void MetaFileSystem::Unmount(std::string prefix, IFileSystem *system)
245 245
246void MetaFileSystem::Shutdown() 246void MetaFileSystem::Shutdown()
247{ 247{
248 std::lock_guard<std::mutex> guard(lock); 248 std::lock_guard<std::recursive_mutex> guard(lock);
249 current = 6; 249 current = 6;
250 250
251 // Ownership is a bit convoluted. Let's just delete everything once. 251 // Ownership is a bit convoluted. Let's just delete everything once.
@@ -267,7 +267,7 @@ void MetaFileSystem::Shutdown()
267 267
268u32 MetaFileSystem::OpenWithError(int &error, std::string filename, FileAccess access, const char *devicename) 268u32 MetaFileSystem::OpenWithError(int &error, std::string filename, FileAccess access, const char *devicename)
269{ 269{
270 std::lock_guard<std::mutex> guard(lock); 270 std::lock_guard<std::recursive_mutex> guard(lock);
271 u32 h = OpenFile(filename, access, devicename); 271 u32 h = OpenFile(filename, access, devicename);
272 error = lastOpenError; 272 error = lastOpenError;
273 return h; 273 return h;
@@ -275,7 +275,7 @@ u32 MetaFileSystem::OpenWithError(int &error, std::string filename, FileAccess a
275 275
276u32 MetaFileSystem::OpenFile(std::string filename, FileAccess access, const char *devicename) 276u32 MetaFileSystem::OpenFile(std::string filename, FileAccess access, const char *devicename)
277{ 277{
278 std::lock_guard<std::mutex> guard(lock); 278 std::lock_guard<std::recursive_mutex> guard(lock);
279 lastOpenError = 0; 279 lastOpenError = 0;
280 std::string of; 280 std::string of;
281 MountPoint *mount; 281 MountPoint *mount;
@@ -291,7 +291,7 @@ u32 MetaFileSystem::OpenFile(std::string filename, FileAccess access, const char
291 291
292FileInfo MetaFileSystem::GetFileInfo(std::string filename) 292FileInfo MetaFileSystem::GetFileInfo(std::string filename)
293{ 293{
294 std::lock_guard<std::mutex> guard(lock); 294 std::lock_guard<std::recursive_mutex> guard(lock);
295 std::string of; 295 std::string of;
296 IFileSystem *system; 296 IFileSystem *system;
297 if (MapFilePath(filename, of, &system)) 297 if (MapFilePath(filename, of, &system))
@@ -307,7 +307,7 @@ FileInfo MetaFileSystem::GetFileInfo(std::string filename)
307 307
308bool MetaFileSystem::GetHostPath(const std::string &inpath, std::string &outpath) 308bool MetaFileSystem::GetHostPath(const std::string &inpath, std::string &outpath)
309{ 309{
310 std::lock_guard<std::mutex> guard(lock); 310 std::lock_guard<std::recursive_mutex> guard(lock);
311 std::string of; 311 std::string of;
312 IFileSystem *system; 312 IFileSystem *system;
313 if (MapFilePath(inpath, of, &system)) { 313 if (MapFilePath(inpath, of, &system)) {
@@ -319,7 +319,7 @@ bool MetaFileSystem::GetHostPath(const std::string &inpath, std::string &outpath
319 319
320std::vector<FileInfo> MetaFileSystem::GetDirListing(std::string path) 320std::vector<FileInfo> MetaFileSystem::GetDirListing(std::string path)
321{ 321{
322 std::lock_guard<std::mutex> guard(lock); 322 std::lock_guard<std::recursive_mutex> guard(lock);
323 std::string of; 323 std::string of;
324 IFileSystem *system; 324 IFileSystem *system;
325 if (MapFilePath(path, of, &system)) 325 if (MapFilePath(path, of, &system))
@@ -335,13 +335,13 @@ std::vector<FileInfo> MetaFileSystem::GetDirListing(std::string path)
335 335
336void MetaFileSystem::ThreadEnded(int threadID) 336void MetaFileSystem::ThreadEnded(int threadID)
337{ 337{
338 std::lock_guard<std::mutex> guard(lock); 338 std::lock_guard<std::recursive_mutex> guard(lock);
339 currentDir.erase(threadID); 339 currentDir.erase(threadID);
340} 340}
341 341
342int MetaFileSystem::ChDir(const std::string &dir) 342int MetaFileSystem::ChDir(const std::string &dir)
343{ 343{
344 std::lock_guard<std::mutex> guard(lock); 344 std::lock_guard<std::recursive_mutex> guard(lock);
345 // Retain the old path and fail if the arg is 1023 bytes or longer. 345 // Retain the old path and fail if the arg is 1023 bytes or longer.
346 if (dir.size() >= 1023) 346 if (dir.size() >= 1023)
347 return -1;//SCE_KERNEL_ERROR_NAMETOOLONG; 347 return -1;//SCE_KERNEL_ERROR_NAMETOOLONG;
@@ -378,7 +378,7 @@ int MetaFileSystem::ChDir(const std::string &dir)
378 378
379bool MetaFileSystem::MkDir(const std::string &dirname) 379bool MetaFileSystem::MkDir(const std::string &dirname)
380{ 380{
381 std::lock_guard<std::mutex> guard(lock); 381 std::lock_guard<std::recursive_mutex> guard(lock);
382 std::string of; 382 std::string of;
383 IFileSystem *system; 383 IFileSystem *system;
384 if (MapFilePath(dirname, of, &system)) 384 if (MapFilePath(dirname, of, &system))
@@ -393,7 +393,7 @@ bool MetaFileSystem::MkDir(const std::string &dirname)
393 393
394bool MetaFileSystem::RmDir(const std::string &dirname) 394bool MetaFileSystem::RmDir(const std::string &dirname)
395{ 395{
396 std::lock_guard<std::mutex> guard(lock); 396 std::lock_guard<std::recursive_mutex> guard(lock);
397 std::string of; 397 std::string of;
398 IFileSystem *system; 398 IFileSystem *system;
399 if (MapFilePath(dirname, of, &system)) 399 if (MapFilePath(dirname, of, &system))
@@ -408,7 +408,7 @@ bool MetaFileSystem::RmDir(const std::string &dirname)
408 408
409int MetaFileSystem::RenameFile(const std::string &from, const std::string &to) 409int MetaFileSystem::RenameFile(const std::string &from, const std::string &to)
410{ 410{
411 std::lock_guard<std::mutex> guard(lock); 411 std::lock_guard<std::recursive_mutex> guard(lock);
412 std::string of; 412 std::string of;
413 std::string rf; 413 std::string rf;
414 IFileSystem *osystem; 414 IFileSystem *osystem;
@@ -440,7 +440,7 @@ int MetaFileSystem::RenameFile(const std::string &from, const std::string &to)
440 440
441bool MetaFileSystem::RemoveFile(const std::string &filename) 441bool MetaFileSystem::RemoveFile(const std::string &filename)
442{ 442{
443 std::lock_guard<std::mutex> guard(lock); 443 std::lock_guard<std::recursive_mutex> guard(lock);
444 std::string of; 444 std::string of;
445 IFileSystem *system; 445 IFileSystem *system;
446 if (MapFilePath(filename, of, &system)) 446 if (MapFilePath(filename, of, &system))
@@ -455,7 +455,7 @@ bool MetaFileSystem::RemoveFile(const std::string &filename)
455 455
456void MetaFileSystem::CloseFile(u32 handle) 456void MetaFileSystem::CloseFile(u32 handle)
457{ 457{
458 std::lock_guard<std::mutex> guard(lock); 458 std::lock_guard<std::recursive_mutex> guard(lock);
459 IFileSystem *sys = GetHandleOwner(handle); 459 IFileSystem *sys = GetHandleOwner(handle);
460 if (sys) 460 if (sys)
461 sys->CloseFile(handle); 461 sys->CloseFile(handle);
@@ -463,7 +463,7 @@ void MetaFileSystem::CloseFile(u32 handle)
463 463
464size_t MetaFileSystem::ReadFile(u32 handle, u8 *pointer, s64 size) 464size_t MetaFileSystem::ReadFile(u32 handle, u8 *pointer, s64 size)
465{ 465{
466 std::lock_guard<std::mutex> guard(lock); 466 std::lock_guard<std::recursive_mutex> guard(lock);
467 IFileSystem *sys = GetHandleOwner(handle); 467 IFileSystem *sys = GetHandleOwner(handle);
468 if (sys) 468 if (sys)
469 return sys->ReadFile(handle,pointer,size); 469 return sys->ReadFile(handle,pointer,size);
@@ -473,7 +473,7 @@ size_t MetaFileSystem::ReadFile(u32 handle, u8 *pointer, s64 size)
473 473
474size_t MetaFileSystem::WriteFile(u32 handle, const u8 *pointer, s64 size) 474size_t MetaFileSystem::WriteFile(u32 handle, const u8 *pointer, s64 size)
475{ 475{
476 std::lock_guard<std::mutex> guard(lock); 476 std::lock_guard<std::recursive_mutex> guard(lock);
477 IFileSystem *sys = GetHandleOwner(handle); 477 IFileSystem *sys = GetHandleOwner(handle);
478 if (sys) 478 if (sys)
479 return sys->WriteFile(handle,pointer,size); 479 return sys->WriteFile(handle,pointer,size);
@@ -483,7 +483,7 @@ size_t MetaFileSystem::WriteFile(u32 handle, const u8 *pointer, s64 size)
483 483
484size_t MetaFileSystem::SeekFile(u32 handle, s32 position, FileMove type) 484size_t MetaFileSystem::SeekFile(u32 handle, s32 position, FileMove type)
485{ 485{
486 std::lock_guard<std::mutex> guard(lock); 486 std::lock_guard<std::recursive_mutex> guard(lock);
487 IFileSystem *sys = GetHandleOwner(handle); 487 IFileSystem *sys = GetHandleOwner(handle);
488 if (sys) 488 if (sys)
489 return sys->SeekFile(handle,position,type); 489 return sys->SeekFile(handle,position,type);
@@ -493,7 +493,7 @@ size_t MetaFileSystem::SeekFile(u32 handle, s32 position, FileMove type)
493 493
494void MetaFileSystem::DoState(PointerWrap &p) 494void MetaFileSystem::DoState(PointerWrap &p)
495{ 495{
496 std::lock_guard<std::mutex> guard(lock); 496 std::lock_guard<std::recursive_mutex> guard(lock);
497 497
498 auto s = p.Section("MetaFileSystem", 1); 498 auto s = p.Section("MetaFileSystem", 1);
499 if (!s) 499 if (!s)
diff --git a/src/core/file_sys/meta_file_system.h b/src/core/file_sys/meta_file_system.h
index 961f75cda..f358d8d5c 100644
--- a/src/core/file_sys/meta_file_system.h
+++ b/src/core/file_sys/meta_file_system.h
@@ -104,7 +104,7 @@ public:
104 // TODO: void IoCtl(...) 104 // TODO: void IoCtl(...)
105 105
106 void SetStartingDirectory(const std::string &dir) { 106 void SetStartingDirectory(const std::string &dir) {
107 std::lock_guard<std::mutex> guard(lock); 107 std::lock_guard<std::recursive_mutex> guard(lock);
108 startingDirectory = dir; 108 startingDirectory = dir;
109 } 109 }
110}; 110};