tech-kern archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: Newbie Kernel Programmer looking for first project.



Hah! I didn't actually post the url to the pr. Okay here it is now.
http://www.netbsd.org/cgi-bin/query-pr-single.pl?number=39106

On 7/4/08, Michael Litchard <michael%schmong.org@localhost> wrote:
> Here's my first submission. It gives the url to the actual patches.
>  Feedback most welcome.
>
>
>                                              Michael Litchard
>
> On 7/3/08, Tim Rightnour <root%garbled.net@localhost> wrote:
>  >
>  >  On 03-Jul-2008 Michael Litchard wrote:
>  >  > When I see a pattern like this:
>  >  >
>  >  >#idef DEBUG
>  >  >    printf("foo"...);
>  >  >#endif
>  >  >
>  >  > I replace those three line with
>  >  >    aprint_debug("foo...");
>  >  >
>  >  > the reasoning being that aprint_debug uses AB_DEBUG to govern behavior,
>  >  > and a new convention is replacing the old.
>  >  >
>  >  > But I'm starting to question this. I see more complex preprocessor 
> commands,
>  >  > and now I wonder if I should just leave them alone. Could you give me 
> some
>  >  > feedback?
>  >
>  >
>  > These are a tough case.  One thing you see alot is something where we do a
>  >  ifdef DEBUG printf, but the arguments to the printf aren't defined unless 
> DEBUG
>  >  is defined.  So you would run into some compile issues there.
>  >
>  >  Additionally, some of the DEBUG stuff is pretty heavyweight, and is there 
> for
>  >  true debugging, not casual use through dmesg.
>  >
>  >  I'm inclined to say leave most of them working the way they currently do. 
>  Ie,
>  >  in the case above, change it to:
>  >
>  >  #idef DEBUG
>  >     aprint_normal("foo"...);
>  >  #endif
>  >
>  >  aprint_debug is more or less for cases where it doesn't require any 
> additional
>  >  processing to just print out some additional data that we already happen 
> to
>  >  have.
>  >
>  >  src/sys/arch/ofppc/ofppc/mainbus.c is a relatively good example of 
> different
>  >  uses, though not a perfect example.  In init_openpic() you can see how we 
> use
>  >  verbose to note the enabling of interrupts on an SMP machine, and then 
> verbose
>  >  to note the address where the openpic was found.  (however, I see one is 
> marked
>  >  normal, oops). Finally, down in init_ofppc_interrupt() you see where we 
> use
>  >  debug.  (I say relatively good example, because there are a few bad uses, 
> and
>  >  it looks like 1-2 printfs are still in there.  Bad Tim.)
>  >
>  >  Alot of these are judgement calls.  You kinda have to do your best.  I 
> would
>  >  convert 1 or 2 files, and then mail the diffs to tech-kern for review.  
> With a
>  >  little feedback from some of us, you will get the hang of it quickly.
>  >
>  >
>  >  ---
>  >  Tim Rightnour <root%garbled.net@localhost>
>  >  NetBSD: Free multi-architecture OS http://www.netbsd.org/
>  >  Genecys: Open Source 3D MMORPG: http://www.genecys.org/
>  >
>


Home | Main Index | Thread Index | Old Index