MCPcopy Create free account
hub / github.com/RPCSX/rpcsx / open_raw

Method open_raw

kernel/cellos/src/sys_fs.cpp:733–938  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

731}
732
733lv2_file::open_raw_result_t lv2_file::open_raw(const std::string &local_path,
734 s32 flags, s32 /*mode*/,
735 lv2_file_type type,
736 const lv2_fs_mount_info &mp) {
737 // TODO: other checks for path
738
739 if (fs::is_dir(local_path)) {
740 return {CELL_EISDIR};
741 }
742
743 rx::EnumBitSet<fs::open_mode> open_mode{};
744
745 switch (flags & CELL_FS_O_ACCMODE) {
746 case CELL_FS_O_RDONLY:
747 open_mode += fs::read;
748 break;
749 case CELL_FS_O_WRONLY:
750 open_mode += fs::write;
751 break;
752 case CELL_FS_O_RDWR:
753 open_mode += fs::read + fs::write;
754 break;
755 default:
756 break;
757 }
758
759 if (mp.read_only) {
760 if ((flags & CELL_FS_O_ACCMODE) != CELL_FS_O_RDONLY &&
761 fs::is_file(local_path)) {
762 return {CELL_EPERM};
763 }
764 }
765
766 if (flags & CELL_FS_O_CREAT) {
767 open_mode += fs::create;
768
769 if (flags & CELL_FS_O_EXCL) {
770 open_mode += fs::excl;
771 }
772 }
773
774 if (flags & CELL_FS_O_TRUNC) {
775 open_mode += fs::trunc;
776 }
777
778 if (flags & CELL_FS_O_MSELF) {
779 open_mode = fs::read;
780 // mself can be mself or mself | rdonly
781 if (flags & ~(CELL_FS_O_MSELF | CELL_FS_O_RDONLY)) {
782 open_mode = {};
783 }
784 }
785
786 if (flags & CELL_FS_O_UNK) {
787 sys_fs.warning(
788 "lv2_file::open() called with CELL_FS_O_UNK flag enabled. FLAGS: %#o",
789 flags);
790 }

Callers

nothing calls this directly

Calls 10

throw_exceptionClass · 0.85
verify_mselfFunction · 0.85
emplace_backMethod · 0.80
errorMethod · 0.80
ReadHeaderMethod · 0.80
formatEnum · 0.50
emptyMethod · 0.45
seekMethod · 0.45
resetMethod · 0.45
loadMethod · 0.45

Tested by

no test coverage detected