Skip to content

Commit

Permalink
shm: remove size hack
Browse files Browse the repository at this point in the history
no need to do it anymore
  • Loading branch information
DHrpcs3 committed Oct 22, 2024
1 parent fc12bee commit 662b23b
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 12 deletions.
15 changes: 5 additions & 10 deletions rpcsx/io-device.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,6 @@

struct HostFile : orbis::File {
bool closeOnExit = true;
bool alignTruncate = false;

~HostFile() {
if (hostFd > 0 && closeOnExit) {
Expand Down Expand Up @@ -438,12 +437,10 @@ static orbis::ErrorCode host_truncate(orbis::File *file, std::uint64_t len,
return orbis::ErrorCode::ISDIR;
}

if (hostFile->alignTruncate) {
len = rx::alignUp(len, vm::kPageSize);
}

if (::ftruncate(hostFile->hostFd, len)) {
return convertErrno();
auto result = convertErrno();
ORBIS_LOG_ERROR("host_truncate", hostFile->hostFd, len);
return result;
}

return {};
Expand Down Expand Up @@ -937,13 +934,11 @@ orbis::ErrorCode HostFsDevice::rename(const char *from, const char *to,
return convertErrorCode(ec);
}

orbis::File *createHostFile(int hostFd, orbis::Ref<IoDevice> device,
bool alignTruncate) {
orbis::File *createHostFile(int hostFd, orbis::Ref<IoDevice> device) {
auto newFile = orbis::knew<HostFile>();
newFile->hostFd = hostFd;
newFile->ops = &hostOps;
newFile->device = device;
newFile->alignTruncate = alignTruncate;
newFile->device = std::move(device);
return newFile;
}

Expand Down
2 changes: 1 addition & 1 deletion rpcsx/io-device.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -74,5 +74,5 @@ IoDevice *createHostIoDevice(orbis::kstring hostPath, orbis::kstring virtualPath
orbis::Ref<orbis::File> wrapSocket(int hostFd, orbis::kstring name, int dom, int type, int prot);
orbis::ErrorCode createSocket(orbis::Ref<orbis::File> *file,
orbis::kstring name, int dom, int type, int prot);
orbis::File *createHostFile(int hostFd, orbis::Ref<IoDevice> device, bool alignTruncate = false);
orbis::File *createHostFile(int hostFd, orbis::Ref<IoDevice> device);
IoDevice *createFdWrapDevice(int fd);
2 changes: 1 addition & 1 deletion rpcsx/iodev/shm.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ orbis::ErrorCode ShmDevice::open(orbis::Ref<orbis::File> *file,
return convertErrno();
}

auto hostFile = createHostFile(fd, this, true);
auto hostFile = createHostFile(fd, this);
*file = hostFile;
return {};
}
Expand Down

0 comments on commit 662b23b

Please sign in to comment.