Accurate flash0 free space with DEVCTL?

Discuss the development of new homebrew software, tools and libraries.

Moderators: cheriff, TyRaNiD

Post Reply
User avatar
Torch
Posts: 825
Joined: Wed May 28, 2008 2:50 am

Accurate flash0 free space with DEVCTL?

Post by Torch »

I've searched and am unable to find any way to determine flash0 free space.
The Memory Stick Devctl command obviously won't because the command is different.
SilverSpring wrote:Just like the MS drivers, both the lflash block driver and lfat filesystem driver provide devctl commands to determine free space, in terms of both free sector space of the flash partitions (via the lflash IO driver) as well as free cluster space of the FAT filesystem (via the lfat IO driver).
Anyone know how to do the above?
Pirata Nervo
Posts: 409
Joined: Tue Oct 09, 2007 4:22 am

Post by Pirata Nervo »

Image
Upgrade your PSP
User avatar
Torch
Posts: 825
Joined: Wed May 28, 2008 2:50 am

Post by Torch »

That doesn't answer my question.
moonlight
Posts: 567
Joined: Wed Oct 26, 2005 7:46 pm

Post by moonlight »

I have worked in a flashfat emulator (the timemachine) and I don't remember to have seen any command to calculate free space.
I would learn a bit about fat filesystem, and calculate the free space myself reading the raw lflash0:0,0 device, basically free_clusters * sizeof(cluster) :)
User avatar
Torch
Posts: 825
Joined: Wed May 28, 2008 2:50 am

Post by Torch »

moonlight wrote:I have worked in a flashfat emulator (the timemachine) and I don't remember to have seen any command to calculate free space.
I would learn a bit about fat filesystem, and calculate the free space myself reading the raw lflash0:0,0 device, basically free_clusters * sizeof(cluster) :)
EDIT:
So how do I read from the device? I can do the file system work with some googling. I don't know how to use the functions to read the device.
Pirata Nervo
Posts: 409
Joined: Tue Oct 09, 2007 4:22 am

Post by Pirata Nervo »

ooops I didnt read the whole post, sorry xD
Image
Upgrade your PSP
User avatar
Torch
Posts: 825
Joined: Wed May 28, 2008 2:50 am

Post by Torch »

I've seen this been used to dump the entire NAND
fd = sceIoOpen("lflash:",PSP_O_RDONLY,0);

But since I need only the flash0 partition I presume it will work if I use
fd = sceIoOpen("lflash0:0,0",PSP_O_RDONLY,0);
moonlight
Posts: 567
Joined: Wed Oct 26, 2005 7:46 pm

Post by moonlight »

Torch wrote:I've seen this been used to dump the entire NAND
fd = sceIoOpen("lflash:",PSP_O_RDONLY,0);

But since I need only the flash0 partition I presume it will work if I use
fd = sceIoOpen("lflash0:0,0",PSP_O_RDONLY,0);
yeah that should be fine. remember to read always in multiples of 512, otherwise you may get an error.
User avatar
Torch
Posts: 825
Joined: Wed May 28, 2008 2:50 am

Post by Torch »

I'm reading about the filesystem right now.
But what about the devctl commands that SilverSpring mentioned. If it can directly get the number of free sectors in a partition it will save a lot of work.
SilverSpring
Posts: 110
Joined: Tue Feb 27, 2007 9:43 pm
Contact:

Post by SilverSpring »

Sorry I didn't get it to work since I do not know exactly the params it returns. It's not free clusters directly but several values from which to calculate from.

Also I was mistaken, only the devctl from the filesystem driver exists not from the logical block driver.
User avatar
Torch
Posts: 825
Joined: Wed May 28, 2008 2:50 am

Post by Torch »

SilverSpring wrote:Also I was mistaken, only the devctl from the filesystem driver exists not from the logical block driver.
It doesn't matter, because calculating free space from the sectors is more trouble than its worth and will probably be erroneous. Only cluster space is practical.

Calculating clusters from the FAT appears to be a trivial task anyway.
Post Reply