Re: [PATCH v2 4/8] trace-cmd: Move trace-cmd global variable "quiet" to libtracecmd

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

 



On Thu, 29 Aug 2019 14:39:43 +0300
Tzvetomir Stoyanov <tz.stoyanov@xxxxxxxxx> wrote:

> On Wed, Aug 28, 2019 at 10:59 PM Steven Rostedt <rostedt@xxxxxxxxxxx> wrote:
> >
> > On Wed, 14 Aug 2019 11:47:04 +0300
> > "Tzvetomir Stoyanov (VMware)" <tz.stoyanov@xxxxxxxxx> wrote:
> >  
> > >  void tracecmd_set_quiet(int quiet);
> > >  int tracecmd_get_quiet(void);  
> >
> > I rather make this a parameter to the descriptor:
> >
> >         tracecmd_set_quiet(struct tracecmd_output *handle, bool quiet);
> >         tracecmd_get_quiet(struct tracecmd output *handle);
> >
> > As we may have multiple handles and perhaps we don't want all of them
> > quiet.
> >  
> It makes sense to have "quiet" per tracecmd_output handler, but when I
> started to modify the code,
> I noticed one flow where tracecmd_get_quiet() is used and there is no
> tracecmd_output handler available -
> in check_plugin(). We have either to drop the usage of
> tracecmd_get_quiet() in check_plugin(), or leave the scope of
> "quiet" to be for the whole library.

We can still have a global variable in trace-record.c called quiet. And
that gets set by the parameter:

	case OPT_quite:
	case 'q':
		quiet = 1;
		break;

[..]

	tracecmd_set_quiet(handle, quiet);

This is the proper way to handle it. The functions local to
trace-record.c, can just use its own quiet state variable, but when we
set quiet, we use the tracecmd_set_quiet() to notify the library that
it too should be quiet.

-- Steve




[Index of Archives]     [Linux USB Development]     [Linux USB Development]     [Linux Audio Users]     [Yosemite Hiking]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux