FS#12125 - Use persistent dircache without HAVE_EEPROM_SETTINGS

Attached to Project: Rockbox
Opened by Rosso Maltese (asettico) - Sunday, 22 May 2011, 16:06 GMT
Task Type Patches
Category Operating System/Drivers
Status Unconfirmed
Assigned To No-one
Operating System All players
Severity Low
Priority Normal
Reported Version Daily build (which?)
Due in Version Undecided
Due Date Undecided
Percent Complete 0%
Votes 0
Private No


The patch allows to use the persistent dircache even in targets that do not define HAVE_EEPROM_SETTINGS.

Starting trying to implement such a feature for my iPod Video, I "discovered" the functions dircache_load/save (I have a slight knowledge of the RB software). Investigating why it was not used on my target, I saw that it's conditioned to the define HAVE_EEPROM_SETTINGS without an apparently reason to limit them just to some targets.
So, I simply "detach" the functions definition and use from the define.
I'm using it since an hour, starting up and shutting down the DAP various times, jumping back and forth inside the dynamic play list, and I got no problems at all.

If I guess correctly the code, the dircache should be updated also when changing the DAP content, if the USB connection is done by RB and not the OF.

It's applied to r29907.
This task depends upon

Comment by Rosso Maltese (asettico) - Sunday, 22 May 2011, 16:07 GMT
I also fixed a typo (missmatch -> mismatch).
Comment by Nils Wallménius (nls) - Monday, 23 May 2011, 06:37 GMT
The problem is dualboot, rockbox has no idea if you changed the contents of the disk in the OF since the last time you booted rockbox so this is only safe on players that don't have dualboot or any usb msc mode besides the one provided by rockbox.
Comment by Rosso Maltese (asettico) - Tuesday, 14 June 2011, 11:18 GMT
To allow rebuild persistent dircache also using the OF, I tried to build a very simply tool, basing from the idea of tools/database.
So I generated tools/dircache with the only purpose, for now, to scan the current directory and build the dircache just like the FW does.
The tool compiles, but, due to my very poor knowledge of the software architecture, it segfaults.
Anyway, I put here the patch, so if someone want to give some hint or continue the development, he/she has some base.

Unfortunately, I haven't sufficient spare time to study the FW, so my development will advance extremely slowly, but I think the advantages got by the feature are enough to involve someone with more knowledge! :-)
Comment by Rosso Maltese (asettico) - Tuesday, 14 June 2011, 11:19 GMT
Ops, I'm going to add the missing sources...
Comment by Rosso Maltese (asettico) - Tuesday, 14 June 2011, 11:24 GMT
Here it is the complete patch... sorry.
Comment by Dave Hooper (stripwax) - Wednesday, 06 July 2011, 11:53 GMT
If the problem is dualboot, then that #define should be changed in rockbox . HAVE_EEPROM_SETTINGS isn't obviously semantically equivalent to "has no dualboot capability".

Having said that, how hard would it be to make dualboot 'not a problem'. E.g. by persisting some sentinel information across rockbox boots, that the dualboot/OF is known to remove. (for example, ipod (at least ipod 5g) is known to persist iram contents across boots, could we encode "rockbox has shutdown" somewhere in there, and if on rockbox reload that information is still there we assume dircache is still valid?)
(noting  FS#11149  , naturally)