fsrw
Dave Hein
Posts: 6,347
I have been working with fsrw 2.6, and it has been working nicely.· There are a few things that I would like to do with it, but it doesn't seem to support· some of the functions I would like to do.
The directory function nextfile returns the file name, but I would also like to get the file size for a directory listing.· It seems like the only way to do this is to first get all the file names, and then open each one·individually to get the file size.· Is there an easier way to to that?
fsrw only allows one file to be open at a time.· I noticed that some of the variables and a buffer are in a VAR section, and other variables and another buffer are in the DAT section.· In theory, I could have multiple instances of the fsrw VAR sections.· Would this allow for multiple files to be opened at the same time?· Has anybody made a version of fsrw that uses a pointer to a "struct" containing the variables and buffers?· This would allow for multiple opened files.
Has anybody done subdirectories with fsrw?· That would be a nice feature also.
Dave
The directory function nextfile returns the file name, but I would also like to get the file size for a directory listing.· It seems like the only way to do this is to first get all the file names, and then open each one·individually to get the file size.· Is there an easier way to to that?
fsrw only allows one file to be open at a time.· I noticed that some of the variables and a buffer are in a VAR section, and other variables and another buffer are in the DAT section.· In theory, I could have multiple instances of the fsrw VAR sections.· Would this allow for multiple files to be opened at the same time?· Has anybody made a version of fsrw that uses a pointer to a "struct" containing the variables and buffers?· This would allow for multiple opened files.
Has anybody done subdirectories with fsrw?· That would be a nice feature also.
Dave
Comments
FSRW does not currently support subdirectories.
Jonathan
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
lonesock
Piranha are people too.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Nyamekye,
Seriously, though, Kye does good work, and he's working on a FAT16/32 driver as well. I'm currently working on the FSRW block driver (in my spare time to make a minimal version (size-wise), without sacrificing much in the way of speed.
Jonathan
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
lonesock
Piranha are people too.
I thought I was the only one still holding that grudge! -- I still raise a fist in anger when I drive by the FOX lot...
Thanks for the tip on multiple files with FSRW.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Jon McPhalen
Hollywood, CA
Well, this sounds promising...
Kye, tell us more
Axel
(see the Wikipedia entry for FAT), and look at what next file does (reads 32 bytes, probably), and then
figure out how to find the file size from the 32-byte directory entry.
However, that version is still buggy. I'll be releasing a better version in about 4 weeks give or take.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Nyamekye,
lonesock said...
FSRW 2.6 does support multiple files at once. Just declare an array of FSRW object, and mount the first one. That is how you would check the filesize in a directory as well.
Thanks for the tip on using multiple instances of FSRW.· I'll give it a try.· In reading the FSRW code it looks like the VAR data should be initialized to zero before using the second instance.· However, I believe the Spin loader zeroes out everything after the end of the program space, so this is probably done by the loader.
I am thinking about creating a modified version of FSRW that would define the VAR variables in the DAT section instead.· I would then add a couple of methods that would swap in and out the 10 "VAR" state variables from user memory.· This would allow an unlimited number of files to be opened at the same time.· An addition varaible would also be needed that would point to a 512-byte data block for each open file.
Once concern I have is that there is only one copy of buf2.· It seems that there would be a lot of thrashing in buf2 if multiple files were accessed at the same time.
Dave
What are you intending to achieve by your modified fsrw? Right now you can open as many files at the same time as you declare.
This could be one or ten. By "user memory" do you mean, perhaps, external memory or some such? Can you give us a big picture
here on what you're trying to achieve?
The one copy of buf2 should be sufficient in normal use. If you use a reasonable cluster size, all should be well. It is true that using
multiple metadata buffers might help in some situations, but the metadata buffer is only used on open, close (for write), seek,
and whenever you cross a cluster boundary on read/write (which, with 32K clusters, is not that frequent).
In case you want to access the date and time fields, here's a code snippet to convert them into a readable format. dent points to a directory entry and dtbuff to a string buffer of at least 20 bytes.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Pullmoll's Propeller Projects
Post Edited (pullmoll) : 4/29/2010 1:32:30 AM GMT
I think for now I will use the object array technique.· I think an array of four fsrw objects should be sufficient.· An fopen will return the index of the next available fsrw object, and an fclose will free up that instance.
Pullmoll, thanks for the code on converting the date and time·information.· I'm not planning on using the date/time information right now, but maybe in the future.
Dave
Post Edited (Dave Hein) : 4/29/2010 3:00:18 AM GMT