[lttng-dev] [MI-prototype] MI: mi-lttng into libcommon, global option lttng_mi_opt , command version

David Goulet dgoulet at efficios.com
Wed Mar 26 09:56:39 EDT 2014


> > > +/*
> > >   *  cmd_version
> > >   */
> > >  int cmd_version(int argc, const char **argv)
> > >  {
> > >  	int opt, ret = CMD_SUCCESS;
> > >  	static poptContext pc;
> > > +	struct mi_writer *writer = NULL;
> > > +	struct lttng_version version;
> > >  
> > >  	pc = poptGetContext(NULL, argc, argv, long_options, 0);
> > >  	poptReadDefaultConfig(pc, 0);
> > > @@ -78,12 +97,58 @@ int cmd_version(int argc, const char **argv)
> > >  		}
> > >  	}
> > >  
> > > -	MSG("lttng version " VERSION " - " VERSION_NAME);
> > > -	MSG("\n" VERSION_DESCRIPTION "\n");
> > > -	MSG("Web site: http://lttng.org");
> > > -	MSG("\nlttng is free software and under the GPL license and part LGPL");
> > > +	if (lttng_opt_mi) {
> > 
> > I would go for a function to print the mi like maybe "print_mi()" since
> > this *may* change depending on what output type we use. For now, only
> > one but let's think ahead :) and this allow to handle the mi writer
> > destruction in one specific call also, cleaner in the long run I think.
> Okai, we got a patch comming for list ( need some cleanup, internal
> code review and 2 features) but you might want to check the way we
> incorporate the mi into the command and tell us what you think. Cause
> with your comment I think we are heading the wrong way.
> https://github.com/PSRCode/lttng-tools-dev/commit/23b3a771083dc9abbf80aa9a46087b0ea9fd5959

What I meant here is to simply have a static function in the same file
that do this job below. This is just easier in terms of code separation
in the long run so keep everything but move it to a function that
handles "mi printouts".

Cheers!
David
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 603 bytes
Desc: Digital signature
URL: <http://lists.lttng.org/pipermail/lttng-dev/attachments/20140326/1ce70599/attachment.pgp>


More information about the lttng-dev mailing list