ps2homebrew/pfsshell

Drive File Descriptor : Invalid argument.

Closed this issue · 5 comments

First off, I've checked the file descriptor and it return nonzero.

Seems that read() and write() needs buffer sizes/count of 512 like so for it to succeed else it returns an invalid argument error.

Also lseek() allows seeking to non block sized offsets but it makes read() and write() return with invalid argument.

Removing lseek continued pfsshell on my chosen hard drive. Then I executed an initialize command afterwards. It was partially successful, as it only made the __mbr partition.

image

Hope this sheds some light on the situation.

Removing lseek makes the hdd_length zero so that explains the no space left error.

Thanks for the information. I may take a look into it at a later date.

Hmm, that's a lot like the bug that kept it from getting the correct device size on macOS. I wonder if the ioctl code would work there?

Updated the post.

Using lseek, read and write only needs sizes/offset of 512, no alignment needed, sorry about that.

Also from how it looks like we really do have to use platform specific API when it comes to getting the hard drive info at least.

lseek works now but it doesn't return zero when it goes past the size of the drive, and just continues. I am not sure why its doing that.

Checked against the old pfsshell v0.2a.
We were having an integer overflow all this time.

Made a pull request fixing this for Windows, while keeping it POSIX ;)

Link to pull request