[libvirt] [PATCH] document virCommandRunRegex function

Ján Tomko jtomko at redhat.com
Mon Nov 23 18:12:13 UTC 2015


On Mon, Nov 23, 2015 at 03:09:49PM +0100, Christian Loehle wrote:
> >From 01a3ed1e6bacba8cd9f398e5233960714b2c4f49 Mon Sep 17 00:00:00 2001
> From: Christian Loehle <cloehle at linutronix.de>
> Date: Mon, 23 Nov 2015 15:06:37 +0100
> Subject: [PATCH] =?UTF-8?q?document=20virCommandRunRegex=20function=C3=84?=
> MIME-Version: 1.0
> Content-Type: text/plain; charset=UTF-8
> Content-Transfer-Encoding: 8bit
> 
> ---
>  src/util/vircommand.c | 16 ++++++++++++++--
>  1 file changed, 14 insertions(+), 2 deletions(-)

ACK, I will push this tomorrow with the following changes:

> diff --git a/src/util/vircommand.c b/src/util/vircommand.c
> index c7f1538..a88cc13 100644
> --- a/src/util/vircommand.c
> +++ b/src/util/vircommand.c
> @@ -2889,12 +2889,24 @@ virCommandSetDryRun(virBufferPtr buf,
>  }
>  
>  #ifndef WIN32
> -/*
> +/**
> + * virCommandRunRegex:
> + * @cmd: command to run
> + * @nregex: number of regexes to apply
> + * @regex: array of regexes to apply
> + * @nvars: array of numbers of variables each regex will produce
> + * @func: callback function that is called for every line of output,
> + * needs to return 0 on success
> + * @data: additional data that will be passed to the callback function
> + * @prefix: prefix that will be skipped at the beginning of each line

> + * @exitstatus: 0 on success, -1 on memory allocation error, virCommandRun
> + * error or callback function error
> + *

We use the format "Returns:" after the description of what the function
does elswehere in the file.

>   * Run an external program.
>   *
>   * Read its output and apply a series of regexes to each line
>   * When the entire set of regexes has matched consecutively
> - * then run a callback passing in all the matches
> + * then run a callback passing in all the matches of the current line.

s/of/on/

(Also, this does not seem very useful for multiple regexes, but we only call
the function with one regex.)


Jan
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: Digital signature
URL: <http://listman.redhat.com/archives/libvir-list/attachments/20151123/f5b90719/attachment-0001.sig>


More information about the libvir-list mailing list