This is the mail archive of the systemtap@sourceware.org mailing list for the systemtap project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [PATCH 1/2] Trace code and documentation


On Fri, 14 Sep 2007 18:08:40 -0700 Andrew Morton wrote:

> > Trace - Provides tracing primitives
> > 
> > ...
> >
> > +config TRACE
> > +	bool "Trace setup and control"
> > +	select RELAY
> > +	select DEBUG_FS
> > +	help
> > +	  This option provides support for the setup, teardown and control
> > +	  of tracing channels from kernel code.  It also provides trace
> > +	  information and control to userspace via a set of debugfs control
> > +	  files.  If unsure, say N.
> > +
> 
> select is evil - you really want to avoid using it.

I checked when I reviewed(?) this patch.  There are a few other
places that select also (IIRC, the blktrace code does), but most of
them use depends on.

> The problem is where you select a symbol whose dependencies aren't met. 
> Kconfig resolves this incompatibility by just not selecting the thing you
> wanted, iirc.  So your CONFIG_SYSFS=n, CONFIG_TRACE=y kernel won't build.
> 
> > +/*
> > + * Based on blktrace code, Copyright (C) 2006 Jens Axboe <axboe@suse.de>
> 
> So can we migrate blktrace to using this?

> > +static ssize_t sub_size_read(struct file *filp, char __user *buffer,
> > +			     size_t count, loff_t *ppos)
> > +{
> > +	struct trace_info *trace = filp->private_data;
> > +	char buf[32];
> > +
> > +	snprintf(buf, sizeof(buf), "%u\n",
> > +		 (unsigned int)trace->rchan->subbuf_size);
> 
> Use %tu to print a size_t, rather than the typecast.

Eh?
Use %zu to print a size_t.  Use %tu to print a ptrdiff_t.


---
~Randy
*** Remember to use Documentation/SubmitChecklist when testing your code ***


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]