forums.ps2dev.org Forum Index forums.ps2dev.org
Homebrew PS2, PSP & PS3 Development Discussions
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Accurate flash0 free space with DEVCTL?

 
Post new topic   Reply to topic    forums.ps2dev.org Forum Index -> PSP Development
View previous topic :: View next topic  
Author Message
Torch



Joined: 28 May 2008
Posts: 842

PostPosted: Tue Jul 01, 2008 11:51 pm    Post subject: Accurate flash0 free space with DEVCTL? Reply with quote

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?
Back to top
View user's profile Send private message
Pirata Nervo



Joined: 09 Oct 2007
Posts: 409

PostPosted: Wed Jul 02, 2008 12:22 am    Post subject: Reply with quote

http://forums.ps2dev.org/viewtopic.php?t=6950&highlight=flash0+free+space

;)
_________________

Upgrade your PSP
Back to top
View user's profile Send private message
Torch



Joined: 28 May 2008
Posts: 842

PostPosted: Wed Jul 02, 2008 1:40 am    Post subject: Reply with quote

That doesn't answer my question.
Back to top
View user's profile Send private message
moonlight



Joined: 26 Oct 2005
Posts: 567

PostPosted: Wed Jul 02, 2008 1:49 am    Post subject: Reply with quote

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) :)
Back to top
View user's profile Send private message
Torch



Joined: 28 May 2008
Posts: 842

PostPosted: Wed Jul 02, 2008 1:53 am    Post subject: Reply with quote

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.
Back to top
View user's profile Send private message
Pirata Nervo



Joined: 09 Oct 2007
Posts: 409

PostPosted: Wed Jul 02, 2008 2:07 am    Post subject: Reply with quote

ooops I didnt read the whole post, sorry xD
_________________

Upgrade your PSP
Back to top
View user's profile Send private message
Torch



Joined: 28 May 2008
Posts: 842

PostPosted: Wed Jul 02, 2008 2:12 am    Post subject: Reply with quote

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);
Back to top
View user's profile Send private message
moonlight



Joined: 26 Oct 2005
Posts: 567

PostPosted: Wed Jul 02, 2008 3:49 am    Post subject: Reply with quote

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.
Back to top
View user's profile Send private message
Torch



Joined: 28 May 2008
Posts: 842

PostPosted: Wed Jul 02, 2008 3:53 am    Post subject: Reply with quote

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.
Back to top
View user's profile Send private message
SilverSpring



Joined: 27 Feb 2007
Posts: 115

PostPosted: Sat Jul 05, 2008 11:31 pm    Post subject: Reply with quote

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.
Back to top
View user's profile Send private message Visit poster's website
Torch



Joined: 28 May 2008
Posts: 842

PostPosted: Sat Jul 05, 2008 11:38 pm    Post subject: Reply with quote

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.
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    forums.ps2dev.org Forum Index -> PSP Development All times are GMT + 10 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group