Re: [Libvir] [PATCH] Device attach/detach on virsh(XML version)

2007-05-23 Thread Richard W.M. Jones
Masayuki: I have applied this patch to CVS. Thanks for your contribution to libvirt. Rich. -- 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 E

Re: [Libvir] [PATCH] Device attach/detach on virsh(XML version)

2007-05-23 Thread Richard W.M. Jones
OK, here we go ... Rich. -- 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 Index: src/

Re: [Libvir] [PATCH] Device attach/detach on virsh(XML version)

2007-05-23 Thread Mark McLoughlin
On Wed, 2007-05-23 at 17:52 +0900, Atsushi SAKAI wrote: > Hi, > > I also agree garbage collection. > Anyway, this kind of problem should be checked by valgrind. The only way to test code paths like this is to set up a test harness which will re-run the code over and over, with a malloc()

Re: [Libvir] [PATCH] Device attach/detach on virsh(XML version)

2007-05-23 Thread Mark McLoughlin
On Wed, 2007-05-23 at 09:51 +0100, Richard W.M. Jones wrote: > +oldbuffer = buffer; > +buffer = realloc (buffer, len+1); > +if (buffer == NULL) goto out_of_memory; Missed it here too. Cheers, Mark. -- Libvir-list mailing list Libvir-list@redhat.com https://www.redhat.com/mai

Re: [Libvir] [PATCH] Device attach/detach on virsh(XML version)

2007-05-23 Thread Mark McLoughlin
Hi Rich, On Tue, 2007-05-22 at 15:10 +0100, Richard W.M. Jones wrote: > +static char * > +readFile (vshControl *ctl, const char *filename) > +{ > +char *buffer = NULL, *oldbuffer; > +int len = 0, fd, r; > +char b[1024]; > + > +fd = open (filename, O_RDONLY); > +if (fd == -1) {

Re: [Libvir] [PATCH] Device attach/detach on virsh(XML version)

2007-05-23 Thread Atsushi SAKAI
Hi, I also agree garbage collection. Anyway, this kind of problem should be checked by valgrind. Thanks Atsushi SAKAI "Richard W.M. Jones" <[EMAIL PROTECTED]> wrote: > Mark McLoughlin wrote: > > On Tue, 2007-05-22 at 15:16 +0100, Richard W.M. Jones wrote: > >> Richard W.M. Jones wrote: > >>>

Re: [Libvir] [PATCH] Device attach/detach on virsh(XML version)

2007-05-23 Thread Richard W.M. Jones
OK, here we go with an updated patch. I think this should go in. Rich. -- 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 unde

Re: [Libvir] [PATCH] Device attach/detach on virsh(XML version)

2007-05-23 Thread Richard W.M. Jones
Mark McLoughlin wrote: On Tue, 2007-05-22 at 15:16 +0100, Richard W.M. Jones wrote: Richard W.M. Jones wrote: +buffer = realloc (buffer, len+1); +if (buffer == NULL) goto out_of_memory; Note, if realloc() fails, the original buffer isn't freed. So, you want to make sure you fr

Re: [Libvir] [PATCH] Device attach/detach on virsh(XML version)

2007-05-23 Thread Mark McLoughlin
On Tue, 2007-05-22 at 15:16 +0100, Richard W.M. Jones wrote: > Richard W.M. Jones wrote: > > +buffer = realloc (buffer, len+1); > > +if (buffer == NULL) goto out_of_memory; Note, if realloc() fails, the original buffer isn't freed. So, you want to make sure you free the original on

Re: [Libvir] [PATCH] Device attach/detach on virsh(XML version)

2007-05-22 Thread Masayuki Sunou
re ... > And, 'close (fd);' is added to this patch. Thanks, Masayuki Sunou In message <[EMAIL PROTECTED]> "Re: [Libvir] [PATCH] Device attach/detach on virsh(XML version)" ""Richard W.M. Jones" <[EMAIL PROTECTED]>" wrote:

Re: [Libvir] [PATCH] Device attach/detach on virsh(XML version)

2007-05-22 Thread Richard W.M. Jones
Richard W.M. Jones wrote: +buffer = realloc (buffer, len+1); +if (buffer == NULL) goto out_of_memory; +buffer[len] = '\0'; +return buffer; Euch, add 'close (fd);' in there ... Rich. -- Emerging Technologies, Red Hat - http://et.redhat.com/~rjones/ Registered Address: Red Hat U

Re: [Libvir] [PATCH] Device attach/detach on virsh(XML version)

2007-05-22 Thread Richard W.M. Jones
I tidied up the patch and some surrounding code, and came up with the attached patch. Unfortunately I don't have a means to test this, but if someone can test attaching and detaching networks and devices, then I have no objection to it going in. Rich. -- Emerging Technologies, Red Hat - htt

Re: [Libvir] [PATCH] Device attach/detach on virsh(XML version)

2007-05-22 Thread Richard W.M. Jones
Masayuki Sunou wrote: Hi Would you give me a comment on this? I'm working on a new version of this patch. Back shortly ... Rich. -- Emerging Technologies, Red Hat - http://et.redhat.com/~rjones/ Registered Address: Red Hat UK Ltd, Amberley Place, 107-111 Peascod Street, Windsor, Berkshire,

Re: [Libvir] [PATCH] Device attach/detach on virsh(XML version)

2007-05-22 Thread Masayuki Sunou
Hi Would you give me a comment on this? Thanks, Masayuki Sunou In message <[EMAIL PROTECTED]> "[Libvir] [PATCH] Device attach/detach on virsh(XML version)" "Masayuki Sunou <[EMAIL PROTECTED]>" wrote: Hi This patch adds virsh attach-device/detach

[Libvir] [PATCH] Device attach/detach on virsh(XML version)

2007-05-15 Thread Masayuki Sunou
Hi This patch adds virsh attach-device/detach-device. Currently it supports a definition of a device by XML(proposal 2). I plan to submit command option version (proposal 1) later. Any comments are welcome! Signed-off-by: Masayuki Sunou <[EMAIL PROTECTED]> Thanks, Masayuki Sunou. -