[PR #2554] [MERGED] libkernel: Filesystem code cleanup #2818

Closed
opened 2026-02-27 22:01:22 +03:00 by kerem · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/shadps4-emu/shadPS4/pull/2554
Author: @StevenMiller123
Created: 2/27/2025
Status: Merged
Merged: 3/26/2025
Merged by: @georgemoralis

Base: mainHead: fs-cleanup


📝 Commits (10+)

📊 Changes

5 files changed (+537 additions, -302 deletions)

View changed files

📝 src/common/io_file.cpp (+4 -1)
📝 src/common/io_file.h (+2 -0)
📝 src/core/libraries/kernel/file_system.cpp (+515 -281)
📝 src/core/libraries/kernel/file_system.h (+4 -4)
📝 src/core/libraries/kernel/kernel.cpp (+12 -16)

📄 Description

This PR reorganizes our libkernel filesystem code to better align with our current coding standards, the actual FreeBSD documentation, and observations I've made while decompiling libkernel.

What this does:

  • Moves all function code from sceKernel functions to the lowest-level export (to match libkernel behavior, and similar changes made in other areas of our libkernel HLE).
  • Fixes a variety of type-casting related errors visible in posix function variants.
  • Fixes several inaccurate error returns, using FreeBSD documentation as reference.
  • Properly convert OS-specific errnos where appropriate.
  • Fixes parameters on the open function (based on libkernel decompilation, seems to work fine in libSceLibcInternal LLE)
  • Cleans up flag handling in open-related functions, using FreeBSD documentation as reference.
  • Add exports for posix_pread and posix_pwrite
  • Fix exports for open and posix_open
  • Rename _writev and _readv to writev and readv to align with other similarly named filesystem functions.

Given the number of changes here, this should probably get thoroughly tested before any merging.


🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/shadps4-emu/shadPS4/pull/2554 **Author:** [@StevenMiller123](https://github.com/StevenMiller123) **Created:** 2/27/2025 **Status:** ✅ Merged **Merged:** 3/26/2025 **Merged by:** [@georgemoralis](https://github.com/georgemoralis) **Base:** `main` ← **Head:** `fs-cleanup` --- ### 📝 Commits (10+) - [`e29e3f1`](https://github.com/shadps4-emu/shadPS4/commit/e29e3f1985c7e79911dec2266d2f2d75e9faa412) sceKernelOpen: Clean up flag handling - [`8b2ec07`](https://github.com/shadps4-emu/shadPS4/commit/8b2ec07154b63e9a2ef1e8ade29e4aa1b1b29f0e) sceKernelOpen: fix params - [`3a68341`](https://github.com/shadps4-emu/shadPS4/commit/3a6834113e49b92966f93d9edfeb8fd6527dcfe0) sceKernelOpen: Fix errors - [`9db2f6e`](https://github.com/shadps4-emu/shadPS4/commit/9db2f6eccb6c03338d5d4d00357bc55157b0554c) Fix exports - [`84c3bdb`](https://github.com/shadps4-emu/shadPS4/commit/84c3bdb140794ec85409daeaf9c972bb6482e4fc) Proper errno behavior on open - [`281a07e`](https://github.com/shadps4-emu/shadPS4/commit/281a07e91136ceefbea844c1d25e7e9c09d103f0) Reorganize open calls, add error log - [`fb8883d`](https://github.com/shadps4-emu/shadPS4/commit/fb8883dcea047a5dd878bc1d0350d6436fef3d67) Improve close - [`4a4589a`](https://github.com/shadps4-emu/shadPS4/commit/4a4589a1e98a4cac3f90d3d935d71e904cfb9e85) Fix log on close - [`671cbfb`](https://github.com/shadps4-emu/shadPS4/commit/671cbfbbd079536db05dfe9ddb72bc96ce4670da) posix_open fixups - [`55790e3`](https://github.com/shadps4-emu/shadPS4/commit/55790e37e858534c2006d36bcc77a21f4b161530) Readd hack in posix_close ### 📊 Changes **5 files changed** (+537 additions, -302 deletions) <details> <summary>View changed files</summary> 📝 `src/common/io_file.cpp` (+4 -1) 📝 `src/common/io_file.h` (+2 -0) 📝 `src/core/libraries/kernel/file_system.cpp` (+515 -281) 📝 `src/core/libraries/kernel/file_system.h` (+4 -4) 📝 `src/core/libraries/kernel/kernel.cpp` (+12 -16) </details> ### 📄 Description This PR reorganizes our libkernel filesystem code to better align with our current coding standards, the actual FreeBSD documentation, and observations I've made while decompiling libkernel. What this does: - Moves all function code from `sceKernel` functions to the lowest-level export (to match libkernel behavior, and similar changes made in other areas of our libkernel HLE). - Fixes a variety of type-casting related errors visible in `posix` function variants. - Fixes several inaccurate error returns, using FreeBSD documentation as reference. - Properly convert OS-specific errnos where appropriate. - Fixes parameters on the `open` function (based on libkernel decompilation, seems to work fine in libSceLibcInternal LLE) - Cleans up flag handling in open-related functions, using FreeBSD documentation as reference. - Add exports for `posix_pread` and `posix_pwrite` - Fix exports for `open` and `posix_open` - Rename `_writev` and `_readv` to `writev` and `readv` to align with other similarly named filesystem functions. Given the number of changes here, this should probably get thoroughly tested before any merging. --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
kerem 2026-02-27 22:01:22 +03:00
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
starred/shadPS4#2818
No description provided.