[PATCH][RFC] cache generation + separate FDI parser process

David Zeuthen david at fubar.dk
Tue Jan 9 14:13:38 PST 2007


On Tue, 2007-01-09 at 16:20 +0300, Sergey Lapin wrote: 
> Hi!
> 
> Attached is a patch which provides these improvements:
> 
> - Separates XML parsing from main running process thus reducing memory 
> fragmentation and consumption.
> - maintains binary cache which is mmapped for reading thus not using 
> heap for that, so it uses mapped memory which is freed on demand which 
> is good for small-memory embedded devices.
> - makes hald smaller due to fact that bunch of rarely used code is out 
> in separate process.

These are great goals.

> so you get /usr/sbin/hald-cache which generates cache at /var/run/hald 
> (for example) which is then used by hald, so it must exist prior to 
> running hald.

It should probably be /var/cache/hald cf. the FHS 2.3

 http://www.pathname.com/fhs/pub/fhs-2.3.html#VARCACHEAPPLICATIONCACHEDATA

as it really is a cache.

> Debug scripts are not changed, they need to be added running of that binary.

As discussed elsewhere hald should probably check cache coherency;
requires traversing all directories we care about.

> It was a lot of work and it could not be done without Mikhail 
> Kshevetskiy who did great job of fixing and rewriting lots of crappy 
> code when my head was seem to blow with that a bit unnecessary 
> complicated parts of code, so we made it far more simpler and solid.
> 
> Hope that will be useful.

Cool, thanks _a lot_ for doing all this. It's very useful!

> Possible TODO:
> 
> move hald-cache-test to noinst

Yes, sounds like a good idea.

> provide check for cache to be consistent with FDI files (newer).

Yes. And also, we should hook up inotify as noted in another mail.

Quick comments on the patch

> +++ b/hald/cache_test.c
> @@ -0,0 +1,78 @@
> +/***************************************************************************
> + * CVSID: $Id$
> + *
> + * device_info.c : match/merge device properties.

Copy/paste? (this occurs several times)


> +static void test_cache(u_int32_t offset, size_t size){
> +    u_int32_t		m = offset;
> +    struct rule 	*r;

Please follow the code formatting guidelines used in the rest of the
source tree.

> +
> +#define MAX_INDENT_DEPTH		64

Probably needs some prefix here.

This is just a quick look through. I think with these changes + the
cache coherency checks + automatic invocation of this tool.. we're good
to commit it and start testing it. Then we can add inotify + other
checks on top. Sounds good?

Thanks again for working on this!

Cheers,
David








More information about the hal mailing list