• Status Closed
  • Percent Complete
  • Task Type Patches
  • Category Operating System/Drivers
  • Assigned To
  • Operating System All players
  • Severity Low
  • Priority Very Low
  • Reported Version Release 3.8.1
  • Due in Version Undecided
  • Due Date Undecided
  • Votes
  • Private
Attached to Project: Rockbox
Opened by kugel. - 2011-05-28
Last edited by kugel. - 2011-06-21

FS#12133 - Dircache patches

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.

Closed by  kugel.
2011-06-21 07:41
Reason for closing:  Accepted
Additional comments about closing:   Warning: Undefined array key "typography" in /home/rockbox/flyspray/plugins/dokuwiki/inc/parserutils.php on line 371 Warning: Undefined array key "camelcase" in /home/rockbox/flyspray/plugins/dokuwiki/inc/parserutils.php on line 407

r30032 onwards

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.

This opimizes dircache_copy_path a bit, so that the string buffer is not walked repeatedly by strlcat.


Available keyboard shortcuts


Task Details

Task Editing