Subject: Re: as long as we're hitting FFS...
To: Bill Studenmund <wrstuden@nas.nasa.gov>
From: Julian Assange <proff@iq.org>
List: tech-kern
Date: 03/26/1999 11:37:47
Bill Studenmund <wrstuden@nas.nasa.gov> writes:

> A type:value chain strikes me as just way too space inefficient and time
> inefficient a thing to stick in the inode, especially for essentials of
> how the fs accesses the node. We don't need that kind of flexability, and
> the overhead is too expensive.

Huh?

int
find_by_type(char type, char *data, int len)
{
	int n;
	for (n=0; p[n]!=IDATA_TYPE_END && n<len; n+=p[n+1]+2)
		if (p[n] == type)
			return n+2;
	return -1;
}

That (miniscule!) loop normaly executes precisely once. For real-life
code you will also need an IDATA_TYPE_NOOP in order to pad some types
to 32 bit boundaries.

Cheers,
Julian.