"Benjamin C.R. LaHaise" wrote:
>
> On Mon, 5 Jun 2000, Mitchell Blank Jr wrote:
>
> > Ben Greear wrote:
> > > Seems a hashtable would be nice for the ifindex....
> >
> > The problemn with using a hashtable: how big should it be? After all
> > you want it small enough that there isn't much memory waste if you
> > have 3 devices, yet we can efficiently do a lookup on 10000 devices.
> > That's why I'm thinking a B+ tree or something would be more
> > appropriate.
>
> Before going that far, why not just take advantage of the fact that
> network devices have a structure to their name: class<number>? Since the
> numbers are typically contiguous starting at zero, just have an array
> pointing to the device structs hanging off of the class name. That way
> memory can be saved on device names too.
>
> -ben
VLAN devices are not numbered contigiously, for one. An array is
also worse than a hashtable at allowing growth. We could have a dynamicly
re-sized array or hashtable though, based on the if_index field.... Doesn't
help finding a device by name though...
Ben
--
Ben Greear (greearb@xxxxxxxxxxxxxxx) http://www.candelatech.com
Author of ScryMUD: scry.wanfear.com 4444 (Released under GPL)
http://scry.wanfear.com http://scry.wanfear.com/~greear
|