[collectd] [PATCH 2/5] sigrok: bare bones plugin

Florian Forster octo at collectd.org
Mon Jul 22 21:50:35 CEST 2013

Hi Bert,

thank you very much for your patches!

On Mon, Jul 22, 2013 at 06:21:18PM +0200, Bert Vermeulen wrote:
> + * This program is free software: you can redistribute it and/or modify
> + * it under the terms of the GNU General Public License as published by
> + * the Free Software Foundation, either version 3 of the License, or
> + * (at your option) any later version.

Unfortunately, this is going to cause licensing issues: Many parts of
collectd are licenses under the GPL version 2, which is not compatible
to GPL version 3.

> +static int cd_logger(void *cb_data, int loglevel, const char *format, va_list args)

Macros are better suited for this kind of prefix implementation, because
you don't need a separate buffer / call to vsnprintf(). E.g.:

  #define SR_INFO(...) INFO ("sigrok plugin: " __VA_ARGS__)

> +	if (!strcmp(key, "loglevel"))
> +		loglevel = atoi(value);

Please use parse_log_severity() from src/plugin.h to parse a string into
a log severity.

> +void module_register(void)
> +{
>> +	ts.tv_sec = 0;
> +	ts.tv_nsec = 1000000000L;
> +	plugin_register_complex_read("sigrok", "sigrok", plugin_read, &ts, NULL);

Please pass in NULL for the interval. The user can then configure the
interval used, e.g.:

  <LoadPlugin sigrok>
    Interval 42.0

Best regards,
collectd – The system statistics collection daemon
Website: http://collectd.org
Google+: http://collectd.org/+
GitHub:  https://github.com/collectd
Twitter: http://twitter.com/collectd
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 836 bytes
Desc: Digital signature
URL: <http://mailman.verplant.org/pipermail/collectd/attachments/20130722/3020c1df/attachment.pgp>

More information about the collectd mailing list