Rockbox

Tasklist

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

Details

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

0001-Dircache-Remove-dircache_entry-name_len.patch:
- 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).

0002-Dircache-Rework-and-simplify-dircache_copy_path.patch:
- 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.

0003-Dircache-Return-the-size-of-the-result-string-in-dir.patch:
- Extends the above dircache_copy_path() to return the string length so that callers don't need it anymore.

0004-Fix-dircache_size-calculation-bug-introcuced-3-revis.patch:
- just fixes a bug introduced by the 1st patch (separate patch to not mess with my local git history).

0005-Dircache-Change-internal-cache-layout.patch:
- 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.

0006-Dircache-Move-struct-maindata-declaration-to-dircach.patch:
- dircache_load() didn't actually very the DIRCACHE_MAGIC found in the cache dump. Fix that.

0007-Dircache-Don-t-expose-struct-dircache_entry-and-poin.patch:
- 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.

Loading...