On Tue, Dec 02, 2008 at 11:06:38AM +0000, Daniel P. Berrange wrote: > On Tue, Dec 02, 2008 at 12:05:10PM +0100, Daniel Veillard wrote: > > On Sun, Nov 30, 2008 at 11:53:17PM +0000, Daniel P. Berrange wrote: > > > This patch makes the UML driver thread safe > > > > [...] > > > @@ -1395,21 +1485,27 @@ static int umlListDefinedDomains(virConn > > > struct uml_driver *driver = conn->privateData; > > > int got = 0, i; > > > > > > + umlDriverLock(driver); > > > for (i = 0 ; i < driver->domains.count && got < nnames ; i++) { > > > + virDomainObjLock(driver->domains.objs[i]); > > > if (!virDomainIsActive(driver->domains.objs[i])) { > > > if (!(names[got++] = strdup(driver->domains.objs[i]->def->name))) { > > > umlReportError(conn, NULL, NULL, VIR_ERR_NO_MEMORY, > > > "%s", _("failed to allocate space for VM name string")); > > > + virDomainObjUnlock(driver->domains.objs[i]); > > > goto cleanup; > > > } > > > } > > > + virDomainObjUnlock(driver->domains.objs[i]); > > > } > > > + umlDriverUnlock(driver); > > > > > > return got; > > > > > > cleanup: > > > > since this is an error code path, I would rather change the label to > > error: ... > > That's a good idea - we should define a standard naming for this usage > > 'cleanup' to be used where error & normal conditions shared the same > exit path of a method. > > 'error' to be used where error path is completely separate from the > normal exit path. yup since we're going to have labels on a lot of functions for exit we should try to standardize their use and name. The set of patches does this mostly, just a small incremental improvement, and then we can document it in the HACKING file. Daniel -- Daniel Veillard | libxml Gnome XML XSLT toolkit http://xmlsoft.org/ daniel@xxxxxxxxxxxx | Rpmfind RPM search engine http://rpmfind.net/ http://veillard.com/ | virtualization library http://libvirt.org/ -- Libvir-list mailing list Libvir-list@xxxxxxxxxx https://www.redhat.com/mailman/listinfo/libvir-list