[lkml]   [2007]   [Mar]   [22]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
Messages in this thread
SubjectRe: [PATCH 2/7] Initial implementation of the trec driver and include files
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.

To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to
More majordomo info at
Please read the FAQ at

 \ /
  Last update: 2007-03-22 06:03    [W:0.049 / U:5.516 seconds]
©2003-2018 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site