LKML Archive on
help / color / mirror / Atom feed
From: "Wink Saville" <>
Subject: Re: [PATCH 2/7] Initial implementation of the trec driver and include files
Date: Wed, 21 Mar 2007 21:59:33 -0700	[thread overview]
Message-ID: <> (raw)
In-Reply-To: <20070321181739.GC16768@leiferikson>

On 3/21/07, Johannes Weiner <> wrote:
> Hi,
> On Wed, Mar 21, 2007 at 09:49:12AM -0700, Wink Saville wrote:
> > >>Please don't use camel-case - in general.
> > >>
> > Would p_next, p_cur and p_end be OK?
> I think it's generally disliked. Quoting Documentation/CodingStyle:
> ``Encoding the type of a function into the name (so-called Hungarian
> notation) is brain damaged - the compiler knows the types anyway and can
> check those, and it only confuses the programmer.  No wonder MicroSoft
> makes buggy programs.''

I'll change it to; next, cur, end (when in rome do as the romans)

> You can implement a sysctl-setting to enable/disable the whole system
> (which then would be runtime changeable).

Generally the way I've used this in the kernel is sprinkle them liberally
where I'm trying to track down a bug or understand how some code works
and then disable some of them using ZREC's but then reenable as
necessary. Finally, I remove them all usually by reverting to the original

In userland I have a more sophisticated version which combines TREC's
and printf's in one macro with a "debug variable" defined as a
set of bits controlling the enable/disable sets of these. For example:

   DPRP1(1 << 2, "This is a DPR with parameter=%d", xyz);

#define DPRP1(__bits, __format, __param, ...) \
do { \
   if (((__bits) << 16) & dbg_variable) \
         printf((__format), __param...); \
   if ((__bits) & dbg_variable) \
         TREC1((__param)); \
} while (0)

The above divides "dbg_variable" into 2 16 bit fields, the upper 16
bits control if the printf is enabled and the lower 16 bits controls if
the TREC1 is enabled. What I envision happening would possibly
to expose the "dbg_variable" via procfs where it could "easily" be
modified from userland.

Anyway, for my immediate needs I just needed the TREC's so I could
understand the inner workings of the kernel better and assist in debugging.
I've submitted it as a patch incase anyone might be interested.

Actually, are you interested in using them?

In anycase thanks for the feed back.


      reply	other threads:[~2007-03-22  4:59 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-03-21  6:47 Wink Saville
2007-03-21  8:22 ` Johannes Weiner
2007-03-21  8:37   ` Johannes Weiner
2007-03-21 16:49   ` Wink Saville
2007-03-21 18:17     ` Johannes Weiner
2007-03-22  4:59       ` Wink Saville [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \ \ \ \
    --subject='Re: [PATCH 2/7] Initial implementation of the trec driver and include files' \

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).