[Libvir] [PATCH] Refactor xend_internal.c block device detection

Richard W.M. Jones rjones at redhat.com
Tue Oct 16 14:16:34 UTC 2007

Daniel P. Berrange wrote:
> On Tue, Oct 16, 2007 at 02:13:04PM +0100, Richard W.M. Jones wrote:
>> This patch is a little bit esoteric, but I need it for something I'm 
>> working on at the moment.
>> At the moment the code in xend_internal.c: xend_parse_sexp_desc parses 
>> the domain sexpr directly into XML.  This makes it rather hard to just 
>> get a list of block devices without repeating the same code.  So here 
>> I've factored out the common code for parsing block devices into a 
>> separate function and callback.
> I agree that its good to separate this code out, however, I'd split it
> slightly differently. Instead of a function to parse all block devices
> and a callback to receive each one, I'd have the new function just be 
> responsible for parsing a single block device. Keep iteration over block
> devices in the caller & avoid the callback. This is more in keeping with
> the style of the other functions for parsing XML & related domain info
> formats

I'm not sure I understand.  Do you mean the function would parse a block 
device and return a structure?


Emerging Technologies, Red Hat - http://et.redhat.com/~rjones/
Registered Address: Red Hat UK Ltd, Amberley Place, 107-111 Peascod
Street, Windsor, Berkshire, SL4 1TE, United Kingdom.  Registered in
England and Wales under Company Registration No. 03798903
-------------- next part --------------
A non-text attachment was scrubbed...
Name: smime.p7s
Type: application/x-pkcs7-signature
Size: 3237 bytes
Desc: S/MIME Cryptographic Signature
URL: <http://listman.redhat.com/archives/libvir-list/attachments/20071016/3e15e4dd/attachment-0001.bin>

More information about the libvir-list mailing list