Notice: A non well formed numeric value encountered in /sites/ on line 96 Notice: A non well formed numeric value encountered in /sites/ on line 96 Notice: A non well formed numeric value encountered in /sites/ on line 96 Deprecated: Function create_function() is deprecated in /sites/ on line 104 Deprecated: The each() function is deprecated. This message will be suppressed on further calls in /sites/ on line 845 Deprecated: Function create_function() is deprecated in /sites/ on line 111 FS#12133 : Dircache patches



FS#12133 - Dircache patches

Attached to Project: Rockbox
Opened by Thomas Martitz (kugel.) - Saturday, 28 May 2011, 23:51 GMT
Last edited by Thomas Martitz (kugel.) - Tuesday, 21 June 2011, 07:41 GMT
Task Type Patches
Category Operating System/Drivers
Status Closed
Assigned To Thomas Martitz (kugel.)
Operating System All players
Severity Low
Priority Normal
Reported Version Release 3.8.1
Due in Version Undecided
Due Date Undecided
Percent Complete 100%
Votes 0
Private No


I put up a few dircache related patches for review/discussion.

- This removes the name_len memeber from struct dircache_entry. This saves 4 bytes per file in the cache which is easily a couple of KB. The name_len was intended as a means to save strlen() calls but that was not really useful as the shortcut was hardly used. The patch also replaces memcpy with strcpy calls to ensure nul-termination (needed to make strlen() work).

- The only place where name_len was useful was dircache_copy_path(), for the final string length calculation. This patch rewrites the function to use recursion so that the length calculation isn't needed and it doesn't need to go through the linked list twice anymore.

- Extends the above dircache_copy_path() to return the string length so that callers don't need it anymore.

- just fixes a bug introduced by the 1st patch (separate patch to not mess with my local git history).

- This changes the layout of the dircache. struct dircache_entrys are allocated from the beginning, the d_name strings from the back. This allows the buffer to be moveable/relocatable which is beneficial for h100 users (as the dircache_root pointer doesn't need to be the same across reboots anymore) and ultimatively needed for my gsoc buflib project.
This task depends upon

Closed by  Thomas Martitz (kugel.)
Tuesday, 21 June 2011, 07:41 GMT
Reason for closing:  Accepted
Additional comments about closing:  r30032 onwards
Comment by Thomas Martitz (kugel.) - Sunday, 29 May 2011, 01:27 GMT
I add 2 more patches.

- dircache_load() didn't actually very the DIRCACHE_MAGIC found in the cache dump. Fix that.

- This patch removes the exposure of pointers into dircache memories to other modules. Only integer IDs are passed around. This enables moving the struct dircache_entry declaration into dircache.c. I will need to isolate the dircache buffer for my buflib gsoc project.
Comment by Thomas Martitz (kugel.) - Sunday, 05 June 2011, 11:03 GMT
This opimizes dircache_copy_path a bit, so that the string buffer is not walked repeatedly by strlcat.