On Tue, Mar 08, 2011 at 06:44:56PM +0800, Daniel Veillard wrote: > diff --git a/daemon/libvirtd.c b/daemon/libvirtd.c > index 452566c..d3631ec 100644 > --- a/daemon/libvirtd.c > +++ b/daemon/libvirtd.c > @@ -2720,11 +2720,16 @@ qemudSetLogging(struct qemud_server *server, virConfPtr conf, > const char *filename) > { > int log_level = 0; > + int log_buffer_size = -2; > char *log_filters = NULL; > char *log_outputs = NULL; > char *log_file = NULL; > int ret = -1; > > + GET_CONF_INT (conf, filename, log_buffer_size); > + if (log_buffer_size != -2) > + virLogSetBufferSize(log_buffer_size); The possible values here seem a little odd. > 0 -> sets the log buffer size == 0 -> disables == -2 -> leave at the default < 0 -> disables IMHO this can be simplified to just > 0 -> sets the log buffer size == 0 -> disables < 0 -> leave at the default And then make virLogSetBufferSize accept size_t > /** > + * virLogSetBufferSize: > + * @size: size of the buffer in kilobytes or 0 to deactivate > + * > + * Dynamically set the size or desactivate the logging buffer used to keep > + * a trace of all recent debug output. Note that the content of the buffer > + * is lost if it gets reallocated. > + * > + * Return -1 in case of failure or 0 in case of success > + */ > +extern int > +virLogSetBufferSize(int size) { > + int ret = 0; > + int oldsize; > + char *oldLogBuffer; > + > + if (size < 0) > + size = 0; IMHO size should just be 'size_t'. We don't need to have -ve values, since '0' already indicates disabled. Daniel -- |: http://berrange.com -o- http://www.flickr.com/photos/dberrange/ :| |: http://libvirt.org -o- http://virt-manager.org :| |: http://autobuild.org -o- http://search.cpan.org/~danberr/ :| |: http://entangle-photo.org -o- http://live.gnome.org/gtk-vnc :| -- libvir-list mailing list libvir-list@xxxxxxxxxx https://www.redhat.com/mailman/listinfo/libvir-list