fdi files device syntax

Richard Hughes hughsient at gmail.com
Sun Jul 23 01:48:59 PDT 2006


On Sun, 2006-07-23 at 07:59 +0200, Kay Sievers wrote:
> On Sat, Jul 22, 2006 at 11:24:22PM +0100, Richard Hughes wrote:
> > On Sat, 2006-07-22 at 11:18 -0400, David Zeuthen wrote:
> > > And Kay already got a patch for this....
> > 
> > Was this cc'd to the mailing list or is it early-stage stuff? I've
> > played for a couple of hours this evening, saving the xml data to a
> > n-ary tree and it's much quicker[1]:
> > 
> > Adding the FDI files[2] and compiling to a n-ary tree : 20ms
> > Checking for applicable rules after adding a device : 4ms
> > 
> > For reference the scan-every-file-every-time way of doing this takes
> > about 75ms, although it's not a fair comparison as my experimental n-ary
> > tree has too little error checking.
> > 
> > Kay, what was your method of caching and storing the tree?
> 
> The xml file is transformed into a linear match/action list, which just
> jumps to the end of a block if the condition of the actual block is not
> matching.

Gotcha, thanks. Wouldn't it be quicker still to use a tree based system,
something like:

static void
hald_fdi_merge_recurse (HaldFdi *fdi, HaldDevice *device, GNode *node)
{
	HaldFdiLink *link;
	gboolean cont;
	if (node == NULL) {
		return;
	}

	link = node->data;
	cont = TRUE;
	if (link->type == HALD_FDI_LINK_MATCH) {
		cont = hald_fdi_merge_item_match (fdi, device, link);
	} else if (link->type == HALD_FDI_LINK_MERGE) {
		hald_fdi_merge_item_merge (fdi, device, link);
	} else if (link->type == HALD_FDI_LINK_SPAWN) {
		hald_fdi_merge_item_spawn (fdi, device, link);
	} else if (link->type == HALD_FDI_LINK_PREPEND) {
		hald_fdi_merge_item_prepend (fdi, device, link);
	} else if (link->type == HALD_FDI_LINK_REMOVE) {
		hald_fdi_merge_item_remove (fdi, device, link);
	} else if (link->type == HALD_FDI_LINK_APPEND) {
		hald_fdi_merge_item_append (fdi, device, link);
	} else {
		g_warning ("no action yet!");
	}
	/* only do children if the match was okay */
	if (cont) {
		hald_fdi_merge_recurse (fdi, device, node->children);
	}
	hald_fdi_merge_recurse (fdi, device, node->next);
}

Then you don't have to go thru the gslist every time you want to skip a
match block. Or am I missing something obvious?

Thanks,

Richard.




More information about the hal mailing list