*BSD News Article 33854


Return to BSD News archive

Xref: sserve comp.os.386bsd.misc:3029 comp.os.linux.misc:21085
Newsgroups: comp.os.386bsd.misc,comp.os.linux.misc
Path: sserve!newshost.anu.edu.au!harbinger.cc.monash.edu.au!msuinfo!agate!trib.apple.com!amd!netcomsv!calcite!vjs
From: vjs@calcite.rhyolite.com (Vernon Schryver)
Subject: Re: source of TCP/IP (was I hope this wont ignite a major flame ...)
Message-ID: <Cu0MG6.MxE@calcite.rhyolite.com>
Organization: Rhyolite Software
Date: Thu, 4 Aug 1994 14:48:06 GMT
References: <31fd07$6pq@cesdis1.gsfc.nasa.gov> <31od8d$15l@fw.novatel.ca> <31q174$kpu@cesdis1.gsfc.nasa.gov>
Lines: 28

In article <31q174$kpu@cesdis1.gsfc.nasa.gov> becker@cesdis.gsfc.nasa.gov (Donald Becker) writes:
>In article <31od8d$15l@fw.novatel.ca>,
>Herb Peyerl <hpeyerl@sidney.novatel.ca> wrote:
>>This is an example of some of the Linux device-drivers I've seen:
>>
>>        short error = rx_status & 0x3C00;
>>        outw(inw(ioaddr + 0x0A) | 0x00C0, ioaddr + 0x0A);
>
>As far as I can tell this code isn't verbatim from any driver.  The closest
>that I can find is the Lance driver which does
>
>           if (status & 0x40000000) { /* There was an major error, log it. */
>                int err_status = lp->tx_ring[entry].misc;
>                lp->stats.tx_errors++;
>                if (err_status & 0x0400) lp->stats.tx_aborted_errors++;
> ...

>OK, there are a lot of numeric constants there, and no comments.  But in
>this case the constants are *good*.  I consider the code much more readable
>than the alternative of writing a list of #defines in the 'constants'
>section 600 lines above, just so that the constants could be used once.
> ...

I agree that that 2nd batch of code is just fine.  It's readable and clear.  
Given a good compiler, it will produced a reasonable binary.


Vernon Schryver    vjs@rhyolite.com