Re: Adding checkpointing API to Linux kernel

Oliver Xymoron (oxymoron@waste.org)
Thu, 21 Jan 1999 11:04:53 -0600 (CST)


On Thu, 21 Jan 1999, Michael Elizabeth Chastain wrote:

> > If these functions register callbacks, we can do away with a fair amount
> > of crufty switch code as well.
>
> Oh yeah. The networking code has a lot of this, where dispatch
> functions have switches with 40 codes in them just to pass them down to
> the next layer. Probably none of this is fast-path code so it's more
> an esthetic thing.

Exactly. The trick is with majors like 0 where minors are different
devices. Dispatching the callbacks becomes a bit uglier (a mask for the
minor field?). For 2.3 we might have enough major numbers to make this a
non-issue, though.

Turning code like switch blocks into data is generally a big win (except
in performance critical cases like reading an IP header). It becomes much
easier for the maintainer to make structural changes and global
optimizations and the code becomes shorter, simpler, and more readable.
And possibly faster.

--
 "Love the dolphins," she advised him. "Write by W.A.S.T.E.." 

- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.rutgers.edu Please read the FAQ at http://www.tux.org/lkml/